Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-06-28 14:59:40 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-06-28 14:59:40 +0400
commit57b69abe0d3263c4f03d453d896ee9527c75d673 (patch)
tree14f74d35aa29cb1131f99f373d8f78a90ee19fc3
parenta9a92ae323fab64d80eeebd2c308edf9f8d22d8e (diff)
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.
-rw-r--r--source/blender/editors/space_node/drawnode.c21
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c4
2 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 69f2867535a..cc58c4174b3 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1194,7 +1194,7 @@ static void node_common_set_butfunc(bNodeType *ntype)
/* ****************** 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 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imap
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 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
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 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin
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 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
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)
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d7970bf3d40..cb1a45ed971 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1944,6 +1944,10 @@ static void def_cmp_image(StructRNA *srna)
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);
}