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
diff options
context:
space:
mode:
authorRobin Allen <roblovski@gmail.com>2009-08-18 23:58:27 +0400
committerRobin Allen <roblovski@gmail.com>2009-08-18 23:58:27 +0400
commitc9795eae45c278460e27ae7f5937ca9bd1300531 (patch)
tree75bd82c4d4ce4dc6ac37899915635b9c576ce5b2 /source/blender/makesrna
parent7d812822bd9c522efc0730a4f219ccec9cfb4a57 (diff)
Fixed the texture preview to work with multi-output node-based textures.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_texture.c32
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c1
2 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 76cb9986306..a5737536b7d 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -110,6 +110,30 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
strcpy(str, "");
}
+static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
+{
+ MTex *mtex= ptr->data;
+ Tex *tex= mtex->tex;
+ int cur= mtex->which_output;
+
+ if(tex) {
+ bNodeTree *ntree= tex->nodetree;
+ bNode *node;
+ if(ntree) {
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->type == TEX_NODE_OUTPUT) {
+ if(cur == node->custom1)
+ return cur;
+ }
+ }
+ }
+ }
+
+ mtex->which_output= 0;
+ return 0;
+}
+
+
static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, int *free)
{
MTex *mtex= ptr->data;
@@ -117,11 +141,9 @@ static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerR
EnumPropertyItem *item= NULL;
int totitem= 0;
- if(tex)
- {
+ if(tex) {
bNodeTree *ntree= tex->nodetree;
- if(ntree)
- {
+ if(ntree) {
EnumPropertyItem tmp= {0, "", 0, "", ""};
bNode *node;
@@ -433,7 +455,7 @@ static void rna_def_mtex(BlenderRNA *brna)
prop= RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "which_output");
RNA_def_property_enum_items(prop, output_node_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TextureSlot_output_node_itemf");
+ RNA_def_property_enum_funcs(prop, "rna_TextureSlot_output_node_get", NULL, "rna_TextureSlot_output_node_itemf");
RNA_def_property_ui_text(prop, "Output Node", "Which output node to use, for node-based textures.");
RNA_def_property_update(prop, NC_TEXTURE, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index f9287bddc10..82694098e69 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -244,6 +244,7 @@ void RNA_api_ui_layout(StructRNA *srna)
parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "parent", "ID", "", "ID datablock.");
+ parm= RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot.");
func= RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
parm= RNA_def_pointer(func, "curvemap", "CurveMapping", "", "Curve mapping pointer.");