Fix #33310: unnecessary redraw of outliner when editing materials and textures.

This commit is contained in:
2012-11-26 08:52:07 +00:00
parent 42c54bcd93
commit c91562d0ff
13 changed files with 20 additions and 18 deletions

View File

@@ -1871,7 +1871,7 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
vc.obedit->actcol = efa->mat_nr + 1;
vc.em->mat_nr = efa->mat_nr;
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
}

View File

@@ -2148,7 +2148,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, ma);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;
}

View File

@@ -865,7 +865,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
paste_matcopybuf(ma);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_DRAW, ma);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;
}
@@ -1027,7 +1027,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
paste_mtex_copybuf(id);
WM_event_add_notifier(C, NC_TEXTURE | ND_SHADING_DRAW, NULL);
WM_event_add_notifier(C, NC_TEXTURE | ND_SHADING_LINKS, NULL);
return OPERATOR_FINISHED;
}

View File

@@ -297,6 +297,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
buttons_area_redraw(sa, BCONTEXT_PHYSICS);
case ND_SHADING:
case ND_SHADING_DRAW:
case ND_SHADING_LINKS:
/* currently works by redraws... if preview is set, it (re)starts job */
sbuts->preview = 1;
break;
@@ -319,6 +320,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
switch (wmn->data) {
case ND_SHADING:
case ND_SHADING_DRAW:
case ND_SHADING_LINKS:
case ND_NODES:
/* currently works by redraws... if preview is set, it (re)starts job */
sbuts->preview = 1;

View File

@@ -193,6 +193,8 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_refresh(sa);
else if (wmn->data == ND_SHADING_DRAW)
ED_area_tag_refresh(sa);
else if (wmn->data == ND_SHADING_LINKS)
ED_area_tag_refresh(sa);
else if (wmn->action == NA_ADDED && snode->edittree)
nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);

View File

@@ -1859,7 +1859,7 @@ static int material_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, ma);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;
}

View File

@@ -222,7 +222,7 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so
}
}
if (set) {
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
}
return 0;
}

View File

@@ -326,15 +326,11 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_MATERIAL:
switch (wmn->data) {
case ND_SHADING:
case ND_SHADING_DRAW:
case ND_SHADING_LINKS:
ED_region_tag_redraw(ar);
break;
}
break;
case NC_TEXTURE:
ED_region_tag_redraw(ar);
break;
case NC_GEOM:
switch (wmn->data) {
case ND_VERTEX_GROUP:

View File

@@ -724,6 +724,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_MATERIAL:
switch (wmn->data) {
case ND_SHADING_DRAW:
case ND_SHADING_LINKS:
ED_region_tag_redraw(ar);
break;
}

View File

@@ -2121,13 +2121,13 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
RNA_def_property_editable_func(prop, activeeditable);
RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
RNA_def_property_update(prop, 0, update);
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update);
prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "texact");
RNA_def_property_range(prop, 0, MAX_MTEX - 1);
RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
RNA_def_property_update(prop, 0, update);
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update);
}
#endif

View File

@@ -2174,7 +2174,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set",
"rna_Object_active_material_index_range");
RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, NULL);
/* transform */
prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);

View File

@@ -46,6 +46,9 @@
#include "BKE_node.h"
#include "WM_api.h"
#include "WM_types.h"
EnumPropertyItem texture_filter_items[] = {
{TXF_BOX, "BOX", 0, "Box", ""},
{TXF_EWA, "EWA", 0, "EWA", ""},
@@ -110,9 +113,6 @@ EnumPropertyItem blend_type_items[] = {
#include "ED_node.h"
#include "WM_api.h"
#include "WM_types.h"
static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
{
Tex *tex = (Tex *)ptr->data;
@@ -603,7 +603,7 @@ static void rna_def_mtex(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Texture");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Texture", "Texture datablock used by this texture slot");
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlot_update");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);

View File

@@ -300,6 +300,7 @@ typedef struct wmNotifier {
/* NC_MATERIAL Material */
#define ND_SHADING (30<<16)
#define ND_SHADING_DRAW (31<<16)
#define ND_SHADING_LINKS (32<<16)
/* NC_LAMP Lamp */
#define ND_LIGHTING (40<<16)