[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32322] trunk/blender/source/blender: Fix #24135: Material modification not immediately updated in Outliner
Sergey Sharybin
g.ulairi at gmail.com
Tue Oct 5 13:55:55 CEST 2010
Revision: 32322
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32322
Author: nazgul
Date: 2010-10-05 13:55:54 +0200 (Tue, 05 Oct 2010)
Log Message:
-----------
Fix #24135: Material modification not immediately updated in Outliner
Also fixed outliner update when changing active_material_index from Py and
when selecting texture from UI
Modified Paths:
--------------
trunk/blender/source/blender/editors/render/render_shading.c
trunk/blender/source/blender/editors/space_outliner/outliner.c
trunk/blender/source/blender/editors/space_outliner/space_outliner.c
trunk/blender/source/blender/makesrna/intern/rna_object.c
Modified: trunk/blender/source/blender/editors/render/render_shading.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_shading.c 2010-10-05 11:25:34 UTC (rev 32321)
+++ trunk/blender/source/blender/editors/render/render_shading.c 2010-10-05 11:55:54 UTC (rev 32322)
@@ -263,6 +263,7 @@
object_add_material_slot(ob);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob);
return OPERATOR_FINISHED;
}
@@ -290,6 +291,7 @@
object_remove_material_slot(ob);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob);
return OPERATOR_FINISHED;
}
Modified: trunk/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner.c 2010-10-05 11:25:34 UTC (rev 32321)
+++ trunk/blender/source/blender/editors/space_outliner/outliner.c 2010-10-05 11:55:54 UTC (rev 32322)
@@ -2050,7 +2050,9 @@
}
}
- WM_event_add_notifier(C, NC_TEXTURE, NULL);
+ if(set)
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
+
return 0;
}
Modified: trunk/blender/source/blender/editors/space_outliner/space_outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/space_outliner.c 2010-10-05 11:25:34 UTC (rev 32321)
+++ trunk/blender/source/blender/editors/space_outliner/space_outliner.c 2010-10-05 11:55:54 UTC (rev 32322)
@@ -116,6 +116,7 @@
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_PARENT:
+ case ND_OB_SHADING:
ED_region_tag_redraw(ar);
break;
case ND_CONSTRAINT:
@@ -150,6 +151,17 @@
if(wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
+ case NC_MATERIAL:
+ switch(wmn->data) {
+ case ND_SHADING:
+ case ND_SHADING_DRAW:
+ ED_region_tag_redraw(ar);
+ break;
+ }
+ break;
+ case NC_TEXTURE:
+ 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 2010-10-05 11:25:34 UTC (rev 32321)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c 2010-10-05 11:55:54 UTC (rev 32322)
@@ -769,6 +769,12 @@
strcpy(str, "");
}
+static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ rna_Object_internal_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_OBJECT|ND_OB_SHADING, ptr->id.data);
+}
+
/* why does this have to be so complicated?, can't all this crap be
* moved to in BGE conversion function? - Campbell *
*
@@ -1143,13 +1149,13 @@
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, link_items);
RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
@@ -1739,14 +1745,14 @@
RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "actcol");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
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_OBJECT|ND_DRAW, NULL);
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
/* transform */
prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
More information about the Bf-blender-cvs
mailing list