2.5: Texture Buttons

* 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.
This commit is contained in:
Brecht Van Lommel 2009-07-21 12:57:55 +00:00
parent 7284eb6d91
commit e56287bfc9
13 changed files with 377 additions and 169 deletions

@ -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,89 +157,76 @@ 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 = 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="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.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")
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.itemR(tex, "default_value", text="DVar", slider=True)
factor_but(row, tex.map_color, "map_color", "color_factor", "Color")
factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
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")
split = layout.split()
col = split.column()
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, "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_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")
col = split.column()
col.itemR(tex, "normal_factor", text="Nor", slider=True)
col.itemR(tex, "variable_factor", text="Var", slider=True)
layout.itemS()
split = layout.split()
col = split.column()
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="")
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)
row = layout.row()
row.itemR(tex, "stencil")
row.itemR(tex, "negate", text="Negative")
class TEXTURE_PT_colors(TextureButtonsPanel):
__idname__= "TEXTURE_PT_colors"
__label__ = "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,7 @@ 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
@ -387,25 +385,65 @@ class TEXTURE_PT_image(TextureButtonsPanel):
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
return (tex and tex.type == 'IMAGE')
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")
sub.itemL(text="Filter:")
sub.itemR(tex, "mipmap")
sub.itemR(tex, "mipmap_gauss")
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 slot:
row = sub.row()
row.active = tex.normal_map
row.itemR(slot, "normal_map_space", text="")
"""
class TEXTURE_PT_crop(TextureButtonsPanel):
__idname__= "TEXTURE_PT_crop"
__label__ = "Crop"
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")
row = sub.row()
row.itemR(tex, "mipmap_gauss", text="Gauss")
row.active = tex.mipmap
sub.itemR(tex, "interpolation")
"""
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_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)

@ -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;

@ -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(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(ma->pr_texture == MA_PR_MATERIAL)
pid= parent;
else if(ma->pr_texture == MA_PR_BOTH)
pparent= parent;
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);
}
}

@ -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)

@ -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;

@ -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

@ -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 */

@ -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;

@ -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)

@ -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);

@ -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");

@ -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

@ -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)