Compositor: Remove Vector Curves node
This patch removes the Vector Curves node that was deprecated in 4.5 and was planned for removal in 5.0. The common Shading Vector Curves node should be used instead. Pull Request: https://projects.blender.org/blender/blender/pulls/140529
This commit is contained in:
@@ -153,7 +153,7 @@
|
||||
#define CMP_NODE_VALTORGB_DEPRECATED 205
|
||||
#define CMP_NODE_RGBTOBW 206
|
||||
#define CMP_NODE_NORMAL 207
|
||||
#define CMP_NODE_CURVE_VEC 208
|
||||
#define CMP_NODE_CURVE_VEC_DEPRECATED 208
|
||||
#define CMP_NODE_CURVE_RGB 209
|
||||
#define CMP_NODE_ALPHAOVER 210
|
||||
#define CMP_NODE_BLUR 211
|
||||
|
||||
@@ -808,7 +808,7 @@ static void node_blend_write_storage(BlendWriter *writer, bNodeTree *ntree, bNod
|
||||
SH_NODE_CURVE_RGB,
|
||||
SH_NODE_CURVE_FLOAT,
|
||||
CMP_NODE_TIME,
|
||||
CMP_NODE_CURVE_VEC,
|
||||
CMP_NODE_CURVE_VEC_DEPRECATED,
|
||||
CMP_NODE_CURVE_RGB,
|
||||
CMP_NODE_HUECORRECT,
|
||||
TEX_NODE_CURVE_RGB,
|
||||
@@ -1458,7 +1458,7 @@ static void node_blend_read_data_storage(BlendDataReader *reader, bNodeTree *ntr
|
||||
case SH_NODE_CURVE_RGB:
|
||||
case SH_NODE_CURVE_FLOAT:
|
||||
case CMP_NODE_TIME:
|
||||
case CMP_NODE_CURVE_VEC:
|
||||
case CMP_NODE_CURVE_VEC_DEPRECATED:
|
||||
case CMP_NODE_CURVE_RGB:
|
||||
case CMP_NODE_HUECORRECT:
|
||||
case TEX_NODE_CURVE_RGB:
|
||||
|
||||
@@ -639,7 +639,7 @@ static const char *node_get_static_idname(int type, int treetype)
|
||||
return "CompositorNodeRGBToBW";
|
||||
case CMP_NODE_NORMAL:
|
||||
return "CompositorNodeNormal";
|
||||
case CMP_NODE_CURVE_VEC:
|
||||
case CMP_NODE_CURVE_VEC_DEPRECATED:
|
||||
return "CompositorNodeCurveVec";
|
||||
case CMP_NODE_CURVE_RGB:
|
||||
return "CompositorNodeCurveRGB";
|
||||
|
||||
@@ -821,7 +821,7 @@ static void do_version_curvemapping_walker(Main *bmain, void (*callback)(CurveMa
|
||||
if (ELEM(node->type_legacy,
|
||||
SH_NODE_CURVE_VEC,
|
||||
SH_NODE_CURVE_RGB,
|
||||
CMP_NODE_CURVE_VEC,
|
||||
CMP_NODE_CURVE_VEC_DEPRECATED,
|
||||
CMP_NODE_CURVE_RGB,
|
||||
CMP_NODE_TIME,
|
||||
CMP_NODE_HUECORRECT,
|
||||
|
||||
@@ -207,7 +207,7 @@ static void do_version_convert_to_generic_nodes(bNodeTree *node_tree)
|
||||
node->type_legacy = SH_NODE_SEPXYZ;
|
||||
STRNCPY(node->idname, "ShaderNodeSeparateXYZ");
|
||||
break;
|
||||
case CMP_NODE_CURVE_VEC:
|
||||
case CMP_NODE_CURVE_VEC_DEPRECATED:
|
||||
node->type_legacy = SH_NODE_CURVE_VEC;
|
||||
STRNCPY(node->idname, "ShaderNodeVectorCurve");
|
||||
break;
|
||||
|
||||
@@ -10639,7 +10639,6 @@ static void rna_def_nodes(BlenderRNA *brna)
|
||||
define("CompositorNode", "CompositorNodeCryptomatte", def_cmp_cryptomatte_legacy);
|
||||
define("CompositorNode", "CompositorNodeCryptomatteV2", def_cmp_cryptomatte);
|
||||
define("CompositorNode", "CompositorNodeCurveRGB", def_rgb_curve);
|
||||
define("CompositorNode", "CompositorNodeCurveVec", def_vector_curve);
|
||||
define("CompositorNode", "CompositorNodeDBlur");
|
||||
define("CompositorNode", "CompositorNodeDefocus", def_cmp_defocus);
|
||||
define("CompositorNode", "CompositorNodeDenoise", def_cmp_denoise);
|
||||
|
||||
@@ -125,116 +125,6 @@ static void register_node_type_cmp_curve_time()
|
||||
}
|
||||
NOD_REGISTER_NODE(register_node_type_cmp_curve_time)
|
||||
|
||||
/* **************** CURVE VEC ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_vector_curves_cc {
|
||||
|
||||
static void cmp_node_curve_vec_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Vector>("Vector")
|
||||
.default_value({0.0f, 0.0f, 0.0f})
|
||||
.min(-1.0f)
|
||||
.max(1.0f)
|
||||
.compositor_domain_priority(0);
|
||||
b.add_output<decl::Vector>("Vector");
|
||||
}
|
||||
|
||||
static void node_composit_init_curve_vec(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
static void node_buts_curvevec(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
static CurveMapping *get_curve_mapping(const bNode &node)
|
||||
{
|
||||
return static_cast<CurveMapping *>(node.storage);
|
||||
}
|
||||
|
||||
static int node_gpu_material(GPUMaterial *material,
|
||||
bNode *node,
|
||||
bNodeExecData * /*execdata*/,
|
||||
GPUNodeStack *inputs,
|
||||
GPUNodeStack *outputs)
|
||||
{
|
||||
CurveMapping *curve_mapping = get_curve_mapping(*node);
|
||||
|
||||
BKE_curvemapping_init(curve_mapping);
|
||||
float *band_values;
|
||||
int band_size;
|
||||
BKE_curvemapping_table_RGBA(curve_mapping, &band_values, &band_size);
|
||||
float band_layer;
|
||||
GPUNodeLink *band_texture = GPU_color_band(material, band_size, band_values, &band_layer);
|
||||
|
||||
float start_slopes[CM_TOT];
|
||||
float end_slopes[CM_TOT];
|
||||
BKE_curvemapping_compute_slopes(curve_mapping, start_slopes, end_slopes);
|
||||
float range_minimums[CM_TOT];
|
||||
BKE_curvemapping_get_range_minimums(curve_mapping, range_minimums);
|
||||
float range_dividers[CM_TOT];
|
||||
BKE_curvemapping_compute_range_dividers(curve_mapping, range_dividers);
|
||||
|
||||
return GPU_stack_link(material,
|
||||
node,
|
||||
"curves_vector",
|
||||
inputs,
|
||||
outputs,
|
||||
band_texture,
|
||||
GPU_constant(&band_layer),
|
||||
GPU_uniform(range_minimums),
|
||||
GPU_uniform(range_dividers),
|
||||
GPU_uniform(start_slopes),
|
||||
GPU_uniform(end_slopes));
|
||||
}
|
||||
|
||||
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
CurveMapping *curve_mapping = get_curve_mapping(builder.node());
|
||||
BKE_curvemapping_init(curve_mapping);
|
||||
|
||||
builder.construct_and_set_matching_fn_cb([=]() {
|
||||
return mf::build::SI1_SO<float3, float3>(
|
||||
"Vector Curves",
|
||||
[=](const float3 &vector) -> float3 {
|
||||
float3 output_vector = float3(0.0f);
|
||||
BKE_curvemapping_evaluate3F(curve_mapping, output_vector, vector);
|
||||
return output_vector;
|
||||
},
|
||||
mf::build::exec_presets::AllSpanOrSingle());
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::node_composite_vector_curves_cc
|
||||
|
||||
static void register_node_type_cmp_curve_vec()
|
||||
{
|
||||
namespace file_ns = blender::nodes::node_composite_vector_curves_cc;
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, "CompositorNodeCurveVec", CMP_NODE_CURVE_VEC);
|
||||
ntype.ui_name = "Vector Curves";
|
||||
ntype.ui_description = "Map input vector components with curves";
|
||||
ntype.enum_name_legacy = "CURVE_VEC";
|
||||
ntype.nclass = NODE_CLASS_OP_VECTOR;
|
||||
ntype.declare = file_ns::cmp_node_curve_vec_declare;
|
||||
ntype.draw_buttons = file_ns::node_buts_curvevec;
|
||||
blender::bke::node_type_size(ntype, 200, 140, 320);
|
||||
ntype.initfunc = file_ns::node_composit_init_curve_vec;
|
||||
blender::bke::node_type_storage(ntype, "CurveMapping", node_free_curves, node_copy_curves);
|
||||
ntype.gpu_fn = file_ns::node_gpu_material;
|
||||
ntype.build_multi_function = file_ns::node_build_multi_function;
|
||||
ntype.gather_link_search_ops = nullptr;
|
||||
|
||||
blender::bke::node_register_type(ntype);
|
||||
}
|
||||
NOD_REGISTER_NODE(register_node_type_cmp_curve_vec)
|
||||
|
||||
/* **************** CURVE RGB ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_rgb_curves_cc {
|
||||
|
||||
Reference in New Issue
Block a user