From c3d3d8be3675e284cbe269b4173c3cc15ce762ae Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 25 Sep 2013 20:28:49 +0000 Subject: 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. --- source/blender/makesrna/intern/rna_texture.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/makesrna/intern/rna_texture.c') 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", ""); -- cgit v1.2.3