2.5 Texture RNA:
authorThomas Dinges <blender@dingto.org>
Tue, 9 Jun 2009 16:04:07 +0000 (16:04 +0000)
committerThomas Dinges <blender@dingto.org>
Tue, 9 Jun 2009 16:04:07 +0000 (16:04 +0000)
* Wrapped some Mapping properties and added them into the layout.

release/ui/buttons_texture.py
source/blender/makesrna/intern/rna_material.c

index 74a1ad9172ca821e0ce90d93d214e098c8960544..e7744bef44bf0c1739cffdafe96ddb52d89a52b1 100644 (file)
@@ -90,61 +90,56 @@ class TEXTURE_PT_map(TextureButtonsPanel):
                col = split.column()
                col.itemR(tex, "from_dupli")
                
-               split = layout.split()
-               col = split.column()
-               col.itemR(tex, "mapping")
-               col = split.column()
-               rowsub = col.row()
-               rowsub.itemL(text="TODO:X")
-               rowsub.itemL(text="TODO:Y")
-               rowsub.itemL(text="TODO:Z")
-               
-               split = layout.split()
-               col = split.column()
-               col.itemR(tex, "offset")
-               col = split.column()
-               col.itemR(tex, "size")
-       
+               layout.itemR(tex, "mapping")
                row = layout.row()
-               row.itemL(text="Affect:")
+               row.itemR(tex, "x_mapping", text="X")
+               row.itemR(tex, "y_mapping", text="Y")
+               row.itemR(tex, "z_mapping", text="Z")
+
+               row = layout.row()
+               row.column().itemR(tex, "offset")
+               row.column().itemR(tex, "size")
+
+               layout.itemL(text="Affect:")
                
                split = layout.split()
+               
                col = split.column()
-               col.itemL(text="TODO: Diffuse Color")
+               col.itemR(tex, "map_color")
                col.itemR(tex, "color_factor")
                col.itemR(tex, "blend_type")
                col.itemR(tex, "no_rgb")
                colsub = col.column()
                colsub.active = tex.no_rgb
                colsub.itemR(tex, "color")
-               col.itemL(text="TODO: Normal")
+               col.itemR(tex, "map_normal")
                col.itemR(tex, "normal_factor")
                col.itemR(tex, "normal_map_space")
-               col.itemL(text="TODO: Warp")
-               col.itemR(tex, "warp_factor")
-               col.itemL(text="TODO: Specular Color")
-               col.itemL(text="TODO: Displacement")
-               col.itemR(tex, "displacement_factor")
+               col.itemR(tex, "map_warp")
+               colsub = col.column()
+               colsub.active = tex.map_warp
+               colsub.itemR(tex, "warp_factor", text="Factor")
+               col.itemR(tex, "map_colorspec")
+               col.itemR(tex, "map_displacement")
+               colsub = col.column()
+               colsub.active = tex.map_displacement
+               colsub.itemR(tex, "displacement_factor", text="Factor")
                col = split.column()
-               col.itemL(text="TODO: Mirror Color")
-               col.itemL(text="TODO: Reflection")
-               col.itemL(text="TODO: Specularity")
-               col.itemL(text="TODO: Ambient")
-               col.itemL(text="TODO: Hard")
-               col.itemL(text="TODO: Ray Mirror")
-               col.itemL(text="TODO: Alpha")
-               col.itemL(text="TODO: Emit")
-               col.itemL(text="TODO: Translucency")
+               col.itemR(tex, "map_mirror")
+               col.itemR(tex, "map_reflection")
+               col.itemR(tex, "map_specularity")
+               col.itemR(tex, "map_ambient")
+               col.itemR(tex, "map_hardness")
+               col.itemR(tex, "map_raymir")
+               col.itemR(tex, "map_alpha")
+               col.itemR(tex, "map_emit")
+               col.itemR(tex, "map_translucency")
 
                col.itemR(tex, "default_value")
                
-               split = layout.split()
-               col = split.column()
-               col.itemR(tex, "stencil")
-               col = split.column()
-               col.itemR(tex, "negate", text="Negative")
-               
-
+               row = layout.row()
+               row.itemR(tex, "stencil")
+               row.itemR(tex, "negate", text="Negative")
 
 class TEXTURE_PT_colors(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_colors"
@@ -495,5 +490,4 @@ bpy.types.register(TEXTURE_PT_musgrave)
 bpy.types.register(TEXTURE_PT_voronoi)
 bpy.types.register(TEXTURE_PT_distortednoise)
 bpy.types.register(TEXTURE_PT_colors)
-bpy.types.register(TEXTURE_PT_map)
-               
+bpy.types.register(TEXTURE_PT_map)
\ No newline at end of file
index b354d1a57a9fc4931228cb6b9337181fae464e57..7e66c9fb5e50286018e161eb01a623303cbd55ec 100644 (file)
@@ -140,6 +140,27 @@ static void rna_def_material_mtex(BlenderRNA *brna)
                {MTEX_TUBE, "TUBE", "Tube", "Maps with Z as central axis."},
                {MTEX_SPHERE, "SPHERE", "Sphere", "Maps with Z as central axis."},
                {0, NULL, NULL, NULL}};
