diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-18 12:42:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-18 12:42:44 +0400 |
commit | aa19d53de131dc46ce799a4befc1c1e829193a6a (patch) | |
tree | b3f886f60810b1ba2348461086787fb37a4ed6ba /source/blender/makesrna/intern/rna_scene.c | |
parent | 9f0a6dca13c0debd27d7bd2a023e7d370c1374cd (diff) |
edits to 41957, main changes to render layer removal.
- report an error if the layer can't be removed
- check the render layer is in the list before removing
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1bb184c9433..e1fe34d5baf 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -734,7 +734,7 @@ static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA valu if (index != -1) rd->actlay= index; } -static SceneRenderLayer *rna_RenderLayer_add(ID *id, RenderData *UNUSED(rd), const char *name) +static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name) { Scene *scene= (Scene *)id; SceneRenderLayer *srl= scene_add_render_layer(scene, name); @@ -744,13 +744,16 @@ static SceneRenderLayer *rna_RenderLayer_add(ID *id, RenderData *UNUSED(rd), con return srl; } -static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, SceneRenderLayer *srl) +static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, SceneRenderLayer *srl) { Scene *scene= (Scene *)id; - scene_remove_render_layer(bmain, scene, srl); - - WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); + if (!scene_remove_render_layer(bmain, scene, srl)) { + BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'", srl->name, scene->id.name+2); + } + else { + WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); + } } static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) @@ -2228,17 +2231,17 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - func= RNA_def_function(srna, "new", "rna_RenderLayer_add"); + func= RNA_def_function(srna, "new", "rna_RenderLayer_new"); RNA_def_function_ui_description(func, "Add a render layer to scene"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); parm= RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_pointer(func, "render_layer", "SceneRenderLayer", "", "Newly created render layer"); + parm= RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer"); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_RenderLayer_remove"); RNA_def_function_ui_description(func, "Remove a render layer"); - RNA_def_function_flag(func, FUNC_USE_MAIN|FUNC_USE_SELF_ID); + RNA_def_function_flag(func, FUNC_USE_MAIN|FUNC_USE_REPORTS|FUNC_USE_SELF_ID); parm= RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } |