Nodes: Remove legacy combine/separate nodes

In Blender 3.3 (1) the individual combine and separate color nodes were
combined together into a single combine/separate color node.

To ensure legacy addons still worked, the old nodes were left in
Blender, but hidden from the Add menus.

It has been nearly 3 years since that change was made, most if not all
addons should have been updated by now. So this commit removes these
hidden legacy nodes.

(1) blender/blender@82df48227b

Pull Request: https://projects.blender.org/blender/blender/pulls/135376
This commit is contained in:
Alaska
2025-06-17 15:36:33 +02:00
committed by Brecht Van Lommel
parent ff8658b457
commit b561c78f93
37 changed files with 265 additions and 1790 deletions

View File

@@ -398,18 +398,6 @@ static ShaderNode *add_node(Scene *scene,
node = mix_node;
}
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateRGB)) {
node = graph->create_node<SeparateRGBNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeCombineRGB)) {
node = graph->create_node<CombineRGBNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateHSV)) {
node = graph->create_node<SeparateHSVNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeCombineHSV)) {
node = graph->create_node<CombineHSVNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateColor)) {
BL::ShaderNodeSeparateColor b_separate_node(b_node);
SeparateColorNode *separate_node = graph->create_node<SeparateColorNode>();

View File

@@ -210,7 +210,6 @@ set(SRC_KERNEL_SVM_HEADERS
svm/ramp.h
svm/ramp_util.h
svm/sepcomb_color.h
svm/sepcomb_hsv.h
svm/sepcomb_vector.h
svm/sky.h
svm/tex_coord.h

View File

@@ -17,8 +17,6 @@ set(SRC_OSL
node_checker_texture.osl
node_clamp.osl
node_combine_color.osl
node_combine_rgb.osl
node_combine_hsv.osl
node_combine_xyz.osl
node_convert_from_color.osl
node_convert_from_float.osl
@@ -77,8 +75,6 @@ set(SRC_OSL
node_rgb_curves.osl
node_rgb_ramp.osl
node_separate_color.osl
node_separate_rgb.osl
node_separate_hsv.osl
node_separate_xyz.osl
node_set_normal.osl
node_sheen_bsdf.osl

View File

@@ -1,10 +0,0 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "stdcycles.h"
shader node_combine_hsv(float H = 0.0, float S = 0.0, float V = 0.0, output color Color = 0.8)
{
Color = color("hsv", H, S, V);
}

View File

@@ -1,10 +0,0 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "stdcycles.h"
shader node_combine_rgb(float R = 0.0, float G = 0.0, float B = 0.0, output color Image = 0.8)
{
Image = color(R, G, B);
}

View File

@@ -1,18 +0,0 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "node_color.h"
#include "stdcycles.h"
shader node_separate_hsv(color Color = 0.8,
output float H = 0.0,
output float S = 0.0,
output float V = 0.0)
{
color col = rgb_to_hsv(Color);
H = col[0];
S = col[1];
V = col[2];
}

View File

@@ -1,15 +0,0 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "stdcycles.h"
shader node_separate_rgb(color Image = 0.8,
output float R = 0.0,
output float G = 0.0,
output float B = 0.0)
{
R = Image[0];
G = Image[1];
B = Image[2];
}

View File

@@ -1,63 +0,0 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#pragma once
#include "kernel/svm/util.h"
#include "util/color.h"
CCL_NAMESPACE_BEGIN
ccl_device_noinline int svm_node_combine_hsv(KernelGlobals kg,
ccl_private float *stack,
const uint hue_in,
const uint saturation_in,
const uint value_in,
int offset)
{
const uint4 node1 = read_node(kg, &offset);
const uint color_out = node1.y;
const float hue = stack_load_float(stack, hue_in);
const float saturation = stack_load_float(stack, saturation_in);
const float value = stack_load_float(stack, value_in);
/* Combine, and convert back to RGB */
const float3 color = hsv_to_rgb(make_float3(hue, saturation, value));
if (stack_valid(color_out)) {
stack_store_float3(stack, color_out, color);
}
return offset;
}
ccl_device_noinline int svm_node_separate_hsv(KernelGlobals kg,
ccl_private float *stack,
const uint color_in,
const uint hue_out,
const uint saturation_out,
int offset)
{
const uint4 node1 = read_node(kg, &offset);
const uint value_out = node1.y;
float3 color = stack_load_float3(stack, color_in);
/* Convert to HSV */
color = rgb_to_hsv(color);
if (stack_valid(hue_out)) {
stack_store_float(stack, hue_out, color.x);
}
if (stack_valid(saturation_out)) {
stack_store_float(stack, saturation_out, color.y);
}
if (stack_valid(value_out)) {
stack_store_float(stack, value_out, color.z);
}
return offset;
}
CCL_NAMESPACE_END

View File

@@ -64,7 +64,6 @@
#include "kernel/svm/normal.h"
#include "kernel/svm/ramp.h"
#include "kernel/svm/sepcomb_color.h"
#include "kernel/svm/sepcomb_hsv.h"
#include "kernel/svm/sepcomb_vector.h"
#include "kernel/svm/sky.h"
#include "kernel/svm/tex_coord.h"
@@ -423,12 +422,6 @@ ccl_device void svm_eval_nodes(KernelGlobals kg,
SVM_CASE(NODE_COMBINE_VECTOR)
svm_node_combine_vector(stack, node.y, node.z, node.w);
break;
SVM_CASE(NODE_SEPARATE_HSV)
offset = svm_node_separate_hsv(kg, stack, node.y, node.z, node.w, offset);
break;
SVM_CASE(NODE_COMBINE_HSV)
offset = svm_node_combine_hsv(kg, stack, node.y, node.z, node.w, offset);
break;
SVM_CASE(NODE_VECTOR_ROTATE)
svm_node_vector_rotate(stack, node.y, node.z, node.w);
break;

View File

@@ -5357,52 +5357,6 @@ void CombineColorNode::compile(OSLCompiler &compiler)
compiler.add(this, "node_combine_color");
}
/* Combine RGB */
NODE_DEFINE(CombineRGBNode)
{
NodeType *type = NodeType::add("combine_rgb", create, NodeType::SHADER);
SOCKET_IN_FLOAT(r, "R", 0.0f);
SOCKET_IN_FLOAT(g, "G", 0.0f);
SOCKET_IN_FLOAT(b, "B", 0.0f);
SOCKET_OUT_COLOR(image, "Image");
return type;
}
CombineRGBNode::CombineRGBNode() : ShaderNode(get_node_type()) {}
void CombineRGBNode::constant_fold(const ConstantFolder &folder)
{
if (folder.all_inputs_constant()) {
folder.make_constant(make_float3(r, g, b));
}
}
void CombineRGBNode::compile(SVMCompiler &compiler)
{
ShaderInput *red_in = input("R");
ShaderInput *green_in = input("G");
ShaderInput *blue_in = input("B");
ShaderOutput *color_out = output("Image");
compiler.add_node(
NODE_COMBINE_VECTOR, compiler.stack_assign(red_in), 0, compiler.stack_assign(color_out));
compiler.add_node(
NODE_COMBINE_VECTOR, compiler.stack_assign(green_in), 1, compiler.stack_assign(color_out));
compiler.add_node(
NODE_COMBINE_VECTOR, compiler.stack_assign(blue_in), 2, compiler.stack_assign(color_out));
}
void CombineRGBNode::compile(OSLCompiler &compiler)
{
compiler.add(this, "node_combine_rgb");
}
/* Combine XYZ */
NODE_DEFINE(CombineXYZNode)
@@ -5449,49 +5403,6 @@ void CombineXYZNode::compile(OSLCompiler &compiler)
compiler.add(this, "node_combine_xyz");
}
/* Combine HSV */
NODE_DEFINE(CombineHSVNode)
{
NodeType *type = NodeType::add("combine_hsv", create, NodeType::SHADER);
SOCKET_IN_FLOAT(h, "H", 0.0f);
SOCKET_IN_FLOAT(s, "S", 0.0f);
SOCKET_IN_FLOAT(v, "V", 0.0f);
SOCKET_OUT_COLOR(color, "Color");
return type;
}
CombineHSVNode::CombineHSVNode() : ShaderNode(get_node_type()) {}
void CombineHSVNode::constant_fold(const ConstantFolder &folder)
{
if (folder.all_inputs_constant()) {
folder.make_constant(hsv_to_rgb(make_float3(h, s, v)));
}
}
void CombineHSVNode::compile(SVMCompiler &compiler)
{
ShaderInput *hue_in = input("H");
ShaderInput *saturation_in = input("S");
ShaderInput *value_in = input("V");
ShaderOutput *color_out = output("Color");
compiler.add_node(NODE_COMBINE_HSV,
compiler.stack_assign(hue_in),
compiler.stack_assign(saturation_in),
compiler.stack_assign(value_in));
compiler.add_node(NODE_COMBINE_HSV, compiler.stack_assign(color_out));
}
void CombineHSVNode::compile(OSLCompiler &compiler)
{
compiler.add(this, "node_combine_hsv");
}
/* Gamma */
NODE_DEFINE(GammaNode)
@@ -5649,57 +5560,6 @@ void SeparateColorNode::compile(OSLCompiler &compiler)
compiler.add(this, "node_separate_color");
}
/* Separate RGB */
NODE_DEFINE(SeparateRGBNode)
{
NodeType *type = NodeType::add("separate_rgb", create, NodeType::SHADER);
SOCKET_IN_COLOR(color, "Image", zero_float3());
SOCKET_OUT_FLOAT(r, "R");
SOCKET_OUT_FLOAT(g, "G");
SOCKET_OUT_FLOAT(b, "B");
return type;
}
SeparateRGBNode::SeparateRGBNode() : ShaderNode(get_node_type()) {}
void SeparateRGBNode::constant_fold(const ConstantFolder &folder)
{
if (folder.all_inputs_constant()) {
for (int channel = 0; channel < 3; channel++) {
if (outputs[channel] == folder.output) {
folder.make_constant(color[channel]);
return;
}
}
}
}
void SeparateRGBNode::compile(SVMCompiler &compiler)
{
ShaderInput *color_in = input("Image");
ShaderOutput *red_out = output("R");
ShaderOutput *green_out = output("G");
ShaderOutput *blue_out = output("B");
compiler.add_node(
NODE_SEPARATE_VECTOR, compiler.stack_assign(color_in), 0, compiler.stack_assign(red_out));
compiler.add_node(
NODE_SEPARATE_VECTOR, compiler.stack_assign(color_in), 1, compiler.stack_assign(green_out));
compiler.add_node(
NODE_SEPARATE_VECTOR, compiler.stack_assign(color_in), 2, compiler.stack_assign(blue_out));
}
void SeparateRGBNode::compile(OSLCompiler &compiler)
{
compiler.add(this, "node_separate_rgb");
}
/* Separate XYZ */
NODE_DEFINE(SeparateXYZNode)
@@ -5751,56 +5611,6 @@ void SeparateXYZNode::compile(OSLCompiler &compiler)
compiler.add(this, "node_separate_xyz");
}
/* Separate HSV */
NODE_DEFINE(SeparateHSVNode)
{
NodeType *type = NodeType::add("separate_hsv", create, NodeType::SHADER);
SOCKET_IN_COLOR(color, "Color", zero_float3());
SOCKET_OUT_FLOAT(h, "H");
SOCKET_OUT_FLOAT(s, "S");
SOCKET_OUT_FLOAT(v, "V");
return type;
}
SeparateHSVNode::SeparateHSVNode() : ShaderNode(get_node_type()) {}
void SeparateHSVNode::constant_fold(const ConstantFolder &folder)
{
if (folder.all_inputs_constant()) {
float3 hsv = rgb_to_hsv(color);
for (int channel = 0; channel < 3; channel++) {
if (outputs[channel] == folder.output) {
folder.make_constant(hsv[channel]);
return;
}
}
}
}
void SeparateHSVNode::compile(SVMCompiler &compiler)
{
ShaderInput *color_in = input("Color");
ShaderOutput *hue_out = output("H");
ShaderOutput *saturation_out = output("S");
ShaderOutput *value_out = output("V");
compiler.add_node(NODE_SEPARATE_HSV,
compiler.stack_assign(color_in),
compiler.stack_assign(hue_out),
compiler.stack_assign(saturation_out));
compiler.add_node(NODE_SEPARATE_HSV, compiler.stack_assign(value_out));
}
void SeparateHSVNode::compile(OSLCompiler &compiler)
{
compiler.add(this, "node_separate_hsv");
}
/* Hue/Saturation/Value */
NODE_DEFINE(HSVNode)

View File

@@ -1171,26 +1171,6 @@ class CombineColorNode : public ShaderNode {
NODE_SOCKET_API(float, b)
};
class CombineRGBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(CombineRGBNode)
void constant_fold(const ConstantFolder &folder) override;
NODE_SOCKET_API(float, r)
NODE_SOCKET_API(float, g)
NODE_SOCKET_API(float, b)
};
class CombineHSVNode : public ShaderNode {
public:
SHADER_NODE_CLASS(CombineHSVNode)
void constant_fold(const ConstantFolder &folder) override;
NODE_SOCKET_API(float, h)
NODE_SOCKET_API(float, s)
NODE_SOCKET_API(float, v)
};
class CombineXYZNode : public ShaderNode {
public:
SHADER_NODE_CLASS(CombineXYZNode)
@@ -1229,22 +1209,6 @@ class SeparateColorNode : public ShaderNode {
NODE_SOCKET_API(float3, color)
};
class SeparateRGBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateRGBNode)
void constant_fold(const ConstantFolder &folder) override;
NODE_SOCKET_API(float3, color)
};
class SeparateHSVNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateHSVNode)
void constant_fold(const ConstantFolder &folder) override;
NODE_SOCKET_API(float3, color)
};
class SeparateXYZNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateXYZNode)

