From c81e6ffdf942a7e8ac58ef3a48ca1bcab78f01fd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 15 Dec 2015 16:23:33 +0500 Subject: Fix T46915: Non-intuitive behavior of Vector Curve Mapping node Vector mapping node was doing some weird mapping of both original and mapped coordinates. Mapping of original coordinates was caused by the clamping nature of the LUT generated from the node. Mapping of the mapped value again was quite totally obscure -- one needed to constantly keep in mind that actual value will be scaled up and moved down. This commit makes it so values in the vector curve mapping are always absolute. In fact, it is now behaving quite the same as RGB curve mapping node and the code could be de-duplicated. Keeping the code duplicated for a bit so it's more clear what exact parts of the node changed. Reviewers: brecht Subscribers: bassamk Differential Revision: https://developer.blender.org/D1672 --- intern/cycles/blender/blender_shader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'intern/cycles/blender/blender_shader.cpp') diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 74dee206c0e..2b4d0e4af9c 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -231,8 +231,13 @@ static ShaderNode *add_node(Scene *scene, } if(b_node.is_a(&RNA_ShaderNodeVectorCurve)) { BL::ShaderNodeVectorCurve b_curve_node(b_node); + BL::CurveMapping mapping(b_curve_node.mapping()); VectorCurvesNode *curves = new VectorCurvesNode(); - curvemapping_color_to_array(b_curve_node.mapping(), curves->curves, RAMP_TABLE_SIZE, false); + curvemapping_color_to_array(mapping, + curves->curves, + RAMP_TABLE_SIZE, + false); + curvemapping_minmax(mapping, false, &curves->min_x, &curves->max_x); node = curves; } else if(b_node.is_a(&RNA_ShaderNodeValToRGB)) { -- cgit v1.2.3