diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-16 22:40:05 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-17 00:13:28 +0300 |
commit | e51bf11b15cb2c26b2bd33c377e1eb74fa8bde38 (patch) | |
tree | 0772e04362ca16c1511ccc48517e50e061187f22 /source/blender/makesrna | |
parent | 09e419fa8da930b13651997417a434de308e697d (diff) |
Remove ViewLayer settings - cleanup 1/2
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 267 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 27 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 13 |
3 files changed, 1 insertions, 306 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 8b3d59cf95c..e6e90f4f05d 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -247,201 +247,8 @@ static void rna_SceneCollection_object_unlink( WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene); } -/****** layer collection engine settings *******/ - -#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _NAME_) \ -static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - return BKE_collection_engine_property_value_get_##_TYPE_(props, #_NAME_); \ -} \ - \ -static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, _TYPE_ value) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - BKE_collection_engine_property_value_set_##_TYPE_(props, #_NAME_, value); \ -} - -#define RNA_LAYER_ENGINE_GET_SET_ARRAY(_TYPE_, _ENGINE_, _NAME_, _LEN_) \ -static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr, _TYPE_ *values) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - IDProperty *idprop = IDP_GetPropertyFromGroup(props, #_NAME_); \ - if (idprop != NULL) { \ - memcpy(values, IDP_Array(idprop), sizeof(_TYPE_) * idprop->len); \ - } \ -} \ - \ -static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, const _TYPE_ *values) \ -{ \ - IDProperty *props = (IDProperty *)ptr->data; \ - BKE_collection_engine_property_value_set_##_TYPE_##_array(props, #_NAME_, values); \ -} - -#undef RNA_LAYER_ENGINE_GET_SET - -static void UNUSED_FUNCTION(rna_ViewLayerEngineSettings_update)(bContext *C, PointerRNA *UNUSED(ptr)) -{ - Scene *scene = CTX_data_scene(C); - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); -} - -static void UNUSED_FUNCTION(rna_LayerCollectionEngineSettings_update)(bContext *UNUSED(C), PointerRNA *ptr) -{ - ID *id = ptr->id.data; - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); - - /* Instead of passing 'noteflag' to the rna update function, we handle the notifier ourselves. - * We need to do this because the LayerCollection may be coming from different ID types (Scene or Group) - * and when using NC_SCENE the id most match the active scene for the listener to receive the notification.*/ - - WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); -} - /***********************************/ -static void engine_settings_use(IDProperty *root, IDProperty *props, PointerRNA *props_ptr, const char *identifier) -{ - PropertyRNA *prop = RNA_struct_find_property(props_ptr, identifier); - - switch (RNA_property_type(prop)) { - case PROP_FLOAT: - { - float value = BKE_collection_engine_property_value_get_float(props, identifier); - BKE_collection_engine_property_add_float(root, identifier, value); - break; - } - case PROP_ENUM: - { - int value = BKE_collection_engine_property_value_get_int(props, identifier); - BKE_collection_engine_property_add_int(root, identifier, value); - break; - } - case PROP_INT: - { - int value = BKE_collection_engine_property_value_get_int(props, identifier); - BKE_collection_engine_property_add_int(root, identifier, value); - break; - } - case PROP_BOOLEAN: - { - int value = BKE_collection_engine_property_value_get_int(props, identifier); - BKE_collection_engine_property_add_bool(root, identifier, value); - break; - } - case PROP_STRING: - case PROP_POINTER: - case PROP_COLLECTION: - default: - break; - } -} - -static StructRNA *rna_ViewLayerSettings_refine(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - BLI_assert(props && props->type == IDP_GROUP); - - switch (props->subtype) { - case IDP_GROUP_SUB_ENGINE_RENDER: - break; - default: - BLI_assert(!"Mode not fully implemented"); - break; - } - - return &RNA_ViewLayerSettings; -} - -static void rna_ViewLayerSettings_name_get(PointerRNA *ptr, char *value) -{ - IDProperty *props = (IDProperty *)ptr->data; - strcpy(value, props->name); -} - -static int rna_ViewLayerSettings_name_length(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - return strnlen(props->name, sizeof(props->name)); -} - -static void rna_ViewLayerSettings_use(ID *id, IDProperty *props, const char *identifier) -{ - Scene *scene = (Scene *)id; - PointerRNA scene_props_ptr; - IDProperty *scene_props; - - scene_props = BKE_view_layer_engine_scene_get(scene, props->name); - RNA_pointer_create(id, &RNA_ViewLayerSettings, scene_props, &scene_props_ptr); - - engine_settings_use(props, scene_props, &scene_props_ptr, identifier); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -static void rna_ViewLayerSettings_unuse(ID *id, IDProperty *props, const char *identifier) -{ - IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier); - IDP_FreeFromGroup(props, prop_to_remove); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - BLI_assert(props && props->type == IDP_GROUP); - - switch (props->subtype) { - case IDP_GROUP_SUB_ENGINE_RENDER: - break; - default: - BLI_assert(!"Mode not fully implemented"); - break; - } - - return &RNA_LayerCollectionSettings; -} - -static void rna_LayerCollectionSettings_name_get(PointerRNA *ptr, char *value) -{ - IDProperty *props = (IDProperty *)ptr->data; - strcpy(value, props->name); -} - -static int rna_LayerCollectionSettings_name_length(PointerRNA *ptr) -{ - IDProperty *props = (IDProperty *)ptr->data; - return strnlen(props->name, sizeof(props->name)); -} - -static void rna_LayerCollectionSettings_use(ID *id, IDProperty *props, const char *identifier) -{ - Scene *scene = (Scene *)id; - PointerRNA scene_props_ptr; - IDProperty *scene_props; - - scene_props = BKE_layer_collection_engine_scene_get(scene, props->name); - RNA_pointer_create(id, &RNA_LayerCollectionSettings, scene_props, &scene_props_ptr); - engine_settings_use(props, scene_props, &scene_props_ptr, identifier); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - -static void rna_LayerCollectionSettings_unuse(ID *id, IDProperty *props, const char *identifier) -{ - IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier); - IDP_FreeFromGroup(props, prop_to_remove); - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(id, 0); -} - static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value) { SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection; @@ -857,78 +664,6 @@ static void rna_def_scene_collection(BlenderRNA *brna) RNA_def_function_return(func, parm); } -static void rna_def_view_layer_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - - srna = RNA_def_struct(brna, "ViewLayerSettings", NULL); - RNA_def_struct_sdna(srna, "IDProperty"); - RNA_def_struct_ui_text(srna, "Scene Layer Settings", - "Engine specific settings that can be overriden by ViewLayer"); - RNA_def_struct_refine_func(srna, "rna_ViewLayerSettings_refine"); - - RNA_define_verify_sdna(0); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_ViewLayerSettings_name_get", "rna_ViewLayerSettings_name_length", NULL); - RNA_def_property_ui_text(prop, "Name", "Engine Name"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_struct_name_property(srna, prop); - - func = RNA_def_function(srna, "use", "rna_ViewLayerSettings_use"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Initialize this property to use"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - func = RNA_def_function(srna, "unuse", "rna_ViewLayerSettings_unuse"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Remove the property"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - RNA_define_verify_sdna(1); -} - -static void rna_def_layer_collection_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - - srna = RNA_def_struct(brna, "LayerCollectionSettings", NULL); - RNA_def_struct_sdna(srna, "IDProperty"); - RNA_def_struct_ui_text(srna, "Layer Collection Settings", - "Engine specific settings that can be overriden by LayerCollection"); - RNA_def_struct_refine_func(srna, "rna_LayerCollectionSettings_refine"); - - RNA_define_verify_sdna(0); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_LayerCollectionSettings_name_get", "rna_LayerCollectionSettings_name_length", NULL); - RNA_def_property_ui_text(prop, "Name", "Engine Name"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_struct_name_property(srna, prop); - - func = RNA_def_function(srna, "use", "rna_LayerCollectionSettings_use"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Initialize this property to use"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - func = RNA_def_function(srna, "unuse", "rna_LayerCollectionSettings_unuse"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Remove the property"); - parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - RNA_define_verify_sdna(1); -} - static void rna_def_layer_collection(BlenderRNA *brna) { StructRNA *srna; @@ -1189,8 +924,6 @@ void RNA_def_view_layer(BlenderRNA *brna) rna_def_object_base(brna); RNA_define_animate_sdna(true); /* *** Animated *** */ - rna_def_view_layer_settings(brna); - rna_def_layer_collection_settings(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index ae774f8d41a..b4fc1b4eeb0 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -264,23 +264,6 @@ static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *nt RNA_parameter_list_free(&list); } -static void engine_collection_settings_create(RenderEngine *engine, struct IDProperty *props) -{ - extern FunctionRNA rna_RenderEngine_collection_settings_create_func; - PointerRNA ptr; - ParameterList list; - FunctionRNA *func; - - RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func = &rna_RenderEngine_collection_settings_create_func; - - RNA_parameter_list_create(&list, &ptr, func); - RNA_parameter_set_lookup(&list, "props", &props); - engine->type->ext.call(NULL, &ptr, func, &list); - - RNA_parameter_list_free(&list); -} - static void engine_update_render_passes(RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer) { extern FunctionRNA rna_RenderEngine_update_render_passes_func; @@ -366,9 +349,8 @@ static StructRNA *rna_RenderEngine_register( et->render_to_view = (have_function[4]) ? engine_render_to_view : NULL; et->update_script_node = (have_function[5]) ? engine_update_script_node : NULL; et->update_render_passes = (have_function[6]) ? engine_update_render_passes : NULL; - et->collection_settings_create = (have_function[7]) ? engine_collection_settings_create : NULL; - RE_engines_register(bmain, et); + RE_engines_register(et); return et->ext.srna; } @@ -560,13 +542,6 @@ static void rna_def_render_engine(BlenderRNA *brna) parm = RNA_def_pointer(func, "scene", "Scene", "", ""); parm = RNA_def_pointer(func, "renderlayer", "ViewLayer", "", ""); - /* per-collection engine settings initialization */ - func = RNA_def_function(srna, "collection_settings_create", NULL); - RNA_def_function_ui_description(func, "Create the per collection settings for the engine"); - RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); - parm = RNA_def_pointer(func, "collection_settings", "LayerCollectionSettings", "", ""); - RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); - /* tag for redraw */ func = RNA_def_function(srna, "tag_redraw", "engine_tag_redraw"); RNA_def_function_ui_description(func, "Request redraw for viewport rendering"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 47af0f0ec6c..72def8e97cd 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -6429,19 +6429,6 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "RenderSettings"); RNA_def_property_ui_text(prop, "Render Data", ""); - /* Render Engine Data */ - prop = RNA_def_property(srna, "layer_properties", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "layer_properties->data.group", NULL); - RNA_def_property_struct_type(prop, "ViewLayerSettings"); - RNA_def_property_ui_text(prop, "Layer Settings", - "Engine specific render settings to be overridden by layers"); - - prop = RNA_def_property(srna, "collection_properties", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "collection_properties->data.group", NULL); - RNA_def_property_struct_type(prop, "LayerCollectionSettings"); - RNA_def_property_ui_text(prop, "Collection Settings", - "Engine specific render settings to be overridden by collections"); - /* Safe Areas */ prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "safe_areas"); |