View File

@@ -797,19 +797,21 @@ TEST_F(RenderGraph, constant_fold_part_mix_div_0)
TEST_F(RenderGraph, constant_fold_separate_combine_rgb)
{
EXPECT_ANY_MESSAGE(log);
CORRECT_INFO_MESSAGE(log, "Folding SeparateRGB::R to constant (0.3).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateRGB::G to constant (0.5).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateRGB::B to constant (0.7).");
CORRECT_INFO_MESSAGE(log, "Folding CombineRGB::Image to constant (0.3, 0.5, 0.7).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateRGB::Red to constant (0.3).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateRGB::Green to constant (0.5).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateRGB::Blue to constant (0.7).");
CORRECT_INFO_MESSAGE(log, "Folding CombineRGB::Color to constant (0.3, 0.5, 0.7).");
builder
.add_node(ShaderNodeBuilder<SeparateRGBNode>(graph, "SeparateRGB")
.set("Image", make_float3(0.3f, 0.5f, 0.7f)))
.add_node(ShaderNodeBuilder<CombineRGBNode>(graph, "CombineRGB"))
.add_connection("SeparateRGB::R", "CombineRGB::R")
.add_connection("SeparateRGB::G", "CombineRGB::G")
.add_connection("SeparateRGB::B", "CombineRGB::B")
.output_color("CombineRGB::Image");
.add_node(ShaderNodeBuilder<SeparateColorNode>(graph, "SeparateRGB")
.set("Color", make_float3(0.3f, 0.5f, 0.7f))
.set_param("color_type", NODE_COMBSEP_COLOR_RGB))
.add_node(ShaderNodeBuilder<CombineColorNode>(graph, "CombineRGB")
.set_param("color_type", NODE_COMBSEP_COLOR_RGB))
.add_connection("SeparateRGB::Red", "CombineRGB::Red")
.add_connection("SeparateRGB::Green", "CombineRGB::Green")
.add_connection("SeparateRGB::Blue", "CombineRGB::Blue")
.output_color("CombineRGB::Color");
graph.finalize(scene.get());
}
@@ -845,18 +847,21 @@ TEST_F(RenderGraph, constant_fold_separate_combine_xyz)
TEST_F(RenderGraph, constant_fold_separate_combine_hsv)
{
EXPECT_ANY_MESSAGE(log);
CORRECT_INFO_MESSAGE(log, "Folding SeparateHSV::H to constant (0.583333).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateHSV::S to constant (0.571429).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateHSV::V to constant (0.7).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateHSV::Red to constant (0.583333).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateHSV::Green to constant (0.571429).");
CORRECT_INFO_MESSAGE(log, "Folding SeparateHSV::Blue to constant (0.7).");
CORRECT_INFO_MESSAGE(log, "Folding CombineHSV::Color to constant (0.3, 0.5, 0.7).");
/* R, G, B corrispond to H, S, V on this node */
builder
.add_node(ShaderNodeBuilder<SeparateHSVNode>(graph, "SeparateHSV")
.set("Color", make_float3(0.3f, 0.5f, 0.7f)))
.add_node(ShaderNodeBuilder<CombineHSVNode>(graph, "CombineHSV"))
.add_connection("SeparateHSV::H", "CombineHSV::H")
.add_connection("SeparateHSV::S", "CombineHSV::S")
.add_connection("SeparateHSV::V", "CombineHSV::V")
.add_node(ShaderNodeBuilder<SeparateColorNode>(graph, "SeparateHSV")
.set("Color", make_float3(0.3f, 0.5f, 0.7f))
.set_param("color_type", NODE_COMBSEP_COLOR_HSV))
.add_node(ShaderNodeBuilder<CombineColorNode>(graph, "CombineHSV")
.set_param("color_type", NODE_COMBSEP_COLOR_HSV))
.add_connection("SeparateHSV::Red", "CombineHSV::Red")
.add_connection("SeparateHSV::Green", "CombineHSV::Green")
.add_connection("SeparateHSV::Blue", "CombineHSV::Blue")
.output_color("CombineHSV::Color");
graph.finalize(scene.get());

View File

@@ -27,7 +27,7 @@
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 13
#define BLENDER_FILE_SUBVERSION 14
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@@ -1934,236 +1934,6 @@ static void version_liboverride_rnacollections_insertion_animdata(ID *id)
}
}
static void versioning_replace_legacy_combined_and_separate_color_nodes(bNodeTree *ntree)
{
/* In geometry nodes, replace shader combine/separate color nodes with function nodes */
if (ntree->type == NTREE_GEOMETRY) {
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "R", "Red");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "G", "Green");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "B", "Blue");
version_node_output_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "Image", "Color");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "R", "Red");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "G", "Green");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "B", "Blue");
version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", "Color");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case SH_NODE_COMBRGB_LEGACY: {
node->type_legacy = FN_NODE_COMBINE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "FunctionNodeCombineColor");
node->storage = storage;
break;
}
case SH_NODE_SEPRGB_LEGACY: {
node->type_legacy = FN_NODE_SEPARATE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "FunctionNodeSeparateColor");
node->storage = storage;
break;
}
}
}
}
/* In compositing nodes, replace combine/separate RGBA/HSVA/YCbCrA/YCCA nodes with
* combine/separate color */
if (ntree->type == NTREE_COMPOSIT) {
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "R", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "G", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "B", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "A", "Alpha");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "H", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "S", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "V", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "A", "Alpha");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Y", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Cb", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Cr", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "A", "Alpha");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "Y", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "U", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "V", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "R", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "G", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "B", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "H", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "S", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "V", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "Y", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "Cb", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "Cr", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "Y", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "U", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "V", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "A", "Alpha");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case CMP_NODE_COMBRGBA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_COMBHSVA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_COMBYCCA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YCC;
storage->ycc_mode = node->custom1;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_COMBYUVA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YUV;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPRGBA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPHSVA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPYCCA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YCC;
storage->ycc_mode = node->custom1;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPYUVA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YUV;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
}
}
}
/* In texture nodes, replace combine/separate RGBA with combine/separate color */
if (ntree->type == NTREE_TEXTURE) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case TEX_NODE_COMPOSE_LEGACY: {
node->type_legacy = TEX_NODE_COMBINE_COLOR;
node->custom1 = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "TextureNodeCombineColor");
break;
}
case TEX_NODE_DECOMPOSE_LEGACY: {
node->type_legacy = TEX_NODE_SEPARATE_COLOR;
node->custom1 = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "TextureNodeSeparateColor");
break;
}
}
}
}
/* In shader nodes, replace combine/separate RGB/HSV with combine/separate color */
if (ntree->type == NTREE_SHADER) {
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "R", "Red");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "G", "Green");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "B", "Blue");
version_node_output_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "Image", "Color");
version_node_input_socket_name(ntree, SH_NODE_COMBHSV_LEGACY, "H", "Red");
version_node_input_socket_name(ntree, SH_NODE_COMBHSV_LEGACY, "S", "Green");
version_node_input_socket_name(ntree, SH_NODE_COMBHSV_LEGACY, "V", "Blue");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "R", "Red");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "G", "Green");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "B", "Blue");
version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", "Color");
version_node_output_socket_name(ntree, SH_NODE_SEPHSV_LEGACY, "H", "Red");
version_node_output_socket_name(ntree, SH_NODE_SEPHSV_LEGACY, "S", "Green");
version_node_output_socket_name(ntree, SH_NODE_SEPHSV_LEGACY, "V", "Blue");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case SH_NODE_COMBRGB_LEGACY: {
node->type_legacy = SH_NODE_COMBINE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "ShaderNodeCombineColor");
node->storage = storage;
break;
}
case SH_NODE_COMBHSV_LEGACY: {
node->type_legacy = SH_NODE_COMBINE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "ShaderNodeCombineColor");
node->storage = storage;
break;
}
case SH_NODE_SEPRGB_LEGACY: {
node->type_legacy = SH_NODE_SEPARATE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "ShaderNodeSeparateColor");
node->storage = storage;
break;
}
case SH_NODE_SEPHSV_LEGACY: {
node->type_legacy = SH_NODE_SEPARATE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "ShaderNodeSeparateColor");
node->storage = storage;
break;
}
}
}
}
}
static void versioning_replace_legacy_mix_rgb_node(bNodeTree *ntree)
{
version_node_input_socket_name(ntree, SH_NODE_MIX_RGB_LEGACY, "Fac", "Factor_Float");
@@ -3832,11 +3602,6 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 303, 1)) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
versioning_replace_legacy_combined_and_separate_color_nodes(ntree);
}
FOREACH_NODETREE_END;
/* Initialize brush curves sculpt settings. */
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {

View File

@@ -15,6 +15,7 @@
#include "BLI_set.hh"
#include "BLI_string.h"
#include "BLI_string_utils.hh"
#include "BLI_sys_types.h"
#include "BKE_attribute_legacy_convert.hh"
#include "BKE_main.hh"
@@ -99,6 +100,236 @@ static void initialize_closure_input_structure_types(bNodeTree &ntree)
}
}
static void versioning_replace_legacy_combined_and_separate_color_nodes(bNodeTree *ntree)
{
/* In geometry nodes, replace shader combine/separate color nodes with function nodes */
if (ntree->type == NTREE_GEOMETRY) {
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "R", "Red");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "G", "Green");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "B", "Blue");
version_node_output_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "Image", "Color");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "R", "Red");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "G", "Green");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "B", "Blue");
version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", "Color");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case SH_NODE_COMBRGB_LEGACY: {
node->type_legacy = FN_NODE_COMBINE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "FunctionNodeCombineColor");
node->storage = storage;
break;
}
case SH_NODE_SEPRGB_LEGACY: {
node->type_legacy = FN_NODE_SEPARATE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "FunctionNodeSeparateColor");
node->storage = storage;
break;
}
}
}
}
/* In compositing nodes, replace combine/separate RGBA/HSVA/YCbCrA/YCCA nodes with
* combine/separate color */
if (ntree->type == NTREE_COMPOSIT) {
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "R", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "G", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "B", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "A", "Alpha");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "H", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "S", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "V", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "A", "Alpha");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Y", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Cb", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Cr", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "A", "Alpha");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "Y", "Red");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "U", "Green");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "V", "Blue");
version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "R", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "G", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "B", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "H", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "S", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "V", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "Y", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "Cb", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "Cr", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPYCCA_LEGACY, "A", "Alpha");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "Y", "Red");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "U", "Green");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "V", "Blue");
version_node_output_socket_name(ntree, CMP_NODE_SEPYUVA_LEGACY, "A", "Alpha");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case CMP_NODE_COMBRGBA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_COMBHSVA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_COMBYCCA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YCC;
storage->ycc_mode = node->custom1;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_COMBYUVA_LEGACY: {
node->type_legacy = CMP_NODE_COMBINE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YUV;
STRNCPY(node->idname, "CompositorNodeCombineColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPRGBA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPHSVA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPYCCA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YCC;
storage->ycc_mode = node->custom1;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
case CMP_NODE_SEPYUVA_LEGACY: {
node->type_legacy = CMP_NODE_SEPARATE_COLOR;
NodeCMPCombSepColor *storage = MEM_callocN<NodeCMPCombSepColor>(__func__);
storage->mode = CMP_NODE_COMBSEP_COLOR_YUV;
STRNCPY(node->idname, "CompositorNodeSeparateColor");
node->storage = storage;
break;
}
}
}
}
/* In texture nodes, replace combine/separate RGBA with combine/separate color */
if (ntree->type == NTREE_TEXTURE) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case TEX_NODE_COMPOSE_LEGACY: {
node->type_legacy = TEX_NODE_COMBINE_COLOR;
node->custom1 = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "TextureNodeCombineColor");
break;
}
case TEX_NODE_DECOMPOSE_LEGACY: {
node->type_legacy = TEX_NODE_SEPARATE_COLOR;
node->custom1 = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "TextureNodeSeparateColor");
break;
}
}
}
}
/* In shader nodes, replace combine/separate RGB/HSV with combine/separate color */
if (ntree->type == NTREE_SHADER) {
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "R", "Red");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "G", "Green");
version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "B", "Blue");
version_node_output_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "Image", "Color");
version_node_input_socket_name(ntree, SH_NODE_COMBHSV_LEGACY, "H", "Red");
version_node_input_socket_name(ntree, SH_NODE_COMBHSV_LEGACY, "S", "Green");
version_node_input_socket_name(ntree, SH_NODE_COMBHSV_LEGACY, "V", "Blue");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "R", "Red");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "G", "Green");
version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "B", "Blue");
version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", "Color");
version_node_output_socket_name(ntree, SH_NODE_SEPHSV_LEGACY, "H", "Red");
version_node_output_socket_name(ntree, SH_NODE_SEPHSV_LEGACY, "S", "Green");
version_node_output_socket_name(ntree, SH_NODE_SEPHSV_LEGACY, "V", "Blue");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
switch (node->type_legacy) {
case SH_NODE_COMBRGB_LEGACY: {
node->type_legacy = SH_NODE_COMBINE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "ShaderNodeCombineColor");
node->storage = storage;
break;
}
case SH_NODE_COMBHSV_LEGACY: {
node->type_legacy = SH_NODE_COMBINE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "ShaderNodeCombineColor");
node->storage = storage;
break;
}
case SH_NODE_SEPRGB_LEGACY: {
node->type_legacy = SH_NODE_SEPARATE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_RGB;
STRNCPY(node->idname, "ShaderNodeSeparateColor");
node->storage = storage;
break;
}
case SH_NODE_SEPHSV_LEGACY: {
node->type_legacy = SH_NODE_SEPARATE_COLOR;
NodeCombSepColor *storage = MEM_callocN<NodeCombSepColor>(__func__);
storage->mode = NODE_COMBSEP_COLOR_HSV;
STRNCPY(node->idname, "ShaderNodeSeparateColor");
node->storage = storage;
break;
}
}
}
}
}
void do_versions_after_linking_500(FileData * /*fd*/, Main * /*bmain*/)
{
/**
@@ -204,6 +435,13 @@ void blo_do_versions_500(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
FOREACH_NODETREE_END;
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 14)) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
versioning_replace_legacy_combined_and_separate_color_nodes(ntree);
}
FOREACH_NODETREE_END;
}
/**
* Always bump subversion in BKE_blender_version.h when adding versioning
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.

View File

@@ -558,8 +558,6 @@ set(GLSL_SRC
shaders/material/gpu_shader_material_camera.glsl
shaders/material/gpu_shader_material_clamp.glsl
shaders/material/gpu_shader_material_combine_color.glsl
shaders/material/gpu_shader_material_combine_hsv.glsl
shaders/material/gpu_shader_material_combine_rgb.glsl
shaders/material/gpu_shader_material_combine_xyz.glsl
shaders/material/gpu_shader_material_diffuse.glsl
shaders/material/gpu_shader_material_displacement.glsl
@@ -599,8 +597,6 @@ set(GLSL_SRC
shaders/material/gpu_shader_material_refraction.glsl
shaders/material/gpu_shader_material_rgb_to_bw.glsl
shaders/material/gpu_shader_material_separate_color.glsl
shaders/material/gpu_shader_material_separate_hsv.glsl
shaders/material/gpu_shader_material_separate_rgb.glsl
shaders/material/gpu_shader_material_separate_xyz.glsl
shaders/material/gpu_shader_material_set.glsl
shaders/material/gpu_shader_material_shader_to_rgba.glsl

View File

@@ -1,10 +0,0 @@
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_common_color_utils.glsl"
void combine_hsv(float h, float s, float v, out float4 col)
{
hsv_to_rgb(float4(h, s, v, 1.0f), col);
}

View File

@@ -1,8 +0,0 @@
/* SPDX-FileCopyrightText: 2019 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
void combine_rgb(float r, float g, float b, out float4 col)
{
col = float4(r, g, b, 1.0f);
}

View File

@@ -1,15 +0,0 @@
/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_common_color_utils.glsl"
void separate_hsv(float4 col, out float h, out float s, out float v)
{
float4 hsv;
rgb_to_hsv(col, hsv);
h = hsv[0];
s = hsv[1];
v = hsv[2];
}

View File

@@ -1,10 +0,0 @@
/* SPDX-FileCopyrightText: 2019 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
void separate_rgb(float4 col, out float r, out float g, out float b)
{
r = col.r;
g = col.g;
b = col.b;
}

View File

@@ -10491,8 +10491,6 @@ static void rna_def_nodes(BlenderRNA *brna)
define("ShaderNode", "ShaderNodeCameraData");
define("ShaderNode", "ShaderNodeClamp", def_clamp);
define("ShaderNode", "ShaderNodeCombineColor", def_sh_combsep_color);
define("ShaderNode", "ShaderNodeCombineHSV");
define("ShaderNode", "ShaderNodeCombineRGB");
define("ShaderNode", "ShaderNodeCombineXYZ");
define("ShaderNode", "ShaderNodeDisplacement", def_sh_displacement);
define("ShaderNode", "ShaderNodeEeveeSpecular");
@@ -10529,8 +10527,6 @@ static void rna_def_nodes(BlenderRNA *brna)
define("ShaderNode", "ShaderNodeRGBToBW");
define("ShaderNode", "ShaderNodeScript", def_sh_script);
define("ShaderNode", "ShaderNodeSeparateColor", def_sh_combsep_color);
define("ShaderNode", "ShaderNodeSeparateHSV");
define("ShaderNode", "ShaderNodeSeparateRGB");
define("ShaderNode", "ShaderNodeSeparateXYZ");
define("ShaderNode", "ShaderNodeShaderToRGB");
define("ShaderNode", "ShaderNodeSqueeze");

View File

@@ -90,10 +90,6 @@ set(SRC
nodes/node_composite_scale.cc
nodes/node_composite_scene_time.cc
nodes/node_composite_sepcomb_color.cc
nodes/node_composite_sepcomb_hsva.cc
nodes/node_composite_sepcomb_rgba.cc
nodes/node_composite_sepcomb_ycca.cc
nodes/node_composite_sepcomb_yuva.cc
nodes/node_composite_setalpha.cc
nodes/node_composite_split.cc
nodes/node_composite_stabilize2d.cc

View File

@@ -1,155 +0,0 @@
/* SPDX-FileCopyrightText: 2006 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup cmpnodes
*/
#include "BLI_math_color.h"
#include "BLI_math_vector_types.hh"
#include "FN_multi_function_builder.hh"
#include "NOD_multi_function.hh"
#include "GPU_material.hh"
#include "node_composite_util.hh"
/* **************** SEPARATE HSVA ******************** */
namespace blender::nodes::node_composite_separate_hsva_cc {
static void cmp_node_sephsva_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Image")
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
.compositor_domain_priority(0);
b.add_output<decl::Float>("H").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("S").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("V").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("A").translation_context(BLT_I18NCONTEXT_COLOR);
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
return GPU_stack_link(material, node, "node_composite_separate_hsva", inputs, outputs);
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto function = mf::build::SI1_SO4<float4, float, float, float, float>(
"Separate Color HSVA",
[](const float4 &color, float &h, float &s, float &v, float &a) -> void {
rgb_to_hsv(color.x, color.y, color.z, &h, &s, &v);
a = color.w;
},
mf::build::exec_presets::AllSpanOrSingle());
builder.set_matching_fn(function);
}
} // namespace blender::nodes::node_composite_separate_hsva_cc
static void register_node_type_cmp_sephsva()
{
namespace file_ns = blender::nodes::node_composite_separate_hsva_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeSepHSVA", CMP_NODE_SEPHSVA_LEGACY);
ntype.ui_name = "Separate HSVA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "SEPHSVA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_sephsva_declare;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_sephsva)
/* **************** COMBINE HSVA ******************** */
namespace blender::nodes::node_composite_combine_hsva_cc {
static void cmp_node_combhsva_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("H")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(0)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("S")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(1)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("V")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(2)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("A")
.default_value(1.0f)
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(3)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Color>("Image");
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
return GPU_stack_link(material, node, "node_composite_combine_hsva", inputs, outputs);
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto function = mf::build::SI4_SO<float, float, float, float, float4>(
"Combine Color HSVA",
[](const float h, const float s, const float v, const float a) -> float4 {
float4 result;
hsv_to_rgb(h, s, v, &result.x, &result.y, &result.z);
result.w = a;
return result;
},
mf::build::exec_presets::Materialized());
builder.set_matching_fn(function);
}
} // namespace blender::nodes::node_composite_combine_hsva_cc
static void register_node_type_cmp_combhsva()
{
namespace file_ns = blender::nodes::node_composite_combine_hsva_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeCombHSVA", CMP_NODE_COMBHSVA_LEGACY);
ntype.ui_name = "Combine HSVA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "COMBHSVA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_combhsva_declare;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_combhsva)

