Fix for own commit 24156:

Normal Map bool and the normal_space menu are only used for material based textures, not for textures used by lamp/world etc. Accidentally ported this over from 2.49, where these buttons are drawn even they don't work in that context.
This commit is contained in:
2010-12-27 12:12:43 +00:00
parent 9118614d8e
commit 56453a4361
3 changed files with 11 additions and 24 deletions

View File

@@ -395,8 +395,9 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
idblock = context_tex_datablock(context)
tex = context.texture tex = context.texture
# slot = context.texture_slot slot = context.texture_slot
split = layout.split() split = layout.split()
@@ -410,10 +411,12 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
col = split.column() col = split.column()
#Only for Material based textures, not for Lamp/World...
if isinstance(idblock, bpy.types.Material):
col.prop(tex, "use_normal_map") col.prop(tex, "use_normal_map")
row = col.row() row = col.row()
row.active = tex.use_normal_map row.active = tex.use_normal_map
row.prop(tex, "normal_space", text="") row.prop(slot, "normal_map_space", text="")
col.prop(tex, "use_mipmap") col.prop(tex, "use_mipmap")
row = col.row() row = col.row()

View File

@@ -496,7 +496,7 @@ static void rna_def_material_mtex(BlenderRNA *brna)
prop= RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE); prop= RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "normapspace"); RNA_def_property_enum_sdna(prop, NULL, "normapspace");
RNA_def_property_enum_items(prop, prop_normal_map_space_items); RNA_def_property_enum_items(prop, prop_normal_map_space_items);
RNA_def_property_ui_text(prop, "Normal Map Space", ""); RNA_def_property_ui_text(prop, "Normal Map Space", "Sets space of normal map image");
RNA_def_property_update(prop, 0, "rna_Material_update"); RNA_def_property_update(prop, 0, "rna_Material_update");
prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE); prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);

View File

@@ -980,13 +980,6 @@ static void rna_def_texture_image(BlenderRNA *brna)
{TEX_CHECKER, "CHECKER", 0, "Checker", "Causes the image to repeat in checker board pattern"}, {TEX_CHECKER, "CHECKER", 0, "Checker", "Causes the image to repeat in checker board pattern"},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_normal_space[] = {
{MTEX_NSPACE_CAMERA, "CAMERA", 0, "Camera", ""},
{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"); srna= RNA_def_struct(brna, "ImageTexture", "Texture");
RNA_def_struct_ui_text(srna, "Image Texture", ""); RNA_def_struct_ui_text(srna, "Image Texture", "");
RNA_def_struct_sdna(srna, "Tex"); RNA_def_struct_sdna(srna, "Tex");
@@ -1123,15 +1116,6 @@ static void rna_def_texture_image(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP); 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_ui_text(prop, "Normal Map", "Uses image RGB values for normal mapping");
RNA_def_property_update(prop, 0, "rna_Texture_update"); 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) static void rna_def_texture_plugin(BlenderRNA *brna)