diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-06-24 14:29:26 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-06-24 14:29:26 +0400 |
commit | 1f7ae143a29b090ed97cdd7eb47a9c2dbd7f72a2 (patch) | |
tree | fff560080a8bbf37ee087653df1b8a30173537b1 /source/blender/makesrna/intern/rna_color.c | |
parent | d38ba6b5d25ca42f76b6d1b746217a565f26228f (diff) | |
parent | 74c9c24d273863319a55c18234e03b7d27a43a87 (diff) |
Merged changes in the trunk up to revision 48227.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_file/filelist.c
Diffstat (limited to 'source/blender/makesrna/intern/rna_color.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 1596e4573ab..315eaaac20e 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -136,6 +136,8 @@ static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float * static char *rna_ColorRamp_path(PointerRNA *ptr) { + char *path = NULL; + /* handle the cases where a single datablock may have 2 ramp types */ if (ptr->id.data) { ID *id = ptr->id.data; @@ -146,11 +148,39 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) Material *ma = (Material *)id; if (ptr->data == ma->ramp_col) - return BLI_strdup("diffuse_ramp"); + path = BLI_strdup("diffuse_ramp"); else if (ptr->data == ma->ramp_spec) - return BLI_strdup("specular_ramp"); + path = BLI_strdup("specular_ramp"); + break; } - break; + + case ID_NT: + { + bNodeTree *ntree = (bNodeTree *)id; + bNode *node; + PointerRNA node_ptr; + char *node_path; + + for (node = ntree->nodes.first; node; node = node->next) { + if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { + if (node->storage == ptr->data) { + /* all node color ramp properties called 'color_ramp' + * prepend path from ID to the node + */ + RNA_pointer_create(id, &RNA_Node, node, &node_ptr); + node_path = RNA_path_from_ID_to_struct(&node_ptr); + path = BLI_sprintfN("%s.color_ramp", node_path); + MEM_freeN(node_path); + } + } + } + break; + } + + default: + /* everything else just uses 'color_ramp' */ + path = BLI_strdup("color_ramp"); + break; case ID_LS: { @@ -161,9 +191,12 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) break; } } + else { + /* everything else just uses 'color_ramp' */ + path = BLI_strdup("color_ramp"); + } - /* everything else just uses 'color_ramp' */ - return BLI_strdup("color_ramp"); + return path; } static char *rna_ColorRampElement_path(PointerRNA *ptr) @@ -213,7 +246,6 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) } break; - /* TODO: node trees need special attention */ case ID_NT: { bNodeTree *ntree = (bNodeTree *)id; |