View File

@@ -1,153 +0,0 @@
/* SPDX-FileCopyrightText: 2006 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup cmpnodes
*/
#include "BLI_math_vector_types.hh"
#include "FN_multi_function_builder.hh"
#include "NOD_multi_function.hh"
#include "GPU_material.hh"
#include "node_composite_util.hh"
/* **************** SEPARATE RGBA ******************** */
namespace blender::nodes::node_composite_separate_rgba_cc {
static void cmp_node_seprgba_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Image")
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
.compositor_domain_priority(0);
b.add_output<decl::Float>("R").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("G").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("B").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("A").translation_context(BLT_I18NCONTEXT_COLOR);
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
return GPU_stack_link(material, node, "node_composite_separate_rgba", inputs, outputs);
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto function = mf::build::SI1_SO4<float4, float, float, float, float>(
"Separate Color RGBA",
[](const float4 &color, float &r, float &g, float &b, float &a) -> void {
r = color.x;
g = color.y;
b = color.z;
a = color.w;
},
mf::build::exec_presets::AllSpanOrSingle());
builder.set_matching_fn(function);
}
} // namespace blender::nodes::node_composite_separate_rgba_cc
static void register_node_type_cmp_seprgba()
{
namespace file_ns = blender::nodes::node_composite_separate_rgba_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeSepRGBA", CMP_NODE_SEPRGBA_LEGACY);
ntype.ui_name = "Separate RGBA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "SEPRGBA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_seprgba_declare;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_seprgba)
/* **************** COMBINE RGBA ******************** */
namespace blender::nodes::node_composite_combine_rgba_cc {
static void cmp_node_combrgba_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("R")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(0)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("G")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(1)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("B")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(2)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("A")
.default_value(1.0f)
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(3)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Color>("Image");
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
return GPU_stack_link(material, node, "node_composite_combine_rgba", inputs, outputs);
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto function = mf::build::SI4_SO<float, float, float, float, float4>(
"Combine Color RGBA",
[](const float r, const float g, const float b, const float a) -> float4 {
return float4(r, g, b, a);
},
mf::build::exec_presets::Materialized());
builder.set_matching_fn(function);
}
} // namespace blender::nodes::node_composite_combine_rgba_cc
static void register_node_type_cmp_combrgba()
{
namespace file_ns = blender::nodes::node_composite_combine_rgba_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeCombRGBA", CMP_NODE_COMBRGBA_LEGACY);
ntype.ui_name = "Combine RGBA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "COMBRGBA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_combrgba_declare;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_combrgba)

