From f5d62d885be1b040a3060fd3846ad2c08a05ad99 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 29 Oct 2009 14:27:56 +0000 Subject: [PATCH] Fixed [#19735] No normal map button in texture->image pane Put it into the "Image Sampling" Panel, not sure if its the right location. --- release/scripts/ui/buttons_texture.py | 20 ++++++------- source/blender/makesrna/intern/rna_texture.c | 30 ++++++++++++++------ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/release/scripts/ui/buttons_texture.py b/release/scripts/ui/buttons_texture.py index 1680a80bb6c..1a308bbb2ad 100644 --- a/release/scripts/ui/buttons_texture.py +++ b/release/scripts/ui/buttons_texture.py @@ -459,16 +459,6 @@ class TEXTURE_PT_image_sampling(TextureTypePanel): slot = context.texture_slot split = layout.split() - - """ - col = split.column() - col.itemR(tex, "flip_axis") - col.itemR(tex, "normal_map") - if slot: - row = col.row() - row.active = tex.normal_map - row.itemR(slot, "normal_map_space", text="") - """ col = split.column() col.itemL(text="Alpha:") @@ -480,6 +470,11 @@ class TEXTURE_PT_image_sampling(TextureTypePanel): col.itemR(tex, "flip_axis", text="X/Y Axis") col = split.column() + col.itemR(tex, "normal_map") + row = col.row() + row.active = tex.normal_map + row.itemR(tex, "normal_space", text="") + col.itemL(text="Filter:") col.itemR(tex, "filter", text="") col.itemR(tex, "mipmap") @@ -519,6 +514,8 @@ class TEXTURE_PT_image_mapping(TextureTypePanel): col.itemL(text="Mirror:") col.itemR(tex, "mirror_x", text="X") col.itemR(tex, "mirror_y", text="Y") + layout.itemS() + elif tex.extension == 'CHECKER': col = split.column(align=True) row = col.row() @@ -526,8 +523,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel): row.itemR(tex, "checker_odd", text="Odd") split.itemR(tex, "checker_distance", text="Distance") - - layout.itemS() + layout.itemS() split = layout.split() diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 3246faa2ecb..c2be65c39d6 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -1060,6 +1060,13 @@ static void rna_def_texture_image(BlenderRNA *brna) {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"}, {TEX_CHECKER, "CHECKER", 0, "Checker", "Causes the image to repeat in checker board pattern"}, {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_normal_space[] = { + {MTEX_NSPACE_CAMERA, "CAMERA", 0, "Extend", ""}, + {MTEX_NSPACE_WORLD, "WORLD", 0, "World", ""}, + {MTEX_NSPACE_OBJECT, "OBJECT", 0, "Object", ""}, + {MTEX_NSPACE_TANGENT, "TANGENT", 0, "Tangent", ""}, + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ImageTexture", "Texture"); RNA_def_struct_ui_text(srna, "Image Texture", ""); @@ -1104,14 +1111,6 @@ static void rna_def_texture_image(BlenderRNA *brna) rna_def_filter_size_common(srna); - prop= RNA_def_property(srna, "normal_map", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP); - RNA_def_property_ui_text(prop, "Normal Map", "Uses image RGB values for normal mapping"); - RNA_def_property_update(prop, 0, "rna_Texture_update"); - - /* XXX: mtex->normapspace "Sets space of normal map image" "Normal Space %t|Camera %x0|World %x1|Object %x2|Tangent %x3" - * not sure why this goes in mtex instead of texture directly? */ - prop= RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "extend"); RNA_def_property_enum_items(prop, prop_image_extension); @@ -1230,6 +1229,21 @@ static void rna_def_texture_image(BlenderRNA *brna) RNA_def_property_range(prop, 1, 256); RNA_def_property_ui_text(prop, "Filter Eccentricity", "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower."); RNA_def_property_update(prop, 0, "rna_Texture_update"); + + /* Normal Map */ + prop= RNA_def_property(srna, "normal_map", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP); + RNA_def_property_ui_text(prop, "Normal Map", "Uses image RGB values for normal mapping"); + RNA_def_property_update(prop, 0, "rna_Texture_update"); + + /* not sure why this goes in mtex instead of texture directly? */ + RNA_def_struct_sdna(srna, "MTex"); + + prop= RNA_def_property(srna, "normal_space", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "normapspace"); + RNA_def_property_enum_items(prop, prop_normal_space); + RNA_def_property_ui_text(prop, "Normal Space", "Sets space of normal map image."); + RNA_def_property_update(prop, 0, "rna_Texture_update"); } static void rna_def_texture_plugin(BlenderRNA *brna)