[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33161] trunk/blender/source/blender: Feature fix

Ton Roosendaal ton at blender.org
Thu Nov 18 17:38:32 CET 2010


Revision: 33161
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33161
Author:   ton
Date:     2010-11-18 17:38:32 +0100 (Thu, 18 Nov 2010)

Log Message:
-----------
Feature fix

When using Material Nodes, there was no indication in Material
Property window which node was active. The context/channel widget
now shows this.

Better would be to be able to browse nodes in this list, and
to have option to preview only this material (not node tree
result). Enough todo for future :)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2010-11-18 16:33:13 UTC (rev 33160)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2010-11-18 16:38:32 UTC (rev 33161)
@@ -38,6 +38,7 @@
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_material.h"
 #include "BKE_texture.h"
 #include "BKE_report.h"
 
@@ -2000,6 +2001,25 @@
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0,  NULL);
 	}
+	else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+		/* provision to draw active node name */
+		Material *ma, *manode;
+		Object *ob= (Object*)ptr->id.data;
+		int index= (Material**)ptr->data - ob->mat;
+		
+		/* default item with material base name */
+		uiItemL(sub, name, icon);
+		
+		ma= give_current_material(ob, index+1);
+		manode= give_node_material(ma);
+		if(manode) {
+			char str[MAX_ID_NAME + 12];
+			sprintf(str, "Node %s", manode->id.name+2);
+			uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1));
+		}
+		else if(ma->use_nodes)
+			uiItemL(sub, "Node <none>", 0);
+	}
 	else if(itemptr->type == &RNA_ShapeKey) {
 		ob= (Object*)activeptr->data;
 

Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2010-11-18 16:33:13 UTC (rev 33160)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2010-11-18 16:38:32 UTC (rev 33161)
@@ -869,7 +869,7 @@
 	return 1;
 }
 
-/* op->invoke */
+/* op->exec */
 static void redo_cb(bContext *C, void *arg_op, int UNUSED(event))
 {
 	wmOperator *lastop= arg_op;





More information about the Bf-blender-cvs mailing list