View File

@@ -1,275 +0,0 @@
/* SPDX-FileCopyrightText: 2006 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup cmpnodes
*/
#include "BLI_assert.h"
#include "BLI_math_color.h"
#include "BLI_math_vector_types.hh"
#include "FN_multi_function_builder.hh"
#include "NOD_multi_function.hh"
#include "GPU_material.hh"
#include "node_composite_util.hh"
/* **************** SEPARATE YCCA ******************** */
namespace blender::nodes::node_composite_separate_ycca_cc {
static void cmp_node_sepycca_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Image")
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
.compositor_domain_priority(0);
b.add_output<decl::Float>("Y").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("Cb");
b.add_output<decl::Float>("Cr");
b.add_output<decl::Float>("A").translation_context(BLT_I18NCONTEXT_COLOR);
}
static void node_composit_init_mode_sepycca(bNodeTree * /*ntree*/, bNode *node)
{
node->custom1 = 1; /* BLI_YCC_ITU_BT709 */
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
switch (node->custom1) {
case BLI_YCC_ITU_BT601:
return GPU_stack_link(
material, node, "node_composite_separate_ycca_itu_601", inputs, outputs);
case BLI_YCC_ITU_BT709:
return GPU_stack_link(
material, node, "node_composite_separate_ycca_itu_709", inputs, outputs);
case BLI_YCC_JFIF_0_255:
return GPU_stack_link(material, node, "node_composite_separate_ycca_jpeg", inputs, outputs);
}
return false;
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto ycca_itu_601_function = mf::build::SI1_SO4<float4, float, float, float, float>(
"Separate Color YCCA ITU 601",
[](const float4 &color, float &y, float &cb, float &cr, float &a) -> void {
rgb_to_ycc(color.x, color.y, color.z, &y, &cb, &cr, BLI_YCC_ITU_BT601);
y /= 255.0f;
cb /= 255.0f;
cr /= 255.0f;
a = color.w;
},
mf::build::exec_presets::AllSpanOrSingle());
static auto ycca_itu_709_function = mf::build::SI1_SO4<float4, float, float, float, float>(
"Separate Color YCCA ITU 709",
[](const float4 &color, float &y, float &cb, float &cr, float &a) -> void {
rgb_to_ycc(color.x, color.y, color.z, &y, &cb, &cr, BLI_YCC_ITU_BT709);
y /= 255.0f;
cb /= 255.0f;
cr /= 255.0f;
a = color.w;
},
mf::build::exec_presets::AllSpanOrSingle());
static auto ycca_jpeg_function = mf::build::SI1_SO4<float4, float, float, float, float>(
"Separate Color YCCA JPEG",
[](const float4 &color, float &y, float &cb, float &cr, float &a) -> void {
rgb_to_ycc(color.x, color.y, color.z, &y, &cb, &cr, BLI_YCC_JFIF_0_255);
y /= 255.0f;
cb /= 255.0f;
cr /= 255.0f;
a = color.w;
},
mf::build::exec_presets::AllSpanOrSingle());
switch (builder.node().custom1) {
case BLI_YCC_ITU_BT601:
builder.set_matching_fn(ycca_itu_601_function);
break;
case BLI_YCC_ITU_BT709:
builder.set_matching_fn(ycca_itu_709_function);
break;
case BLI_YCC_JFIF_0_255:
builder.set_matching_fn(ycca_jpeg_function);
break;
}
}
} // namespace blender::nodes::node_composite_separate_ycca_cc
static void register_node_type_cmp_sepycca()
{
namespace file_ns = blender::nodes::node_composite_separate_ycca_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeSepYCCA", CMP_NODE_SEPYCCA_LEGACY);
ntype.ui_name = "Separate YCbCrA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "SEPYCCA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_sepycca_declare;
ntype.initfunc = file_ns::node_composit_init_mode_sepycca;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_sepycca)
/* **************** COMBINE YCCA ******************** */
namespace blender::nodes::node_composite_combine_ycca_cc {
static void cmp_node_combycca_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("Y")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(0)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("Cb")
.default_value(0.5f)
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(1);
b.add_input<decl::Float>("Cr")
.default_value(0.5f)
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(2);
b.add_input<decl::Float>("A")
.default_value(1.0f)
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(3)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Color>("Image");
}
static void node_composit_init_mode_combycca(bNodeTree * /*ntree*/, bNode *node)
{
node->custom1 = 1; /* BLI_YCC_ITU_BT709 */
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
switch (node->custom1) {
case BLI_YCC_ITU_BT601:
return GPU_stack_link(
material, node, "node_composite_combine_ycca_itu_601", inputs, outputs);
case BLI_YCC_ITU_BT709:
return GPU_stack_link(
material, node, "node_composite_combine_ycca_itu_709", inputs, outputs);
case BLI_YCC_JFIF_0_255:
return GPU_stack_link(material, node, "node_composite_combine_ycca_jpeg", inputs, outputs);
}
return false;
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto ycca_itu_601_function = mf::build::SI4_SO<float, float, float, float, float4>(
"Combine Color YCCA ITU 601",
[](const float y, const float cb, const float cr, const float a) -> float4 {
float4 result;
ycc_to_rgb(y * 255.0f,
cb * 255.0f,
cr * 255.0f,
&result.x,
&result.y,
&result.z,
BLI_YCC_ITU_BT601);
result.w = a;
return result;
},
mf::build::exec_presets::Materialized());
static auto ycca_itu_709_function = mf::build::SI4_SO<float, float, float, float, float4>(
"Combine Color YCCA ITU 709",
[](const float y, const float cb, const float cr, const float a) -> float4 {
float4 result;
ycc_to_rgb(y * 255.0f,
cb * 255.0f,
cr * 255.0f,
&result.x,
&result.y,
&result.z,
BLI_YCC_ITU_BT709);
result.w = a;
return result;
},
mf::build::exec_presets::Materialized());
static auto ycca_jpeg_function = mf::build::SI4_SO<float, float, float, float, float4>(
"Combine Color YCCA JPEG",
[](const float y, const float cb, const float cr, const float a) -> float4 {
float4 result;
ycc_to_rgb(y * 255.0f,
cb * 255.0f,
cr * 255.0f,
&result.x,
&result.y,
&result.z,
BLI_YCC_JFIF_0_255);
result.w = a;
return result;
},
mf::build::exec_presets::Materialized());
switch (builder.node().custom1) {
case BLI_YCC_ITU_BT601:
builder.set_matching_fn(ycca_itu_601_function);
break;
case BLI_YCC_ITU_BT709:
builder.set_matching_fn(ycca_itu_709_function);
break;
case BLI_YCC_JFIF_0_255:
builder.set_matching_fn(ycca_jpeg_function);
break;
}
}
} // namespace blender::nodes::node_composite_combine_ycca_cc
static void register_node_type_cmp_combycca()
{
namespace file_ns = blender::nodes::node_composite_combine_ycca_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeCombYCCA", CMP_NODE_COMBYCCA_LEGACY);
ntype.ui_name = "Combine YCbCrA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "COMBYCCA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_combycca_declare;
ntype.initfunc = file_ns::node_composit_init_mode_combycca;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_combycca)

