[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42466] trunk/blender/source/blender: Fix related to #29513: materials using nodes will output passes from the active

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Dec 6 17:04:46 CET 2011


Revision: 42466
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42466
Author:   blendix
Date:     2011-12-06 16:04:45 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Fix related to #29513: materials using nodes will output passes from the active
material node. This is a confusing system, but two features were missing from
2.4x that made this at least a bit more clear:

* The top right icon in the node now shows brighter again for the active node.
* Setting a material datablock in a node makes that node active.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/node_draw.c
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c

Modified: trunk/blender/source/blender/editors/space_node/node_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_draw.c	2011-12-06 16:00:57 UTC (rev 42465)
+++ trunk/blender/source/blender/editors/space_node/node_draw.c	2011-12-06 16:04:45 UTC (rev 42466)
@@ -605,15 +605,11 @@
 	iconofs= rct->xmax - 7.0f;
 	
 	if(node->typeinfo->flag & NODE_PREVIEW) {
-		int icon_id;
+		float alpha = (node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))? 1.0f: 0.5f;
 		
-		if(node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))
-			icon_id= ICON_MATERIAL;
-		else
-			icon_id= ICON_MATERIAL_DATA;
 		iconofs-=iconbutw;
-		uiDefIconBut(node->block, LABEL, B_REDR, icon_id, iconofs, rct->ymax-NODE_DY,
-					 iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, 0.5, "");
+		uiDefIconBut(node->block, LABEL, B_REDR, ICON_MATERIAL, iconofs, rct->ymax-NODE_DY,
+					 iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, alpha, "");
 	}
 	if(node->type == NODE_GROUP) {
 		

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2011-12-06 16:00:57 UTC (rev 42465)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2011-12-06 16:04:45 UTC (rev 42466)
@@ -365,6 +365,17 @@
 	node_update(bmain, scene, ntree, node);
 }
 
+static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
+	bNode *node= (bNode*)ptr->data;
+
+	if(node->id)
+		nodeSetActive(ntree, node);
+
+	node_update(bmain, scene, ntree, node);
+}
+
 static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
@@ -1119,7 +1130,7 @@
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Material", "");
-	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_material_update");
 
 	prop = RNA_def_property(srna, "use_diffuse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF);




More information about the Bf-blender-cvs mailing list