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:
authorOmarSquircleArt <omar.squircleart@gmail.com>2019-09-17 22:54:09 +0300
committerOmarSquircleArt <omar.squircleart@gmail.com>2019-09-17 22:54:09 +0300
commit9609840b5ea1f8ef1ae9ad39423223d465a4594a (patch)
tree9901ac726e4855ce22096a1c5b8da51848a55736 /source/blender/blenloader/intern/versioning_cycles.c
parente13a2cde28d715f6ff501d46b0f8b4ab37b95603 (diff)
Fix T69989: Correct Mapping node min/max versioning.
The old min/max options specified the target min/max values, they didn't act as min/max operators. So the versioning code should be adjusted accordingly. Reviewers: brecht Differential Revision: https://developer.blender.org/D5828
Diffstat (limited to 'source/blender/blenloader/intern/versioning_cycles.c')
-rw-r--r--source/blender/blenloader/intern/versioning_cycles.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c
index 52d62725ef8..3325484e9a0 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -813,10 +813,10 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
copy_v3_v3(cycles_node_socket_vector_value(sockScale), mapping->size);
bNode *maximumNode = NULL;
- if (mapping->flag & TEXMAP_CLIP_MAX) {
+ if (mapping->flag & TEXMAP_CLIP_MIN) {
maximumNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
maximumNode->custom1 = NODE_VECTOR_MATH_MAXIMUM;
- if (mapping->flag & TEXMAP_CLIP_MIN) {
+ if (mapping->flag & TEXMAP_CLIP_MAX) {
maximumNode->locx = node->locx + (node->width + 20.0f) * 2.0f;
}
else {
@@ -824,7 +824,7 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
}
maximumNode->locy = node->locy;
bNodeSocket *sockMaximumB = BLI_findlink(&maximumNode->inputs, 1);
- copy_v3_v3(cycles_node_socket_vector_value(sockMaximumB), mapping->max);
+ copy_v3_v3(cycles_node_socket_vector_value(sockMaximumB), mapping->min);
bNodeSocket *sockMappingResult = nodeFindSocket(node, SOCK_OUT, "Vector");
LISTBASE_FOREACH_BACKWARD_MUTABLE (bNodeLink *, link, &ntree->links) {
@@ -834,7 +834,7 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
nodeRemLink(ntree, link);
}
}
- if (!(mapping->flag & TEXMAP_CLIP_MIN)) {
+ if (!(mapping->flag & TEXMAP_CLIP_MAX)) {
bNodeSocket *sockMaximumA = BLI_findlink(&maximumNode->inputs, 0);
nodeAddLink(ntree, node, sockMappingResult, maximumNode, sockMaximumA);
}
@@ -843,13 +843,13 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
}
bNode *minimumNode = NULL;
- if (mapping->flag & TEXMAP_CLIP_MIN) {
+ if (mapping->flag & TEXMAP_CLIP_MAX) {
minimumNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
minimumNode->custom1 = NODE_VECTOR_MATH_MINIMUM;
minimumNode->locx = node->locx + node->width + 20.0f;
minimumNode->locy = node->locy;
bNodeSocket *sockMinimumB = BLI_findlink(&minimumNode->inputs, 1);
- copy_v3_v3(cycles_node_socket_vector_value(sockMinimumB), mapping->min);
+ copy_v3_v3(cycles_node_socket_vector_value(sockMinimumB), mapping->max);
bNodeSocket *sockMinimumResult = nodeFindSocket(minimumNode, SOCK_OUT, "Vector");
bNodeSocket *sockMappingResult = nodeFindSocket(node, SOCK_OUT, "Vector");
@@ -878,7 +878,6 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
AnimData *animData = BKE_animdata_from_id(&ntree->id);
if (animData && animData->action) {
char *nodePath = BLI_sprintfN("nodes[\"%s\"]", node->name);
-
for (FCurve *fcu = animData->action->curves.first; fcu; fcu = fcu->next) {
if (STRPREFIX(fcu->rna_path, nodePath) &&
!BLI_str_endswith(fcu->rna_path, "default_value")) {
@@ -893,11 +892,11 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
else if (BLI_str_endswith(old_fcu_rna_path, "scale")) {
fcu->rna_path = BLI_sprintfN("%s.%s", nodePath, "inputs[3].default_value");
}
- else if (minimumNode && BLI_str_endswith(old_fcu_rna_path, "min")) {
+ else if (minimumNode && BLI_str_endswith(old_fcu_rna_path, "max")) {
fcu->rna_path = BLI_sprintfN(
"nodes[\"%s\"].%s", minimumNode->name, "inputs[1].default_value");
}
- else if (maximumNode && BLI_str_endswith(old_fcu_rna_path, "max")) {
+ else if (maximumNode && BLI_str_endswith(old_fcu_rna_path, "min")) {
fcu->rna_path = BLI_sprintfN(
"nodes[\"%s\"].%s", maximumNode->name, "inputs[1].default_value");
}