[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25428] trunk/blender/source/blender: Notifier related tweaks, partially from patch 20370 by Jason Millis

Matt Ebb matt at mke3.net
Thu Dec 17 07:06:34 CET 2009


Revision: 25428
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25428
Author:   broken
Date:     2009-12-17 07:06:30 +0100 (Thu, 17 Dec 2009)

Log Message:
-----------
Notifier related tweaks, partially from patch 20370 by Jason Millis

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_hook.c
    trunk/blender/source/blender/editors/object/object_vgroup.c
    trunk/blender/source/blender/editors/space_buttons/space_buttons.c
    trunk/blender/source/blender/editors/space_view3d/space_view3d.c
    trunk/blender/source/blender/makesrna/intern/rna_object.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/source/blender/editors/object/object_hook.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_hook.c	2009-12-17 04:55:15 UTC (rev 25427)
+++ trunk/blender/source/blender/editors/object/object_hook.c	2009-12-17 06:06:30 UTC (rev 25428)
@@ -491,7 +491,7 @@
 	
 	add_hook_object(scene, obedit, obsel, OBJECT_ADDHOOK_SELOB);
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit);
 	return OPERATOR_FINISHED;
 }
 
@@ -518,6 +518,7 @@
 	add_hook_object(scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB);
 	
 	WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit);
 	return OPERATOR_FINISHED;
 }
 
@@ -559,7 +560,7 @@
 	modifier_free((ModifierData *)hmd);
 	
 	DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
 	
 	return OPERATOR_FINISHED;
 }

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2009-12-17 04:55:15 UTC (rev 25427)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2009-12-17 06:06:30 UTC (rev 25428)
@@ -1736,7 +1736,7 @@
 	ob->actdef= nr+1;
 
 	DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
 
 	return OPERATOR_FINISHED;
 }

Modified: trunk/blender/source/blender/editors/space_buttons/space_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_buttons/space_buttons.c	2009-12-17 04:55:15 UTC (rev 25427)
+++ trunk/blender/source/blender/editors/space_buttons/space_buttons.c	2009-12-17 06:06:30 UTC (rev 25428)
@@ -236,6 +236,17 @@
 	UI_view2d_view_restore(C);
 }
 
+/* draw a certain button set only if properties area is currently
+ * showing that button set, to reduce unnecessary drawing. */
+static void buttons_area_redraw(ScrArea *sa, short buttons)
+{
+	SpaceButs *sbuts= sa->spacedata.first;
+	
+	/* if the area's current button set is equal to the one to redraw */
+	if(sbuts->mainb == buttons)
+		ED_area_tag_redraw(sa);
+}
+
 /* reused! */
 static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 {
@@ -244,45 +255,56 @@
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SCENE:
-			/* lazy general redraw tag here, in case more than 1 propertie window is opened 
-			Not all RNA props have a ND_sub notifier(yet) */
-			ED_area_tag_redraw(sa);
 			switch(wmn->data) {
 				case ND_FRAME:
-				case ND_MODE:
 				case ND_RENDER_OPTIONS:
-				case ND_KEYINGSET:
-				case ND_LAYER:
-					ED_area_tag_redraw(sa);
+					buttons_area_redraw(sa, BCONTEXT_RENDER);
 					break;
-					
 				case ND_OB_ACTIVE:
 					ED_area_tag_redraw(sa);
 					sbuts->preview= 1;
 					break;
+				case ND_KEYINGSET:
+					buttons_area_redraw(sa, BCONTEXT_SCENE);
+					break;
+				case ND_MODE:
+				case ND_LAYER:
+				default:
+					ED_area_tag_redraw(sa);
+					break;
 			}
 			break;
 		case NC_OBJECT:
-			ED_area_tag_redraw(sa);
-			/* lazy general redraw tag here, in case more than 1 propertie window is opened 
-			Not all RNA props have a ND_ notifier(yet) */
 			switch(wmn->data) {
 				case ND_TRANSFORM:
+					buttons_area_redraw(sa, BCONTEXT_OBJECT);
+					break;
 				case ND_BONE_ACTIVE:
 				case ND_BONE_SELECT:
+					buttons_area_redraw(sa, BCONTEXT_BONE);
+					break;
 				case ND_MODIFIER:
 					if(wmn->action == NA_RENAME)
 						ED_area_tag_redraw(sa);
+					else
+						buttons_area_redraw(sa, BCONTEXT_MODIFIER);
 					break;
 				case ND_CONSTRAINT:
-					ED_area_tag_redraw(sa);
+					buttons_area_redraw(sa, BCONTEXT_CONSTRAINT);
 					break;
+				case ND_PARTICLE_DATA:
+					buttons_area_redraw(sa, BCONTEXT_PARTICLE);
+					break;
 				case ND_DRAW:
 				case ND_SHADING:
 				case ND_SHADING_DRAW:
 					/* currently works by redraws... if preview is set, it (re)starts job */
 					sbuts->preview= 1;
 					break;
+				default:
+					/* Not all object RNA props have a ND_ notifier (yet) */
+					ED_area_tag_redraw(sa);
+					break;
 			}
 			break;
 		case NC_GEOM:
@@ -304,7 +326,12 @@
 			}					
 			break;
 		case NC_WORLD:
