Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2009-12-17 09:06:30 +0300
committerMatt Ebb <matt@mke3.net>2009-12-17 09:06:30 +0300
commitb438dd8668704a01225fb650413aa75f715a2933 (patch)
tree63f00dc10b69889f422ce1ef24252c4a153f690a /source
parentfac65a3f4d1645fb59ed0b023247535b4b1d6d77 (diff)
Notifier related tweaks, partially from patch 20370 by Jason Millis
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/object/object_hook.c5
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c51
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c1
-rw-r--r--source/blender/makesrna/intern/rna_object.c8
-rw-r--r--source/blender/makesrna/intern/rna_scene.c14
6 files changed, 57 insertions, 24 deletions
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index a2feee54c8c..313ffe79c66 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -491,7 +491,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
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 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
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 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
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;
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index d9c21a9c9a5..43fabff6793 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1736,7 +1736,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
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;
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 160343cf940..acc34fce660 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -236,6 +236,17 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar)
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,38 +255,45 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
/* 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:
@@ -283,6 +301,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
/* 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 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
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;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index e65cb98e665..e362303c3cc 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -452,6 +452,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_OB_ACTIVE:
case ND_OB_SELECT:
case ND_LAYER:
+ case ND_RENDER_OPTIONS:
case ND_MODE:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 021fdcefd33..4c22316be19 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1010,6 +1010,7 @@ static void rna_def_vertex_group(BlenderRNA *brna)
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 @@ static void rna_def_object(BlenderRNA *brna)
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 @@ static void rna_def_object(BlenderRNA *brna)
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.");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 51344fdf8b3..e4df352bcc8 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1599,13 +1599,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
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 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
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 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
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 @@ void RNA_def_scene(BlenderRNA *brna)
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);
prop= RNA_def_property(srna, "set", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "set");
@@ -2359,11 +2360,12 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL);
RNA_def_property_ui_text(prop, "Set Scene", "Background set scene.");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "World", "World used for rendering the scene.");
- RNA_def_property_update(prop, NC_WORLD, NULL);
+ RNA_def_property_update(prop, NC_SCENE|NC_WORLD, NULL);
prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ|PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "cursor");