View File

@@ -1,155 +0,0 @@
/* SPDX-FileCopyrightText: 2006 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup cmpnodes
*/
#include "BLI_math_color.h"
#include "BLI_math_vector_types.hh"
#include "FN_multi_function_builder.hh"
#include "NOD_multi_function.hh"
#include "GPU_material.hh"
#include "node_composite_util.hh"
/* **************** SEPARATE YUVA ******************** */
namespace blender::nodes::node_composite_separate_yuva_cc {
static void cmp_node_sepyuva_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Image")
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
.compositor_domain_priority(0);
b.add_output<decl::Float>("Y").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("U").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("V").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("A").translation_context(BLT_I18NCONTEXT_COLOR);
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
return GPU_stack_link(material, node, "node_composite_separate_yuva_itu_709", inputs, outputs);
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto function = mf::build::SI1_SO4<float4, float, float, float, float>(
"Separate Color YUVA",
[](const float4 &color, float &y, float &u, float &v, float &a) -> void {
rgb_to_yuv(color.x, color.y, color.z, &y, &u, &v, BLI_YUV_ITU_BT709);
a = color.w;
},
mf::build::exec_presets::AllSpanOrSingle());
builder.set_matching_fn(function);
}
} // namespace blender::nodes::node_composite_separate_yuva_cc
static void register_node_type_cmp_sepyuva()
{
namespace file_ns = blender::nodes::node_composite_separate_yuva_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeSepYUVA", CMP_NODE_SEPYUVA_LEGACY);
ntype.ui_name = "Separate YUVA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "SEPYUVA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_sepyuva_declare;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_sepyuva)
/* **************** COMBINE YUVA ******************** */
namespace blender::nodes::node_composite_combine_yuva_cc {
static void cmp_node_combyuva_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("Y")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(0)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("U")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(1)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("V")
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(2)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("A")
.default_value(1.0f)
.min(0.0f)
.max(1.0f)
.compositor_domain_priority(3)
.translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Color>("Image");
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *inputs,
GPUNodeStack *outputs)
{
return GPU_stack_link(material, node, "node_composite_combine_yuva_itu_709", inputs, outputs);
}
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
static auto function = mf::build::SI4_SO<float, float, float, float, float4>(
"Combine Color YUVA",
[](const float y, const float u, const float v, const float a) -> float4 {
float4 result;
yuv_to_rgb(y, u, v, &result.x, &result.y, &result.z, BLI_YUV_ITU_BT709);
result.w = a;
return result;
},
mf::build::exec_presets::Materialized());
builder.set_matching_fn(function);
}
} // namespace blender::nodes::node_composite_combine_yuva_cc
static void register_node_type_cmp_combyuva()
{
namespace file_ns = blender::nodes::node_composite_combine_yuva_cc;
static blender::bke::bNodeType ntype;
cmp_node_type_base(&ntype, "CompositorNodeCombYUVA", CMP_NODE_COMBYUVA_LEGACY);
ntype.ui_name = "Combine YUVA (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "COMBYUVA";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::cmp_node_combyuva_declare;
ntype.gather_link_search_ops = nullptr;
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_combyuva)

