[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22354] branches/blender2.5/blender/source /blender/makesrna/intern: RNA: make curve and metaball update functions consistent with

Brecht Van Lommel brecht at blender.org
Mon Aug 10 23:10:09 CEST 2009


Revision: 22354
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22354
Author:   blendix
Date:     2009-08-10 23:10:09 +0200 (Mon, 10 Aug 2009)

Log Message:
-----------
RNA: make curve and metaball update functions consistent with
others, these cannot assume the existence of an edit object
or active object.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_meta.c

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c	2009-08-10 20:57:12 UTC (rev 22353)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_curve.c	2009-08-10 21:10:09 UTC (rev 22354)
@@ -55,6 +55,7 @@
 
 #include "BKE_curve.h"
 #include "BKE_depsgraph.h"
+#include "BKE_main.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -148,13 +149,20 @@
 	rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint*), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
 }
 
-static void rna_Curve_update(bContext *C, PointerRNA *ptr)
+static void rna_Curve_update_data(bContext *C, PointerRNA *ptr)
 {
+	Main *bmain= CTX_data_main(C);
 	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
+	Curve *cu= ptr->id.data;
+	Object *ob;
 
-	DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, scene);
+	for(ob=bmain->object.first; ob; ob= ob->id.next) {
+		if(ob->data == cu) {
+			/* XXX this will loop over all objects again (slow) */
+			DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+			WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+		}
+	}
 }
 
 #else
@@ -172,38 +180,38 @@
 	prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
 	RNA_def_property_ui_text(prop, "Selected", "Selection status");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "hidden", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
 	RNA_def_property_ui_text(prop, "Hidden", "Visibility status");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Vector value */
 	prop= RNA_def_property(srna, "point", PROP_FLOAT, PROP_VECTOR);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_float_sdna(prop, NULL, "vec");
 	RNA_def_property_ui_text(prop, "Point", "Point coordinates");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Number values */
 	prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alfa");
 	/*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
 	RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3d View");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01f, 100.0f);
 	RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "bevel_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "radius");
 	/*RNA_def_property_range(prop, 0.0f, 1.0f);*/
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 }
 
 static void rna_def_beztriple(BlenderRNA *brna)
@@ -219,80 +227,80 @@
 	prop= RNA_def_property(srna, "selected_handle1", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
 	RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "selected_handle2", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
 	RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "selected_control_point", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
 	RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "hidden", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
 	RNA_def_property_ui_text(prop, "Hidden", "Visibility status");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Enums */
 	prop= RNA_def_property(srna, "handle1_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "h1");
 	RNA_def_property_enum_items(prop, beztriple_handle_type_items);
 	RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "handle2_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "h2");
 	RNA_def_property_enum_items(prop, beztriple_handle_type_items);
 	RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ipo");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items);
 	RNA_def_property_ui_text(prop, "Interpolation", "(For F-Curves Only) Interpolation to use for segment of curve starting from current BezTriple.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Vector values */
 	prop= RNA_def_property(srna, "handle1", PROP_FLOAT, PROP_VECTOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL);
 	RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "control_point", PROP_FLOAT, PROP_VECTOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL);
 	RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "handle2", PROP_FLOAT, PROP_VECTOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL);
 	RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Number values */
 	prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alfa");
 	/*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
 	RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3d View");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01f, 100.0f);
 	RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "bevel_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "radius");
 	/*RNA_def_property_range(prop, 0.0f, 1.0f);*/
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 }
 
 static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
@@ -304,28 +312,28 @@
 	RNA_def_property_int_sdna(prop, NULL, "pathlen");
 	RNA_def_property_range(prop, 1, 32767);
 	RNA_def_property_ui_text(prop, "Path Length", "If no speed IPO was set, the length of path in frames.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	/* flags */
 	prop= RNA_def_property(srna, "path", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
 	RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	prop= RNA_def_property(srna, "follow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
 	RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	prop= RNA_def_property(srna, "stretch", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
 	RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: makes deformed child to stretch along entire path.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	prop= RNA_def_property(srna, "offset_path_distance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
 	RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 }
 
 static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
@@ -336,12 +344,12 @@
 	prop= RNA_def_property(srna, "uv_orco", PROP_BOOLEAN, PROP_NONE);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list