2.5: Texture Buttons
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 21 Jul 2009 12:57:55 +0000 (12:57 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 21 Jul 2009 12:57:55 +0000 (12:57 +0000)
* World and Lamp previews now working here too.
* Experiment with list template, showing only icons. Unfortunately
  texture icon render crashes combined with preview render so it
  shows all icons the same.
* Influence panels updated, with slider for each option. The values
  are still linked though, will fix that later.
* Image texture controls a bit more complete, still WIP.
* Color ramp back.

13 files changed:
release/ui/buttons_texture.py
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_utils.c
source/blender/makesdna/DNA_lamp_types.h
source/blender/makesdna/DNA_material_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesdna/DNA_world_types.h
source/blender/makesrna/intern/rna_lamp.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_world.c

index 49f04b886b4e9d7f32195e1f876f686712cd6b1b..7367805a39542a5e0fa0b748dae8f1364cfc7070 100644 (file)
@@ -16,10 +16,16 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
        def draw(self, context):
                layout = self.layout
                tex = context.texture
-               mat = context.material
+               ma = context.material
+               la = context.lamp
+               wo = context.world
                
-               if mat:
-                       layout.template_preview(tex, parent=mat)
+               if ma:
+                       layout.template_preview(tex, parent=ma)
+               elif la:
+                       layout.template_preview(tex, parent=la)
+               elif wo:
+                       layout.template_preview(tex, parent=wo)
                else:
                        layout.template_preview(tex)
 
@@ -43,16 +49,11 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
                if ma or la or wo:
                        row = layout.row()
                        if ma:
-                               row.template_list(ma, "textures", ma, "active_texture_index")
+                               row.template_list(ma, "textures", ma, "active_texture_index", type="ICONS")
                        elif la:
-                               row.template_list(la, "textures", la, "active_texture_index")
+                               row.template_list(la, "textures", la, "active_texture_index", type="ICONS")
                        elif wo:
-                               row.template_list(wo, "textures", wo, "active_texture_index")
-                       """if ma or la or wo: 
-                               col = row.column(align=True)
-                               col.itemO("texture.new", icon="ICON_ZOOMIN", text="")
-                               #col.itemO("object.material_slot_remove", icon="ICON_ZOOMOUT", text="")
-                       """
+                               row.template_list(wo, "textures", wo, "active_texture_index", type="ICONS")
 
                split = layout.split(percentage=0.65)
 
@@ -97,21 +98,30 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
                col = split.column()
                col.itemR(tex, "texture_coordinates", text="")
 
-               if tex.texture_coordinates == 'UV':
-                       row = layout.row()
-                       row.itemR(tex, "uv_layer")
+               if tex.texture_coordinates == 'ORCO':
+                       """
+                       ob = context.object
+                       if ob and ob.type == 'MESH':
+                               split = layout.split(percentage=0.3)
+                               split.itemL(text="Mesh:")
+                               split.itemR(ob.data, "texco_mesh", text="")
+                       """
+               elif tex.texture_coordinates == 'UV':
+                       split = layout.split(percentage=0.3)
+                       split.itemL(text="Layer:")
+                       split.itemR(tex, "uv_layer", text="")
                elif tex.texture_coordinates == 'OBJECT':
-                       row = layout.row()
-                       row.itemR(tex, "object")
+                       split = layout.split(percentage=0.3)
+                       split.itemL(text="Object:")
+                       split.itemR(tex, "object", text="")
                
-               if textype.type in ('IMAGE', 'ENVIRONMENT_MAP'):
+               if ma:
                        split = layout.split(percentage=0.3)
                        col = split.column()
                        col.itemL(text="Projection:")
                        col = split.column()
                        col.itemR(tex, "mapping", text="")
 
-               if ma:
                        split = layout.split()
                        
                        col = split.column()
@@ -147,88 +157,75 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
                wo = context.world
                textype = context.texture
                tex = context.texture_slot
+
+               def factor_but(layout, active, toggle, factor, name):
+                       row = layout.row(align=True)
+                       row.itemR(tex, toggle, text="")
+                       sub = row.row()
+                       sub.active = active
+                       sub.itemR(tex, factor, text=name, slider=True)
                
                if ma:
                        split = layout.split()
                        
                        col = split.column()
-                       col.itemR(tex, "map_color", text="Diffuse Color")
-                       colsub = col.column()
-                       colsub.active = tex.map_color
-                       colsub.itemR(tex, "color_factor", text="Opacity", slider=True)
-                       colsub.itemR(tex, "blend_type")
-                       col.itemR(tex, "rgb_to_intensity")
-                       colsub = col.column()
-                       colsub.active = tex.rgb_to_intensity
-                       colsub.itemR(tex, "color")
-               
-                       col.itemR(tex, "map_colorspec")
-                       col.itemR(tex, "map_normal")
-                       colsub = col.column()
-                       colsub.active = tex.map_normal
-                       colsub.itemR(tex, "normal_factor", text="Amount", slider=True)
-                       col.itemR(tex, "normal_map_space")
-                       col.itemR(tex, "map_warp")
-                       colsub = col.column()
-                       colsub.active = tex.map_warp
-                       colsub.itemR(tex, "warp_factor", text="Amount", slider=True)    
-                       col.itemR(tex, "map_displacement")
-                       colsub = col.column()
-                       colsub.active = tex.map_displacement
-                       colsub.itemR(tex, "displacement_factor", text="Amount", slider=True)
+
+                       col.itemL(text="Diffuse:")
+                       factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity")
+                       factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color")
+                       factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha")
+                       factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency")
+
+                       col.itemL(text="Specular:")
+                       factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity")
+                       factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
+                       factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
+
                        col = split.column()
-                       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")
-
-                       colsub = col.column()
-                       colsub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
-                       colsub.itemR(tex, "default_value", text="Amount", slider=True)
-                       
+                       col.itemL(text="Shading:")
+                       factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
+                       factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
+                       factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror")
+                       factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror")
+
+                       col.itemL(text="Geometry:")
+                       factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal")
+                       factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
+                       factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
+
+                       #colsub = col.column()
+                       #colsub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
+                       #colsub.itemR(tex, "default_value", text="Amount", slider=True)
                elif la:
                        row = layout.row()
-                       row.itemR(tex, "map_color")
-                       row.itemR(tex, "map_shadow")
-
+                       factor_but(row, tex.map_color, "map_color", "color_factor", "Color")
+                       factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
+               elif wo:
                        split = layout.split()
-
                        col = split.column()
-                       col.itemR(tex, "color_factor", text="Opacity", slider=True)
-                       col.itemR(tex, "blend_type")
-                       col.itemR(tex, "rgb_to_intensity")
-                       col.itemR(tex, "color")
+                       factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
+                       factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
 
                        col = split.column()
-                       col.itemR(tex, "default_value", text="DVar", slider=True)
-               elif wo:
-                       row = layout.row()
-                       row.itemR(tex, "map_blend")
-                       row.itemR(tex, "map_horizon")
-                       row.itemR(tex, "map_zenith_up")
-                       row.itemR(tex, "map_zenith_down")
+                       factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
+                       factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
 
-                       split = layout.split()
+               layout.itemS()
+               split = layout.split()
 
-                       col = split.column()
-                       col.itemR(tex, "color_factor", text="Opacity", slider=True)
-                       col.itemR(tex, "blend_type")
-                       col.itemR(tex, "rgb_to_intensity")
-                       col.itemR(tex, "color")
+               col = split.column()
 
-                       col = split.column()
-                       col.itemR(tex, "normal_factor", text="Nor", slider=True)
-                       col.itemR(tex, "variable_factor", text="Var", slider=True)
-                       col.itemR(tex, "default_value", text="DVar", slider=True)
+               col.itemR(tex, "blend_type", text="Blend")
+               col.itemR(tex, "rgb_to_intensity")
+               colsub = col.column()
+               colsub.active = tex.rgb_to_intensity
+               colsub.itemR(tex, "color", text="")
 
-               row = layout.row()
-               row.itemR(tex, "stencil")
-               row.itemR(tex, "negate", text="Negative")
+               col = split.column()
+               col.itemR(tex, "negate", text="Negative")
+               col.itemR(tex, "stencil")
+               if ma or wo:
+                       col.itemR(tex, "default_value", text="DVar", slider=True)
 
 class TEXTURE_PT_colors(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_colors"
@@ -239,12 +236,13 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
                layout = self.layout
                tex = context.texture
 
-               if tex.color_ramp:
+               layout.itemR(tex, "use_color_ramp", text="Ramp")
+               if tex.use_color_ramp:
                        layout.template_color_ramp(tex.color_ramp, expand=True)
-               else:
-                       split = layout.split()
-                       col = split.column()
-                       col.itemR(tex, "rgb_factor", text="Multiply RGB")
+
+               split = layout.split()
+               col = split.column()
+               col.itemR(tex, "rgb_factor", text="Multiply RGB")
 
                col = split.column()
                col.itemL(text="Adjust:")
@@ -378,7 +376,22 @@ class TEXTURE_PT_stucci(TextureButtonsPanel):
                
 class TEXTURE_PT_image(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_image"
-       __label__ = "Image/Movie"
+       __label__ = "Image"
+       
+       def poll(self, context):
+               tex = context.texture
+               return (tex and tex.type == 'IMAGE')
+
+       def draw(self, context):
+               layout = self.layout
+               tex = context.texture
+
+               layout.template_texture_image(tex)
+
+class TEXTURE_PT_image_sampling(TextureButtonsPanel):
+       __idname__= "TEXTURE_PT_image_sampling"
+       __label__ = "Image Sampling"
+       __default_closed__ = True
        
        def poll(self, context):
                tex = context.texture
@@ -387,25 +400,50 @@ class TEXTURE_PT_image(TextureButtonsPanel):
        def draw(self, context):
                layout = self.layout
                tex = context.texture
+               slot = context.texture_slot
                
                split = layout.split()
                
+               """
                sub = split.column()            
                sub.itemR(tex, "flip_axis")
                sub.itemR(tex, "normal_map")
+               if slot:
+                       row = sub.row()
+                       row.active = tex.normal_map
+                       row.itemR(slot, "normal_map_space", text="")
+               """
+
+               sub = split.column()
+
+               sub.itemL(text="Alpha:")
+               sub.itemR(tex, "use_alpha", text="Use")
+               sub.itemR(tex, "calculate_alpha", text="Calculate")
+               sub.itemR(tex, "invert_alpha", text="Invert")
+
+               sub.itemL(text="Flip:")
+               sub.itemR(tex, "flip_axis", text="X/Y Axis")
+
+               sub = split.column() 
                sub.itemL(text="Filter:")
+               #sub.itemR(tex, "filter", text="")
                sub.itemR(tex, "mipmap")
-               sub.itemR(tex, "mipmap_gauss")
+               row = sub.row()
+               row.itemR(tex, "mipmap_gauss", text="Gauss")
+               row.active = tex.mipmap
                sub.itemR(tex, "interpolation")
-               sub = split.column() 
-               sub.itemL(text="Alpha:")
-               sub.itemR(tex, "use_alpha")
-               sub.itemR(tex, "calculate_alpha")
-               sub.itemR(tex, "invert_alpha")
+               """
+               if tex.mipmap and tex.filter != 'DEFAULT':
+                       if tex.filter == 'FELINE':
+                               sub.itemR(tex, "filter_probes", text="Probes")
+                       else:
+                               sub.itemR(tex, "filter_eccentricity", text="Eccentricity")
+               """
 
-class TEXTURE_PT_crop(TextureButtonsPanel):
-       __idname__= "TEXTURE_PT_crop"
-       __label__ = "Crop"
+class TEXTURE_PT_image_mapping(TextureButtonsPanel):
+       __idname__= "TEXTURE_PT_image_mapping"
+       __label__ = "Image Mapping"
+       __default_closed__ = True
        
        def poll(self, context):
                tex = context.texture
@@ -414,37 +452,41 @@ class TEXTURE_PT_crop(TextureButtonsPanel):
        def draw(self, context):
                layout = self.layout
                tex = context.texture
-                               
-               split = layout.split()
-               
-               sub = split.column()
-               #sub.itemR(tex, "crop_rectangle")
-               sub.itemL(text="Crop Minimum:")
-               sub.itemR(tex, "crop_min_x", text="X")
-               sub.itemR(tex, "crop_min_y", text="Y")
-               sub = split.column()
-               sub.itemL(text="Crop Maximum:")
-               sub.itemR(tex, "crop_max_x", text="X")
-               sub.itemR(tex, "crop_max_y", text="Y")
                
                layout.itemR(tex, "extension")
                
                split = layout.split()
                
-               sub = split.column()
                if tex.extension == 'REPEAT': 
+                       sub = split.column(align=True)
                        sub.itemL(text="Repeat:")
                        sub.itemR(tex, "repeat_x", text="X")
                        sub.itemR(tex, "repeat_y", text="Y")
-                       sub = split.column()
+                       sub = split.column(align=True)
                        sub.itemL(text="Mirror:")
                        sub.itemR(tex, "mirror_x", text="X")
                        sub.itemR(tex, "mirror_y", text="Y")
                elif tex.extension == 'CHECKER': 
-                       sub.itemR(tex, "checker_even", text="Even")
-                       sub.itemR(tex, "checker_odd", text="Odd")
+                       sub = split.column(align=True)
+                       row = sub.row()
+                       row.itemR(tex, "checker_even", text="Even")
+                       row.itemR(tex, "checker_odd", text="Odd")
                        sub = split.column()
                        sub.itemR(tex, "checker_distance", text="Distance")
+
+               layout.itemS()
+
+               split = layout.split()
+               
+               sub = split.column(align=True)
+               #sub.itemR(tex, "crop_rectangle")
+               sub.itemL(text="Crop Minimum:")
+               sub.itemR(tex, "crop_min_x", text="X")
+               sub.itemR(tex, "crop_min_y", text="Y")
+               sub = split.column(align=True)
+               sub.itemL(text="Crop Maximum:")
+               sub.itemR(tex, "crop_max_x", text="X")
+               sub.itemR(tex, "crop_max_y", text="Y")
        
 class TEXTURE_PT_plugin(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_plugin"
@@ -573,7 +615,8 @@ bpy.types.register(TEXTURE_PT_magic)
 bpy.types.register(TEXTURE_PT_blend)
 bpy.types.register(TEXTURE_PT_stucci)
 bpy.types.register(TEXTURE_PT_image)
-bpy.types.register(TEXTURE_PT_crop)
+bpy.types.register(TEXTURE_PT_image_sampling)
+bpy.types.register(TEXTURE_PT_image_mapping)
 bpy.types.register(TEXTURE_PT_plugin)
 bpy.types.register(TEXTURE_PT_envmap)
 bpy.types.register(TEXTURE_PT_musgrave)
index f6774d6ac92c16d187aa114ec95d326904c2ca52..b40f90dcf0cecfb613300a6ad697c4ad128e5962 100644 (file)
@@ -59,6 +59,7 @@ struct CurveMapping;
 struct Image;
 struct ImageUser;
 struct uiWidgetColors;
+struct Tex;
 
 typedef struct uiBut uiBut;
 typedef struct uiBlock uiBlock;
@@ -628,6 +629,7 @@ void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *i
 void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
 void uiTemplateOperatorSearch(uiLayout *layout);
 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
+void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex);
 
 typedef struct uiListItem {
        struct uiListItem *next, *prev;
index 24009819f45448985c0596aa0781dde66861ebd5..f8d1e1d7ab98cb5c57144147b7c9e5eb19b2ba0e 100644 (file)
@@ -1155,11 +1155,12 @@ uiLayout *uiTemplateGroup(uiLayout *layout, Object *ob, Group *group)
 
 /************************* Preview Template ***************************/
 
+#include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
+#include "DNA_world_types.h"
 
 #define B_MATPRV 1
 
-
 static void do_preview_buttons(bContext *C, void *arg, int event)
 {
        switch(event) {
@@ -1175,6 +1176,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent)
        uiBlock *block;
        Material *ma= NULL;
        ID *pid, *pparent;
+       short *pr_texture= NULL;
 
        if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
                printf("uiTemplatePreview: expected ID of type material, texture, lamp or world.\n");
@@ -1185,13 +1187,20 @@ void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent)
        pid= id;
        pparent= NULL;
 
-       if((id && GS(id->name) == ID_TE) && (parent && GS(parent->name) == ID_MA)) {
-               ma= ((Material*)parent);
-
-               if(ma->pr_texture == MA_PR_MATERIAL)
-                       pid= parent;
-               else if(ma->pr_texture == MA_PR_BOTH)
-                       pparent= parent;
+       if(id && (GS(id->name) == ID_TE)) {
+               if(parent && (GS(parent->name) == ID_MA))
+                       pr_texture= &((Material*)parent)->pr_texture;
+               else if(parent && (GS(parent->name) == ID_WO))
+                       pr_texture= &((World*)parent)->pr_texture;
+               else if(parent && (GS(parent->name) == ID_LA))
+                       pr_texture= &((Lamp*)parent)->pr_texture;
+
+               if(pr_texture) {
+                       if(*pr_texture == TEX_PR_OTHER)
+                               pid= parent;
+                       else if(*pr_texture == TEX_PR_BOTH)
+                               pparent= parent;
+               }
        }
 
        /* layout */
@@ -1221,12 +1230,17 @@ void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent)
                        uiDefIconButC(block, ROW, B_MATPRV, ICON_MATSPHERE, 0, 0,UI_UNIT_X*1.5,UI_UNIT_Y, &(ma->pr_type), 10, MA_SPHERE_A, 0, 0, "Preview type: Large sphere with sky");
                }
 
-               if(GS(id->name) == ID_TE && (parent && GS(parent->name) == ID_MA)) {
+               if(pr_texture) {
                        uiLayoutRow(layout, 1);
 
-                       uiDefButS(block, ROW, B_MATPRV, "Texture",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, &(ma->pr_texture), 10, MA_PR_TEXTURE, 0, 0, "");
-                       uiDefButS(block, ROW, B_MATPRV, "Material",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, &(ma->pr_texture), 10, MA_PR_MATERIAL, 0, 0, "");
-                       uiDefButS(block, ROW, B_MATPRV, "Both",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, &(ma->pr_texture), 10, MA_PR_BOTH, 0, 0, "");
+                       uiDefButS(block, ROW, B_MATPRV, "Texture",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
+                       if(GS(parent->name) == ID_MA)
+                               uiDefButS(block, ROW, B_MATPRV, "Material",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+                       else if(GS(parent->name) == ID_LA)
+                               uiDefButS(block, ROW, B_MATPRV, "Lamp",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+                       else if(GS(parent->name) == ID_WO)
+                               uiDefButS(block, ROW, B_MATPRV, "World",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+                       uiDefButS(block, ROW, B_MATPRV, "Both",  0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
                }
        }
 }
@@ -1669,3 +1683,17 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
                uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_REC, "Anim Player", 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop animation playback");
 }
 
+/************************* Image Template **************************/
+
+#include "ED_image.h"
+
+void uiTemplateTextureImage(uiLayout *layout, bContext *C, Tex *tex)
+{
+       uiBlock *block;
+
+       if(tex) {
+               block= uiLayoutFreeBlock(layout);
+               ED_image_uiblock_panel(C, block, &tex->ima, &tex->iuser, 0, 0);
+       }
+}
+
index 4df8641b4555b86eecd37cb26c385d677d8696b3..5c10c69d1c1605f21f0daeeb8697c4630b533116 100644 (file)
@@ -1011,14 +1011,16 @@ static void colorband_buttons_large(uiBlock *block, ColorBand *coba, int xoffs,
        
        if(coba==NULL) return;
        
-       bt= uiDefBut(block, BUT, redraw,        "Add",          80+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
+       uiBlockBeginAlign(block);
+       bt= uiDefBut(block, BUT, redraw,        "Add",          0+xoffs,100+yoffs,50,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
        uiButSetFunc(bt, colorband_add_cb, coba, NULL);
-       uiDefButS(block, NUM, redraw,           "Cur:",         117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
-       bt= uiDefBut(block, BUT, redraw,                "Del",          199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
+       uiDefButS(block, NUM, redraw,           "Cur:",         50+xoffs,100+yoffs,100,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
+       bt= uiDefBut(block, BUT, redraw,                "Del",          150+xoffs,100+yoffs,50,20, 0, 0, 0, 0, 0, "Deletes the active position");
        uiButSetFunc(bt, colorband_del_cb, coba, NULL);
        
        uiDefButS(block, MENU, redraw,          "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
-               236+xoffs, 95+yoffs, 64, 20,            &coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
+               200+xoffs, 100+yoffs, 100, 20,          &coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
+       uiBlockEndAlign(block);
 
        uiDefBut(block, BUT_COLORBAND, redraw, "",      xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
        
@@ -1059,7 +1061,6 @@ static void colorband_buttons_small(uiBlock *block, ColorBand *coba, rctf *butr,
 
        uiDefBut(block, BUT_COLORBAND, event, "",               xs,butr->ymin,butr->xmax-butr->xmin,20.0f, coba, 0, 0, 0, 0, "");
        uiBlockEndAlign(block);
-       
 }
 
 void colorband_buttons(uiBlock *block, ColorBand *coba, rctf *butr, int small)
index c6a1a2b45e2b43272c69830b2ed0c83e0445b348..a10590387778b0714c5a816c5d331d56a7ba9c86 100644 (file)
@@ -104,8 +104,9 @@ typedef struct Lamp {
        float YF_glowint, YF_glowofs;
        short YF_glowtype, YF_pad2;
        
-       struct MTex *mtex[18];                  /* MAX_MTEX */
        struct Ipo *ipo;                                // XXX depreceated... old animation system
+       struct MTex *mtex[18];                  /* MAX_MTEX */
+       short pr_texture, pad[3];
        
        /* preview */
        struct PreviewImage *preview;
index fd73d371d87b1ead510ce7a5419830936c65e47c..a2ead6fc33d8a1618587f3d20e6c2b13b485e5ae 100644 (file)
@@ -326,12 +326,6 @@ typedef struct Material {
 #define MA_HAIR                        10
 #define MA_ATMOS               11
 
-/* pr_texture */
-#define MA_PR_TEXTURE  0
-#define MA_PR_MATERIAL 1
-#define MA_PR_BOTH             2
-
-
 /* pr_back */
 #define MA_DARK                        1
 
index f37d9eca282714f711586ee81022c342f2f53013..6b7bfbdcd83df5c51c856b7e3fd191da67cb5099 100644 (file)
@@ -341,6 +341,11 @@ typedef struct TexMapping {
 #define TEX_RGB                1
 #define TEX_NOR                2
 
+/* pr_texture in material, world, lamp, */
+#define TEX_PR_TEXTURE 0
+#define TEX_PR_OTHER   1
+#define TEX_PR_BOTH            2
+
 /* **************** MTEX ********************* */
 
 /* proj */
index b6e387fbede59a0826f12f33a14f773af171ac32..31f0727cf73553cfd3519acae35327a8f4b83a81 100644 (file)
@@ -119,6 +119,7 @@ typedef struct World {
        
        struct Ipo *ipo;                        // XXX depreceated... old animation system
        struct MTex *mtex[18];          /* MAX_MTEX */
+       short pr_texture, pad[3];
 
        /* previews */
        struct PreviewImage *preview;
index bbe3b1dedb3b18fb9c33c2b078e9c478564b9532..fe14870cf6f1ea24b86a23317ff745acc046a87e 100644 (file)
@@ -141,10 +141,24 @@ static void rna_def_lamp_mtex(BlenderRNA *brna)
        prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_COL);
        RNA_def_property_ui_text(prop, "Color", "Lets the texture affect the basic color of the lamp.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        prop= RNA_def_property(srna, "map_shadow", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_SHAD);
        RNA_def_property_ui_text(prop, "Shadow", "Lets the texture affect the shadow color of the lamp.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Color Factor", "Amount texture affects color values.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "shadow_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Shadow Factor", "Amount texture affects shadow.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 }
 
 static void rna_def_lamp_sky_settings(BlenderRNA *brna)
index c8ee0479f61ad7d56327fd7cf6c4f77e1f00d707..6686d43d0759dfc1225ceee9d64a7fe45041d1fc 100644 (file)
@@ -244,15 +244,15 @@ static void rna_def_material_mtex(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "from_dupli", PROP_BOOLEAN, PROP_NONE);
        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).");
+       RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent.");
 
        prop= RNA_def_property(srna, "from_original", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG);
        RNA_def_property_ui_text(prop, "From Original", "Dupli's derive their object coordinates from the original objects transformation.");
 
-       prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE);
+       prop= RNA_def_property(srna, "map_colordiff", 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");
+       RNA_def_property_ui_text(prop, "Diffuse 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);
@@ -260,19 +260,19 @@ static void rna_def_material_mtex(BlenderRNA *brna)
        
        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");
+       RNA_def_property_ui_text(prop, "Specular 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);
+       prop= RNA_def_property(srna, "map_diffuse", 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");
+       RNA_def_property_ui_text(prop, "Diffuse", "Causes the texture to affect the value of the materials diffuse reflectivity");
        
-       prop= RNA_def_property(srna, "map_specularity", PROP_BOOLEAN, PROP_NONE);
+       prop= RNA_def_property(srna, "map_specular", 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");
+       RNA_def_property_ui_text(prop, "Specular", "Causes the texture to affect the value of specular reflectivity");
        
        prop= RNA_def_property(srna, "map_ambient", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_AMB);
@@ -336,21 +336,91 @@ static void rna_def_material_mtex(BlenderRNA *brna)
 
        /* XXX: MTex.k */
 
-       prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_VECTOR);
+       prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "dispfac");
-       RNA_def_property_range(prop, 0, 1);
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Displacement Factor", "Amount texture displaces the surface.");
 
-       prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_VECTOR);
+       prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "warpfac");
-       RNA_def_property_range(prop, 0, 1);
-       RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects color values.");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects texture coordinates of next channels.");
+
+       prop= RNA_def_property(srna, "colorspec_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Specular Color Factor", "Amount texture affects specular color.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "colordiff_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "mirror_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Mirror Factor", "Amount texture affects mirror color.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Diffuse Factor", "Amount texture affects diffuse reflectivity.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Specular Factor", "Amount texture affects specular reflectivity.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Emit Factor", "Amount texture affects emission.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Hardness Factor", "Amount texture affects hardness.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Ray Mirror Factor", "Amount texture affects ray mirror.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Translucency Factor", "Amount texture affects translucency.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_MaterialTextureSlot_enabled_get", "rna_MaterialTextureSlot_enabled_set");
        RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
+       /*prop= RNA_def_property(srna, "new_bump", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEW_BUMP);
+       RNA_def_property_ui_text(prop, "New Bump", "Use new, corrected bump mapping code (backwards compatibility option).");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);*/
 }
 
 static void rna_def_material_colors(StructRNA *srna)
@@ -784,13 +854,13 @@ static void rna_def_material_sss(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "sss_colfac");
-       RNA_def_property_range(prop, 0, 1);
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
        prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "sss_texfac");
-       RNA_def_property_range(prop, 0, 1);
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
index 9ba98d766cc88e6ee1337d7aef0401c39e74c5ee..2573ad8394aed73fb2bee573c9e6d74ac5c25d3a 100644 (file)
@@ -41,6 +41,8 @@
 
 #ifdef RNA_RUNTIME
 
+#include "BKE_texture.h"
+
 StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
 {
        Tex *tex= (Tex*)ptr->data;
@@ -97,6 +99,17 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
                strcpy(str, "");
 }
 
+static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value)
+{
+       Tex *tex= (Tex*)ptr->data;
+
+       if(value) tex->flag |= TEX_COLORBAND;
+       else tex->flag &= ~TEX_COLORBAND;
+
+       if((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
+               tex->coba= add_colorband(0);
+}
+
 #else
 
 static void rna_def_color_ramp_element(BlenderRNA *brna)
@@ -277,25 +290,19 @@ static void rna_def_mtex(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_VECTOR);
        RNA_def_property_float_sdna(prop, NULL, "def_var");
-       RNA_def_property_range(prop, 0, 1);
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Default Value", "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard.");
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
        
        prop= RNA_def_property(srna, "variable_factor", PROP_FLOAT, PROP_VECTOR);
        RNA_def_property_float_sdna(prop, NULL, "varfac");
-       RNA_def_property_range(prop, 0, 1);
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Variable Factor", "Amount texture affects other values.");
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
        
-       prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_VECTOR);
-       RNA_def_property_float_sdna(prop, NULL, "colfac");
-       RNA_def_property_range(prop, 0, 1);
-       RNA_def_property_ui_text(prop, "Color Factor", "Amount texture affects color values.");
-       RNA_def_property_update(prop, NC_TEXTURE, NULL);
-
        prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VECTOR);
        RNA_def_property_float_sdna(prop, NULL, "norfac");
-       RNA_def_property_range(prop, 0, 25);
+       RNA_def_property_ui_range(prop, 0, 5, 10, 3);
        RNA_def_property_ui_text(prop, "Normal Factor", "Amount texture affects normal values.");
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
 }
@@ -744,6 +751,7 @@ static void rna_def_texture_image(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "mipmap", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
+       //RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
        RNA_def_property_ui_text(prop, "MIP Map", "Uses auto-generated MIP maps for the image");
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
@@ -1120,7 +1128,7 @@ static void rna_def_texture(BlenderRNA *brna)
                {TEX_BLEND, "BLEND", 0, "Blend", ""},
                {TEX_STUCCI, "STUCCI", 0, "Stucci", ""},
                {TEX_NOISE, "NOISE", 0, "Noise", ""},
-               {TEX_IMAGE, "IMAGE", 0, "Image/Movie", ""},
+               {TEX_IMAGE, "IMAGE", 0, "Image or Movie", ""},
                {TEX_PLUGIN, "PLUGIN", 0, "Plugin", ""},
                {TEX_ENVMAP, "ENVIRONMENT_MAP", 0, "Environment Map", ""},
                {TEX_MUSGRAVE, "MUSGRAVE", 0, "Musgrave", ""},
@@ -1139,6 +1147,12 @@ static void rna_def_texture(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Type", "");
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
+       prop= RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND);
+       RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set");
+       RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
        prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_pointer_sdna(prop, NULL, "coba");
        RNA_def_property_struct_type(prop, "ColorRamp");
index b88a2d50d7e7f58a79aee5195eeabbb74e23d47f..67ade9998ed18647af79eb9300950187b4a81a1e 100644 (file)
@@ -286,6 +286,11 @@ void RNA_api_ui_layout(StructRNA *srna)
 
        func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
        RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+       func= RNA_def_function(srna, "template_texture_image", "uiTemplateTextureImage");
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+       parm= RNA_def_pointer(func, "texture", "Texture", "", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
 #endif
index b40f3de43ef453068e02c54d6eb020c82d3ab86b..c3032326a3dbf8d4693ab232ec2e29c06aed4041 100644 (file)
@@ -117,18 +117,22 @@ static void rna_def_world_mtex(BlenderRNA *brna)
        prop= RNA_def_property(srna, "map_blend", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_BLEND);
        RNA_def_property_ui_text(prop, "Blend", "Affect the color progression of the background.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        prop= RNA_def_property(srna, "map_horizon", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_HORIZ);
        RNA_def_property_ui_text(prop, "Horizon", "Affect the color of the horizon.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        prop= RNA_def_property(srna, "map_zenith_up", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENUP);
        RNA_def_property_ui_text(prop, "Zenith Up", "Affect the color of the zenith above.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        prop= RNA_def_property(srna, "map_zenith_down", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENDOWN);
        RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        /* unused
        prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE);
@@ -139,12 +143,38 @@ static void rna_def_world_mtex(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "texco");
        RNA_def_property_enum_items(prop, texco_items);
        RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
        prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "object");
        RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "varfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Blend Factor", "Amount texture affects color progression of the background.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "horizon_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Horizon Factor", "Amount texture affects color of the horizon.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "zenith_up_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Zenith Up Factor", "Amount texture affects color of the zenith above.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "zenith_down_factor", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "colfac");
+       RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+       RNA_def_property_ui_text(prop, "Zenith Down Factor", "Amount texture affects color of the zenith below.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
 }
 
 static void rna_def_ambient_occlusion(BlenderRNA *brna)