diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-04-14 12:52:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-04-14 12:52:22 +0400 |
commit | 1f87dbbbbc08e4ec9a831f9f0b0fd324104060ff (patch) | |
tree | d27b42ad58cef9a0523ca5f7e64964b054cb22ad | |
parent | eb30a66aa68ff02f35c06e7c01726ee7daf5a0b0 (diff) |
rna api, when linking objects to an inactive scene, dont change its layer, removed NULL object data check since this isnt allowed from the api side.
-rw-r--r-- | release/scripts/op/presets.py | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 17 |
2 files changed, 9 insertions, 9 deletions
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 75766995a05..440b5a547f7 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -87,7 +87,6 @@ class ExecutePreset(bpy.types.Operator): # change the menu title to the most recently chosen option preset_class = getattr(bpy.types, self.properties.menu_idname) preset_class.bl_label = self.properties.preset_name - print(10) # execute the preset using script.python_file_run bpy.ops.script.python_file_run(path=self.properties.path) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 40027b16950..e5c6d970687 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -179,15 +179,11 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object); } -static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob) +static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob) { + Scene *scene_act= CTX_data_scene(C); Base *base; - if (ob->type != OB_EMPTY && ob->data==NULL) { - BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.", ob->id.name+2); - return NULL; - } - if (object_in_scene(ob, scene)) { BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is already in scene \"%s\".", ob->id.name+2, scene->id.name+2); return NULL; @@ -197,7 +193,12 @@ static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob ob->id.us++; /* this is similar to what object_add_type and add_object do */ - ob->lay= base->lay= scene->lay; + base->lay= scene->lay; + + /* when linking to an inactive scene dont touch the layer */ + if(scene == scene_act) + ob->lay= base->lay; + ob->recalc |= OB_RECALC; DAG_scene_sort(scene); @@ -2750,7 +2751,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "link", "rna_Scene_object_link"); RNA_def_function_ui_description(func, "Link object to scene."); - RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base."); |