Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-21 16:57:55 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-21 16:57:55 +0400
commite56287bfc900ec80f97ad281d54bb8c315db5af4 (patch)
treea26082a04964be3b3ae5cb3c6af98312712a3a4e /source
parent7284eb6d9119f70766242f490a0dc841e01cc585 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface_templates.c52
-rw-r--r--source/blender/editors/interface/interface_utils.c11
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h3
-rw-r--r--source/blender/makesdna/DNA_material_types.h6
-rw-r--r--source/blender/makesdna/DNA_texture_types.h5
-rw-r--r--source/blender/makesdna/DNA_world_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c14
-rw-r--r--source/blender/makesrna/intern/rna_material.c100
-rw-r--r--source/blender/makesrna/intern/rna_texture.c34
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c5
-rw-r--r--source/blender/makesrna/intern/rna_world.c30
12 files changed, 214 insertions, 49 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f6774d6ac92..b40f90dcf0c 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -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;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 24009819f45..f8d1e1d7ab9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -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);
+ }
+}
+
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 4df8641b455..5c10c69d1c1 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -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)
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index c6a1a2b45e2..a1059038777 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -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;
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index fd73d371d87..a2ead6fc33d 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -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
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index f37d9eca282..6b7bfbdcd83 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -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 */
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index b6e387fbede..31f0727cf73 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -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;
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index bbe3b1dedb3..fe14870cf6f 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -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)
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index c8ee0479f61..6686d43d075 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -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);
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 9ba98d766cc..2573ad8394a 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -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");
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index b88a2d50d7e..67ade9998ed 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -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
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index b40f3de43ef..c3032326a3d 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -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)