View File

@@ -77,8 +77,6 @@ set(SRC
nodes/node_shader_rgb_to_bw.cc
nodes/node_shader_script.cc
nodes/node_shader_sepcomb_color.cc
nodes/node_shader_sepcomb_hsv.cc
nodes/node_shader_sepcomb_rgb.cc
nodes/node_shader_sepcomb_xyz.cc
nodes/node_shader_shader_to_rgb.cc
nodes/node_shader_squeeze.cc

View File

@@ -36,8 +36,6 @@ void register_shader_nodes()
register_node_type_sh_camera();
register_node_type_sh_clamp();
register_node_type_sh_combcolor();
register_node_type_sh_combhsv();
register_node_type_sh_combrgb();
register_node_type_sh_combxyz();
register_node_type_sh_curve_float();
register_node_type_sh_curve_rgb();
@@ -75,8 +73,6 @@ void register_shader_nodes()
register_node_type_sh_rgbtobw();
register_node_type_sh_script();
register_node_type_sh_sepcolor();
register_node_type_sh_sephsv();
register_node_type_sh_seprgb();
register_node_type_sh_sepxyz();
register_node_type_sh_shadertorgb();
register_node_type_sh_squeeze();

View File

@@ -32,8 +32,6 @@ void register_node_type_sh_bump();
void register_node_type_sh_camera();
void register_node_type_sh_clamp();
void register_node_type_sh_combcolor();
void register_node_type_sh_combhsv();
void register_node_type_sh_combrgb();
void register_node_type_sh_combxyz();
void register_node_type_sh_curve_float();
void register_node_type_sh_curve_rgb();
@@ -74,8 +72,6 @@ void register_node_type_sh_rgb();
void register_node_type_sh_rgbtobw();
void register_node_type_sh_script();
void register_node_type_sh_sepcolor();
void register_node_type_sh_sephsv();
void register_node_type_sh_seprgb();
void register_node_type_sh_sepxyz();
void register_node_type_sh_shadertorgb();
void register_node_type_sh_squeeze();

View File

@@ -1,91 +0,0 @@
/* SPDX-FileCopyrightText: 2013 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup shdnodes
*/
#include "node_shader_util.hh"
namespace blender::nodes::node_shader_sepcomb_hsv_cc {
/* **************** SEPARATE HSV ******************** */
static void node_declare_sephsv(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Color").default_value({0.8f, 0.8f, 0.8f, 1.0});
b.add_output<decl::Float>("H");
b.add_output<decl::Float>("S");
b.add_output<decl::Float>("V");
}
static int gpu_shader_sephsv(GPUMaterial *mat,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *in,
GPUNodeStack *out)
{
return GPU_stack_link(mat, node, "separate_hsv", in, out);
}
} // namespace blender::nodes::node_shader_sepcomb_hsv_cc
void register_node_type_sh_sephsv()
{
namespace file_ns = blender::nodes::node_shader_sepcomb_hsv_cc;
static blender::bke::bNodeType ntype;
sh_node_type_base(&ntype, "ShaderNodeSeparateHSV", SH_NODE_SEPHSV_LEGACY);
ntype.ui_name = "Separate HSV (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "SEPHSV";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::node_declare_sephsv;
ntype.gpu_fn = file_ns::gpu_shader_sephsv;
ntype.gather_link_search_ops = nullptr;
blender::bke::node_register_type(ntype);
}
namespace blender::nodes::node_shader_sepcomb_hsv_cc {
/* **************** COMBINE HSV ******************** */
static void node_declare_combhsv(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("H").default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED);
b.add_input<decl::Float>("S").default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED);
b.add_input<decl::Float>("V").default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED);
b.add_output<decl::Color>("Color");
}
static int gpu_shader_combhsv(GPUMaterial *mat,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *in,
GPUNodeStack *out)
{
return GPU_stack_link(mat, node, "combine_hsv", in, out);
}
} // namespace blender::nodes::node_shader_sepcomb_hsv_cc
void register_node_type_sh_combhsv()
{
namespace file_ns = blender::nodes::node_shader_sepcomb_hsv_cc;
static blender::bke::bNodeType ntype;
sh_node_type_base(&ntype, "ShaderNodeCombineHSV", SH_NODE_COMBHSV_LEGACY);
ntype.ui_name = "Combine HSV (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "COMBHSV";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::node_declare_combhsv;
ntype.gpu_fn = file_ns::gpu_shader_combhsv;
ntype.gather_link_search_ops = nullptr;
blender::bke::node_register_type(ntype);
}

