[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28190] trunk/blender: 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.

Campbell Barton ideasman42 at gmail.com
Wed Apr 14 10:52:22 CEST 2010


Revision: 28190
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28190
Author:   campbellbarton
Date:     2010-04-14 10:52:22 +0200 (Wed, 14 Apr 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/presets.py
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/release/scripts/op/presets.py
===================================================================
--- trunk/blender/release/scripts/op/presets.py	2010-04-14 08:08:15 UTC (rev 28189)
+++ trunk/blender/release/scripts/op/presets.py	2010-04-14 08:52:22 UTC (rev 28190)
@@ -87,7 +87,6 @@
         # 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)

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-04-14 08:08:15 UTC (rev 28189)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-04-14 08:52:22 UTC (rev 28190)
@@ -179,15 +179,11 @@
 	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 @@
 	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 @@
 
 	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.");





More information about the Bf-blender-cvs mailing list