+               
+       static EnumPropertyItem prop_x_mapping_items[] = {
+               {0, "NONE", "None", ""},
+               {1, "X", "X", ""},
+               {2, "Y", "Y", ""},
+               {3, "Z", "Z", ""},
+               {0, NULL, NULL, NULL}};
+               
+       static EnumPropertyItem prop_y_mapping_items[] = {
+               {0, "NONE", "None", ""},
+               {1, "X", "X", ""},
+               {2, "Y", "Y", ""},
+               {3, "Z", "Z", ""},
+               {0, NULL, NULL, NULL}};
+               
+       static EnumPropertyItem prop_z_mapping_items[] = {
+               {0, "NONE", "None", ""},
+               {1, "X", "X", ""},
+               {2, "Y", "Y", ""},
+               {3, "Z", "Z", ""},
+               {0, NULL, NULL, NULL}};
 
        static EnumPropertyItem prop_normal_map_space_items[] = {
                {MTEX_NSPACE_CAMERA, "CAMERA", "Camera", ""},
@@ -171,9 +192,76 @@ static void rna_def_material_mtex(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO);
        RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent (only for UV and Orco texture coordinates).");
 
-       /* XXX: MTex.mapto and MTex.maptoneg */
+       prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL);
+       RNA_def_property_ui_text(prop, "Color", "Causes the texture to affect basic color of the material");
+       
+       prop= RNA_def_property(srna, "map_normal", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_NORM);
+       RNA_def_property_ui_text(prop, "Normal", "Causes the texture to affect the rendered normal");
+       
+       prop= RNA_def_property(srna, "map_colorspec", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLSPEC);
+       RNA_def_property_ui_text(prop, "Specularity Color", "Causes the texture to affect the specularity color");
+       
+       prop= RNA_def_property(srna, "map_mirror", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLMIR);
+       RNA_def_property_ui_text(prop, "Mirror", "Causes the texture to affect the mirror color");
+       
+       prop= RNA_def_property(srna, "map_reflection", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REF);
+       RNA_def_property_ui_text(prop, "Reflection", "Causes the texture to affect the value of the materials reflectivity");
+       
+       prop= RNA_def_property(srna, "map_specularity", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SPEC);
+       RNA_def_property_ui_text(prop, "Specularity", "Causes the texture to affect the value of specularity");
+       
+       prop= RNA_def_property(srna, "map_ambient", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_AMB);
+       RNA_def_property_ui_text(prop, "Ambient", "Causes the texture to affect the value of ambient");
+       
+       prop= RNA_def_property(srna, "map_hardness", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_HAR);
+       RNA_def_property_ui_text(prop, "Hardness", "Causes the texture to affect the hardness value");
+       
+       prop= RNA_def_property(srna, "map_raymir", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_RAYMIRR);
+       RNA_def_property_ui_text(prop, "Ray-Mirror", "Causes the texture to affect the ray-mirror value");
+       
+       prop= RNA_def_property(srna, "map_alpha", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA);
+       RNA_def_property_ui_text(prop, "Alpha", "Causes the texture to affect the alpha value");
+       
+       prop= RNA_def_property(srna, "map_emit", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMIT);
+       RNA_def_property_ui_text(prop, "Emit", "Causes the texture to affect the emit value");
+       
+       prop= RNA_def_property(srna, "map_translucency", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSLU);
+       RNA_def_property_ui_text(prop, "Translucency", "Causes the texture to affect the translucency value");
+       
+       prop= RNA_def_property(srna, "map_displacement", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DISPLACE);
+       RNA_def_property_ui_text(prop, "Displacement", "Let the texture displace the surface");
+       
+       prop= RNA_def_property(srna, "map_warp", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_WARP);
+       RNA_def_property_ui_text(prop, "Warp", "Let the texture warp texture coordinates of next channels");
 
-       /* XXX: MTex.proj[xyz] */
+       prop= RNA_def_property(srna, "x_mapping", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "projx");
+       RNA_def_property_enum_items(prop, prop_x_mapping_items);
+       RNA_def_property_ui_text(prop, "X Mapping", "");
+       
+       prop= RNA_def_property(srna, "y_mapping", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "projy");
+       RNA_def_property_enum_items(prop, prop_y_mapping_items);
+       RNA_def_property_ui_text(prop, "Y Mapping", "");
+       
+       prop= RNA_def_property(srna, "z_mapping", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "projz");
+       RNA_def_property_enum_items(prop, prop_z_mapping_items);
+       RNA_def_property_ui_text(prop, "Z Mapping", "");
 
        prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, prop_mapping_items);