View File

@@ -1,141 +0,0 @@
/* SPDX-FileCopyrightText: 2006 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup shdnodes
*/
#include "node_shader_util.hh"
#include "FN_multi_function_builder.hh"
#include "NOD_multi_function.hh"
namespace blender::nodes::node_shader_sepcomb_rgb_cc {
static void sh_node_seprgb_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Color>("Image").default_value({0.8f, 0.8f, 0.8f, 1.0f});
b.add_output<decl::Float>("R").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("G").translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Float>("B").translation_context(BLT_I18NCONTEXT_COLOR);
}
static int gpu_shader_seprgb(GPUMaterial *mat,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *in,
GPUNodeStack *out)
{
return GPU_stack_link(mat, node, "separate_rgb", in, out);
}
class SeparateRGBFunction : public mf::MultiFunction {
public:
SeparateRGBFunction()
{
static const mf::Signature signature = []() {
mf::Signature signature;
mf::SignatureBuilder builder{"Separate RGB", signature};
builder.single_input<ColorGeometry4f>("Color");
builder.single_output<float>("R");
builder.single_output<float>("G");
builder.single_output<float>("B");
return signature;
}();
this->set_signature(&signature);
}
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const override
{
const VArray<ColorGeometry4f> &colors = params.readonly_single_input<ColorGeometry4f>(0,
"Color");
MutableSpan<float> rs = params.uninitialized_single_output<float>(1, "R");
MutableSpan<float> gs = params.uninitialized_single_output<float>(2, "G");
MutableSpan<float> bs = params.uninitialized_single_output<float>(3, "B");
mask.foreach_index([&](const int64_t i) {
ColorGeometry4f color = colors[i];
rs[i] = color.r;
gs[i] = color.g;
bs[i] = color.b;
});
}
};
static void sh_node_seprgb_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static SeparateRGBFunction fn;
builder.set_matching_fn(fn);
}
} // namespace blender::nodes::node_shader_sepcomb_rgb_cc
void register_node_type_sh_seprgb()
{
namespace file_ns = blender::nodes::node_shader_sepcomb_rgb_cc;
static blender::bke::bNodeType ntype;
common_node_type_base(&ntype, "ShaderNodeSeparateRGB", SH_NODE_SEPRGB_LEGACY);
ntype.ui_name = "Separate RGB (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "SEPRGB";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::sh_node_seprgb_declare;
ntype.gpu_fn = file_ns::gpu_shader_seprgb;
ntype.build_multi_function = file_ns::sh_node_seprgb_build_multi_function;
ntype.gather_link_search_ops = nullptr;
blender::bke::node_register_type(ntype);
}
namespace blender::nodes::node_shader_sepcomb_rgb_cc {
static void sh_node_combrgb_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Float>("R").min(0.0f).max(1.0f).translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("G").min(0.0f).max(1.0f).translation_context(BLT_I18NCONTEXT_COLOR);
b.add_input<decl::Float>("B").min(0.0f).max(1.0f).translation_context(BLT_I18NCONTEXT_COLOR);
b.add_output<decl::Color>("Image");
}
static int gpu_shader_combrgb(GPUMaterial *mat,
bNode *node,
bNodeExecData * /*execdata*/,
GPUNodeStack *in,
GPUNodeStack *out)
{
return GPU_stack_link(mat, node, "combine_rgb", in, out);
}
static void sh_node_combrgb_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static auto fn = mf::build::SI3_SO<float, float, float, ColorGeometry4f>(
"Combine RGB", [](float r, float g, float b) { return ColorGeometry4f(r, g, b, 1.0f); });
builder.set_matching_fn(fn);
}
} // namespace blender::nodes::node_shader_sepcomb_rgb_cc
void register_node_type_sh_combrgb()
{
namespace file_ns = blender::nodes::node_shader_sepcomb_rgb_cc;
static blender::bke::bNodeType ntype;
common_node_type_base(&ntype, "ShaderNodeCombineRGB", SH_NODE_COMBRGB_LEGACY);
ntype.ui_name = "Combine RGB (Legacy)";
ntype.ui_description = "Deprecated";
ntype.enum_name_legacy = "COMBRGB";
ntype.nclass = NODE_CLASS_CONVERTER;
ntype.declare = file_ns::sh_node_combrgb_declare;
ntype.gpu_fn = file_ns::gpu_shader_combrgb;
ntype.build_multi_function = file_ns::sh_node_combrgb_build_multi_function;
ntype.gather_link_search_ops = nullptr;
blender::bke::node_register_type(ntype);
}

