forked from bartvdbraak/blender
Notifier related tweaks, partially from patch 20370 by Jason Millis
This commit is contained in:
parent
fac65a3f4d
commit
b438dd8668
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.");
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user