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_texture.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_texture.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index a27e41a96c8..6aee4486cf5 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -495,6 +495,14 @@ static void rna_def_texmapping(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + 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} + }; + static EnumPropertyItem prop_xyz_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, @@ -509,6 +517,12 @@ static void rna_def_texmapping(BlenderRNA *brna) srna = RNA_def_struct(brna, "TexMapping", NULL); RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings"); + 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_Texture_mapping_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", ""); |