View File

@@ -21,10 +21,8 @@ set(SRC
nodes/node_texture_checker.cc
nodes/node_texture_combine_color.cc
nodes/node_texture_common.cc
nodes/node_texture_compose.cc
nodes/node_texture_coord.cc
nodes/node_texture_curves.cc
nodes/node_texture_decompose.cc
nodes/node_texture_distance.cc
nodes/node_texture_hueSatVal.cc
nodes/node_texture_image.cc

View File

@@ -16,11 +16,9 @@ void register_texture_nodes()
register_node_type_tex_bricks();
register_node_type_tex_checker();
register_node_type_tex_combine_color();
register_node_type_tex_compose();
register_node_type_tex_coord();
register_node_type_tex_curve_rgb();
register_node_type_tex_curve_time();
register_node_type_tex_decompose();
register_node_type_tex_distance();
register_node_type_tex_hue_sat();
register_node_type_tex_image();

View File

@@ -12,11 +12,9 @@ void register_node_type_tex_at();
void register_node_type_tex_bricks();
void register_node_type_tex_checker();
void register_node_type_tex_combine_color();
void register_node_type_tex_compose();
void register_node_type_tex_coord();
void register_node_type_tex_curve_rgb();
void register_node_type_tex_curve_time();
void register_node_type_tex_decompose();
void register_node_type_tex_distance();
void register_node_type_tex_hue_sat();
void register_node_type_tex_image();

View File

@@ -1,53 +0,0 @@
/* SPDX-FileCopyrightText: 2005 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup texnodes
*/
#include "node_texture_util.hh"
static blender::bke::bNodeSocketTemplate inputs[] = {
{SOCK_FLOAT, N_("Red"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Blue"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{-1, ""},
};
static blender::bke::bNodeSocketTemplate outputs[] = {
{SOCK_RGBA, N_("Color")},
{-1, ""},
};
static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
{
int i;
for (i = 0; i < 4; i++) {
out[i] = tex_input_value(in[i], p, thread);
}
}
static void exec(void *data,
int /*thread*/,
bNode *node,
bNodeExecData *execdata,
bNodeStack **in,
bNodeStack **out)
{
tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
}
void register_node_type_tex_compose()
{
static blender::bke::bNodeType ntype;
tex_node_type_base(&ntype, "TextureNodeCompose", TEX_NODE_COMPOSE_LEGACY);
ntype.ui_name = "Combine RGBA (Legacy)";
ntype.enum_name_legacy = "COMPOSE";
ntype.nclass = NODE_CLASS_OP_COLOR;
blender::bke::node_type_socket_templates(&ntype, inputs, outputs);
ntype.exec_fn = exec;
blender::bke::node_register_type(ntype);
}

View File

@@ -1,73 +0,0 @@
/* SPDX-FileCopyrightText: 2005 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup texnodes
*/
#include "node_texture_util.hh"
static blender::bke::bNodeSocketTemplate inputs[] = {
{SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{-1, ""},
};
static blender::bke::bNodeSocketTemplate outputs[] = {
{SOCK_FLOAT, N_("Red")},
{SOCK_FLOAT, N_("Green")},
{SOCK_FLOAT, N_("Blue")},
{SOCK_FLOAT, N_("Alpha")},
{-1, ""},
};
static void valuefn_r(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[0];
}
static void valuefn_g(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[1];
}
static void valuefn_b(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[2];
}
static void valuefn_a(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
{
tex_input_rgba(out, in[0], p, thread);
*out = out[3];
}
static void exec(void *data,
int /*thread*/,
bNode *node,
bNodeExecData *execdata,
bNodeStack **in,
bNodeStack **out)
{
TexCallData *tex_call_data = static_cast<TexCallData *>(data);
tex_output(node, execdata, in, out[0], &valuefn_r, tex_call_data);
tex_output(node, execdata, in, out[1], &valuefn_g, tex_call_data);
tex_output(node, execdata, in, out[2], &valuefn_b, tex_call_data);
tex_output(node, execdata, in, out[3], &valuefn_a, tex_call_data);
}
void register_node_type_tex_decompose()
{
static blender::bke::bNodeType ntype;
tex_node_type_base(&ntype, "TextureNodeDecompose", TEX_NODE_DECOMPOSE_LEGACY);
ntype.ui_name = "Separate RGBA";
ntype.enum_name_legacy = "DECOMPOSE";
ntype.nclass = NODE_CLASS_OP_COLOR;
blender::bke::node_type_socket_templates(&ntype, inputs, outputs);
ntype.exec_fn = exec;
blender::bke::node_register_type(ntype);
}