diff options
Diffstat (limited to 'source/blender/compositor')
8 files changed, 212 insertions, 13 deletions
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index b9b365a3175..2f473ef2945 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -274,10 +274,14 @@ set(SRC # converter nodes nodes/COM_CombineColorNode.cc nodes/COM_CombineColorNode.h + nodes/COM_CombineXYZNode.cc + nodes/COM_CombineXYZNode.h nodes/COM_IDMaskNode.cc nodes/COM_IDMaskNode.h nodes/COM_SeparateColorNode.cc nodes/COM_SeparateColorNode.h + nodes/COM_SeparateXYZNode.cc + nodes/COM_SeparateXYZNode.h nodes/COM_MapRangeNode.cc nodes/COM_MapRangeNode.h @@ -631,10 +635,6 @@ list(APPEND SRC unset(GENSRC) unset(GENSRC_DIR) -if(WITH_INTERNATIONAL) - add_definitions(-DWITH_INTERNATIONAL) -endif() - if(WITH_OPENIMAGEDENOISE) add_definitions(-DWITH_OPENIMAGEDENOISE) add_definitions(-DOIDN_STATIC_LIB) diff --git a/source/blender/compositor/intern/COM_Converter.cc b/source/blender/compositor/intern/COM_Converter.cc index 6cf6c698a2f..d0b3ae74446 100644 --- a/source/blender/compositor/intern/COM_Converter.cc +++ b/source/blender/compositor/intern/COM_Converter.cc @@ -44,6 +44,7 @@ #include "COM_ColorSpillNode.h" #include "COM_ColorToBWNode.h" #include "COM_CombineColorNode.h" +#include "COM_CombineXYZNode.h" #include "COM_CompositorNode.h" #include "COM_ConvertAlphaNode.h" #include "COM_ConvertColorSpaceNode.h" @@ -96,6 +97,7 @@ #include "COM_ScaleOperation.h" #include "COM_SceneTimeNode.h" #include "COM_SeparateColorNode.h" +#include "COM_SeparateXYZNode.h" #include "COM_SetAlphaNode.h" #include "COM_SetValueOperation.h" #include "COM_SplitViewerNode.h" @@ -434,6 +436,12 @@ Node *COM_convert_bnode(bNode *b_node) case CMP_NODE_CONVERT_COLOR_SPACE: node = new ConvertColorSpaceNode(b_node); break; + case CMP_NODE_SEPARATE_XYZ: + node = new SeparateXYZNode(b_node); + break; + case CMP_NODE_COMBINE_XYZ: + node = new CombineXYZNode(b_node); + break; } return node; } diff --git a/source/blender/compositor/nodes/COM_CombineXYZNode.cc b/source/blender/compositor/nodes/COM_CombineXYZNode.cc new file mode 100644 index 00000000000..2b71b94e192 --- /dev/null +++ b/source/blender/compositor/nodes/COM_CombineXYZNode.cc @@ -0,0 +1,55 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2021, Blender Foundation. + */ + +#include "COM_CombineXYZNode.h" + +#include "COM_ConvertOperation.h" + +namespace blender::compositor { + +CombineXYZNode::CombineXYZNode(bNode *editor_node) : Node(editor_node) +{ +} + +void CombineXYZNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &UNUSED(context)) const +{ + NodeInput *input_x_socket = this->get_input_socket(0); + NodeInput *input_y_socket = this->get_input_socket(1); + NodeInput *input_z_socket = this->get_input_socket(2); + NodeOutput *output_socket = this->get_output_socket(0); + + CombineChannelsOperation *operation = new CombineChannelsOperation(); + if (input_x_socket->is_linked()) { + operation->set_canvas_input_index(0); + } + else if (input_y_socket->is_linked()) { + operation->set_canvas_input_index(1); + } + else { + operation->set_canvas_input_index(2); + } + converter.add_operation(operation); + + converter.map_input_socket(input_x_socket, operation->get_input_socket(0)); + converter.map_input_socket(input_y_socket, operation->get_input_socket(1)); + converter.map_input_socket(input_z_socket, operation->get_input_socket(2)); + converter.map_output_socket(output_socket, operation->get_output_socket()); +} + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CombineXYZNode.h b/source/blender/compositor/nodes/COM_CombineXYZNode.h new file mode 100644 index 00000000000..c3bb69b03ed --- /dev/null +++ b/source/blender/compositor/nodes/COM_CombineXYZNode.h @@ -0,0 +1,36 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2021, Blender Foundation. + */ + +#pragma once + +#include "COM_Node.h" + +namespace blender::compositor { + +/** + * \brief SeparateXYZNode + * \ingroup Node + */ +class CombineXYZNode : public Node { + public: + CombineXYZNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; +}; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index 605dc1dc84d..c360e519cf8 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -16,9 +16,12 @@ * Copyright 2018, Blender Foundation. */ -#include "COM_CryptomatteNode.h" #include "BKE_node.h" + +#include "NOD_composite.h" + #include "COM_ConvertOperation.h" +#include "COM_CryptomatteNode.h" #include "COM_MultilayerImageOperation.h" #include "COM_RenderLayersProg.h" #include "COM_SetAlphaMultiplyOperation.h" diff --git a/source/blender/compositor/nodes/COM_SeparateXYZNode.cc b/source/blender/compositor/nodes/COM_SeparateXYZNode.cc new file mode 100644 index 00000000000..749116d6217 --- /dev/null +++ b/source/blender/compositor/nodes/COM_SeparateXYZNode.cc @@ -0,0 +1,63 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2021, Blender Foundation. + */ + +#include "COM_SeparateXYZNode.h" + +#include "COM_ConvertOperation.h" + +namespace blender::compositor { + +SeparateXYZNode::SeparateXYZNode(bNode *editor_node) : Node(editor_node) +{ + /* pass */ +} + +void SeparateXYZNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &UNUSED(context)) const +{ + NodeInput *vector_socket = this->get_input_socket(0); + NodeOutput *output_x_socket = this->get_output_socket(0); + NodeOutput *output_y_socket = this->get_output_socket(1); + NodeOutput *output_z_socket = this->get_output_socket(2); + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->set_channel(0); + converter.add_operation(operation); + converter.map_input_socket(vector_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_x_socket, operation->get_output_socket(0)); + } + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->set_channel(1); + converter.add_operation(operation); + converter.map_input_socket(vector_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_y_socket, operation->get_output_socket(0)); + } + + { + SeparateChannelOperation *operation = new SeparateChannelOperation(); + operation->set_channel(2); + converter.add_operation(operation); + converter.map_input_socket(vector_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_z_socket, operation->get_output_socket(0)); + } +} + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SeparateXYZNode.h b/source/blender/compositor/nodes/COM_SeparateXYZNode.h new file mode 100644 index 00000000000..1efa017d9e3 --- /dev/null +++ b/source/blender/compositor/nodes/COM_SeparateXYZNode.h @@ -0,0 +1,36 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2021, Blender Foundation. + */ + +#pragma once + +#include "COM_Node.h" + +namespace blender::compositor { + +/** + * \brief SeparateXYZNode + * \ingroup Node + */ +class SeparateXYZNode : public Node { + public: + SeparateXYZNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; +}; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index f5d47478a8d..069d00b5e66 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -22,6 +22,8 @@ #include "BKE_image.h" #include "BKE_node.h" +#include "NOD_texture.h" + namespace blender::compositor { TextureBaseOperation::TextureBaseOperation() @@ -131,11 +133,9 @@ void TextureBaseOperation::execute_pixel_sampled(float output[4], retval = multitex_ext( texture_, vec, nullptr, nullptr, 0, &texres, thread_id, pool_, scene_color_manage_, false); - output[3] = texres.talpha ? texres.ta : texres.tin; + output[3] = texres.talpha ? texres.trgba[3] : texres.tin; if (retval & TEX_RGB) { - output[0] = texres.tr; - output[1] = texres.tg; - output[2] = texres.tb; + copy_v3_v3(output, texres.trgba); } else { output[0] = output[1] = output[2] = output[3]; @@ -184,11 +184,9 @@ void TextureBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, scene_color_manage_, false); - it.out[3] = tex_result.talpha ? tex_result.ta : tex_result.tin; + it.out[3] = tex_result.talpha ? tex_result.trgba[3] : tex_result.tin; if (retval & TEX_RGB) { - it.out[0] = tex_result.tr; - it.out[1] = tex_result.tg; - it.out[2] = tex_result.tb; + copy_v3_v3(it.out, tex_result.trgba); } else { it.out[0] = it.out[1] = it.out[2] = it.out[3]; |