forked from bartvdbraak/blender
2.5
* Some changes to make lamp and world textures editing work. You may have to click on another texture slot once before being able to add a texture, and the layout is messy. Added this so lightenv project isn't blocked by this being missing. * Adding a new material slot now doesn't create a new material anymore, to avoid creating unused materials. * Tiny changes to scene/object buttons.
This commit is contained in:
parent
4df1836325
commit
d4504aa891
@ -161,7 +161,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
|
||||
sub.itemR(ob, "time_offset", text="Offset")
|
||||
|
||||
sub = split.column()
|
||||
sub.itemL(text="Tracking:")
|
||||
sub.itemL(text="Track:")
|
||||
sub.itemR(ob, "track", text="")
|
||||
sub.itemR(ob, "track_axis", text="Axis")
|
||||
sub.itemR(ob, "up_axis", text="Up Axis")
|
||||
|
@ -111,11 +111,12 @@ class RENDER_PT_shading(RenderButtonsPanel):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.itemR(rd, "render_textures", text="Textures")
|
||||
col.itemR(rd, "render_shadows", text="Shadows")
|
||||
col.itemR(rd, "render_sss", text="Subsurface Scattering")
|
||||
col.itemR(rd, "render_envmaps", text="Environment Map")
|
||||
|
||||
col = split.column()
|
||||
col.itemR(rd, "render_envmaps", text="Environment Map")
|
||||
col.itemR(rd, "render_raytracing", text="Ray Tracing")
|
||||
col.itemR(rd, "alpha_mode", text="Alpha")
|
||||
|
||||
|
@ -81,6 +81,9 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
ma = context.material
|
||||
la = context.lamp
|
||||
wo = context.world
|
||||
tex = context.texture_slot
|
||||
textype = context.texture
|
||||
|
||||
@ -104,16 +107,22 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
|
||||
col = split.column()
|
||||
col.itemR(tex, "mapping", text="")
|
||||
|
||||
split = layout.split()
|
||||
if ma:
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.itemR(tex, "from_dupli")
|
||||
col = split.column()
|
||||
if tex.texture_coordinates in ('ORCO', 'UV'):
|
||||
col.itemR(tex, "from_dupli")
|
||||
elif tex.texture_coordinates == 'OBJECT':
|
||||
col.itemR(tex, "from_original")
|
||||
else:
|
||||
col.itemL()
|
||||
|
||||
col = split.column()
|
||||
row = col.row()
|
||||
row.itemR(tex, "x_mapping", text="")
|
||||
row.itemR(tex, "y_mapping", text="")
|
||||
row.itemR(tex, "z_mapping", text="")
|
||||
col = split.column()
|
||||
row = col.row()
|
||||
row.itemR(tex, "x_mapping", text="")
|
||||
row.itemR(tex, "y_mapping", text="")
|
||||
row.itemR(tex, "z_mapping", text="")
|
||||
|
||||
row = layout.row()
|
||||
row.column().itemR(tex, "offset")
|
||||
@ -129,50 +138,89 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ma = context.material
|
||||
la = context.lamp
|
||||
wo = context.world
|
||||
textype = context.texture
|
||||
tex = context.texture_slot
|
||||
|
||||
split = layout.split()
|
||||
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 = 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")
|
||||
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)
|
||||
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)
|
||||
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()
|
||||
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, "normal_factor", text="Nor", slider=True)
|
||||
col.itemR(tex, "variable_factor", text="Var", slider=True)
|
||||
col.itemR(tex, "default_value", text="DVar", slider=True)
|
||||
|
||||
row = layout.row()
|
||||
row.itemR(tex, "stencil")
|
||||
|
@ -613,7 +613,8 @@ void assign_material(Object *ob, Material *ma, int act)
|
||||
(*matarar)[act-1]= ma;
|
||||
}
|
||||
|
||||
id_us_plus((ID *)ma);
|
||||
if(ma)
|
||||
id_us_plus((ID *)ma);
|
||||
test_object_materials(ob->data);
|
||||
}
|
||||
|
||||
@ -645,12 +646,6 @@ void object_add_material_slot(Object *ob)
|
||||
if(ob->totcol>=MAXMAT) return;
|
||||
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
if(ma==NULL)
|
||||
ma= add_material("Material");
|
||||
else
|
||||
ma= copy_material(ma);
|
||||
|
||||
ma->id.us= 0; /* eeh... */
|
||||
|
||||
assign_material(ob, ma, ob->totcol+1);
|
||||
ob->actcol= ob->totcol;
|
||||
|
@ -1301,13 +1301,14 @@ ListBase uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, Point
|
||||
CollectionPointerLink *link;
|
||||
PropertyRNA *prop= NULL, *activeprop;
|
||||
PropertyType type, activetype;
|
||||
StructRNA *ptype;
|
||||
uiLayout *box, *row, *col;
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
Panel *pa;
|
||||
ListBase lb;
|
||||
char *name, str[32];
|
||||
int i= 0, activei= 0, len, items, found, min, max;
|
||||
int icon=0, i= 0, activei= 0, len, items, found, min, max;
|
||||
|
||||
lb.first= lb.last= NULL;
|
||||
|
||||
@ -1351,6 +1352,12 @@ ListBase uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, Point
|
||||
return lb;
|
||||
}
|
||||
|
||||
/* get icon */
|
||||
if(ptr->data && prop) {
|
||||
ptype= RNA_property_pointer_type(ptr, prop);
|
||||
icon= RNA_struct_ui_icon(ptype);
|
||||
}
|
||||
|
||||
/* get active data */
|
||||
activei= RNA_property_int_get(activeptr, activeprop);
|
||||
|
||||
@ -1368,10 +1375,10 @@ ListBase uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, Point
|
||||
if(found) {
|
||||
/* create button */
|
||||
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
|
||||
if(name) {
|
||||
uiItemL(row, name, RNA_struct_ui_icon(itemptr.type));
|
||||
uiItemL(row, (name)? name: "", icon);
|
||||
|
||||
if(name)
|
||||
MEM_freeN(name);
|
||||
}
|
||||
|
||||
/* add to list to return */
|
||||
link= MEM_callocN(sizeof(CollectionPointerLink), "uiTemplateList return");
|
||||
@ -1423,13 +1430,12 @@ ListBase uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, Point
|
||||
if(i >= pa->list_scroll && i<pa->list_scroll+items) {
|
||||
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
|
||||
|
||||
if(name) {
|
||||
/* create button */
|
||||
but= uiDefIconTextButR(block, ROW, 0, RNA_struct_ui_icon(itemptr.type), name, 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
|
||||
uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
|
||||
/* create button */
|
||||
but= uiDefIconTextButR(block, ROW, 0, icon, (name)? name: "", 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
|
||||
uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
|
||||
|
||||
if(name)
|
||||
MEM_freeN(name);
|
||||
}
|
||||
|
||||
/* add to list to return */
|
||||
link= MEM_callocN(sizeof(CollectionPointerLink), "uiTemplateList return");
|
||||
|
@ -34,6 +34,10 @@
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_texture.h"
|
||||
|
||||
static void rna_Brush_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
Brush *brush= (Brush*)ptr->data;
|
||||
@ -46,6 +50,27 @@ static PointerRNA rna_Brush_active_texture_get(PointerRNA *ptr)
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, brush->mtex[(int)brush->texact]);
|
||||
}
|
||||
|
||||
static void rna_Brush_active_texture_index_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Brush *brush= (Brush*)ptr->data;
|
||||
int act= brush->texact;
|
||||
|
||||
if(value == act || value < 0 || value >= MAX_MTEX)
|
||||
return;
|
||||
|
||||
/* auto create/free mtex on activate/deactive, so we can edit
|
||||
* the texture pointer in the buttons UI. */
|
||||
if(brush->mtex[act] && !brush->mtex[act]->tex) {
|
||||
MEM_freeN(brush->mtex[act]);
|
||||
brush->mtex[act]= NULL;
|
||||
}
|
||||
|
||||
brush->texact= value;
|
||||
|
||||
if(!brush->mtex[value])
|
||||
brush->mtex[value]= add_mtex();
|
||||
}
|
||||
|
||||
static float rna_Brush_rotation_get(PointerRNA *ptr)
|
||||
{
|
||||
Brush *brush= (Brush*)ptr->data;
|
||||
@ -198,7 +223,7 @@ void rna_def_brush(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve.");
|
||||
|
||||
/* texture */
|
||||
rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get", "TextureSlot");
|
||||
rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get", "rna_Brush_active_texture_index_set", "TextureSlot");
|
||||
|
||||
/* clone tool */
|
||||
prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
|
||||
|
@ -169,7 +169,7 @@ void RNA_def_world(struct BlenderRNA *brna);
|
||||
void rna_def_animdata_common(struct StructRNA *srna);
|
||||
|
||||
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
|
||||
void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *structname);
|
||||
void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname);
|
||||
|
||||
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
|
||||
int rna_ID_name_length(struct PointerRNA *ptr);
|
||||
|
@ -37,6 +37,10 @@
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_texture.h"
|
||||
|
||||
static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Lamp *la= (Lamp*)ptr->data;
|
||||
@ -63,6 +67,29 @@ static PointerRNA rna_Lamp_active_texture_get(PointerRNA *ptr)
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, la->mtex[(int)la->texact]);
|
||||
}
|
||||
|
||||
static void rna_Lamp_active_texture_index_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Lamp *la= (Lamp*)ptr->data;
|
||||
int act= la->texact;
|
||||
|
||||
if(value == act || value < 0 || value >= MAX_MTEX)
|
||||
return;
|
||||
|
||||
/* auto create/free mtex on activate/deactive, so we can edit
|
||||
* the texture pointer in the buttons UI. */
|
||||
if(la->mtex[act] && !la->mtex[act]->tex) {
|
||||
MEM_freeN(la->mtex[act]);
|
||||
la->mtex[act]= NULL;
|
||||
}
|
||||
|
||||
la->texact= value;
|
||||
|
||||
if(!la->mtex[value]) {
|
||||
la->mtex[value]= add_mtex();
|
||||
la->mtex[value]->texco= TEXCO_GLOB;
|
||||
}
|
||||
}
|
||||
|
||||
static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
|
||||
{
|
||||
Lamp *la= (Lamp*)ptr->data;
|
||||
@ -111,13 +138,13 @@ static void rna_def_lamp_mtex(BlenderRNA *brna)
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates.");
|
||||
|
||||
prop= RNA_def_property(srna, "map_to_color", PROP_BOOLEAN, PROP_NONE);
|
||||
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, "Map To Color", "Lets the texture affect the basic color of the lamp.");
|
||||
RNA_def_property_ui_text(prop, "Color", "Lets the texture affect the basic color of the lamp.");
|
||||
|
||||
prop= RNA_def_property(srna, "map_to_shadow", PROP_BOOLEAN, PROP_NONE);
|
||||
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, "Map To Shadow", "Lets the texture affect the shadow color of the lamp.");
|
||||
RNA_def_property_ui_text(prop, "Shadow", "Lets the texture affect the shadow color of the lamp.");
|
||||
}
|
||||
|
||||
static void rna_def_lamp_sky_settings(BlenderRNA *brna)
|
||||
@ -308,7 +335,7 @@ static void rna_def_lamp(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
|
||||
/* textures */
|
||||
rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get", "LampTextureSlot");
|
||||
rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get", "rna_Lamp_active_texture_index_set", "LampTextureSlot");
|
||||
|
||||
/* script link */
|
||||
prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
|
||||
|
@ -37,6 +37,10 @@
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_texture.h"
|
||||
|
||||
static PointerRNA rna_Material_mirror_get(PointerRNA *ptr)
|
||||
{
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceMirror, ptr->id.data);
|
||||
@ -84,6 +88,27 @@ static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr)
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, ma->mtex[(int)ma->texact]);
|
||||
}
|
||||
|
||||
static void rna_Material_active_texture_index_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Material *ma= (Material*)ptr->data;
|
||||
int act= ma->texact;
|
||||
|
||||
if(value == act || value < 0 || value >= MAX_MTEX)
|
||||
return;
|
||||
|
||||
/* auto create/free mtex on activate/deactive, so we can edit
|
||||
* the texture pointer in the buttons UI. */
|
||||
if(ma->mtex[act] && !ma->mtex[act]->tex) {
|
||||
MEM_freeN(ma->mtex[act]);
|
||||
ma->mtex[act]= NULL;
|
||||
}
|
||||
|
||||
ma->texact= value;
|
||||
|
||||
if(!ma->mtex[value])
|
||||
ma->mtex[value]= add_mtex();
|
||||
}
|
||||
|
||||
static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max)
|
||||
{
|
||||
Material *ma= (Material*)ptr->id.data;
|
||||
@ -221,6 +246,10 @@ static void rna_def_material_mtex(BlenderRNA *brna)
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO);
|
||||
RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent (only for UV and Orco texture coordinates).");
|
||||
|
||||
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);
|
||||
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");
|
||||
@ -1116,7 +1145,7 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
|
||||
/* common */
|
||||
rna_def_animdata_common(srna);
|
||||
rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", "MaterialTextureSlot");
|
||||
rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", "rna_Material_active_texture_index_set", "MaterialTextureSlot");
|
||||
|
||||
prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "scriptlink");
|
||||
@ -1136,7 +1165,7 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
rna_def_material_strand(brna);
|
||||
}
|
||||
|
||||
void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeget, const char *structname)
|
||||
void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
@ -1154,6 +1183,7 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
|
||||
|
||||
prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "texact");
|
||||
RNA_def_property_int_funcs(prop, NULL, activeset, NULL);
|
||||
RNA_def_property_range(prop, 0, MAX_MTEX-1);
|
||||
RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot.");
|
||||
}
|
||||
|
@ -38,6 +38,10 @@
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_texture.h"
|
||||
|
||||
static PointerRNA rna_World_ambient_occlusion_get(PointerRNA *ptr)
|
||||
{
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_WorldAmbientOcclusion, ptr->id.data);
|
||||
@ -66,6 +70,29 @@ static PointerRNA rna_World_active_texture_get(PointerRNA *ptr)
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, wo->mtex[(int)wo->texact]);
|
||||
}
|
||||
|
||||
static void rna_World_active_texture_index_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
World *wo= (World*)ptr->data;
|
||||
int act= wo->texact;
|
||||
|
||||
if(value == act || value < 0 || value >= MAX_MTEX)
|
||||
return;
|
||||
|
||||
/* auto create/free mtex on activate/deactive, so we can edit
|
||||
* the texture pointer in the buttons UI. */
|
||||
if(wo->mtex[act] && !wo->mtex[act]->tex) {
|
||||
MEM_freeN(wo->mtex[act]);
|
||||
wo->mtex[act]= NULL;
|
||||
}
|
||||
|
||||
wo->texact= value;
|
||||
|
||||
if(!wo->mtex[value]) {
|
||||
wo->mtex[value]= add_mtex();
|
||||
wo->mtex[value]->texco= TEXCO_VIEW;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_world_mtex(BlenderRNA *brna)
|
||||
@ -87,26 +114,26 @@ static void rna_def_world_mtex(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_text(srna, "World Texture Slot", "Texture slot for textures in a World datablock.");
|
||||
|
||||
/* map to */
|
||||
prop= RNA_def_property(srna, "map_to_blend", PROP_BOOLEAN, PROP_NONE);
|
||||
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, "Map To Blend", "Affect the color progression of the background.");
|
||||
RNA_def_property_ui_text(prop, "Blend", "Affect the color progression of the background.");
|
||||
|
||||
prop= RNA_def_property(srna, "map_to_horizon", PROP_BOOLEAN, PROP_NONE);
|
||||
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, "Map To Horizon", "Affect the color of the horizon.");
|
||||
RNA_def_property_ui_text(prop, "Horizon", "Affect the color of the horizon.");
|
||||
|
||||
prop= RNA_def_property(srna, "map_to_zenith_up", PROP_BOOLEAN, PROP_NONE);
|
||||
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, "Map To Zenith Up", "Affect the color of the zenith above.");
|
||||
RNA_def_property_ui_text(prop, "Zenith Up", "Affect the color of the zenith above.");
|
||||
|
||||
prop= RNA_def_property(srna, "map_to_zenith_down", PROP_BOOLEAN, PROP_NONE);
|
||||
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, "Map To Zenith Down", "Affect the color of the zenith below.");
|
||||
RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below.");
|
||||
|
||||
/* unused
|
||||
prop= RNA_def_property(srna, "map_to_mist", PROP_BOOLEAN, PROP_NONE);
|
||||
prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_MIST);
|
||||
RNA_def_property_ui_text(prop, "Map To Mist", "Causes the texture to affect the intensity of the mist.");*/
|
||||
RNA_def_property_ui_text(prop, "Mist", "Causes the texture to affect the intensity of the mist.");*/
|
||||
|
||||
prop= RNA_def_property(srna, "texture_coordinates", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "texco");
|
||||
@ -348,7 +375,7 @@ void RNA_def_world(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
|
||||
|
||||
rna_def_animdata_common(srna);
|
||||
rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get", "WorldTextureSlot");
|
||||
rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get", "rna_World_active_texture_index_set", "WorldTextureSlot");
|
||||
|
||||
/* colors */
|
||||
prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
|
||||
|
Loading…
Reference in New Issue
Block a user