+			buttons_area_redraw(sa, BCONTEXT_WORLD);
+			break;
 		case NC_LAMP:
+			buttons_area_redraw(sa, BCONTEXT_DATA);
+			sbuts->preview= 1;
+			break;
 		case NC_TEXTURE:
 			ED_area_tag_redraw(sa);
 			sbuts->preview= 1;

Modified: trunk/blender/source/blender/editors/space_view3d/space_view3d.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/space_view3d.c	2009-12-17 04:55:15 UTC (rev 25427)
+++ trunk/blender/source/blender/editors/space_view3d/space_view3d.c	2009-12-17 06:06:30 UTC (rev 25428)
@@ -452,6 +452,7 @@
 				case ND_OB_ACTIVE:
 				case ND_OB_SELECT:
 				case ND_LAYER:
+				case ND_RENDER_OPTIONS:
 				case ND_MODE:
 					ED_region_tag_redraw(ar);
 					break;

Modified: trunk/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object.c	2009-12-17 04:55:15 UTC (rev 25427)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c	2009-12-17 06:06:30 UTC (rev 25428)
@@ -1010,6 +1010,7 @@
 	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Vertex group name.");
 	RNA_def_struct_name_property(srna, prop);
+	RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, NULL);
 
 	prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1678,13 +1679,13 @@
 	RNA_def_property_struct_type(prop, "VertexGroup");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL);
 	RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object.");
-	RNA_def_property_update(prop, 0, "rna_Object_update_data");
+	RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_update_data");
 
 	prop= RNA_def_property(srna, "active_vertex_group_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "actdef");
 	RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
 	RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array.");
-	RNA_def_property_update(prop, 0, "rna_Object_update_data");
+	RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_update_data");
 
 	/* empty */
 	prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
@@ -1703,7 +1704,8 @@
 	prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "index");
 	RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexOB render pass.");
-
+	RNA_def_property_update(prop, NC_OBJECT, NULL);
+	
 	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "col");
 	RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled.");

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2009-12-17 04:55:15 UTC (rev 25427)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2009-12-17 06:06:30 UTC (rev 25428)
@@ -1599,13 +1599,13 @@
 	RNA_def_property_int_sdna(prop, NULL, "xsch");
 	RNA_def_property_range(prop, 4, 10000);
 	RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image.");
-	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ysch");
 	RNA_def_property_range(prop, 4, 10000);
 	RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image.");
-	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "size");
@@ -1629,13 +1629,13 @@
 	RNA_def_property_float_sdna(prop, NULL, "xasp");
 	RNA_def_property_range(prop, 1.0f, 200.0f);
 	RNA_def_property_ui_text(prop, "Pixel Aspect X", "Horizontal aspect ratio - for anamorphic or non-square pixel output");
-	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	prop= RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yasp");
 	RNA_def_property_range(prop, 1.0f, 200.0f);
 	RNA_def_property_ui_text(prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
-	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	/* JPEG and AVI JPEG */
 	
@@ -1992,7 +1992,7 @@
 	prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
 	RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size.");
-	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	prop= RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "border.xmin");
@@ -2352,6 +2352,7 @@
 	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene.");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list