Files
test2/source/blender/compositor/nodes/COM_MapUVNode.cc
Martijn Versteegh a3b7674c6e Compositor: Add a Nearest sampling to Map UV node
When using the MapUV node for certain NPR workflows (for example palette
based remapping of colors) it can be useful to not use the default
anisotropic filtering.

In preparation of potentially adding more filter modes at a later stage
and to keep things consistent with the 'transform' node we use the full
set of interpolation modes in the enum, but expose only the implemented
ones in RNA..
2024-01-19 13:24:22 +01:00

33 lines
1.1 KiB
C++

/* SPDX-FileCopyrightText: 2011 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "COM_MapUVNode.h"
#include "COM_MapUVOperation.h"
namespace blender::compositor {
MapUVNode::MapUVNode(bNode *editor_node) : Node(editor_node)
{
/* pass */
}
void MapUVNode::convert_to_operations(NodeConverter &converter,
const CompositorContext & /*context*/) const
{
const bNode *node = this->get_bnode();
MapUVOperation *operation = new MapUVOperation();
operation->set_alpha(float(node->custom1));
operation->set_nearest_neighbour(static_cast<CMPNodeMapUVFiltering>(node->custom2) ==
CMP_NODE_MAP_UV_FILTERING_NEAREST);
operation->set_canvas_input_index(1);
converter.add_operation(operation);
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1));
converter.map_output_socket(get_output_socket(0), operation->get_output_socket());
}
} // namespace blender::compositor