diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-15 00:39:53 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-15 00:39:53 +0400 |
commit | 3442c16c09b31a23f45b23be72e6eb5ba02c7bbf (patch) | |
tree | 54d3cb1bc15f82c7d4e301dd794c86496de7def7 /source | |
parent | bc98d4e383d21834d074c64adb85ec4de7c84a7c (diff) |
Fix #29249: mapping node not keyable anymore, restore RNA to what it was before
Cycles change, generating RNA paths for this is a bit complicated.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 48 |
2 files changed, 50 insertions, 13 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index e2e47338eee..92592a7c071 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -947,28 +947,27 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - PointerRNA mappingptr = RNA_pointer_get(ptr, "mapping"); uiLayout *row; uiItemL(layout, "Location:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "location", 0, "", ICON_NONE); + uiItemR(row, ptr, "location", 0, "", ICON_NONE); uiItemL(layout, "Rotation:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "rotation", 0, "", ICON_NONE); + uiItemR(row, ptr, "rotation", 0, "", ICON_NONE); uiItemL(layout, "Scale:", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "scale", 0, "", ICON_NONE); + uiItemR(row, ptr, "scale", 0, "", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "use_min", 0, "Min", ICON_NONE); - uiItemR(row, &mappingptr, "min", 0, "", ICON_NONE); + uiItemR(row, ptr, "use_min", 0, "Min", ICON_NONE); + uiItemR(row, ptr, "min", 0, "", ICON_NONE); row= uiLayoutRow(layout, 1); - uiItemR(row, &mappingptr, "use_max", 0, "Max", ICON_NONE); - uiItemR(row, &mappingptr, "max", 0, "", ICON_NONE); + uiItemR(row, ptr, "use_max", 0, "Max", ICON_NONE); + uiItemR(row, ptr, "max", 0, "", ICON_NONE); } static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 170cfcb103e..30889bb25f6 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -757,6 +757,13 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep return NULL; } +static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNode *node = ptr->data; + init_tex_mapping(node->storage); + rna_Node_update(bmain, scene, ptr); +} + #else static EnumPropertyItem prop_image_layer_items[] = { @@ -1097,12 +1104,43 @@ static void def_sh_material(StructRNA *srna) static void def_sh_mapping(StructRNA *srna) { PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); - prop= RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "storage"); - RNA_def_property_struct_type(prop, "TexMapping"); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "Mapping", "Texture coordinate mapping settings"); + prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "loc"); + RNA_def_property_ui_text(prop, "Location", ""); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */ + RNA_def_property_float_sdna(prop, NULL, "rot"); + RNA_def_property_ui_text(prop, "Rotation", ""); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_ui_text(prop, "Scale", ""); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "min"); + RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "max"); + RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); + RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + + prop= RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); + RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); } static void def_sh_geometry(StructRNA *srna) |