[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48369] trunk/blender/source/blender: Fix for image node: The button draw function was using the image user pointer for displaying properties , which does not work correctly.

Lukas Toenne lukas.toenne at googlemail.com
Thu Jun 28 12:59:54 CEST 2012


Revision: 48369
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48369
Author:   lukastoenne
Date:     2012-06-28 10:59:40 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
Fix for image node: The button draw function was using the image user pointer for displaying properties, which does not work correctly. The image node has to redefine image user RNA properties in order to make correct update calls and to have meaningful image layer names. For these properties the node pointer itself has to be used then.

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

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2012-06-28 10:34:38 UTC (rev 48368)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2012-06-28 10:59:40 UTC (rev 48369)
@@ -1194,7 +1194,7 @@
 
 /* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
 
-static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imaptr, PointerRNA *iuserptr)
+static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr)
 {
 	uiLayout *col;
 	int source;
@@ -1220,18 +1220,17 @@
 
 	if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
 		col = uiLayoutColumn(layout, TRUE);
-		uiItemR(col, iuserptr, "frame_duration", 0, NULL, ICON_NONE);
-		uiItemR(col, iuserptr, "frame_start", 0, NULL, ICON_NONE);
-		uiItemR(col, iuserptr, "frame_offset", 0, NULL, ICON_NONE);
-		uiItemR(col, iuserptr, "use_cyclic", 0, NULL, ICON_NONE);
-		uiItemR(col, iuserptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
+		uiItemR(col, ptr, "frame_duration", 0, NULL, ICON_NONE);
+		uiItemR(col, ptr, "frame_start", 0, NULL, ICON_NONE);
+		uiItemR(col, ptr, "frame_offset", 0, NULL, ICON_NONE);
+		uiItemR(col, ptr, "use_cyclic", 0, NULL, ICON_NONE);
+		uiItemR(col, ptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
 	}
 
 	col = uiLayoutColumn(layout, FALSE);
 
 	if (RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER)
-		uiItemR(col, iuserptr, "layer", 0, NULL, ICON_NONE);
-
+		uiItemR(col, ptr, "layer", 0, NULL, ICON_NONE);
 }
 
 static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1311,7 +1310,7 @@
 	uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
 	uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
 
-	node_buts_image_user(layout, C, &imaptr, &iuserptr);
+	node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
 }
 
 static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1323,7 +1322,7 @@
 	uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
 	uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
 
-	node_buts_image_user(layout, C, &imaptr, &iuserptr);
+	node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
 }
 
 static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1456,7 +1455,7 @@
 	imaptr = RNA_pointer_get(ptr, "image");
 	RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr);
 	
-	node_buts_image_user(layout, C, &imaptr, &iuserptr);
+	node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
 }
 
 static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr)

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-06-28 10:34:38 UTC (rev 48368)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-06-28 10:59:40 UTC (rev 48369)
@@ -1944,6 +1944,10 @@
 	RNA_def_property_ui_text(prop, "Image", "");
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 	
+	/* NB: image user properties used in the UI are redefined in def_node_image_user,
+	 * to trigger correct updates of the node editor. RNA design problem that prevents
+	 * updates from nested structs ...
+	 */
 	RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
 	def_node_image_user(srna);
 }




More information about the Bf-blender-cvs mailing list