diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-26 00:28:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-26 00:28:49 +0400 |
commit | c3d3d8be3675e284cbe269b4173c3cc15ce762ae (patch) | |
tree | deff4134588923edb71ba8f7823562773957f6b7 /source/blender/makesrna/intern/rna_nodetree.c | |
parent | e9859bb0e59cd54a5d682a0fc484e2366d5e54fe (diff) |
Fix cycles issue with mapping node rotation and scale order. When using both
scale and rotation in mapping node, there would be shearing, and the only way
to avoid that was to add 2 mapping nodes. This is because to transform the
texture, the inverse transform needs to be done on the texture coordinate
Now the mapping node has Texture/Point/Vector/Normal types to transform the
vector for a particular purpose. Point is the existing behavior, Texture is
the new default that behaves more like you might expect.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index eb5f5933bf1..cc99296614d 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3135,10 +3135,24 @@ static void def_sh_material(StructRNA *srna) static void def_sh_mapping(StructRNA *srna) { + static EnumPropertyItem prop_vect_type_items[] = { + {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transforms a texture by inverse mapping the texture coordinate"}, + {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transforms a point"}, + {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transforms a direction vector"}, + {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transforms a normal vector with unit length"}, + {0, NULL, 0, NULL, NULL} + }; + PropertyRNA *prop; RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_vect_type_items); + RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms"); + RNA_def_property_update(prop, 0, "rna_Mapping_Node_update"); + prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_ui_text(prop, "Location", ""); @@ -3522,9 +3536,9 @@ static void def_sh_tex_coord(StructRNA *srna) static void def_sh_vect_transform(StructRNA *srna) { static EnumPropertyItem prop_vect_type_items[] = { - {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", ""}, - {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", ""}, - {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", ""}, + {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transforms a point"}, + {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transforms a direction vector"}, + {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transforms a normal vector with unit length"}, {0, NULL, 0, NULL, NULL} }; |