Compositor: Turn Menu options to inputs
This patch turns node Menu options into menu inputs. This patch only covers node operations like Filter, Distort, and so on. Pixel nodes like Color Balance, Matte, and so on will be done in a separate patch. Pull Request: https://projects.blender.org/blender/blender/pulls/144495
This commit is contained in:
@@ -114,6 +114,29 @@ def add_node_type_with_searchable_enum(context, layout, node_idname, property_na
|
||||
prop.value = repr(item.identifier)
|
||||
|
||||
|
||||
def add_node_type_with_searchable_enum_socket(
|
||||
context,
|
||||
layout,
|
||||
node_idname,
|
||||
socket_identifier,
|
||||
enum_names,
|
||||
search_weight=0.0):
|
||||
add_node_type(layout, node_idname, search_weight=search_weight)
|
||||
if getattr(context, "is_menu_search", False):
|
||||
node_type = getattr(bpy.types, node_idname)
|
||||
for enum_name in enum_names:
|
||||
label = "{} ▸ {}".format(iface_(node_type.bl_rna.name), iface_(enum_name))
|
||||
props = add_node_type(
|
||||
layout,
|
||||
node_idname,
|
||||
label=label,
|
||||
translate=False,
|
||||
search_weight=search_weight)
|
||||
prop = props.settings.add()
|
||||
prop.name = f'inputs["{socket_identifier}"].default_value'
|
||||
prop.value = repr(enum_name)
|
||||
|
||||
|
||||
def add_color_mix_node(context, layout):
|
||||
label = iface_("Mix Color")
|
||||
props = node_add_menu.add_node_type(layout, "ShaderNodeMix", label=label, translate=False)
|
||||
|
||||
@@ -145,8 +145,12 @@ class NODE_MT_category_compositor_filter(Menu):
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeDilateErode")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeInpaint")
|
||||
layout.separator()
|
||||
node_add_menu.add_node_type_with_searchable_enum(context, layout, "CompositorNodeFilter", "filter_type")
|
||||
node_add_menu.add_node_type_with_searchable_enum(context, layout, "CompositorNodeGlare", "glare_type")
|
||||
node_add_menu.add_node_type_with_searchable_enum_socket(
|
||||
context, layout, "CompositorNodeFilter", "Type", [
|
||||
"Soften", "Box Sharpen", "Diamond Sharpen", "Laplace", "Sobel", "Prewitt", "Kirsch", "Shadow"])
|
||||
node_add_menu.add_node_type_with_searchable_enum_socket(
|
||||
context, layout, "CompositorNodeGlare", "Type", [
|
||||
"Bloom", "Ghosts", "Streaks", "Fog Glow", "Simple Star", "Sun Beams"])
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeKuwahara")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodePixelate")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodePosterize")
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 65
|
||||
#define BLENDER_FILE_SUBVERSION 66
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -799,6 +799,182 @@ static void write_legacy_properties(bNodeTree &ntree)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NTREE_COMPOSIT: {
|
||||
for (bNode *node : ntree.all_nodes()) {
|
||||
if (node->type_legacy == CMP_NODE_BLUR) {
|
||||
auto &storage = *static_cast<NodeBlurData *>(node->storage);
|
||||
const bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
storage.filtertype = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_FILTER) {
|
||||
const bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_VIEW_LEVELS) {
|
||||
const bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Channel");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_DILATEERODE) {
|
||||
const bNodeSocket *type_socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
node->custom1 = type_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
|
||||
auto &storage = *static_cast<NodeDilateErode *>(node->storage);
|
||||
const bNodeSocket *falloff_socket = node_find_socket(*node, SOCK_IN, "Falloff");
|
||||
storage.falloff = falloff_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TONEMAP) {
|
||||
auto &storage = *static_cast<NodeTonemap *>(node->storage);
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
storage.type = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_LENSDIST) {
|
||||
auto &storage = *static_cast<NodeLensDist *>(node->storage);
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
storage.distortion_type = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_KUWAHARA) {
|
||||
auto &storage = *static_cast<NodeKuwaharaData *>(node->storage);
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
storage.variation = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_DENOISE) {
|
||||
auto &storage = *static_cast<NodeDenoise *>(node->storage);
|
||||
bNodeSocket *prefilter_socket = node_find_socket(*node, SOCK_IN, "Prefilter");
|
||||
storage.prefilter = prefilter_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *quality_socket = node_find_socket(*node, SOCK_IN, "Quality");
|
||||
storage.quality = quality_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TRANSLATE) {
|
||||
auto &storage = *static_cast<NodeTranslateData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TRANSFORM) {
|
||||
auto &storage = *static_cast<NodeTransformData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_CORNERPIN) {
|
||||
auto &storage = *static_cast<NodeCornerPinData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MAP_UV) {
|
||||
auto &storage = *static_cast<NodeMapUVData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_SCALE) {
|
||||
bNodeSocket *type_socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
node->custom1 = type_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *frame_type_socket = node_find_socket(*node, SOCK_IN, "Frame Type");
|
||||
node->custom2 = frame_type_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
|
||||
auto &storage = *static_cast<NodeScaleData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_ROTATE) {
|
||||
auto &storage = *static_cast<NodeRotateData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_DISPLACE) {
|
||||
auto &storage = *static_cast<NodeDisplaceData *>(node->storage);
|
||||
bNodeSocket *interpolation_socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
storage.interpolation =
|
||||
interpolation_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_x_socket = node_find_socket(*node, SOCK_IN, "Extension X");
|
||||
storage.extension_x =
|
||||
extension_x_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *extension_y_socket = node_find_socket(*node, SOCK_IN, "Extension Y");
|
||||
storage.extension_y =
|
||||
extension_y_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_STABILIZE2D) {
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Interpolation");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MASK_BOX) {
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Operation");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MASK_ELLIPSE) {
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Operation");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TRACKPOS) {
|
||||
bNodeSocket *mode_socket = node_find_socket(*node, SOCK_IN, "Mode");
|
||||
node->custom1 = mode_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *frame_socket = node_find_socket(*node, SOCK_IN, "Frame");
|
||||
node->custom2 = frame_socket->default_value_typed<bNodeSocketValueInt>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_KEYING) {
|
||||
auto &storage = *static_cast<NodeKeyingData *>(node->storage);
|
||||
bNodeSocket *feather_falloff_socket = node_find_socket(
|
||||
*node, SOCK_IN, "Feather Falloff");
|
||||
storage.feather_falloff =
|
||||
feather_falloff_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MASK) {
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Size Source");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MOVIEDISTORTION) {
|
||||
bNodeSocket *socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
node->custom1 = socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_GLARE) {
|
||||
auto &storage = *static_cast<NodeGlare *>(node->storage);
|
||||
bNodeSocket *type_socket = node_find_socket(*node, SOCK_IN, "Type");
|
||||
storage.type = type_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
bNodeSocket *quality_socket = node_find_socket(*node, SOCK_IN, "Quality");
|
||||
storage.quality = quality_socket->default_value_typed<bNodeSocketValueMenu>()->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1369,19 +1369,21 @@ static void do_version_sun_beams(bNodeTree &node_tree, bNode &node)
|
||||
bNodeSocket *old_image_output = blender::bke::node_find_socket(node, SOCK_OUT, "Image");
|
||||
|
||||
bNode *glare_node = blender::bke::node_add_node(nullptr, node_tree, "CompositorNodeGlare");
|
||||
static_cast<NodeGlare *>(glare_node->storage)->type = CMP_NODE_GLARE_SUN_BEAMS;
|
||||
static_cast<NodeGlare *>(glare_node->storage)->quality = 0;
|
||||
glare_node->parent = node.parent;
|
||||
glare_node->location[0] = node.location[0];
|
||||
glare_node->location[1] = node.location[1];
|
||||
|
||||
bNodeSocket *image_input = blender::bke::node_find_socket(*glare_node, SOCK_IN, "Image");
|
||||
bNodeSocket *type_input = blender::bke::node_find_socket(*glare_node, SOCK_IN, "Type");
|
||||
bNodeSocket *quality_input = blender::bke::node_find_socket(*glare_node, SOCK_IN, "Quality");
|
||||
bNodeSocket *threshold_input = blender::bke::node_find_socket(
|
||||
*glare_node, SOCK_IN, "Highlights Threshold");
|
||||
bNodeSocket *size_input = blender::bke::node_find_socket(*glare_node, SOCK_IN, "Size");
|
||||
bNodeSocket *source_input = blender::bke::node_find_socket(*glare_node, SOCK_IN, "Sun Position");
|
||||
bNodeSocket *glare_output = blender::bke::node_find_socket(*glare_node, SOCK_OUT, "Glare");
|
||||
|
||||
type_input->default_value_typed<bNodeSocketValueMenu>()->value = CMP_NODE_GLARE_SUN_BEAMS;
|
||||
quality_input->default_value_typed<bNodeSocketValueMenu>()->value = CMP_NODE_GLARE_QUALITY_HIGH;
|
||||
copy_v4_v4(image_input->default_value_typed<bNodeSocketValueRGBA>()->value,
|
||||
old_image_input->default_value_typed<bNodeSocketValueRGBA>()->value);
|
||||
threshold_input->default_value_typed<bNodeSocketValueFloat>()->value = 0.0f;
|
||||
@@ -1600,6 +1602,327 @@ static void do_version_world_remove_use_nodes(Main *bmain, World *world)
|
||||
new_output.parent = frame;
|
||||
}
|
||||
|
||||
static void do_version_blur_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
const auto &storage = *static_cast<NodeBlurData *>(node.storage);
|
||||
bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.filtertype;
|
||||
}
|
||||
|
||||
static void do_version_filter_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_levels_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Channel")) {
|
||||
return;
|
||||
}
|
||||
bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Channel");
|
||||
socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_dilate_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
bNodeSocket &type_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
type_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
|
||||
const auto &storage = *static_cast<NodeDilateErode *>(node.storage);
|
||||
bNodeSocket &falloff_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Falloff");
|
||||
falloff_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.falloff;
|
||||
}
|
||||
|
||||
static void do_version_tone_map_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeTonemap *>(node.storage);
|
||||
bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.type;
|
||||
}
|
||||
|
||||
static void do_version_lens_distortion_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeLensDist *>(node.storage);
|
||||
bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.distortion_type;
|
||||
}
|
||||
|
||||
static void do_version_kuwahara_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeKuwaharaData *>(node.storage);
|
||||
bNodeSocket &socket = version_node_add_socket(ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.variation;
|
||||
}
|
||||
|
||||
static void do_version_denoise_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Prefilter")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeDenoise *>(node.storage);
|
||||
bNodeSocket &prefilter_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Prefilter");
|
||||
prefilter_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.prefilter;
|
||||
bNodeSocket &quality_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Quality");
|
||||
quality_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.quality;
|
||||
}
|
||||
|
||||
static void do_version_translate_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeTranslateData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_transform_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeTransformData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_corner_pin_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeCornerPinData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_map_uv_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeMapUVData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_scale_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &type_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
type_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
bNodeSocket &frame_type_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Frame Type");
|
||||
frame_type_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom2;
|
||||
|
||||
const auto &storage = *static_cast<NodeScaleData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_rotate_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeRotateData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_displace_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeDisplaceData *>(node.storage);
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.interpolation;
|
||||
bNodeSocket &extension_x_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension X");
|
||||
extension_x_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_x;
|
||||
bNodeSocket &extension_y_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Extension Y");
|
||||
extension_y_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.extension_y;
|
||||
}
|
||||
|
||||
static void do_version_stabilize_2d_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Interpolation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &interpolation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Interpolation");
|
||||
interpolation_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_box_mask_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Operation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &operation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Operation");
|
||||
operation_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_ellipse_mask_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Operation")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &operation_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Operation");
|
||||
operation_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_track_position_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Mode")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &mode_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Mode");
|
||||
mode_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
bNodeSocket &frame_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketInt", "Frame");
|
||||
frame_socket.default_value_typed<bNodeSocketValueInt>()->value = node.custom2;
|
||||
}
|
||||
|
||||
static void do_version_keying_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Feather Falloff")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeKeyingData *>(node.storage);
|
||||
bNodeSocket &feather_falloff_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Feather Falloff");
|
||||
feather_falloff_socket.default_value_typed<bNodeSocketValueMenu>()->value =
|
||||
storage.feather_falloff;
|
||||
}
|
||||
|
||||
static void do_version_mask_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Size Source")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &size_source_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Size Source");
|
||||
size_source_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_movie_distortion_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeSocket &type_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
type_socket.default_value_typed<bNodeSocketValueMenu>()->value = node.custom1;
|
||||
}
|
||||
|
||||
static void do_version_glare_menus_to_inputs(bNodeTree &ntree, bNode &node)
|
||||
{
|
||||
if (blender::bke::node_find_socket(node, SOCK_IN, "Type")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &storage = *static_cast<NodeGlare *>(node.storage);
|
||||
bNodeSocket &type_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Type");
|
||||
type_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.type;
|
||||
bNodeSocket &quality_socket = version_node_add_socket(
|
||||
ntree, node, SOCK_IN, "NodeSocketMenu", "Quality");
|
||||
quality_socket.default_value_typed<bNodeSocketValueMenu>()->value = storage.quality;
|
||||
}
|
||||
|
||||
void do_versions_after_linking_500(FileData *fd, Main *bmain)
|
||||
{
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 9)) {
|
||||
@@ -2432,6 +2755,86 @@ void blo_do_versions_500(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 66)) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, node_tree, id) {
|
||||
if (node_tree->type != NTREE_COMPOSIT) {
|
||||
continue;
|
||||
}
|
||||
LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) {
|
||||
if (node->type_legacy == CMP_NODE_BLUR) {
|
||||
do_version_blur_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_FILTER) {
|
||||
do_version_filter_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_VIEW_LEVELS) {
|
||||
do_version_levels_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_DILATEERODE) {
|
||||
do_version_dilate_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TONEMAP) {
|
||||
do_version_tone_map_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_LENSDIST) {
|
||||
do_version_lens_distortion_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_KUWAHARA) {
|
||||
do_version_kuwahara_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_DENOISE) {
|
||||
do_version_denoise_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TRANSLATE) {
|
||||
do_version_translate_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TRANSFORM) {
|
||||
do_version_transform_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_CORNERPIN) {
|
||||
do_version_corner_pin_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MAP_UV) {
|
||||
do_version_map_uv_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_SCALE) {
|
||||
do_version_scale_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_ROTATE) {
|
||||
do_version_rotate_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_DISPLACE) {
|
||||
do_version_displace_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_STABILIZE2D) {
|
||||
do_version_stabilize_2d_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MASK_BOX) {
|
||||
do_version_box_mask_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MASK_ELLIPSE) {
|
||||
do_version_ellipse_mask_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_TRACKPOS) {
|
||||
do_version_track_position_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_KEYING) {
|
||||
do_version_keying_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MASK) {
|
||||
do_version_mask_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_MOVIEDISTORTION) {
|
||||
do_version_movie_distortion_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
else if (node->type_legacy == CMP_NODE_GLARE) {
|
||||
do_version_glare_menus_to_inputs(*node_tree, *node);
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace blender::compositor {
|
||||
class Context;
|
||||
|
||||
enum class DistortionType : uint8_t {
|
||||
Distort,
|
||||
Undistort,
|
||||
Distort = 0,
|
||||
Undistort = 1,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -755,19 +755,26 @@ static bool WIDGETGROUP_node_glare_poll(const bContext *C, wmGizmoGroupType * /*
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNode *node = bke::node_get_active(*snode->edittree);
|
||||
|
||||
if ((node && node->is_type("CompositorNodeGlare")) &&
|
||||
static_cast<NodeGlare *>(node->storage)->type == CMP_NODE_GLARE_SUN_BEAMS)
|
||||
{
|
||||
snode->edittree->ensure_topology_cache();
|
||||
LISTBASE_FOREACH (bNodeSocket *, input, &node->inputs) {
|
||||
if (STR_ELEM(input->name, "Sun Position") && input->is_directly_linked()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (!node || !node->is_type("CompositorNodeGlare")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
bNodeSocket &type_socket = *blender::bke::node_find_socket(*node, SOCK_IN, "Type");
|
||||
snode->edittree->ensure_topology_cache();
|
||||
if (type_socket.is_directly_linked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type_socket.default_value_typed<bNodeSocketValueMenu>()->value != CMP_NODE_GLARE_SUN_BEAMS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (bNodeSocket *, input, &node->inputs) {
|
||||
if (STR_ELEM(input->name, "Sun Position") && input->is_directly_linked()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void WIDGETGROUP_node_glare_setup(const bContext * /*C*/, wmGizmoGroup *gzgroup)
|
||||
|
||||
@@ -1182,7 +1182,7 @@ typedef struct NodeBlurData {
|
||||
float fac DNA_DEPRECATED;
|
||||
float percentx DNA_DEPRECATED;
|
||||
float percenty DNA_DEPRECATED;
|
||||
short filtertype;
|
||||
short filtertype DNA_DEPRECATED;
|
||||
char bokeh DNA_DEPRECATED;
|
||||
char gamma DNA_DEPRECATED;
|
||||
} NodeBlurData;
|
||||
@@ -1207,7 +1207,7 @@ typedef struct NodeBilateralBlurData {
|
||||
|
||||
typedef struct NodeKuwaharaData {
|
||||
short size DNA_DEPRECATED;
|
||||
short variation;
|
||||
short variation DNA_DEPRECATED;
|
||||
int uniformity DNA_DEPRECATED;
|
||||
float sharpness DNA_DEPRECATED;
|
||||
float eccentricity DNA_DEPRECATED;
|
||||
@@ -1351,8 +1351,8 @@ typedef struct NodeScriptDict {
|
||||
|
||||
/** glare node. */
|
||||
typedef struct NodeGlare {
|
||||
char type;
|
||||
char quality;
|
||||
char type DNA_DEPRECATED;
|
||||
char quality DNA_DEPRECATED;
|
||||
char iter DNA_DEPRECATED;
|
||||
char angle DNA_DEPRECATED;
|
||||
char _pad0;
|
||||
@@ -1383,7 +1383,7 @@ typedef struct NodeTonemap {
|
||||
float m DNA_DEPRECATED;
|
||||
float a DNA_DEPRECATED;
|
||||
float c DNA_DEPRECATED;
|
||||
int type;
|
||||
int type DNA_DEPRECATED;
|
||||
} NodeTonemap;
|
||||
|
||||
/* Lens Distortion node. */
|
||||
@@ -1392,7 +1392,7 @@ typedef struct NodeLensDist {
|
||||
short proj DNA_DEPRECATED;
|
||||
short fit DNA_DEPRECATED;
|
||||
char _pad[2];
|
||||
int distortion_type;
|
||||
int distortion_type DNA_DEPRECATED;
|
||||
} NodeLensDist;
|
||||
|
||||
typedef struct NodeColorBalance {
|
||||
@@ -1586,7 +1586,7 @@ typedef struct NodeKeyingData {
|
||||
float clip_white DNA_DEPRECATED;
|
||||
int dilate_distance DNA_DEPRECATED;
|
||||
int feather_distance DNA_DEPRECATED;
|
||||
int feather_falloff;
|
||||
int feather_falloff DNA_DEPRECATED;
|
||||
int blur_pre DNA_DEPRECATED;
|
||||
int blur_post DNA_DEPRECATED;
|
||||
} NodeKeyingData;
|
||||
@@ -1597,47 +1597,47 @@ typedef struct NodeTrackPosData {
|
||||
} NodeTrackPosData;
|
||||
|
||||
typedef struct NodeTransformData {
|
||||
short interpolation;
|
||||
char extension_x;
|
||||
char extension_y;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
char extension_x DNA_DEPRECATED;
|
||||
char extension_y DNA_DEPRECATED;
|
||||
} NodeTransformData;
|
||||
|
||||
typedef struct NodeTranslateData {
|
||||
char wrap_axis DNA_DEPRECATED;
|
||||
char relative DNA_DEPRECATED;
|
||||
short extension_x;
|
||||
short extension_y;
|
||||
short interpolation;
|
||||
short extension_x DNA_DEPRECATED;
|
||||
short extension_y DNA_DEPRECATED;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
} NodeTranslateData;
|
||||
|
||||
typedef struct NodeRotateData {
|
||||
short interpolation;
|
||||
char extension_x;
|
||||
char extension_y;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
char extension_x DNA_DEPRECATED;
|
||||
char extension_y DNA_DEPRECATED;
|
||||
} NodeRotateData;
|
||||
|
||||
typedef struct NodeScaleData {
|
||||
short interpolation;
|
||||
char extension_x;
|
||||
char extension_y;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
char extension_x DNA_DEPRECATED;
|
||||
char extension_y DNA_DEPRECATED;
|
||||
} NodeScaleData;
|
||||
|
||||
typedef struct NodeCornerPinData {
|
||||
short interpolation;
|
||||
char extension_x;
|
||||
char extension_y;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
char extension_x DNA_DEPRECATED;
|
||||
char extension_y DNA_DEPRECATED;
|
||||
} NodeCornerPinData;
|
||||
|
||||
typedef struct NodeDisplaceData {
|
||||
short interpolation;
|
||||
char extension_x;
|
||||
char extension_y;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
char extension_x DNA_DEPRECATED;
|
||||
char extension_y DNA_DEPRECATED;
|
||||
} NodeDisplaceData;
|
||||
|
||||
typedef struct NodeMapUVData {
|
||||
short interpolation;
|
||||
char extension_x;
|
||||
char extension_y;
|
||||
short interpolation DNA_DEPRECATED;
|
||||
char extension_x DNA_DEPRECATED;
|
||||
char extension_y DNA_DEPRECATED;
|
||||
} NodeMapUVData;
|
||||
|
||||
typedef struct NodePlaneTrackDeformData {
|
||||
@@ -1738,8 +1738,8 @@ typedef struct NodeCryptomatte {
|
||||
|
||||
typedef struct NodeDenoise {
|
||||
char hdr DNA_DEPRECATED;
|
||||
char prefilter;
|
||||
char quality;
|
||||
char prefilter DNA_DEPRECATED;
|
||||
char quality DNA_DEPRECATED;
|
||||
char _pad[1];
|
||||
} NodeDenoise;
|
||||
|
||||
|
||||
@@ -188,12 +188,14 @@ DEF_ENUM(rna_enum_node_vec_math_items)
|
||||
DEF_ENUM(rna_enum_node_boolean_math_items)
|
||||
DEF_ENUM(rna_enum_node_float_compare_items)
|
||||
DEF_ENUM(rna_enum_node_compare_operation_items)
|
||||
DEF_ENUM(rna_enum_node_filter_items)
|
||||
DEF_ENUM(rna_enum_node_integer_math_items)
|
||||
DEF_ENUM(rna_enum_node_float_to_int_items)
|
||||
DEF_ENUM(rna_enum_node_map_range_items)
|
||||
DEF_ENUM(rna_enum_node_clamp_items)
|
||||
|
||||
DEF_ENUM(rna_enum_node_compositor_extension_items)
|
||||
DEF_ENUM(rna_enum_node_compositor_interpolation_items)
|
||||
|
||||
DEF_ENUM(rna_enum_ramp_blend_items)
|
||||
|
||||
DEF_ENUM(rna_enum_prop_dynamicpaint_type_items)
|
||||
|
||||
@@ -480,18 +480,6 @@ static const EnumPropertyItem rna_enum_node_tex_dimensions_items[] = {
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
const EnumPropertyItem rna_enum_node_filter_items[] = {
|
||||
{0, "SOFTEN", 0, "Soften", ""},
|
||||
{1, "SHARPEN", 0, "Box Sharpen", "An aggressive sharpening filter"},
|
||||
{7, "SHARPEN_DIAMOND", 0, "Diamond Sharpen", "A moderate sharpening filter"},
|
||||
{2, "LAPLACE", 0, "Laplace", ""},
|
||||
{3, "SOBEL", 0, "Sobel", ""},
|
||||
{4, "PREWITT", 0, "Prewitt", ""},
|
||||
{5, "KIRSCH", 0, "Kirsch", ""},
|
||||
{6, "SHADOW", 0, "Shadow", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem rna_node_geometry_curve_handle_type_items[] = {
|
||||
{GEO_NODE_CURVE_HANDLE_FREE,
|
||||
"FREE",
|
||||
@@ -570,8 +558,7 @@ const EnumPropertyItem rna_enum_geometry_nodes_linear_gizmo_draw_style_items[] =
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
#ifndef RNA_RUNTIME
|
||||
static const EnumPropertyItem cmp_extension_mode_items[] = {
|
||||
const EnumPropertyItem rna_enum_node_compositor_extension_items[] = {
|
||||
{CMP_NODE_EXTENSION_MODE_CLIP,
|
||||
"CLIP",
|
||||
0,
|
||||
@@ -590,7 +577,7 @@ static const EnumPropertyItem cmp_extension_mode_items[] = {
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem cmp_interpolation_items[] = {
|
||||
const EnumPropertyItem rna_enum_node_compositor_interpolation_items[] = {
|
||||
{CMP_NODE_INTERPOLATION_NEAREST, "NEAREST", 0, "Nearest", "Use Nearest interpolation"},
|
||||
{CMP_NODE_INTERPOLATION_BILINEAR, "BILINEAR", 0, "Bilinear", "Use Bilinear interpolation"},
|
||||
{CMP_NODE_INTERPOLATION_BICUBIC, "BICUBIC", 0, "Bicubic", "Use Cubic B-Spline interpolation"},
|
||||
@@ -602,6 +589,8 @@ static const EnumPropertyItem cmp_interpolation_items[] = {
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
#ifndef RNA_RUNTIME
|
||||
|
||||
static const EnumPropertyItem prop_shader_output_target_items[] = {
|
||||
{SHD_OUTPUT_ALL,
|
||||
"ALL",
|
||||
@@ -4069,11 +4058,6 @@ void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
rna_Node_update(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
rna_Node_update(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
static void rna_ShaderNode_is_active_output_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
|
||||
@@ -6296,41 +6280,6 @@ static void def_sh_script(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
|
||||
/* -- Compositor Nodes ------------------------------------------------------ */
|
||||
|
||||
static void def_cmp_blur(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
static const EnumPropertyItem filter_type_items[] = {
|
||||
{R_FILTER_BOX, "FLAT", 0, "Flat", ""},
|
||||
{R_FILTER_TENT, "TENT", 0, "Tent", ""},
|
||||
{R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
|
||||
{R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
|
||||
{R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
|
||||
{R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
|
||||
{R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
|
||||
{R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
|
||||
|
||||
PropertyRNA *prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "filtertype");
|
||||
RNA_def_property_enum_items(prop, filter_type_items);
|
||||
RNA_def_property_ui_text(prop, "Filter Type", "");
|
||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_NODETREE);
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_filter(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, rna_enum_node_filter_items);
|
||||
RNA_def_property_ui_text(prop, "Filter Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_set_alpha(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -6357,26 +6306,6 @@ static void def_cmp_set_alpha(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_levels(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem channel_items[] = {
|
||||
{CMP_NODE_LEVLES_LUMINANCE, "COMBINED_RGB", 0, "Combined", "Combined RGB"},
|
||||
{CMP_NODE_LEVLES_RED, "RED", 0, "Red", "Red Channel"},
|
||||
{CMP_NODE_LEVLES_GREEN, "GREEN", 0, "Green", "Green Channel"},
|
||||
{CMP_NODE_LEVLES_BLUE, "BLUE", 0, "Blue", "Blue Channel"},
|
||||
{CMP_NODE_LEVLES_LUMINANCE_BT709, "LUMINANCE", 0, "Luminance", "Luminance Channel"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, channel_items);
|
||||
RNA_def_property_ui_text(prop, "Channel", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_node_image_user(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -6570,139 +6499,6 @@ static void def_cmp_file_output(BlenderRNA *brna, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, nullptr);
|
||||
}
|
||||
|
||||
static void def_cmp_dilate_erode(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem mode_items[] = {
|
||||
{CMP_NODE_DILATE_ERODE_STEP, "STEP", 0, "Steps", ""},
|
||||
{CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD, "THRESHOLD", 0, "Threshold", ""},
|
||||
{CMP_NODE_DILATE_ERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
|
||||
{CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, mode_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
|
||||
|
||||
/* CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER only */
|
||||
prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "falloff");
|
||||
RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Falloff type of the feather");
|
||||
RNA_def_property_translation_context(prop,
|
||||
BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_displace(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeDisplaceData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_scale(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem space_items[] = {
|
||||
{CMP_NODE_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
|
||||
{CMP_NODE_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
|
||||
{CMP_NODE_SCALE_RENDER_PERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
|
||||
{CMP_NODE_SCALE_RENDER_SIZE, "RENDER_SIZE", 0, "Render Size", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* matching bgpic_camera_frame_items[] */
|
||||
static const EnumPropertyItem space_frame_items[] = {
|
||||
{CMP_NODE_SCALE_RENDER_SIZE_STRETCH, "STRETCH", 0, "Stretch", ""},
|
||||
{CMP_NODE_SCALE_RENDER_SIZE_FIT, "FIT", 0, "Fit", ""},
|
||||
{CMP_NODE_SCALE_RENDER_SIZE_CROP, "CROP", 0, "Crop", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, space_items);
|
||||
RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
|
||||
|
||||
/* expose 2 flags as a enum of 3 items */
|
||||
prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "custom2");
|
||||
RNA_def_property_enum_items(prop, space_frame_items);
|
||||
RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeScaleData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_rotate(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
RNA_def_struct_sdna_from(srna, "NodeRotateData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_distance_matte(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
static const EnumPropertyItem color_space_items[] = {
|
||||
@@ -6845,17 +6641,6 @@ static void def_cmp_channel_matte(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_split(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom2");
|
||||
RNA_def_property_enum_items(prop, rna_enum_axis_xy_items);
|
||||
RNA_def_property_ui_text(prop, "Axis", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_double_edge_mask(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -6890,31 +6675,6 @@ static void def_cmp_double_edge_mask(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_map_uv(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeMapUVData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_defocus(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -7007,92 +6767,6 @@ static void def_cmp_premul_key(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_glare(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_GLARE_BLOOM, "BLOOM", 0, "Bloom", ""},
|
||||
{CMP_NODE_GLARE_GHOST, "GHOSTS", 0, "Ghosts", ""},
|
||||
{CMP_NODE_GLARE_STREAKS, "STREAKS", 0, "Streaks", ""},
|
||||
{CMP_NODE_GLARE_FOG_GLOW, "FOG_GLOW", 0, "Fog Glow", ""},
|
||||
{CMP_NODE_GLARE_SIMPLE_STAR, "SIMPLE_STAR", 0, "Simple Star", ""},
|
||||
{CMP_NODE_GLARE_SUN_BEAMS, "SUN_BEAMS", 0, "Sun Beams", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem quality_items[] = {
|
||||
{CMP_NODE_GLARE_QUALITY_HIGH, "HIGH", 0, "High", ""},
|
||||
{CMP_NODE_GLARE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", ""},
|
||||
{CMP_NODE_GLARE_QUALITY_LOW, "LOW", 0, "Low", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "type");
|
||||
RNA_def_property_enum_items(prop, type_items);
|
||||
RNA_def_property_ui_text(prop, "Glare Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "quality");
|
||||
RNA_def_property_enum_items(prop, quality_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Quality",
|
||||
"If not set to high quality, the effect will be applied to a low-res copy "
|
||||
"of the source image");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_tonemap(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{1,
|
||||
"RD_PHOTORECEPTOR",
|
||||
0,
|
||||
"R/D Photoreceptor",
|
||||
"More advanced algorithm based on eye physiology, by Reinhard and Devlin"},
|
||||
{0, "RH_SIMPLE", 0, "Rh Simple", "Simpler photographic algorithm by Reinhard"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
|
||||
|
||||
PropertyRNA *prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "type");
|
||||
RNA_def_property_enum_items(prop, type_items);
|
||||
RNA_def_property_ui_text(prop, "Tonemap Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_lensdist(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_LENS_DISTORTION_RADIAL,
|
||||
"RADIAL",
|
||||
0,
|
||||
"Radial",
|
||||
"Radially distorts the image to create a barrel or a Pincushion distortion"},
|
||||
{CMP_NODE_LENS_DISTORTION_HORIZONTAL,
|
||||
"HORIZONTAL",
|
||||
0,
|
||||
"Horizontal",
|
||||
"Horizontally distorts the image to create a channel/color shifting effect"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
|
||||
|
||||
PropertyRNA *prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "distortion_type");
|
||||
RNA_def_property_enum_items(prop, type_items);
|
||||
RNA_def_property_ui_text(prop, "Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_colorbalance(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -7238,24 +6912,12 @@ static void def_cmp_stabilize2d(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Movie Clip", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
|
||||
|
||||
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_moviedistortion(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem distortion_type_items[] = {
|
||||
{0, "UNDISTORT", 0, "Undistort", ""},
|
||||
{1, "DISTORT", 0, "Distort", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "id");
|
||||
RNA_def_property_struct_type(prop, "MovieClip");
|
||||
@@ -7263,29 +6925,12 @@ static void def_cmp_moviedistortion(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Movie Clip", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
|
||||
|
||||
prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, distortion_type_items);
|
||||
RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_mask(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem aspect_type_items[] = {
|
||||
{0, "SCENE", 0, "Scene Size", ""},
|
||||
{CMP_NODE_MASK_FLAG_SIZE_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
|
||||
{CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE,
|
||||
"FIXED_SCENE",
|
||||
0,
|
||||
"Fixed/Scene",
|
||||
"Pixel size scaled by scene percentage"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "id");
|
||||
RNA_def_property_struct_type(prop, "Mask");
|
||||
@@ -7293,65 +6938,6 @@ static void def_cmp_mask(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Mask", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
|
||||
|
||||
prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, aspect_type_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Size Source", "Where to get the mask size from for aspect/size information");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
/* -- Compositor Nodes ------------------------------------------------------ */
|
||||
|
||||
static const EnumPropertyItem node_masktype_items[] = {
|
||||
{0, "ADD", 0, "Add", ""},
|
||||
{1, "SUBTRACT", 0, "Subtract", ""},
|
||||
{2, "MULTIPLY", 0, "Multiply", ""},
|
||||
{3, "NOT", 0, "Not", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void def_cmp_boxmask(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, node_masktype_items);
|
||||
RNA_def_property_ui_text(prop, "Mask Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_ellipsemask(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, node_masktype_items);
|
||||
RNA_def_property_ui_text(prop, "Mask Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_cornerpin(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
RNA_def_struct_sdna_from(srna, "NodeCornerPinData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_viewer(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
@@ -7385,47 +6971,10 @@ static void def_cmp_keyingscreen(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_keying(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
|
||||
|
||||
PropertyRNA *prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "feather_falloff");
|
||||
RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type of the feather");
|
||||
RNA_def_property_translation_context(prop,
|
||||
BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_trackpos(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem position_items[] = {
|
||||
{CMP_NODE_TRACK_POSITION_ABSOLUTE,
|
||||
"ABSOLUTE",
|
||||
0,
|
||||
"Absolute",
|
||||
"Output absolute position of a marker"},
|
||||
{CMP_NODE_TRACK_POSITION_RELATIVE_START,
|
||||
"RELATIVE_START",
|
||||
0,
|
||||
"Relative Start",
|
||||
"Output position of a marker relative to first marker of a track"},
|
||||
{CMP_NODE_TRACK_POSITION_RELATIVE_FRAME,
|
||||
"RELATIVE_FRAME",
|
||||
0,
|
||||
"Relative Frame",
|
||||
"Output position of a marker relative to marker at given frame number"},
|
||||
{CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME,
|
||||
"ABSOLUTE_FRAME",
|
||||
0,
|
||||
"Absolute Frame",
|
||||
"Output absolute position of a marker at given frame number"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "id");
|
||||
RNA_def_property_struct_type(prop, "MovieClip");
|
||||
@@ -7434,17 +6983,6 @@ static void def_cmp_trackpos(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_ui_text(prop, "Movie Clip", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
|
||||
|
||||
prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, position_items);
|
||||
RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "custom2");
|
||||
RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
|
||||
@@ -7459,55 +6997,6 @@ static void def_cmp_trackpos(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_transform(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeTransformData", "storage");
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_translate(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "interpolation");
|
||||
RNA_def_property_enum_items(prop, cmp_interpolation_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_x", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_x");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "X Extension Mode", "The extension mode applied to the X axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "extension_y", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "extension_y");
|
||||
RNA_def_property_enum_items(prop, cmp_extension_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Y Extension Mode", "The extension mode applied to the Y axis");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_planetrackdeform(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -7664,77 +7153,6 @@ static void def_cmp_cryptomatte(BlenderRNA *brna, StructRNA *srna)
|
||||
def_node_image_user(brna, srna);
|
||||
}
|
||||
|
||||
static void def_cmp_denoise(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem prefilter_items[] = {
|
||||
{CMP_NODE_DENOISE_PREFILTER_NONE,
|
||||
"NONE",
|
||||
0,
|
||||
"None",
|
||||
"No prefiltering, use when guiding passes are noise-free"},
|
||||
{CMP_NODE_DENOISE_PREFILTER_FAST,
|
||||
"FAST",
|
||||
0,
|
||||
"Fast",
|
||||
"Denoise image and guiding passes together. Improves quality when guiding passes are noisy "
|
||||
"using least amount of extra processing time."},
|
||||
{CMP_NODE_DENOISE_PREFILTER_ACCURATE,
|
||||
"ACCURATE",
|
||||
0,
|
||||
"Accurate",
|
||||
"Prefilter noisy guiding passes before denoising image. Improves quality when guiding "
|
||||
"passes are noisy using extra processing time."},
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
static const EnumPropertyItem quality_items[] = {
|
||||
{CMP_NODE_DENOISE_QUALITY_SCENE,
|
||||
"FOLLOW_SCENE",
|
||||
0,
|
||||
"Follow Scene",
|
||||
"Use the scene's denoising quality setting"},
|
||||
{CMP_NODE_DENOISE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
|
||||
{CMP_NODE_DENOISE_QUALITY_BALANCED,
|
||||
"BALANCED",
|
||||
0,
|
||||
"Balanced",
|
||||
"Balanced between performance and quality"},
|
||||
{CMP_NODE_DENOISE_QUALITY_FAST, "FAST", 0, "Fast", "High perfomance"},
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeDenoise", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "prefilter", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prefilter_items);
|
||||
RNA_def_property_enum_default(prop, CMP_NODE_DENOISE_PREFILTER_ACCURATE);
|
||||
RNA_def_property_ui_text(prop, "", "Denoising prefilter");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, quality_items);
|
||||
RNA_def_property_enum_default(prop, CMP_NODE_DENOISE_QUALITY_SCENE);
|
||||
RNA_def_property_ui_text(prop, "", "Denoising quality");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_kuwahara(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
{
|
||||
RNA_def_struct_sdna_from(srna, "NodeKuwaharaData", "storage");
|
||||
|
||||
static const EnumPropertyItem variation_items[] = {
|
||||
{0, "CLASSIC", 0, "Classic", "Fast but less accurate variation"},
|
||||
{1, "ANISOTROPIC", 0, "Anisotropic", "Accurate but slower variation"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
PropertyRNA *prop = RNA_def_property(srna, "variation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "variation");
|
||||
RNA_def_property_enum_items(prop, variation_items);
|
||||
RNA_def_property_ui_text(prop, "", "Variation of Kuwahara filter to use");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
/* -- Texture Nodes --------------------------------------------------------- */
|
||||
|
||||
static void def_tex_output(BlenderRNA * /*brna*/, StructRNA *srna)
|
||||
@@ -10478,10 +9896,10 @@ static void rna_def_nodes(BlenderRNA *brna)
|
||||
define("CompositorNode", "CompositorNodeAlphaOver");
|
||||
define("CompositorNode", "CompositorNodeAntiAliasing");
|
||||
define("CompositorNode", "CompositorNodeBilateralblur");
|
||||
define("CompositorNode", "CompositorNodeBlur", def_cmp_blur);
|
||||
define("CompositorNode", "CompositorNodeBlur");
|
||||
define("CompositorNode", "CompositorNodeBokehBlur");
|
||||
define("CompositorNode", "CompositorNodeBokehImage");
|
||||
define("CompositorNode", "CompositorNodeBoxMask", def_cmp_boxmask);
|
||||
define("CompositorNode", "CompositorNodeBoxMask");
|
||||
define("CompositorNode", "CompositorNodeBrightContrast");
|
||||
define("CompositorNode", "CompositorNodeChannelMatte", def_cmp_channel_matte);
|
||||
define("CompositorNode", "CompositorNodeChromaMatte");
|
||||
@@ -10495,26 +9913,26 @@ static void rna_def_nodes(BlenderRNA *brna)
|
||||
define("CompositorNode", "CompositorNodeCombYCCA", def_cmp_ycc);
|
||||
define("CompositorNode", "CompositorNodeCombYUVA");
|
||||
define("CompositorNode", "CompositorNodeConvertColorSpace", def_cmp_convert_color_space);
|
||||
define("CompositorNode", "CompositorNodeCornerPin", def_cmp_cornerpin);
|
||||
define("CompositorNode", "CompositorNodeCornerPin");
|
||||
define("CompositorNode", "CompositorNodeCrop");
|
||||
define("CompositorNode", "CompositorNodeCryptomatte", def_cmp_cryptomatte_legacy);
|
||||
define("CompositorNode", "CompositorNodeCryptomatteV2", def_cmp_cryptomatte);
|
||||
define("CompositorNode", "CompositorNodeCurveRGB", def_rgb_curve);
|
||||
define("CompositorNode", "CompositorNodeDBlur");
|
||||
define("CompositorNode", "CompositorNodeDefocus", def_cmp_defocus);
|
||||
define("CompositorNode", "CompositorNodeDenoise", def_cmp_denoise);
|
||||
define("CompositorNode", "CompositorNodeDenoise");
|
||||
define("CompositorNode", "CompositorNodeDespeckle");
|
||||
define("CompositorNode", "CompositorNodeDiffMatte");
|
||||
define("CompositorNode", "CompositorNodeDilateErode", def_cmp_dilate_erode);
|
||||
define("CompositorNode", "CompositorNodeDisplace", def_cmp_displace);
|
||||
define("CompositorNode", "CompositorNodeDilateErode");
|
||||
define("CompositorNode", "CompositorNodeDisplace");
|
||||
define("CompositorNode", "CompositorNodeDistanceMatte", def_cmp_distance_matte);
|
||||
define("CompositorNode", "CompositorNodeDoubleEdgeMask", def_cmp_double_edge_mask);
|
||||
define("CompositorNode", "CompositorNodeEllipseMask", def_cmp_ellipsemask);
|
||||
define("CompositorNode", "CompositorNodeEllipseMask");
|
||||
define("CompositorNode", "CompositorNodeExposure");
|
||||
define("CompositorNode", "CompositorNodeFilter", def_cmp_filter);
|
||||
define("CompositorNode", "CompositorNodeFilter");
|
||||
define("CompositorNode", "CompositorNodeFlip");
|
||||
define("CompositorNode", "CompositorNodeGamma");
|
||||
define("CompositorNode", "CompositorNodeGlare", def_cmp_glare);
|
||||
define("CompositorNode", "CompositorNodeGlare");
|
||||
define("CompositorNode", "CompositorNodeHueCorrect", def_cmp_huecorrect);
|
||||
define("CompositorNode", "CompositorNodeHueSat");
|
||||
define("CompositorNode", "CompositorNodeIDMask");
|
||||
@@ -10523,13 +9941,13 @@ static void rna_def_nodes(BlenderRNA *brna)
|
||||
define("CompositorNode", "CompositorNodeImageInfo");
|
||||
define("CompositorNode", "CompositorNodeInpaint");
|
||||
define("CompositorNode", "CompositorNodeInvert");
|
||||
define("CompositorNode", "CompositorNodeKeying", def_cmp_keying);
|
||||
define("CompositorNode", "CompositorNodeKeying");
|
||||
define("CompositorNode", "CompositorNodeKeyingScreen", def_cmp_keyingscreen);
|
||||
define("CompositorNode", "CompositorNodeKuwahara", def_cmp_kuwahara);
|
||||
define("CompositorNode", "CompositorNodeLensdist", def_cmp_lensdist);
|
||||
define("CompositorNode", "CompositorNodeLevels", def_cmp_levels);
|
||||
define("CompositorNode", "CompositorNodeKuwahara");
|
||||
define("CompositorNode", "CompositorNodeLensdist");
|
||||
define("CompositorNode", "CompositorNodeLevels");
|
||||
define("CompositorNode", "CompositorNodeLumaMatte");
|
||||
define("CompositorNode", "CompositorNodeMapUV", def_cmp_map_uv);
|
||||
define("CompositorNode", "CompositorNodeMapUV");
|
||||
define("CompositorNode", "CompositorNodeMask", def_cmp_mask);
|
||||
define("CompositorNode", "CompositorNodeMovieClip", def_cmp_movieclip);
|
||||
define("CompositorNode", "CompositorNodeMovieDistortion", def_cmp_moviedistortion);
|
||||
@@ -10544,8 +9962,8 @@ static void rna_def_nodes(BlenderRNA *brna)
|
||||
define("CompositorNode", "CompositorNodeRGB");
|
||||
define("CompositorNode", "CompositorNodeRGBToBW");
|
||||
define("CompositorNode", "CompositorNodeRLayers", def_cmp_render_layers);
|
||||
define("CompositorNode", "CompositorNodeRotate", def_cmp_rotate);
|
||||
define("CompositorNode", "CompositorNodeScale", def_cmp_scale);
|
||||
define("CompositorNode", "CompositorNodeRotate");
|
||||
define("CompositorNode", "CompositorNodeScale");
|
||||
define("CompositorNode", "CompositorNodeSceneTime");
|
||||
define("CompositorNode", "CompositorNodeSeparateColor", def_cmp_combsep_color);
|
||||
define("CompositorNode", "CompositorNodeSepHSVA");
|
||||
@@ -10553,15 +9971,15 @@ static void rna_def_nodes(BlenderRNA *brna)
|
||||
define("CompositorNode", "CompositorNodeSepYCCA", def_cmp_ycc);
|
||||
define("CompositorNode", "CompositorNodeSepYUVA");
|
||||
define("CompositorNode", "CompositorNodeSetAlpha", def_cmp_set_alpha);
|
||||
define("CompositorNode", "CompositorNodeSplit", def_cmp_split);
|
||||
define("CompositorNode", "CompositorNodeSplit");
|
||||
define("CompositorNode", "CompositorNodeStabilize", def_cmp_stabilize2d);
|
||||
define("CompositorNode", "CompositorNodeSwitch");
|
||||
define("CompositorNode", "CompositorNodeSwitchView");
|
||||
define("CompositorNode", "CompositorNodeTime", def_time);
|
||||
define("CompositorNode", "CompositorNodeTonemap", def_cmp_tonemap);
|
||||
define("CompositorNode", "CompositorNodeTonemap");
|
||||
define("CompositorNode", "CompositorNodeTrackPos", def_cmp_trackpos);
|
||||
define("CompositorNode", "CompositorNodeTransform", def_cmp_transform);
|
||||
define("CompositorNode", "CompositorNodeTranslate", def_cmp_translate);
|
||||
define("CompositorNode", "CompositorNodeTransform");
|
||||
define("CompositorNode", "CompositorNodeTranslate");
|
||||
define("CompositorNode", "CompositorNodeVecBlur");
|
||||
define("CompositorNode", "CompositorNodeViewer", def_cmp_viewer);
|
||||
define("CompositorNode", "CompositorNodeZcombine");
|
||||
|
||||
@@ -428,6 +428,20 @@ class BaseSocketDeclarationBuilder {
|
||||
*/
|
||||
BaseSocketDeclarationBuilder &usage_by_single_menu(const int menu_value);
|
||||
|
||||
/**
|
||||
* Utility method for the case when this socket is only used when the menu input of the given
|
||||
* identifier has a specific value.
|
||||
*/
|
||||
BaseSocketDeclarationBuilder &usage_by_menu(const StringRef menu_input_identifier,
|
||||
const int menu_value);
|
||||
|
||||
/**
|
||||
* Utility method for the case when this socket is only used when the menu input of the given
|
||||
* identifier has one of the specifies values.
|
||||
*/
|
||||
BaseSocketDeclarationBuilder &usage_by_menu(const StringRef menu_input_identifier,
|
||||
const Array<int> menu_values);
|
||||
|
||||
/**
|
||||
* Puts this socket on the same row as the previous socket. This only works when one of them is
|
||||
* an input and the other is an output.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "node_util.hh" // IWYU pragma: export
|
||||
|
||||
#include "NOD_composite.hh" // IWYU pragma: export
|
||||
#include "NOD_menu_value.hh" // IWYU pragma: export
|
||||
#include "NOD_register.hh" // IWYU pragma: export
|
||||
#include "NOD_socket.hh" // IWYU pragma: export
|
||||
#include "NOD_socket_declarations.hh" // IWYU pragma: export
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
|
||||
@@ -28,11 +27,19 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** BLUR ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_blur_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeBlurData)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{R_FILTER_BOX, "FLAT", 0, "Flat", ""},
|
||||
{R_FILTER_TENT, "TENT", 0, "Tent", ""},
|
||||
{R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
|
||||
{R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
|
||||
{R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
|
||||
{R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
|
||||
{R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
|
||||
{R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_blur_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
@@ -44,10 +51,10 @@ static void cmp_node_blur_declare(NodeDeclarationBuilder &b)
|
||||
.default_value({0.0f, 0.0f})
|
||||
.min(0.0f)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type").default_value(R_FILTER_GAUSS).static_items(type_items);
|
||||
b.add_input<decl::Bool>("Extend Bounds").default_value(false);
|
||||
b.add_input<decl::Bool>("Separable")
|
||||
.default_value(true)
|
||||
|
||||
.description(
|
||||
"Use faster approximation by blurring along the horizontal and vertical directions "
|
||||
"independently");
|
||||
@@ -57,16 +64,11 @@ static void cmp_node_blur_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_composit_init_blur(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, but allocated for forward compatibility. */
|
||||
NodeBlurData *data = MEM_callocN<NodeBlurData>(__func__);
|
||||
data->filtertype = R_FILTER_GAUSS;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_blur(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class BlurOperation : public NodeOperation {
|
||||
@@ -122,12 +124,12 @@ class BlurOperation : public NodeOperation {
|
||||
if (!size.is_single_value()) {
|
||||
this->execute_variable_size(input, size, output);
|
||||
}
|
||||
else if (node_storage(bnode()).filtertype == R_FILTER_FAST_GAUSS) {
|
||||
else if (this->get_type() == R_FILTER_FAST_GAUSS) {
|
||||
recursive_gaussian_blur(this->context(), input, output, this->get_blur_size());
|
||||
}
|
||||
else if (use_separable_filter()) {
|
||||
symmetric_separable_blur(
|
||||
this->context(), input, output, this->get_blur_size(), node_storage(bnode()).filtertype);
|
||||
this->context(), input, output, this->get_blur_size(), this->get_type());
|
||||
}
|
||||
else {
|
||||
this->execute_constant_size(input, output);
|
||||
@@ -154,7 +156,7 @@ class BlurOperation : public NodeOperation {
|
||||
const float2 blur_radius = this->get_blur_size();
|
||||
|
||||
const Result &weights = context().cache_manager().symmetric_blur_weights.get(
|
||||
context(), node_storage(bnode()).filtertype, blur_radius);
|
||||
context(), this->get_type(), blur_radius);
|
||||
weights.bind_as_texture(shader, "weights_tx");
|
||||
|
||||
const Domain domain = input.domain();
|
||||
@@ -173,7 +175,7 @@ class BlurOperation : public NodeOperation {
|
||||
{
|
||||
const float2 blur_radius = this->get_blur_size();
|
||||
const Result &weights = this->context().cache_manager().symmetric_blur_weights.get(
|
||||
this->context(), node_storage(this->bnode()).filtertype, blur_radius);
|
||||
this->context(), this->get_type(), blur_radius);
|
||||
|
||||
const Domain domain = input.domain();
|
||||
output.allocate_texture(domain);
|
||||
@@ -239,7 +241,7 @@ class BlurOperation : public NodeOperation {
|
||||
{
|
||||
const float2 blur_radius = this->compute_maximum_blur_size();
|
||||
const Result &weights = context().cache_manager().symmetric_blur_weights.get(
|
||||
context(), node_storage(bnode()).filtertype, blur_radius);
|
||||
context(), this->get_type(), blur_radius);
|
||||
|
||||
gpu::Shader *shader = context().get_shader("compositor_symmetric_blur_variable_size");
|
||||
GPU_shader_bind(shader);
|
||||
@@ -265,7 +267,7 @@ class BlurOperation : public NodeOperation {
|
||||
{
|
||||
const float2 blur_radius = this->compute_maximum_blur_size();
|
||||
const Result &weights = this->context().cache_manager().symmetric_blur_weights.get(
|
||||
this->context(), node_storage(this->bnode()).filtertype, blur_radius);
|
||||
this->context(), this->get_type(), blur_radius);
|
||||
|
||||
const Domain domain = input.domain();
|
||||
output.allocate_texture(domain);
|
||||
@@ -367,7 +369,7 @@ class BlurOperation : public NodeOperation {
|
||||
}
|
||||
|
||||
/* Only Gaussian filters are separable. The rest is not. */
|
||||
switch (node_storage(bnode()).filtertype) {
|
||||
switch (this->get_type()) {
|
||||
case R_FILTER_GAUSS:
|
||||
case R_FILTER_FAST_GAUSS:
|
||||
return true;
|
||||
@@ -391,6 +393,14 @@ class BlurOperation : public NodeOperation {
|
||||
{
|
||||
return this->get_input("Extend Bounds").get_single_value_default(false);
|
||||
}
|
||||
|
||||
int get_type()
|
||||
{
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(R_FILTER_GAUSS);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return menu_value.value;
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
@@ -412,7 +422,6 @@ static void register_node_type_cmp_blur()
|
||||
ntype.enum_name_legacy = "BLUR";
|
||||
ntype.nclass = NODE_CLASS_OP_FILTER;
|
||||
ntype.declare = file_ns::cmp_node_blur_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_blur;
|
||||
ntype.flag |= NODE_PREVIEW;
|
||||
ntype.initfunc = file_ns::node_composit_init_blur;
|
||||
blender::bke::node_type_storage(
|
||||
|
||||
@@ -12,24 +12,30 @@
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "COM_node_operation.hh"
|
||||
#include "COM_utilities.hh"
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** SCALAR MATH ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_boxmask_cc {
|
||||
|
||||
static const EnumPropertyItem operation_items[] = {
|
||||
{CMP_NODE_MASKTYPE_ADD, "ADD", 0, "Add", ""},
|
||||
{CMP_NODE_MASKTYPE_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
|
||||
{CMP_NODE_MASKTYPE_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
|
||||
{CMP_NODE_MASKTYPE_NOT, "NOT", 0, "Not", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_boxmask_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Menu>("Operation")
|
||||
.default_value(CMP_NODE_MASKTYPE_ADD)
|
||||
.static_items(operation_items);
|
||||
b.add_input<decl::Float>("Mask")
|
||||
.subtype(PROP_FACTOR)
|
||||
.default_value(0.0f)
|
||||
@@ -59,11 +65,6 @@ static void cmp_node_boxmask_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>("Mask").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_buts_boxmask(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "mask_type", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
template<CMPNodeMaskType MaskType>
|
||||
@@ -161,8 +162,7 @@ class BoxMaskOperation : public NodeOperation {
|
||||
|
||||
const char *get_shader_name()
|
||||
{
|
||||
switch (get_mask_type()) {
|
||||
default:
|
||||
switch (this->get_operation()) {
|
||||
case CMP_NODE_MASKTYPE_ADD:
|
||||
return "compositor_box_mask_add";
|
||||
case CMP_NODE_MASKTYPE_SUBTRACT:
|
||||
@@ -172,6 +172,8 @@ class BoxMaskOperation : public NodeOperation {
|
||||
case CMP_NODE_MASKTYPE_NOT:
|
||||
return "compositor_box_mask_not";
|
||||
}
|
||||
|
||||
return "compositor_box_mask_add";
|
||||
}
|
||||
|
||||
void execute_cpu()
|
||||
@@ -189,7 +191,7 @@ class BoxMaskOperation : public NodeOperation {
|
||||
const float cos_angle = math::cos(this->get_angle());
|
||||
const float sin_angle = math::sin(this->get_angle());
|
||||
|
||||
switch (this->get_mask_type()) {
|
||||
switch (this->get_operation()) {
|
||||
case CMP_NODE_MASKTYPE_ADD:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
box_mask<CMP_NODE_MASKTYPE_ADD>(base_mask,
|
||||
@@ -202,7 +204,7 @@ class BoxMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_MASKTYPE_SUBTRACT:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
box_mask<CMP_NODE_MASKTYPE_SUBTRACT>(base_mask,
|
||||
@@ -215,7 +217,7 @@ class BoxMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_MASKTYPE_MULTIPLY:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
box_mask<CMP_NODE_MASKTYPE_MULTIPLY>(base_mask,
|
||||
@@ -228,7 +230,7 @@ class BoxMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_MASKTYPE_NOT:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
box_mask<CMP_NODE_MASKTYPE_NOT>(base_mask,
|
||||
@@ -241,8 +243,20 @@ class BoxMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
box_mask<CMP_NODE_MASKTYPE_ADD>(base_mask,
|
||||
value_mask,
|
||||
output_mask,
|
||||
texel,
|
||||
domain_size,
|
||||
location,
|
||||
size,
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
}
|
||||
|
||||
Domain compute_domain() override
|
||||
@@ -253,11 +267,6 @@ class BoxMaskOperation : public NodeOperation {
|
||||
return get_input("Mask").domain();
|
||||
}
|
||||
|
||||
CMPNodeMaskType get_mask_type()
|
||||
{
|
||||
return CMPNodeMaskType(bnode().custom1);
|
||||
}
|
||||
|
||||
float2 get_location()
|
||||
{
|
||||
return this->get_input("Position").get_single_value_default(float2(0.5f));
|
||||
@@ -273,6 +282,14 @@ class BoxMaskOperation : public NodeOperation {
|
||||
{
|
||||
return this->get_input("Rotation").get_single_value_default(0.0f);
|
||||
}
|
||||
|
||||
CMPNodeMaskType get_operation()
|
||||
{
|
||||
const Result &input = this->get_input("Operation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_MASKTYPE_ADD);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeMaskType>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
@@ -294,7 +311,6 @@ static void register_node_type_cmp_boxmask()
|
||||
ntype.enum_name_legacy = "BOXMASK";
|
||||
ntype.nclass = NODE_CLASS_MATTE;
|
||||
ntype.declare = file_ns::cmp_node_boxmask_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_boxmask;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
|
||||
blender::bke::node_register_type(ntype);
|
||||
|
||||
@@ -6,16 +6,13 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "COM_domain.hh"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
@@ -25,10 +22,8 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "COM_algorithm_smaa.hh"
|
||||
#include "COM_domain.hh"
|
||||
#include "COM_node_operation.hh"
|
||||
#include "COM_utilities.hh"
|
||||
|
||||
@@ -36,10 +31,13 @@
|
||||
|
||||
namespace blender::nodes::node_composite_cornerpin_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeCornerPinData)
|
||||
|
||||
static void cmp_node_cornerpin_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
b.add_output<decl::Float>("Plane").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
@@ -68,30 +66,28 @@ static void cmp_node_cornerpin_declare(NodeDeclarationBuilder &b)
|
||||
.min(0.0f)
|
||||
.max(1.0f);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
b.add_output<decl::Float>("Plane").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void node_composit_init_cornerpin(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeCornerPinData *data = MEM_callocN<NodeCornerPinData>(__func__);
|
||||
data->interpolation = CMP_NODE_INTERPOLATION_ANISOTROPIC;
|
||||
data->extension_x = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
data->extension_y = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_cornerpin(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout &column = layout->column(true);
|
||||
column.prop(ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
if (RNA_enum_get(ptr, "interpolation") != CMP_NODE_INTERPOLATION_ANISOTROPIC) {
|
||||
uiLayout &row = column.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class CornerPinOperation : public NodeOperation {
|
||||
@@ -334,29 +330,37 @@ class CornerPinOperation : public NodeOperation {
|
||||
return homography_matrix;
|
||||
}
|
||||
|
||||
Interpolation get_interpolation() const
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(node_storage(bnode()).interpolation)) {
|
||||
case CMP_NODE_INTERPOLATION_ANISOTROPIC:
|
||||
return Interpolation::Anisotropic;
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
return Interpolation::Bilinear;
|
||||
case CMP_NODE_INTERPOLATION_BICUBIC:
|
||||
return Interpolation::Bicubic;
|
||||
case CMP_NODE_INTERPOLATION_ANISOTROPIC:
|
||||
return Interpolation::Anisotropic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x() const
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
if (this->get_interpolation() == Interpolation::Anisotropic) {
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -365,16 +369,20 @@ class CornerPinOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y() const
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
if (this->get_interpolation() == Interpolation::Anisotropic) {
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -383,7 +391,6 @@ class CornerPinOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
@@ -411,7 +418,7 @@ class CornerPinOperation : public NodeOperation {
|
||||
case Interpolation::Anisotropic:
|
||||
break;
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
|
||||
return "compositor_plane_deform_anisotropic_masked";
|
||||
}
|
||||
|
||||
@@ -456,7 +463,6 @@ static void register_node_type_cmp_cornerpin()
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_cornerpin_declare;
|
||||
ntype.initfunc = file_ns::node_composit_init_cornerpin;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_cornerpin;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeCornerPinData", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -36,7 +36,40 @@
|
||||
|
||||
namespace blender::nodes::node_composite_denoise_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeDenoise)
|
||||
static const EnumPropertyItem prefilter_items[] = {
|
||||
{CMP_NODE_DENOISE_PREFILTER_NONE,
|
||||
"NONE",
|
||||
0,
|
||||
"None",
|
||||
"No prefiltering, use when guiding passes are noise-free"},
|
||||
{CMP_NODE_DENOISE_PREFILTER_FAST,
|
||||
"FAST",
|
||||
0,
|
||||
"Fast",
|
||||
"Denoise image and guiding passes together. Improves quality when guiding passes are noisy "
|
||||
"using least amount of extra processing time."},
|
||||
{CMP_NODE_DENOISE_PREFILTER_ACCURATE,
|
||||
"ACCURATE",
|
||||
0,
|
||||
"Accurate",
|
||||
"Prefilter noisy guiding passes before denoising image. Improves quality when guiding "
|
||||
"passes are noisy using extra processing time."},
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
static const EnumPropertyItem quality_items[] = {
|
||||
{CMP_NODE_DENOISE_QUALITY_SCENE,
|
||||
"FOLLOW_SCENE",
|
||||
0,
|
||||
"Follow Scene",
|
||||
"Use the scene's denoising quality setting"},
|
||||
{CMP_NODE_DENOISE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
|
||||
{CMP_NODE_DENOISE_QUALITY_BALANCED,
|
||||
"BALANCED",
|
||||
0,
|
||||
"Balanced",
|
||||
"Balanced between performance and quality"},
|
||||
{CMP_NODE_DENOISE_QUALITY_FAST, "FAST", 0, "Fast", "High perfomance"},
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
static void cmp_node_denoise_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
@@ -57,15 +90,20 @@ static void cmp_node_denoise_declare(NodeDeclarationBuilder &b)
|
||||
.compositor_domain_priority(1)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Bool>("HDR").default_value(true);
|
||||
b.add_input<decl::Menu>("Prefilter")
|
||||
.default_value(CMP_NODE_DENOISE_PREFILTER_ACCURATE)
|
||||
.static_items(prefilter_items);
|
||||
b.add_input<decl::Menu>("Quality")
|
||||
.default_value(CMP_NODE_DENOISE_QUALITY_SCENE)
|
||||
.static_items(quality_items);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_init_denonise(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeDenoise *ndg = MEM_callocN<NodeDenoise>(__func__);
|
||||
ndg->prefilter = CMP_NODE_DENOISE_PREFILTER_ACCURATE;
|
||||
ndg->quality = CMP_NODE_DENOISE_QUALITY_SCENE;
|
||||
node->storage = ndg;
|
||||
}
|
||||
|
||||
@@ -86,7 +124,7 @@ static bool is_oidn_supported()
|
||||
#endif
|
||||
}
|
||||
|
||||
static void node_composit_buts_denoise(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
static void node_composit_buts_denoise(uiLayout *layout, bContext * /*C*/, PointerRNA * /*ptr*/)
|
||||
{
|
||||
#ifndef WITH_OPENIMAGEDENOISE
|
||||
layout->label(RPT_("Disabled. Built without OpenImageDenoise"), ICON_ERROR);
|
||||
@@ -95,11 +133,6 @@ static void node_composit_buts_denoise(uiLayout *layout, bContext * /*C*/, Point
|
||||
layout->label(RPT_("Disabled. Platform not supported"), ICON_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
layout->label(IFACE_("Prefilter:"), ICON_NONE);
|
||||
layout->prop(ptr, "prefilter", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
layout->label(IFACE_("Quality:"), ICON_NONE);
|
||||
layout->prop(ptr, "quality", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
@@ -288,22 +321,11 @@ class DenoiseOperation : public NodeOperation {
|
||||
return get_prefilter_mode() == CMP_NODE_DENOISE_PREFILTER_ACCURATE;
|
||||
}
|
||||
|
||||
bool use_hdr()
|
||||
{
|
||||
return this->get_input("HDR").get_single_value_default(true);
|
||||
}
|
||||
|
||||
CMPNodeDenoisePrefilter get_prefilter_mode()
|
||||
{
|
||||
return static_cast<CMPNodeDenoisePrefilter>(node_storage(bnode()).prefilter);
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENIMAGEDENOISE
|
||||
# if OIDN_VERSION_MAJOR >= 2
|
||||
oidn::Quality get_quality()
|
||||
{
|
||||
const CMPNodeDenoiseQuality node_quality = static_cast<CMPNodeDenoiseQuality>(
|
||||
node_storage(bnode()).quality);
|
||||
const CMPNodeDenoiseQuality node_quality = this->get_quality_mode();
|
||||
|
||||
if (node_quality == CMP_NODE_DENOISE_QUALITY_SCENE) {
|
||||
const eCompositorDenoiseQaulity scene_quality = context().get_denoise_quality();
|
||||
@@ -315,9 +337,10 @@ class DenoiseOperation : public NodeOperation {
|
||||
case SCE_COMPOSITOR_DENOISE_BALANCED:
|
||||
return oidn::Quality::Balanced;
|
||||
case SCE_COMPOSITOR_DENOISE_HIGH:
|
||||
default:
|
||||
return oidn::Quality::High;
|
||||
}
|
||||
|
||||
return oidn::Quality::High;
|
||||
}
|
||||
|
||||
switch (node_quality) {
|
||||
@@ -328,9 +351,11 @@ class DenoiseOperation : public NodeOperation {
|
||||
case CMP_NODE_DENOISE_QUALITY_BALANCED:
|
||||
return oidn::Quality::Balanced;
|
||||
case CMP_NODE_DENOISE_QUALITY_HIGH:
|
||||
default:
|
||||
case CMP_NODE_DENOISE_QUALITY_SCENE:
|
||||
return oidn::Quality::High;
|
||||
}
|
||||
|
||||
return oidn::Quality::High;
|
||||
}
|
||||
# endif /* OIDN_VERSION_MAJOR >= 2 */
|
||||
|
||||
@@ -342,6 +367,27 @@ class DenoiseOperation : public NodeOperation {
|
||||
# endif
|
||||
}
|
||||
#endif /* WITH_OPENIMAGEDENOISE */
|
||||
|
||||
bool use_hdr()
|
||||
{
|
||||
return this->get_input("HDR").get_single_value_default(true);
|
||||
}
|
||||
|
||||
CMPNodeDenoisePrefilter get_prefilter_mode()
|
||||
{
|
||||
const Result &input = this->get_input("Prefilter");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_DENOISE_PREFILTER_ACCURATE);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeDenoisePrefilter>(menu_value.value);
|
||||
}
|
||||
|
||||
CMPNodeDenoiseQuality get_quality_mode()
|
||||
{
|
||||
const Result &input = this->get_input("Quality");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_DENOISE_QUALITY_SCENE);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeDenoiseQuality>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
|
||||
@@ -14,10 +14,8 @@
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_task.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
|
||||
@@ -29,11 +27,15 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Dilate/Erode ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_dilate_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeDilateErode)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_DILATE_ERODE_STEP, "STEP", 0, "Steps", ""},
|
||||
{CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD, "THRESHOLD", 0, "Threshold", ""},
|
||||
{CMP_NODE_DILATE_ERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
|
||||
{CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_dilate_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
@@ -42,39 +44,31 @@ static void cmp_node_dilate_declare(NodeDeclarationBuilder &b)
|
||||
b.add_input<decl::Int>("Size").default_value(0).description(
|
||||
"The size of dilation/erosion in pixels. Positive values dilates and negative values "
|
||||
"erodes");
|
||||
b.add_input<decl::Menu>("Type")
|
||||
.default_value(CMP_NODE_DILATE_ERODE_STEP)
|
||||
.static_items(type_items);
|
||||
b.add_input<decl::Float>("Falloff Size")
|
||||
.default_value(0.0f)
|
||||
.min(0.0f)
|
||||
.make_available([](bNode &node) { node.custom1 = CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD; })
|
||||
.usage_by_menu("Type", CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD)
|
||||
.description(
|
||||
"The size of the falloff from the edges in pixels. If less than two pixels, the edges "
|
||||
"will be anti-aliased");
|
||||
b.add_input<decl::Menu>("Falloff")
|
||||
.default_value(PROP_SMOOTH)
|
||||
.static_items(rna_enum_proportional_falloff_curve_only_items)
|
||||
.usage_by_menu("Type", CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER);
|
||||
|
||||
b.add_output<decl::Float>("Mask").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_init_dilateerode(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused but kept for forward compatibility. */
|
||||
NodeDilateErode *data = MEM_callocN<NodeDilateErode>(__func__);
|
||||
data->falloff = PROP_SMOOTH;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_dilateerode(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
if (RNA_enum_get(ptr, "mode") == CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER) {
|
||||
layout->prop(ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
bNodeSocket *falloff_size_input = bke::node_find_socket(*node, SOCK_IN, "Falloff Size");
|
||||
const bool is_falloff_size_needed = node->custom1 == CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD;
|
||||
blender::bke::node_set_socket_availability(*ntree, *falloff_size_input, is_falloff_size_needed);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class DilateErodeOperation : public NodeOperation {
|
||||
@@ -83,14 +77,15 @@ class DilateErodeOperation : public NodeOperation {
|
||||
|
||||
void execute() override
|
||||
{
|
||||
const Result &input = this->get_input("Mask");
|
||||
Result &output = this->get_result("Mask");
|
||||
|
||||
if (this->is_identity()) {
|
||||
const Result &input = this->get_input("Mask");
|
||||
Result &output = this->get_result("Mask");
|
||||
output.share_data(input);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (get_method()) {
|
||||
switch (this->get_type()) {
|
||||
case CMP_NODE_DILATE_ERODE_STEP:
|
||||
execute_step();
|
||||
return;
|
||||
@@ -103,10 +98,9 @@ class DilateErodeOperation : public NodeOperation {
|
||||
case CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER:
|
||||
execute_distance_feather();
|
||||
return;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return;
|
||||
}
|
||||
|
||||
output.share_data(input);
|
||||
}
|
||||
|
||||
/* ----------------------------
|
||||
@@ -498,11 +492,8 @@ class DilateErodeOperation : public NodeOperation {
|
||||
|
||||
void execute_distance_feather()
|
||||
{
|
||||
morphological_distance_feather(context(),
|
||||
get_input("Mask"),
|
||||
get_result("Mask"),
|
||||
this->get_size(),
|
||||
node_storage(bnode()).falloff);
|
||||
morphological_distance_feather(
|
||||
context(), get_input("Mask"), get_result("Mask"), this->get_size(), this->get_falloff());
|
||||
}
|
||||
|
||||
/* ---------------
|
||||
@@ -516,7 +507,7 @@ class DilateErodeOperation : public NodeOperation {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (get_method() == CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD &&
|
||||
if (this->get_type() == CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD &&
|
||||
this->get_falloff_size() != 0.0f)
|
||||
{
|
||||
return false;
|
||||
@@ -554,9 +545,20 @@ class DilateErodeOperation : public NodeOperation {
|
||||
return math::max(0.0f, this->get_input("Falloff Size").get_single_value_default(0.0f));
|
||||
}
|
||||
|
||||
CMPNodeDilateErodeMethod get_method()
|
||||
CMPNodeDilateErodeMethod get_type()
|
||||
{
|
||||
return static_cast<CMPNodeDilateErodeMethod>(bnode().custom1);
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_DILATE_ERODE_STEP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeDilateErodeMethod>(menu_value.value);
|
||||
}
|
||||
|
||||
int get_falloff()
|
||||
{
|
||||
const Result &input = this->get_input("Falloff");
|
||||
const MenuValue default_menu_value = MenuValue(PROP_SMOOTH);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return menu_value.value;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -578,9 +580,7 @@ static void register_node_type_cmp_dilateerode()
|
||||
ntype.ui_description = "Expand and shrink masks";
|
||||
ntype.enum_name_legacy = "DILATEERODE";
|
||||
ntype.nclass = NODE_CLASS_OP_FILTER;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_dilateerode;
|
||||
ntype.declare = file_ns::cmp_node_dilate_declare;
|
||||
ntype.updatefunc = file_ns::node_update;
|
||||
ntype.initfunc = file_ns::node_composit_init_dilateerode;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -8,36 +8,34 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "COM_domain.hh"
|
||||
#include "COM_node_operation.hh"
|
||||
#include "COM_utilities.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Displace ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_displace_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeDisplaceData)
|
||||
|
||||
static void cmp_node_displace_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
@@ -59,31 +57,28 @@ static void cmp_node_displace_declare(NodeDeclarationBuilder &b)
|
||||
.max(1000.0f)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void cmp_node_init_displace(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeDisplaceData *data = MEM_callocN<NodeDisplaceData>(__func__);
|
||||
data->interpolation = CMP_NODE_INTERPOLATION_ANISOTROPIC;
|
||||
data->extension_x = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
data->extension_y = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void cmp_buts_displace(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout &column_interpolation_extension_modes = layout->column(true);
|
||||
|
||||
column_interpolation_extension_modes.prop(
|
||||
ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
if (RNA_enum_get(ptr, "interpolation") != CMP_NODE_INTERPOLATION_ANISOTROPIC) {
|
||||
uiLayout &row = column_interpolation_extension_modes.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class DisplaceOperation : public NodeOperation {
|
||||
@@ -300,30 +295,37 @@ class DisplaceOperation : public NodeOperation {
|
||||
case Interpolation::Nearest:
|
||||
return "compositor_displace";
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
|
||||
return "compositor_displace";
|
||||
}
|
||||
|
||||
Interpolation get_interpolation() const
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (node_storage(bnode()).interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_ANISOTROPIC:
|
||||
return Interpolation::Anisotropic;
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
return Interpolation::Bilinear;
|
||||
case CMP_NODE_INTERPOLATION_BICUBIC:
|
||||
return Interpolation::Bicubic;
|
||||
case CMP_NODE_INTERPOLATION_ANISOTROPIC:
|
||||
return Interpolation::Anisotropic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -332,13 +334,16 @@ class DisplaceOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -347,7 +352,6 @@ class DisplaceOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
@@ -396,7 +400,6 @@ static void register_node_type_cmp_displace()
|
||||
ntype.enum_name_legacy = "DISPLACE";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_displace_declare;
|
||||
ntype.draw_buttons = file_ns::cmp_buts_displace;
|
||||
ntype.initfunc = file_ns::cmp_node_init_displace;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeDisplaceData", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
|
||||
#include "COM_node_operation.hh"
|
||||
@@ -22,12 +19,21 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** SCALAR MATH ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_ellipsemask_cc {
|
||||
|
||||
static const EnumPropertyItem operation_items[] = {
|
||||
{CMP_NODE_MASKTYPE_ADD, "ADD", 0, "Add", ""},
|
||||
{CMP_NODE_MASKTYPE_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
|
||||
{CMP_NODE_MASKTYPE_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
|
||||
{CMP_NODE_MASKTYPE_NOT, "NOT", 0, "Not", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_ellipsemask_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Menu>("Operation")
|
||||
.default_value(CMP_NODE_MASKTYPE_ADD)
|
||||
.static_items(operation_items);
|
||||
b.add_input<decl::Float>("Mask")
|
||||
.subtype(PROP_FACTOR)
|
||||
.default_value(0.0f)
|
||||
@@ -57,11 +63,6 @@ static void cmp_node_ellipsemask_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>("Mask").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_buts_ellipsemask(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "mask_type", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
template<CMPNodeMaskType MaskType>
|
||||
@@ -164,8 +165,7 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
|
||||
const char *get_shader_name()
|
||||
{
|
||||
switch (get_mask_type()) {
|
||||
default:
|
||||
switch (this->get_operation()) {
|
||||
case CMP_NODE_MASKTYPE_ADD:
|
||||
return "compositor_ellipse_mask_add";
|
||||
case CMP_NODE_MASKTYPE_SUBTRACT:
|
||||
@@ -175,6 +175,8 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
case CMP_NODE_MASKTYPE_NOT:
|
||||
return "compositor_ellipse_mask_not";
|
||||
}
|
||||
|
||||
return "compositor_ellipse_mask_add";
|
||||
}
|
||||
|
||||
void execute_cpu()
|
||||
@@ -192,7 +194,7 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
const float cos_angle = math::cos(this->get_angle());
|
||||
const float sin_angle = math::sin(this->get_angle());
|
||||
|
||||
switch (this->get_mask_type()) {
|
||||
switch (this->get_operation()) {
|
||||
case CMP_NODE_MASKTYPE_ADD:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
ellipse_mask<CMP_NODE_MASKTYPE_ADD>(base_mask,
|
||||
@@ -205,7 +207,7 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_MASKTYPE_SUBTRACT:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
ellipse_mask<CMP_NODE_MASKTYPE_SUBTRACT>(base_mask,
|
||||
@@ -218,7 +220,7 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_MASKTYPE_MULTIPLY:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
ellipse_mask<CMP_NODE_MASKTYPE_MULTIPLY>(base_mask,
|
||||
@@ -231,7 +233,7 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_MASKTYPE_NOT:
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
ellipse_mask<CMP_NODE_MASKTYPE_NOT>(base_mask,
|
||||
@@ -244,8 +246,20 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
parallel_for(domain_size, [&](const int2 texel) {
|
||||
ellipse_mask<CMP_NODE_MASKTYPE_ADD>(base_mask,
|
||||
value_mask,
|
||||
output_mask,
|
||||
texel,
|
||||
domain_size,
|
||||
location,
|
||||
radius,
|
||||
cos_angle,
|
||||
sin_angle);
|
||||
});
|
||||
}
|
||||
|
||||
Domain compute_domain() override
|
||||
@@ -256,11 +270,6 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
return get_input("Mask").domain();
|
||||
}
|
||||
|
||||
CMPNodeMaskType get_mask_type()
|
||||
{
|
||||
return CMPNodeMaskType(bnode().custom1);
|
||||
}
|
||||
|
||||
float2 get_location()
|
||||
{
|
||||
return this->get_input("Position").get_single_value_default(float2(0.5f));
|
||||
@@ -276,6 +285,14 @@ class EllipseMaskOperation : public NodeOperation {
|
||||
{
|
||||
return this->get_input("Rotation").get_single_value_default(0.0f);
|
||||
}
|
||||
|
||||
CMPNodeMaskType get_operation()
|
||||
{
|
||||
const Result &input = this->get_input("Operation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_MASKTYPE_ADD);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeMaskType>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
@@ -298,7 +315,6 @@ static void register_node_type_cmp_ellipsemask()
|
||||
ntype.enum_name_legacy = "ELLIPSEMASK";
|
||||
ntype.nclass = NODE_CLASS_MATTE;
|
||||
ntype.declare = file_ns::cmp_node_ellipsemask_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_ellipsemask;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
|
||||
blender::bke::node_register_type(ntype);
|
||||
|
||||
@@ -10,18 +10,31 @@
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "COM_node_operation.hh"
|
||||
#include "COM_utilities.hh"
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** FILTER ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_filter_cc {
|
||||
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_FILTER_SOFT, "SOFTEN", 0, "Soften", ""},
|
||||
{CMP_NODE_FILTER_SHARP_BOX, "SHARPEN", 0, "Box Sharpen", "An aggressive sharpening filter"},
|
||||
{CMP_NODE_FILTER_SHARP_DIAMOND,
|
||||
"SHARPEN_DIAMOND",
|
||||
0,
|
||||
"Diamond Sharpen",
|
||||
"A moderate sharpening filter"},
|
||||
{CMP_NODE_FILTER_LAPLACE, "LAPLACE", 0, "Laplace", ""},
|
||||
{CMP_NODE_FILTER_SOBEL, "SOBEL", 0, "Sobel", ""},
|
||||
{CMP_NODE_FILTER_PREWITT, "PREWITT", 0, "Prewitt", ""},
|
||||
{CMP_NODE_FILTER_KIRSCH, "KIRSCH", 0, "Kirsch", ""},
|
||||
{CMP_NODE_FILTER_SHADOW, "SHADOW", 0, "Shadow", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_filter_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Float>("Fac")
|
||||
@@ -35,22 +48,19 @@ static void cmp_node_filter_declare(NodeDeclarationBuilder &b)
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.compositor_domain_priority(0)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type").default_value(CMP_NODE_FILTER_SOFT).static_items(type_items);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_buts_filter(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
class SocketSearchOp {
|
||||
public:
|
||||
CMPNodeFilterMethod filter_type = CMP_NODE_FILTER_SOFT;
|
||||
void operator()(LinkSearchOpParams ¶ms)
|
||||
{
|
||||
bNode &node = params.add_node("CompositorNodeFilter");
|
||||
node.custom1 = filter_type;
|
||||
bNodeSocket &type_socket = *blender::bke::node_find_socket(node, SOCK_IN, "Type");
|
||||
type_socket.default_value_typed<bNodeSocketValueMenu>()->value = this->filter_type;
|
||||
params.update_and_connect_available_socket(node, "Image");
|
||||
}
|
||||
};
|
||||
@@ -192,7 +202,7 @@ class FilterOperation : public NodeOperation {
|
||||
|
||||
bool is_edge_filter()
|
||||
{
|
||||
switch (this->get_filter_method()) {
|
||||
switch (this->get_type()) {
|
||||
case CMP_NODE_FILTER_LAPLACE:
|
||||
case CMP_NODE_FILTER_SOBEL:
|
||||
case CMP_NODE_FILTER_PREWITT:
|
||||
@@ -212,7 +222,7 @@ class FilterOperation : public NodeOperation {
|
||||
/* Initialize the kernels as arrays of rows with the top row first. Edge detection kernels
|
||||
* return the kernel in the X direction, while the kernel in the Y direction will be computed
|
||||
* inside the shader by transposing the kernel in the X direction. */
|
||||
switch (get_filter_method()) {
|
||||
switch (this->get_type()) {
|
||||
case CMP_NODE_FILTER_SOFT: {
|
||||
const float kernel[3][3] = {{1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f},
|
||||
{2.0f / 16.0f, 4.0f / 16.0f, 2.0f / 16.0f},
|
||||
@@ -252,16 +262,18 @@ class FilterOperation : public NodeOperation {
|
||||
{0.0f, -1.0f, 0.0f}, {-1.0f, 5.0f, -1.0f}, {0.0f, -1.0f, 0.0f}};
|
||||
return float3x3(kernel);
|
||||
}
|
||||
default: {
|
||||
const float kernel[3][3] = {{0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}};
|
||||
return float3x3(kernel);
|
||||
}
|
||||
}
|
||||
|
||||
const float kernel[3][3] = {{0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}};
|
||||
return float3x3(kernel);
|
||||
}
|
||||
|
||||
CMPNodeFilterMethod get_filter_method()
|
||||
CMPNodeFilterMethod get_type()
|
||||
{
|
||||
return static_cast<CMPNodeFilterMethod>(bnode().custom1);
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_FILTER_SOFT);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeFilterMethod>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -284,8 +296,6 @@ static void register_node_type_cmp_filter()
|
||||
ntype.enum_name_legacy = "FILTER";
|
||||
ntype.nclass = NODE_CLASS_OP_FILTER;
|
||||
ntype.declare = file_ns::cmp_node_filter_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_filter;
|
||||
ntype.labelfunc = node_filter_label;
|
||||
ntype.flag |= NODE_PREVIEW;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
ntype.gather_link_search_ops = file_ns::gather_link_searches;
|
||||
|
||||
@@ -31,11 +31,6 @@
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_state.hh"
|
||||
#include "GPU_texture.hh"
|
||||
@@ -51,7 +46,22 @@
|
||||
|
||||
namespace blender::nodes::node_composite_glare_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeGlare)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_GLARE_BLOOM, "BLOOM", 0, "Bloom", ""},
|
||||
{CMP_NODE_GLARE_GHOST, "GHOSTS", 0, "Ghosts", ""},
|
||||
{CMP_NODE_GLARE_STREAKS, "STREAKS", 0, "Streaks", ""},
|
||||
{CMP_NODE_GLARE_FOG_GLOW, "FOG_GLOW", 0, "Fog Glow", ""},
|
||||
{CMP_NODE_GLARE_SIMPLE_STAR, "SIMPLE_STAR", 0, "Simple Star", ""},
|
||||
{CMP_NODE_GLARE_SUN_BEAMS, "SUN_BEAMS", 0, "Sun Beams", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem quality_items[] = {
|
||||
{CMP_NODE_GLARE_QUALITY_HIGH, "HIGH", 0, "High", ""},
|
||||
{CMP_NODE_GLARE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", ""},
|
||||
{CMP_NODE_GLARE_QUALITY_LOW, "LOW", 0, "Low", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
@@ -67,21 +77,13 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
.structure_type(StructureType::Dynamic)
|
||||
.description("The extracted highlights from which the glare was generated");
|
||||
|
||||
b.add_layout([](uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) {
|
||||
#ifndef WITH_FFTW3
|
||||
const int glare_type = RNA_enum_get(ptr, "glare_type");
|
||||
if (glare_type == CMP_NODE_GLARE_FOG_GLOW) {
|
||||
layout->label(RPT_("Disabled, built without FFTW"), ICON_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
layout->prop(ptr, "glare_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
layout->prop(ptr, "quality", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
});
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type").default_value(CMP_NODE_GLARE_STREAKS).static_items(type_items);
|
||||
b.add_input<decl::Menu>("Quality")
|
||||
.default_value(CMP_NODE_GLARE_QUALITY_MEDIUM)
|
||||
.static_items(quality_items);
|
||||
|
||||
PanelDeclarationBuilder &highlights_panel = b.add_panel("Highlights").default_closed(true);
|
||||
highlights_panel.add_input<decl::Float>("Threshold", "Highlights Threshold")
|
||||
@@ -132,19 +134,28 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.usage_by_menu("Type",
|
||||
{CMP_NODE_GLARE_FOG_GLOW, CMP_NODE_GLARE_BLOOM, CMP_NODE_GLARE_SUN_BEAMS})
|
||||
.description(
|
||||
"The size of the glare relative to the image. 1 means the glare covers the entire "
|
||||
"image, 0.5 means the glare covers half the image, and so on");
|
||||
glare_panel.add_input<decl::Int>("Streaks").default_value(4).min(1).max(16).description(
|
||||
"The number of streaks");
|
||||
glare_panel.add_input<decl::Int>("Streaks")
|
||||
.default_value(4)
|
||||
.min(1)
|
||||
.max(16)
|
||||
.usage_by_menu("Type", CMP_NODE_GLARE_STREAKS)
|
||||
.description("The number of streaks");
|
||||
glare_panel.add_input<decl::Float>("Streaks Angle")
|
||||
.default_value(0.0f)
|
||||
.subtype(PROP_ANGLE)
|
||||
.usage_by_menu("Type", CMP_NODE_GLARE_STREAKS)
|
||||
.description("The angle that the first streak makes with the horizontal axis");
|
||||
glare_panel.add_input<decl::Int>("Iterations")
|
||||
.default_value(3)
|
||||
.min(2)
|
||||
.max(5)
|
||||
.usage_by_menu("Type",
|
||||
{CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS})
|
||||
.description(
|
||||
"The number of ghosts for Ghost glare or the quality and spread of Glare for Streaks "
|
||||
"and Simple Star");
|
||||
@@ -153,15 +164,18 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
.min(0.75f)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.usage_by_menu("Type", {CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_STREAKS})
|
||||
.description("Streak fade-out factor");
|
||||
glare_panel.add_input<decl::Float>("Color Modulation")
|
||||
.default_value(0.25)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.usage_by_menu("Type", {CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS})
|
||||
.description("Modulates colors of streaks and ghosts for a spectral dispersion effect");
|
||||
glare_panel.add_input<decl::Bool>("Diagonal", "Diagonal Star")
|
||||
.default_value(true)
|
||||
.usage_by_menu("Type", CMP_NODE_GLARE_SIMPLE_STAR)
|
||||
.description("Align the star diagonally");
|
||||
glare_panel.add_input<decl::Vector>("Sun Position")
|
||||
.subtype(PROP_FACTOR)
|
||||
@@ -169,6 +183,7 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
.default_value({0.5f, 0.5f})
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.usage_by_menu("Type", CMP_NODE_GLARE_SUN_BEAMS)
|
||||
.description(
|
||||
"The position of the source of the rays in normalized coordinates. 0 means lower left "
|
||||
"corner and 1 means upper right corner");
|
||||
@@ -177,6 +192,7 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
.min(0.0f)
|
||||
.max(1.0)
|
||||
.subtype(PROP_FACTOR)
|
||||
.usage_by_menu("Type", CMP_NODE_GLARE_SUN_BEAMS)
|
||||
.description(
|
||||
"The amount of jitter to introduce while computing rays, higher jitter can be faster "
|
||||
"but can produce grainy or noisy results");
|
||||
@@ -184,66 +200,19 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_composit_init_glare(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, but kept for forward compatibility. */
|
||||
NodeGlare *ndg = MEM_callocN<NodeGlare>(__func__);
|
||||
ndg->quality = 1;
|
||||
ndg->type = CMP_NODE_GLARE_STREAKS;
|
||||
node->storage = ndg;
|
||||
}
|
||||
|
||||
static void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
const CMPNodeGlareType glare_type = static_cast<CMPNodeGlareType>(node_storage(*node).type);
|
||||
|
||||
bNodeSocket *size_input = bke::node_find_socket(*node, SOCK_IN, "Size");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree,
|
||||
*size_input,
|
||||
ELEM(glare_type, CMP_NODE_GLARE_FOG_GLOW, CMP_NODE_GLARE_BLOOM, CMP_NODE_GLARE_SUN_BEAMS));
|
||||
|
||||
bNodeSocket *iterations_input = bke::node_find_socket(*node, SOCK_IN, "Iterations");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree,
|
||||
*iterations_input,
|
||||
ELEM(glare_type, CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS));
|
||||
|
||||
bNodeSocket *fade_input = bke::node_find_socket(*node, SOCK_IN, "Fade");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *fade_input, ELEM(glare_type, CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_STREAKS));
|
||||
|
||||
bNodeSocket *color_modulation_input = bke::node_find_socket(*node, SOCK_IN, "Color Modulation");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree,
|
||||
*color_modulation_input,
|
||||
ELEM(glare_type, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS));
|
||||
|
||||
bNodeSocket *streaks_input = bke::node_find_socket(*node, SOCK_IN, "Streaks");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *streaks_input, glare_type == CMP_NODE_GLARE_STREAKS);
|
||||
|
||||
bNodeSocket *streaks_angle_input = bke::node_find_socket(*node, SOCK_IN, "Streaks Angle");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *streaks_angle_input, glare_type == CMP_NODE_GLARE_STREAKS);
|
||||
|
||||
bNodeSocket *diagonal_star_input = bke::node_find_socket(*node, SOCK_IN, "Diagonal Star");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *diagonal_star_input, glare_type == CMP_NODE_GLARE_SIMPLE_STAR);
|
||||
|
||||
bNodeSocket *source_input = bke::node_find_socket(*node, SOCK_IN, "Sun Position");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *source_input, glare_type == CMP_NODE_GLARE_SUN_BEAMS);
|
||||
|
||||
bNodeSocket *jitter_steps = bke::node_find_socket(*node, SOCK_IN, "Jitter");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *jitter_steps, glare_type == CMP_NODE_GLARE_SUN_BEAMS);
|
||||
}
|
||||
|
||||
class SocketSearchOp {
|
||||
public:
|
||||
CMPNodeGlareType type = CMP_NODE_GLARE_SIMPLE_STAR;
|
||||
void operator()(LinkSearchOpParams ¶ms)
|
||||
{
|
||||
bNode &node = params.add_node("CompositorNodeGlare");
|
||||
node_storage(node).type = this->type;
|
||||
bNodeSocket &type_socket = *blender::bke::node_find_socket(node, SOCK_IN, "Type");
|
||||
type_socket.default_value_typed<bNodeSocketValueMenu>()->value = this->type;
|
||||
params.update_and_connect_available_socket(node, "Image");
|
||||
}
|
||||
};
|
||||
@@ -334,7 +303,7 @@ class GlareOperation : public NodeOperation {
|
||||
GPU_shader_uniform_1f(shader, "threshold", this->get_threshold());
|
||||
GPU_shader_uniform_1f(shader, "highlights_smoothness", this->get_highlights_smoothness());
|
||||
GPU_shader_uniform_1f(shader, "max_brightness", this->get_maximum_brightness());
|
||||
GPU_shader_uniform_1i(shader, "quality", node_storage(bnode()).quality);
|
||||
GPU_shader_uniform_1i(shader, "quality", this->get_quality());
|
||||
|
||||
const Result &input_image = get_input("Image");
|
||||
GPU_texture_filter_mode(input_image, true);
|
||||
@@ -366,8 +335,7 @@ class GlareOperation : public NodeOperation {
|
||||
Result output = context().create_result(ResultType::Color);
|
||||
output.allocate_texture(highlights_size);
|
||||
|
||||
const CMPNodeGlareQuality quality = static_cast<CMPNodeGlareQuality>(
|
||||
node_storage(bnode()).quality);
|
||||
const CMPNodeGlareQuality quality = this->get_quality();
|
||||
const int2 input_size = input.domain().size;
|
||||
|
||||
parallel_for(highlights_size, [&](const int2 texel) {
|
||||
@@ -597,7 +565,7 @@ class GlareOperation : public NodeOperation {
|
||||
return this->context().create_result(ResultType::Color);
|
||||
}
|
||||
|
||||
switch (node_storage(bnode()).type) {
|
||||
switch (this->get_type()) {
|
||||
case CMP_NODE_GLARE_SIMPLE_STAR:
|
||||
return this->execute_simple_star(highlights_result);
|
||||
case CMP_NODE_GLARE_FOG_GLOW:
|
||||
@@ -610,10 +578,9 @@ class GlareOperation : public NodeOperation {
|
||||
return this->execute_bloom(highlights_result);
|
||||
case CMP_NODE_GLARE_SUN_BEAMS:
|
||||
return this->execute_sun_beams(highlights_result);
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return this->context().create_result(ResultType::Color);
|
||||
}
|
||||
|
||||
return this->execute_simple_star(highlights_result);
|
||||
}
|
||||
|
||||
/* Glare should be computed either because the glare output is needed directly or the image
|
||||
@@ -2540,7 +2507,7 @@ class GlareOperation : public NodeOperation {
|
||||
* strength anyways. */
|
||||
float get_normalization_scale()
|
||||
{
|
||||
switch (static_cast<CMPNodeGlareType>(node_storage(bnode()).type)) {
|
||||
switch (this->get_type()) {
|
||||
case CMP_NODE_GLARE_BLOOM:
|
||||
/* Bloom adds a number of passes equal to the chain length, if the input is constant, each
|
||||
* of those passes will hold the same constant, so we need to normalize by the chain
|
||||
@@ -2555,6 +2522,7 @@ class GlareOperation : public NodeOperation {
|
||||
case CMP_NODE_GLARE_SUN_BEAMS:
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@@ -2562,6 +2530,14 @@ class GlareOperation : public NodeOperation {
|
||||
* Common.
|
||||
* ------- */
|
||||
|
||||
CMPNodeGlareType get_type()
|
||||
{
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_GLARE_STREAKS);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeGlareType>(menu_value.value);
|
||||
}
|
||||
|
||||
float get_strength()
|
||||
{
|
||||
return math::max(0.0f, this->get_input("Strength").get_single_value_default(1.0f));
|
||||
@@ -2624,7 +2600,15 @@ class GlareOperation : public NodeOperation {
|
||||
* factor. */
|
||||
int get_quality_factor()
|
||||
{
|
||||
return 1 << node_storage(bnode()).quality;
|
||||
return 1 << this->get_quality();
|
||||
}
|
||||
|
||||
CMPNodeGlareQuality get_quality()
|
||||
{
|
||||
const Result &input = this->get_input("Quality");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_GLARE_QUALITY_MEDIUM);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeGlareQuality>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2647,7 +2631,6 @@ static void register_node_type_cmp_glare()
|
||||
ntype.enum_name_legacy = "GLARE";
|
||||
ntype.nclass = NODE_CLASS_OP_FILTER;
|
||||
ntype.declare = file_ns::cmp_node_glare_declare;
|
||||
ntype.updatefunc = file_ns::node_update;
|
||||
ntype.initfunc = file_ns::node_composit_init_glare;
|
||||
ntype.gather_link_search_ops = file_ns::gather_link_searches;
|
||||
blender::bke::node_type_storage(
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
|
||||
@@ -24,12 +23,8 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Keying ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_keying_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeKeyingData)
|
||||
|
||||
static void cmp_node_keying_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
@@ -136,9 +131,9 @@ static void cmp_node_keying_declare(NodeDeclarationBuilder &b)
|
||||
"Dilate or erode the computed matte using an inverse distance operation evaluated at "
|
||||
"the given falloff of the specified size. Negative sizes means erosion while positive "
|
||||
"means dilation");
|
||||
postprocess_panel.add_layout([](uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) {
|
||||
layout->prop(ptr, "feather_falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
});
|
||||
postprocess_panel.add_input<decl::Menu>("Feather Falloff")
|
||||
.default_value(PROP_SMOOTH)
|
||||
.static_items(rna_enum_proportional_falloff_curve_only_items);
|
||||
|
||||
PanelDeclarationBuilder &despill_panel = b.add_panel("Despill").default_closed(true);
|
||||
despill_panel.add_input<decl::Float>("Strength", "Despill Strength")
|
||||
@@ -160,6 +155,7 @@ static void cmp_node_keying_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_composit_init_keying(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, only kept for forward compatibility. */
|
||||
NodeKeyingData *data = MEM_callocN<NodeKeyingData>(__func__);
|
||||
node->storage = data;
|
||||
}
|
||||
@@ -704,7 +700,7 @@ class KeyingOperation : public NodeOperation {
|
||||
|
||||
Result feathered_matte = context().create_result(ResultType::Float);
|
||||
morphological_distance_feather(
|
||||
context(), input_matte, feathered_matte, distance, node_storage(bnode()).feather_falloff);
|
||||
context(), input_matte, feathered_matte, distance, this->get_feather_falloff());
|
||||
|
||||
return feathered_matte;
|
||||
}
|
||||
@@ -714,6 +710,14 @@ class KeyingOperation : public NodeOperation {
|
||||
return this->get_input("Postprocess Feather Size").get_single_value_default(0);
|
||||
}
|
||||
|
||||
int get_feather_falloff()
|
||||
{
|
||||
const Result &input = this->get_input("Feather Falloff");
|
||||
const MenuValue default_menu_value = MenuValue(PROP_SMOOTH);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return menu_value.value;
|
||||
}
|
||||
|
||||
void compute_image(Result &matte)
|
||||
{
|
||||
if (this->context().use_gpu()) {
|
||||
|
||||
@@ -14,10 +14,7 @@
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "COM_node_operation.hh"
|
||||
#include "COM_utilities.hh"
|
||||
@@ -27,11 +24,17 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Kuwahara ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_kuwahara_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeKuwaharaData)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_KUWAHARA_CLASSIC, "CLASSIC", 0, "Classic", "Fast but less accurate variation"},
|
||||
{CMP_NODE_KUWAHARA_ANISOTROPIC,
|
||||
"ANISOTROPIC",
|
||||
0,
|
||||
"Anisotropic",
|
||||
"Accurate but slower variation"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_kuwahara_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
@@ -43,9 +46,14 @@ static void cmp_node_kuwahara_declare(NodeDeclarationBuilder &b)
|
||||
.min(0.0f)
|
||||
.description("The size of the filter in pixels")
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type")
|
||||
.default_value(CMP_NODE_KUWAHARA_ANISOTROPIC)
|
||||
.static_items(type_items);
|
||||
|
||||
b.add_input<decl::Int>("Uniformity")
|
||||
.default_value(4)
|
||||
.min(0)
|
||||
.usage_by_single_menu(CMP_NODE_KUWAHARA_ANISOTROPIC)
|
||||
.description(
|
||||
"Controls the uniformity of the direction of the filter. Higher values produces more "
|
||||
"uniform directions");
|
||||
@@ -54,6 +62,7 @@ static void cmp_node_kuwahara_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_FACTOR)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.usage_by_single_menu(CMP_NODE_KUWAHARA_ANISOTROPIC)
|
||||
.description(
|
||||
"Controls the sharpness of the filter. 0 means completely smooth while 1 means "
|
||||
"completely sharp");
|
||||
@@ -62,11 +71,13 @@ static void cmp_node_kuwahara_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_FACTOR)
|
||||
.min(0.0f)
|
||||
.max(2.0f)
|
||||
.usage_by_single_menu(CMP_NODE_KUWAHARA_ANISOTROPIC)
|
||||
.description(
|
||||
"Controls how directional the filter is. 0 means the filter is completely "
|
||||
"omnidirectional while 2 means it is maximally directed along the edges of the image");
|
||||
b.add_input<decl::Bool>("High Precision")
|
||||
.default_value(false)
|
||||
.usage_by_single_menu(CMP_NODE_KUWAHARA_CLASSIC)
|
||||
.description(
|
||||
"Uses a more precise but slower method. Use if the output contains undesirable noise.");
|
||||
|
||||
@@ -75,31 +86,11 @@ static void cmp_node_kuwahara_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_composit_init_kuwahara(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeKuwaharaData *data = MEM_callocN<NodeKuwaharaData>(__func__);
|
||||
data->variation = CMP_NODE_KUWAHARA_ANISOTROPIC;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_kuwahara(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "variation", UI_ITEM_NONE, std::nullopt, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
const bool is_classic = node_storage(*node).variation == CMP_NODE_KUWAHARA_CLASSIC;
|
||||
|
||||
bNodeSocket *high_precision_input = bke::node_find_socket(*node, SOCK_IN, "High Precision");
|
||||
blender::bke::node_set_socket_availability(*ntree, *high_precision_input, is_classic);
|
||||
|
||||
bNodeSocket *uniformity_input = bke::node_find_socket(*node, SOCK_IN, "Uniformity");
|
||||
bNodeSocket *sharpness_input = bke::node_find_socket(*node, SOCK_IN, "Sharpness");
|
||||
bNodeSocket *eccentricity_input = bke::node_find_socket(*node, SOCK_IN, "Eccentricity");
|
||||
blender::bke::node_set_socket_availability(*ntree, *uniformity_input, !is_classic);
|
||||
blender::bke::node_set_socket_availability(*ntree, *sharpness_input, !is_classic);
|
||||
blender::bke::node_set_socket_availability(*ntree, *eccentricity_input, !is_classic);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class ConvertKuwaharaOperation : public NodeOperation {
|
||||
@@ -115,7 +106,7 @@ class ConvertKuwaharaOperation : public NodeOperation {
|
||||
return;
|
||||
}
|
||||
|
||||
if (node_storage(bnode()).variation == CMP_NODE_KUWAHARA_ANISOTROPIC) {
|
||||
if (this->get_type() == CMP_NODE_KUWAHARA_ANISOTROPIC) {
|
||||
execute_anisotropic();
|
||||
}
|
||||
else {
|
||||
@@ -817,6 +808,14 @@ class ConvertKuwaharaOperation : public NodeOperation {
|
||||
{
|
||||
return math::clamp(this->get_input("Eccentricity").get_single_value_default(1.0f), 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
CMPNodeKuwahara get_type()
|
||||
{
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_KUWAHARA_ANISOTROPIC);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeKuwahara>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
@@ -839,8 +838,6 @@ static void register_node_type_cmp_kuwahara()
|
||||
ntype.enum_name_legacy = "KUWAHARA";
|
||||
ntype.nclass = NODE_CLASS_OP_FILTER;
|
||||
ntype.declare = file_ns::cmp_node_kuwahara_declare;
|
||||
ntype.updatefunc = file_ns::node_update;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_kuwahara;
|
||||
ntype.initfunc = file_ns::node_composit_init_kuwahara;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeKuwaharaData", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
@@ -36,18 +33,34 @@
|
||||
|
||||
namespace blender::nodes::node_composite_lensdist_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeLensDist)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_LENS_DISTORTION_RADIAL,
|
||||
"RADIAL",
|
||||
0,
|
||||
"Radial",
|
||||
"Radially distorts the image to create a barrel or a Pincushion distortion"},
|
||||
{CMP_NODE_LENS_DISTORTION_HORIZONTAL,
|
||||
"HORIZONTAL",
|
||||
0,
|
||||
"Horizontal",
|
||||
"Horizontally distorts the image to create a channel/color shifting effect"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_lensdist_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type")
|
||||
.default_value(CMP_NODE_LENS_DISTORTION_RADIAL)
|
||||
.static_items(type_items);
|
||||
b.add_input<decl::Float>("Distortion")
|
||||
.default_value(0.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.min(MINIMUM_DISTORTION)
|
||||
.max(1.0f)
|
||||
.usage_by_single_menu(CMP_NODE_LENS_DISTORTION_RADIAL)
|
||||
.description(
|
||||
"The amount of distortion. 0 means no distortion, -1 means full Pincushion distortion, "
|
||||
"and 1 means full Barrel distortion");
|
||||
@@ -57,46 +70,29 @@ static void cmp_node_lensdist_declare(NodeDeclarationBuilder &b)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.description("The amount of chromatic aberration to add to the distortion");
|
||||
b.add_input<decl::Bool>("Jitter").default_value(false).description(
|
||||
"Introduces jitter while doing distortion, which can be faster but can produce grainy "
|
||||
"or noisy results");
|
||||
b.add_input<decl::Bool>("Fit").default_value(false).description(
|
||||
"Scales the image such that it fits entirely in the frame, leaving no empty spaces at "
|
||||
"the corners");
|
||||
b.add_input<decl::Bool>("Jitter")
|
||||
.default_value(false)
|
||||
.usage_by_single_menu(CMP_NODE_LENS_DISTORTION_RADIAL)
|
||||
.description(
|
||||
"Introduces jitter while doing distortion, which can be faster but can produce grainy "
|
||||
"or noisy results");
|
||||
b.add_input<decl::Bool>("Fit")
|
||||
.default_value(false)
|
||||
.usage_by_single_menu(CMP_NODE_LENS_DISTORTION_RADIAL)
|
||||
.description(
|
||||
"Scales the image such that it fits entirely in the frame, leaving no empty spaces at "
|
||||
"the corners");
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_init_lensdist(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeLensDist *data = MEM_callocN<NodeLensDist>(__func__);
|
||||
data->distortion_type = CMP_NODE_LENS_DISTORTION_RADIAL;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_lensdist(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "distortion_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
const CMPNodeLensDistortionType distortion_type = CMPNodeLensDistortionType(
|
||||
node_storage(*node).distortion_type);
|
||||
|
||||
bNodeSocket *distortion_input = bke::node_find_socket(*node, SOCK_IN, "Distortion");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *distortion_input, distortion_type == CMP_NODE_LENS_DISTORTION_RADIAL);
|
||||
|
||||
bNodeSocket *jitter_input = bke::node_find_socket(*node, SOCK_IN, "Jitter");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *jitter_input, distortion_type == CMP_NODE_LENS_DISTORTION_RADIAL);
|
||||
|
||||
bNodeSocket *fit_input = bke::node_find_socket(*node, SOCK_IN, "Fit");
|
||||
blender::bke::node_set_socket_availability(
|
||||
*ntree, *fit_input, distortion_type == CMP_NODE_LENS_DISTORTION_RADIAL);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
@@ -302,9 +298,10 @@ class LensDistortionOperation : public NodeOperation {
|
||||
|
||||
void execute() override
|
||||
{
|
||||
const Result &input = this->get_input("Image");
|
||||
Result &output = this->get_result("Image");
|
||||
|
||||
if (this->is_identity()) {
|
||||
const Result &input = this->get_input("Image");
|
||||
Result &output = this->get_result("Image");
|
||||
output.share_data(input);
|
||||
return;
|
||||
}
|
||||
@@ -312,11 +309,13 @@ class LensDistortionOperation : public NodeOperation {
|
||||
switch (this->get_type()) {
|
||||
case CMP_NODE_LENS_DISTORTION_RADIAL:
|
||||
this->execute_radial_distortion();
|
||||
break;
|
||||
return;
|
||||
case CMP_NODE_LENS_DISTORTION_HORIZONTAL:
|
||||
this->execute_horizontal_distortion();
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
output.share_data(input);
|
||||
}
|
||||
|
||||
void execute_horizontal_distortion()
|
||||
@@ -487,7 +486,10 @@ class LensDistortionOperation : public NodeOperation {
|
||||
|
||||
CMPNodeLensDistortionType get_type()
|
||||
{
|
||||
return CMPNodeLensDistortionType(node_storage(bnode()).distortion_type);
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_LENS_DISTORTION_RADIAL);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return CMPNodeLensDistortionType(menu_value.value);
|
||||
}
|
||||
|
||||
bool get_use_jitter()
|
||||
@@ -544,8 +546,6 @@ static void register_node_type_cmp_lensdist()
|
||||
ntype.enum_name_legacy = "LENSDIST";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_lensdist_declare;
|
||||
ntype.updatefunc = file_ns::node_update;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_lensdist;
|
||||
ntype.initfunc = file_ns::node_composit_init_lensdist;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -8,12 +8,10 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "IMB_colormanagement.hh"
|
||||
|
||||
@@ -22,30 +20,30 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** LEVELS ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_levels_cc {
|
||||
|
||||
static const EnumPropertyItem channel_items[] = {
|
||||
{CMP_NODE_LEVLES_LUMINANCE, "COMBINED_RGB", 0, "Combined", "Combined RGB"},
|
||||
{CMP_NODE_LEVLES_RED, "RED", 0, "Red", "Red Channel"},
|
||||
{CMP_NODE_LEVLES_GREEN, "GREEN", 0, "Green", "Green Channel"},
|
||||
{CMP_NODE_LEVLES_BLUE, "BLUE", 0, "Blue", "Blue Channel"},
|
||||
{CMP_NODE_LEVLES_LUMINANCE_BT709, "LUMINANCE", 0, "Luminance", "Luminance Channel"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_levels_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({0.0f, 0.0f, 0.0f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Channel")
|
||||
.default_value(CMP_NODE_LEVLES_LUMINANCE)
|
||||
.static_items(channel_items);
|
||||
|
||||
b.add_output<decl::Float>("Mean");
|
||||
b.add_output<decl::Float>("Standard Deviation");
|
||||
}
|
||||
|
||||
static void node_composit_init_view_levels(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
node->custom1 = 1; /* All channels. */
|
||||
}
|
||||
|
||||
static void node_composit_buts_view_levels(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "channel", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class LevelsOperation : public NodeOperation {
|
||||
@@ -113,9 +111,6 @@ class LevelsOperation : public NodeOperation {
|
||||
mean_result.set_single_value(math::dot(input, float3(luminance_coefficients)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,10 +137,9 @@ class LevelsOperation : public NodeOperation {
|
||||
IMB_colormanagement_get_luminance_coefficients(luminance_coefficients);
|
||||
return sum_luminance(context(), input, float3(luminance_coefficients));
|
||||
}
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float compute_standard_deviation(float mean)
|
||||
@@ -174,15 +168,17 @@ class LevelsOperation : public NodeOperation {
|
||||
return sum_luminance_squared_difference(
|
||||
context(), input, float3(luminance_coefficients), subtrahend);
|
||||
}
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
CMPNodeLevelsChannel get_channel()
|
||||
{
|
||||
return static_cast<CMPNodeLevelsChannel>(bnode().custom1);
|
||||
const Result &input = this->get_input("Channel");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_LEVLES_LUMINANCE);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeLevelsChannel>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -205,9 +201,7 @@ static void register_node_type_cmp_view_levels()
|
||||
ntype.enum_name_legacy = "LEVELS";
|
||||
ntype.nclass = NODE_CLASS_OUTPUT;
|
||||
ntype.declare = file_ns::cmp_node_levels_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_view_levels;
|
||||
ntype.flag |= NODE_PREVIEW;
|
||||
ntype.initfunc = file_ns::node_composit_init_view_levels;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
|
||||
blender::bke::node_register_type(ntype);
|
||||
|
||||
@@ -6,23 +6,19 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BKE_node.hh"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "COM_algorithm_sample_pixel.hh"
|
||||
#include "COM_domain.hh"
|
||||
@@ -31,14 +27,14 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Map UV ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_map_uv_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeMapUVData)
|
||||
|
||||
static void cmp_node_map_uv_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.compositor_realization_mode(CompositorInputRealizationMode::Transforms)
|
||||
@@ -53,26 +49,24 @@ static void cmp_node_map_uv_declare(NodeDeclarationBuilder &b)
|
||||
.compositor_domain_priority(0)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
|
||||
static void node_composit_buts_map_uv(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout &column = layout->column(true);
|
||||
column.prop(ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
if (RNA_enum_get(ptr, "interpolation") != CMP_NODE_INTERPOLATION_ANISOTROPIC) {
|
||||
uiLayout &row = column.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void node_composit_init_map_uv(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
NodeMapUVData *data = MEM_callocN<NodeMapUVData>(__func__);
|
||||
data->interpolation = CMP_NODE_INTERPOLATION_BILINEAR;
|
||||
data->extension_x = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
data->extension_y = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
@@ -156,7 +150,7 @@ class MapUVOperation : public NodeOperation {
|
||||
case Interpolation::Nearest:
|
||||
return "compositor_map_uv";
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
|
||||
return "compositor_map_uv";
|
||||
}
|
||||
|
||||
@@ -306,26 +300,33 @@ class MapUVOperation : public NodeOperation {
|
||||
});
|
||||
}
|
||||
|
||||
Interpolation get_interpolation() const
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(node_storage(bnode()).interpolation)) {
|
||||
case CMP_NODE_INTERPOLATION_ANISOTROPIC:
|
||||
return Interpolation::Anisotropic;
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
return Interpolation::Bilinear;
|
||||
case CMP_NODE_INTERPOLATION_BICUBIC:
|
||||
return Interpolation::Bicubic;
|
||||
case CMP_NODE_INTERPOLATION_ANISOTROPIC:
|
||||
return Interpolation::Anisotropic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -334,13 +335,16 @@ class MapUVOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -349,7 +353,6 @@ class MapUVOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
};
|
||||
@@ -374,7 +377,6 @@ static void register_node_type_cmp_mapuv()
|
||||
ntype.enum_name_legacy = "MAP_UV";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_map_uv_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_map_uv;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
ntype.initfunc = file_ns::node_composit_init_map_uv;
|
||||
blender::bke::node_type_storage(
|
||||
|
||||
@@ -14,17 +14,24 @@
|
||||
#include "UI_interface.hh"
|
||||
#include "UI_interface_layout.hh"
|
||||
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "COM_cached_mask.hh"
|
||||
#include "COM_node_operation.hh"
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Mask ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_mask_cc {
|
||||
|
||||
static const EnumPropertyItem size_source_items[] = {
|
||||
{0, "SCENE", 0, "Scene Size", ""},
|
||||
{CMP_NODE_MASK_FLAG_SIZE_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
|
||||
{CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE,
|
||||
"FIXED_SCENE",
|
||||
0,
|
||||
"Fixed/Scene",
|
||||
"Pixel size scaled by scene percentage"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_mask_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
@@ -33,13 +40,24 @@ static void cmp_node_mask_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
b.add_layout([](uiLayout *layout, bContext *C, PointerRNA *ptr) {
|
||||
uiTemplateID(layout, C, ptr, "mask", nullptr, nullptr, nullptr);
|
||||
layout->prop(ptr, "size_source", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
});
|
||||
|
||||
b.add_input<decl::Int>("Size X").default_value(256).min(1).description(
|
||||
"The resolution of the mask along the X direction");
|
||||
b.add_input<decl::Int>("Size Y").default_value(256).min(1).description(
|
||||
"The resolution of the mask along the Y direction");
|
||||
b.add_input<decl::Menu>("Size Source")
|
||||
.default_value(MenuValue(0))
|
||||
.static_items(size_source_items)
|
||||
.description("The source where the size of the mask is retrieved");
|
||||
b.add_input<decl::Int>("Size X")
|
||||
.default_value(256)
|
||||
.min(1)
|
||||
.usage_by_menu("Size Source",
|
||||
{CMP_NODE_MASK_FLAG_SIZE_FIXED, CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE})
|
||||
.description("The resolution of the mask along the X direction");
|
||||
b.add_input<decl::Int>("Size Y")
|
||||
.default_value(256)
|
||||
.min(1)
|
||||
.usage_by_menu("Size Source",
|
||||
{CMP_NODE_MASK_FLAG_SIZE_FIXED, CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE})
|
||||
.description("The resolution of the mask along the Y direction");
|
||||
b.add_input<decl::Bool>("Feather").default_value(true).description(
|
||||
"Use feather information from the mask");
|
||||
|
||||
@@ -69,16 +87,6 @@ static void node_mask_label(const bNodeTree * /*ntree*/,
|
||||
BLI_strncpy_utf8(label, node->id ? node->id->name + 2 : IFACE_("Mask"), label_maxncpy);
|
||||
}
|
||||
|
||||
static void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
const bool is_size_needed = node->custom1 & (CMP_NODE_MASK_FLAG_SIZE_FIXED |
|
||||
CMP_NODE_MASK_FLAG_SIZE_FIXED_SCENE);
|
||||
bNodeSocket *size_x_input = bke::node_find_socket(*node, SOCK_IN, "Size X");
|
||||
bNodeSocket *size_y_input = bke::node_find_socket(*node, SOCK_IN, "Size Y");
|
||||
blender::bke::node_set_socket_availability(*ntree, *size_x_input, is_size_needed);
|
||||
blender::bke::node_set_socket_availability(*ntree, *size_y_input, is_size_needed);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class MaskOperation : public NodeOperation {
|
||||
@@ -172,7 +180,10 @@ class MaskOperation : public NodeOperation {
|
||||
|
||||
CMPNodeMaskFlags get_flags()
|
||||
{
|
||||
return static_cast<CMPNodeMaskFlags>(this->bnode().custom1);
|
||||
const Result &input = this->get_input("Size Source");
|
||||
const MenuValue default_menu_value = MenuValue(0);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeMaskFlags>(menu_value.value);
|
||||
}
|
||||
|
||||
Mask *get_mask()
|
||||
@@ -200,7 +211,6 @@ static void register_node_type_cmp_mask()
|
||||
ntype.enum_name_legacy = "MASK";
|
||||
ntype.nclass = NODE_CLASS_INPUT;
|
||||
ntype.declare = file_ns::cmp_node_mask_declare;
|
||||
ntype.updatefunc = file_ns::node_update;
|
||||
ntype.labelfunc = file_ns::node_mask_label;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
|
||||
|
||||
@@ -28,15 +28,22 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Translate ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_moviedistortion_cc {
|
||||
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{int(compositor::DistortionType::Distort), "UNDISTORT", 0, "Undistort", ""},
|
||||
{int(compositor::DistortionType::Undistort), "DISTORT", 0, "Distort", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_moviedistortion_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({0.8f, 0.8f, 0.8f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type")
|
||||
.default_value(compositor::DistortionType::Distort)
|
||||
.static_items(type_items);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
}
|
||||
@@ -68,15 +75,7 @@ static void storage_copy(bNodeTree * /*dst_ntree*/, bNode *dest_node, const bNod
|
||||
|
||||
static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "clip", nullptr, "CLIP_OT_open", nullptr);
|
||||
|
||||
if (!node->id) {
|
||||
return;
|
||||
}
|
||||
|
||||
layout->prop(ptr, "distortion_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
@@ -149,7 +148,10 @@ class MovieDistortionOperation : public NodeOperation {
|
||||
|
||||
DistortionType get_distortion_type()
|
||||
{
|
||||
return bnode().custom1 == 0 ? DistortionType::Distort : DistortionType::Undistort;
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(DistortionType::Distort);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<DistortionType>(menu_value.value);
|
||||
}
|
||||
|
||||
MovieClip *get_movie_clip()
|
||||
|
||||
@@ -6,30 +6,28 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "COM_domain.hh"
|
||||
#include "COM_node_operation.hh"
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Rotate ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_rotate_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeRotateData)
|
||||
|
||||
static void cmp_node_rotate_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.compositor_realization_mode(CompositorInputRealizationMode::None)
|
||||
@@ -37,27 +35,28 @@ static void cmp_node_rotate_declare(NodeDeclarationBuilder &b)
|
||||
b.add_input<decl::Float>("Angle").default_value(0.0f).min(-10000.0f).max(10000.0f).subtype(
|
||||
PROP_ANGLE);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void node_composit_init_rotate(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeRotateData *data = MEM_callocN<NodeRotateData>(__func__);
|
||||
data->interpolation = CMP_NODE_INTERPOLATION_BILINEAR;
|
||||
data->extension_x = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
data->extension_y = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_rotate(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout &column = layout->column(true);
|
||||
column.prop(ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiLayout &row = column.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class RotateOperation : public NodeOperation {
|
||||
@@ -80,7 +79,11 @@ class RotateOperation : public NodeOperation {
|
||||
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(node_storage(bnode()).interpolation)) {
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
@@ -90,13 +93,16 @@ class RotateOperation : public NodeOperation {
|
||||
return Interpolation::Bicubic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -105,13 +111,16 @@ class RotateOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -120,7 +129,6 @@ class RotateOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
};
|
||||
@@ -144,7 +152,6 @@ static void register_node_type_cmp_rotate()
|
||||
ntype.enum_name_legacy = "ROTATE";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_rotate_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_rotate;
|
||||
ntype.initfunc = file_ns::node_composit_init_rotate;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
blender::bke::node_type_storage(
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_base.hh"
|
||||
@@ -18,10 +17,7 @@
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
@@ -32,75 +28,75 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Scale ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_scale_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeScaleData)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
|
||||
{CMP_NODE_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
|
||||
{CMP_NODE_SCALE_RENDER_PERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
|
||||
{CMP_NODE_SCALE_RENDER_SIZE, "RENDER_SIZE", 0, "Render Size", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* Matches bgpic_camera_frame_items[]. */
|
||||
static const EnumPropertyItem frame_type_items[] = {
|
||||
{CMP_NODE_SCALE_RENDER_SIZE_STRETCH, "STRETCH", 0, "Stretch", ""},
|
||||
{CMP_NODE_SCALE_RENDER_SIZE_FIT, "FIT", 0, "Fit", ""},
|
||||
{CMP_NODE_SCALE_RENDER_SIZE_CROP, "CROP", 0, "Crop", ""},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_scale_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.compositor_realization_mode(CompositorInputRealizationMode::None)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
b.add_input<decl::Menu>("Type").default_value(CMP_NODE_SCALE_RELATIVE).static_items(type_items);
|
||||
b.add_input<decl::Float>("X")
|
||||
.default_value(1.0f)
|
||||
.min(0.0001f)
|
||||
.max(CMP_SCALE_MAX)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
.structure_type(StructureType::Dynamic)
|
||||
.usage_by_menu("Type", {CMP_NODE_SCALE_RELATIVE, CMP_NODE_SCALE_ABSOLUTE});
|
||||
b.add_input<decl::Float>("Y")
|
||||
.default_value(1.0f)
|
||||
.min(0.0001f)
|
||||
.max(CMP_SCALE_MAX)
|
||||
.structure_type(StructureType::Dynamic);
|
||||
.structure_type(StructureType::Dynamic)
|
||||
.usage_by_menu("Type", {CMP_NODE_SCALE_RELATIVE, CMP_NODE_SCALE_ABSOLUTE});
|
||||
b.add_input<decl::Menu>("Frame Type")
|
||||
.default_value(CMP_NODE_SCALE_RENDER_SIZE_STRETCH)
|
||||
.static_items(frame_type_items)
|
||||
.usage_by_menu("Type", CMP_NODE_SCALE_RENDER_SIZE)
|
||||
.description("How the image fits in the camera frame");
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void node_composit_init_scale(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeScaleData *data = MEM_callocN<NodeScaleData>(__func__);
|
||||
data->interpolation = CMP_NODE_INTERPOLATION_BILINEAR;
|
||||
data->extension_x = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
data->extension_y = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composite_update_scale(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
bool use_xy_scale = ELEM(node->custom1, CMP_NODE_SCALE_RELATIVE, CMP_NODE_SCALE_ABSOLUTE);
|
||||
|
||||
/* Only show X/Y scale factor inputs for modes using them! */
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (STR_ELEM(sock->name, "X", "Y")) {
|
||||
bke::node_set_socket_availability(*ntree, *sock, use_xy_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_composit_buts_scale(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout &column = layout->column(true);
|
||||
column.prop(ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(ptr, "space") == CMP_NODE_SCALE_RENDER_SIZE) {
|
||||
column.prop(ptr,
|
||||
"frame_method",
|
||||
UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND,
|
||||
std::nullopt,
|
||||
ICON_NONE);
|
||||
}
|
||||
|
||||
uiLayout &column_interpolation_extension_modes = layout->column(true);
|
||||
|
||||
column_interpolation_extension_modes.prop(
|
||||
ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiLayout &row = column_interpolation_extension_modes.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class ScaleOperation : public NodeOperation {
|
||||
@@ -219,39 +215,13 @@ class ScaleOperation : public NodeOperation {
|
||||
return "compositor_scale_variable";
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
Interpolation get_interpolation() const
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(node_storage(bnode()).interpolation)) {
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
@@ -261,13 +231,48 @@ class ScaleOperation : public NodeOperation {
|
||||
return Interpolation::Bicubic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x() const
|
||||
{
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y() const
|
||||
{
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
float2 get_scale()
|
||||
{
|
||||
switch (get_scale_method()) {
|
||||
switch (get_type()) {
|
||||
case CMP_NODE_SCALE_RELATIVE:
|
||||
return get_scale_relative();
|
||||
case CMP_NODE_SCALE_ABSOLUTE:
|
||||
@@ -276,10 +281,9 @@ class ScaleOperation : public NodeOperation {
|
||||
return get_scale_render_percent();
|
||||
case CMP_NODE_SCALE_RENDER_SIZE:
|
||||
return get_scale_render_size();
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return float2(1.0f);
|
||||
}
|
||||
|
||||
return float2(1.0f);
|
||||
}
|
||||
|
||||
/* Scale by the input factors. */
|
||||
@@ -310,17 +314,16 @@ class ScaleOperation : public NodeOperation {
|
||||
return float2(1.0f);
|
||||
}
|
||||
|
||||
switch (get_scale_render_size_method()) {
|
||||
switch (get_frame_type()) {
|
||||
case CMP_NODE_SCALE_RENDER_SIZE_STRETCH:
|
||||
return get_scale_render_size_stretch();
|
||||
case CMP_NODE_SCALE_RENDER_SIZE_FIT:
|
||||
return get_scale_render_size_fit();
|
||||
case CMP_NODE_SCALE_RENDER_SIZE_CROP:
|
||||
return get_scale_render_size_crop();
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return float2(1.0f);
|
||||
}
|
||||
|
||||
return float2(1.0f);
|
||||
}
|
||||
|
||||
/* Scale such that the new size matches the render size. Since the input is freely scaled, it is
|
||||
@@ -359,21 +362,27 @@ class ScaleOperation : public NodeOperation {
|
||||
bool is_variable_size()
|
||||
{
|
||||
/* Only relative scaling can be variable. */
|
||||
if (get_scale_method() != CMP_NODE_SCALE_RELATIVE) {
|
||||
if (get_type() != CMP_NODE_SCALE_RELATIVE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !get_input("X").is_single_value() || !get_input("Y").is_single_value();
|
||||
}
|
||||
|
||||
CMPNodeScaleMethod get_scale_method()
|
||||
CMPNodeScaleMethod get_type()
|
||||
{
|
||||
return static_cast<CMPNodeScaleMethod>(bnode().custom1);
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_SCALE_RELATIVE);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeScaleMethod>(menu_value.value);
|
||||
}
|
||||
|
||||
CMPNodeScaleRenderSizeMethod get_scale_render_size_method()
|
||||
CMPNodeScaleRenderSizeMethod get_frame_type()
|
||||
{
|
||||
return static_cast<CMPNodeScaleRenderSizeMethod>(bnode().custom2);
|
||||
const Result &input = this->get_input("Frame Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_SCALE_RENDER_SIZE_STRETCH);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeScaleRenderSizeMethod>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -396,9 +405,7 @@ static void register_node_type_cmp_scale()
|
||||
ntype.enum_name_legacy = "SCALE";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_scale_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_scale;
|
||||
ntype.initfunc = file_ns::node_composit_init_scale;
|
||||
ntype.updatefunc = file_ns::node_composite_update_scale;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeScaleData", node_free_standard_storage, node_copy_standard_storage);
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
@@ -28,12 +28,14 @@
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Stabilize 2D ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_stabilize2d_cc {
|
||||
|
||||
static void cmp_node_stabilize2d_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({0.8f, 0.8f, 0.8f, 1.0f})
|
||||
.compositor_realization_mode(CompositorInputRealizationMode::None)
|
||||
@@ -41,7 +43,19 @@ static void cmp_node_stabilize2d_declare(NodeDeclarationBuilder &b)
|
||||
b.add_input<decl::Bool>("Invert").default_value(false).description(
|
||||
"Invert stabilization to reintroduce motion to the image");
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void init(const bContext *C, PointerRNA *ptr)
|
||||
@@ -51,22 +65,11 @@ static void init(const bContext *C, PointerRNA *ptr)
|
||||
|
||||
node->id = (ID *)scene->clip;
|
||||
id_us_plus(node->id);
|
||||
|
||||
/* Default to bi-linear, see node_sampler_type_items in `rna_nodetree.cc`. */
|
||||
node->custom1 = 1;
|
||||
}
|
||||
|
||||
static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
|
||||
uiTemplateID(layout, C, ptr, "clip", nullptr, "CLIP_OT_open", nullptr);
|
||||
|
||||
if (!node->id) {
|
||||
return;
|
||||
}
|
||||
|
||||
layout->prop(ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
@@ -105,11 +108,17 @@ class Stabilize2DOperation : public NodeOperation {
|
||||
output.share_data(input);
|
||||
output.transform(transformation);
|
||||
output.get_realization_options().interpolation = this->get_interpolation();
|
||||
output.get_realization_options().extension_x = this->get_extension_mode_x();
|
||||
output.get_realization_options().extension_y = this->get_extension_mode_y();
|
||||
}
|
||||
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(bnode().custom1)) {
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
@@ -119,10 +128,45 @@ class Stabilize2DOperation : public NodeOperation {
|
||||
return Interpolation::Bicubic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
bool do_inverse_stabilization()
|
||||
{
|
||||
return this->get_input("Invert").get_single_value_default(false);
|
||||
|
||||
@@ -8,15 +8,11 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_base.hh"
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "IMB_colormanagement.hh"
|
||||
|
||||
@@ -28,7 +24,19 @@
|
||||
|
||||
namespace blender::nodes::node_composite_tonemap_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTonemap)
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
{CMP_NODE_TONE_MAP_PHOTORECEPTOR,
|
||||
"RD_PHOTORECEPTOR",
|
||||
0,
|
||||
"R/D Photoreceptor",
|
||||
"More advanced algorithm based on eye physiology, by Reinhard and Devlin"},
|
||||
{CMP_NODE_TONE_MAP_SIMPLE,
|
||||
"RH_SIMPLE",
|
||||
0,
|
||||
"Rh Simple",
|
||||
"Simpler photographic algorithm by Reinhard"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
@@ -36,23 +44,40 @@ static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b)
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Float>("Key").default_value(0.18f).min(0.0f).description(
|
||||
"The luminance that will be mapped to the log average luminance, typically set to the "
|
||||
"middle gray value");
|
||||
b.add_input<decl::Float>("Balance").default_value(1.0f).min(0.0f).description(
|
||||
"Balances low and high luminance areas. Lower values emphasize details in shadows, "
|
||||
"while higher values compress highlights more smoothly");
|
||||
b.add_input<decl::Float>("Gamma").default_value(1.0f).min(0.0f).description(
|
||||
"Gamma correction factor applied after tone mapping");
|
||||
b.add_input<decl::Menu>("Type")
|
||||
.default_value(CMP_NODE_TONE_MAP_PHOTORECEPTOR)
|
||||
.static_items(type_items);
|
||||
|
||||
b.add_input<decl::Float>("Key")
|
||||
.default_value(0.18f)
|
||||
.min(0.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_SIMPLE)
|
||||
.description(
|
||||
"The luminance that will be mapped to the log average luminance, typically set to the "
|
||||
"middle gray value");
|
||||
b.add_input<decl::Float>("Balance")
|
||||
.default_value(1.0f)
|
||||
.min(0.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_SIMPLE)
|
||||
.description(
|
||||
"Balances low and high luminance areas. Lower values emphasize details in shadows, "
|
||||
"while higher values compress highlights more smoothly");
|
||||
b.add_input<decl::Float>("Gamma")
|
||||
.default_value(1.0f)
|
||||
.min(0.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_SIMPLE)
|
||||
.description("Gamma correction factor applied after tone mapping");
|
||||
|
||||
b.add_input<decl::Float>("Intensity")
|
||||
.default_value(0.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_PHOTORECEPTOR)
|
||||
.description(
|
||||
"Controls the intensity of the image, lower values makes it darker while higher values "
|
||||
"makes it lighter");
|
||||
b.add_input<decl::Float>("Contrast")
|
||||
.default_value(0.0f)
|
||||
.min(0.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_PHOTORECEPTOR)
|
||||
.description(
|
||||
"Controls the contrast of the image. Zero automatically sets the contrast based on its "
|
||||
"global range for better luminance distribution");
|
||||
@@ -61,6 +86,7 @@ static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_FACTOR)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_PHOTORECEPTOR)
|
||||
.description(
|
||||
"Specifies if tone mapping operates on the entire image or per pixel, 0 means the "
|
||||
"entire image, 1 means it is per pixel, and values in between blends between both");
|
||||
@@ -69,6 +95,7 @@ static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_FACTOR)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.usage_by_single_menu(CMP_NODE_TONE_MAP_PHOTORECEPTOR)
|
||||
.description(
|
||||
"Specifies if tone mapping operates on the luminance or on each channel independently, "
|
||||
"0 means it uses luminance, 1 means it is per channel, and values in between blends "
|
||||
@@ -79,40 +106,11 @@ static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_composit_init_tonemap(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, but still allocated for forward compatibility. */
|
||||
NodeTonemap *ntm = MEM_callocN<NodeTonemap>(__func__);
|
||||
ntm->type = CMP_NODE_TONE_MAP_PHOTORECEPTOR;
|
||||
node->storage = ntm;
|
||||
}
|
||||
|
||||
static void node_composit_buts_tonemap(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
layout->prop(ptr, "tonemap_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_update(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
const bool is_simple = node_storage(*node).type == CMP_NODE_TONE_MAP_SIMPLE;
|
||||
|
||||
bNodeSocket *key_input = bke::node_find_socket(*node, SOCK_IN, "Key");
|
||||
bNodeSocket *balance_input = bke::node_find_socket(*node, SOCK_IN, "Balance");
|
||||
bNodeSocket *gamma_input = bke::node_find_socket(*node, SOCK_IN, "Gamma");
|
||||
|
||||
blender::bke::node_set_socket_availability(*ntree, *key_input, is_simple);
|
||||
blender::bke::node_set_socket_availability(*ntree, *balance_input, is_simple);
|
||||
blender::bke::node_set_socket_availability(*ntree, *gamma_input, is_simple);
|
||||
|
||||
bNodeSocket *intensity_input = bke::node_find_socket(*node, SOCK_IN, "Intensity");
|
||||
bNodeSocket *contrast_input = bke::node_find_socket(*node, SOCK_IN, "Contrast");
|
||||
bNodeSocket *light_adaptation_input = bke::node_find_socket(*node, SOCK_IN, "Light Adaptation");
|
||||
bNodeSocket *chromatic_adaptation_input = bke::node_find_socket(
|
||||
*node, SOCK_IN, "Chromatic Adaptation");
|
||||
|
||||
blender::bke::node_set_socket_availability(*ntree, *intensity_input, !is_simple);
|
||||
blender::bke::node_set_socket_availability(*ntree, *contrast_input, !is_simple);
|
||||
blender::bke::node_set_socket_availability(*ntree, *light_adaptation_input, !is_simple);
|
||||
blender::bke::node_set_socket_availability(*ntree, *chromatic_adaptation_input, !is_simple);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class ToneMapOperation : public NodeOperation {
|
||||
@@ -135,10 +133,9 @@ class ToneMapOperation : public NodeOperation {
|
||||
case CMP_NODE_TONE_MAP_PHOTORECEPTOR:
|
||||
execute_photoreceptor();
|
||||
return;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return;
|
||||
}
|
||||
|
||||
output_image.share_data(input_image);
|
||||
}
|
||||
|
||||
/* Tone mapping based on equation (3) from Reinhard, Erik, et al. "Photographic tone reproduction
|
||||
@@ -457,7 +454,10 @@ class ToneMapOperation : public NodeOperation {
|
||||
|
||||
CMPNodeToneMapType get_type()
|
||||
{
|
||||
return static_cast<CMPNodeToneMapType>(node_storage(bnode()).type);
|
||||
const Result &input = this->get_input("Type");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_TONE_MAP_PHOTORECEPTOR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeToneMapType>(menu_value.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -482,8 +482,6 @@ static void register_node_type_cmp_tonemap()
|
||||
ntype.enum_name_legacy = "TONEMAP";
|
||||
ntype.nclass = NODE_CLASS_OP_COLOR;
|
||||
ntype.declare = file_ns::cmp_node_tonemap_declare;
|
||||
ntype.updatefunc = file_ns::node_update;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_tonemap;
|
||||
ntype.initfunc = file_ns::node_composit_init_tonemap;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -34,8 +34,41 @@ namespace blender::nodes::node_composite_trackpos_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTrackPosData)
|
||||
|
||||
static const EnumPropertyItem mode_items[] = {
|
||||
{CMP_NODE_TRACK_POSITION_ABSOLUTE,
|
||||
"ABSOLUTE",
|
||||
0,
|
||||
"Absolute",
|
||||
"Returns the position and speed of the marker at the current scene frame relative to the "
|
||||
"zero origin of the tracking space"},
|
||||
{CMP_NODE_TRACK_POSITION_RELATIVE_START,
|
||||
"RELATIVE_START",
|
||||
0,
|
||||
"Relative Start",
|
||||
"Returns the position and speed of the marker at the current scene frame relative to the "
|
||||
"position of the first non-disabled marker in the track"},
|
||||
{CMP_NODE_TRACK_POSITION_RELATIVE_FRAME,
|
||||
"RELATIVE_FRAME",
|
||||
0,
|
||||
"Relative Frame",
|
||||
"Returns the position and speed of the marker at the current scene frame relative to the "
|
||||
"position of the marker at the current scene frame plus the user given relative frame"},
|
||||
{CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME,
|
||||
"ABSOLUTE_FRAME",
|
||||
0,
|
||||
"Absolute Frame",
|
||||
"Returns the position and speed of the marker at the given absolute frame"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void cmp_node_trackpos_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Menu>("Mode")
|
||||
.default_value(CMP_NODE_TRACK_POSITION_ABSOLUTE)
|
||||
.static_items(mode_items);
|
||||
b.add_input<decl::Int>("Frame").usage_by_menu(
|
||||
"Mode", {CMP_NODE_TRACK_POSITION_RELATIVE_FRAME, CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME});
|
||||
|
||||
b.add_output<decl::Float>("X");
|
||||
b.add_output<decl::Float>("Y");
|
||||
b.add_output<decl::Vector>("Speed").subtype(PROP_VELOCITY).dimensions(4);
|
||||
@@ -92,15 +125,6 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN
|
||||
else {
|
||||
layout->prop(ptr, "track_name", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_ANIM_DATA);
|
||||
}
|
||||
|
||||
layout->prop(ptr, "position", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
|
||||
if (ELEM(node->custom1,
|
||||
CMP_NODE_TRACK_POSITION_RELATIVE_FRAME,
|
||||
CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME))
|
||||
{
|
||||
layout->prop(ptr, "frame_relative", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,9 +252,12 @@ class TrackPositionOperation : public NodeOperation {
|
||||
return compute_first_marker_position(track);
|
||||
case CMP_NODE_TRACK_POSITION_RELATIVE_FRAME:
|
||||
return compute_marker_position_at_frame(track, get_relative_frame());
|
||||
default:
|
||||
case CMP_NODE_TRACK_POSITION_ABSOLUTE:
|
||||
case CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME:
|
||||
return float2(0.0f);
|
||||
}
|
||||
|
||||
return float2(0.0f);
|
||||
}
|
||||
|
||||
/* Compute the position of the first non-disabled marker in the track. */
|
||||
@@ -298,7 +325,7 @@ class TrackPositionOperation : public NodeOperation {
|
||||
* added to the current scene frame. See the get_mode() method for more information. */
|
||||
int get_relative_frame()
|
||||
{
|
||||
return bnode().custom2;
|
||||
return this->get_input("Frame").get_single_value_default(0);
|
||||
}
|
||||
|
||||
/* Get the frame where the marker will be retrieved. This is the absolute frame for the absolute
|
||||
@@ -316,26 +343,15 @@ class TrackPositionOperation : public NodeOperation {
|
||||
* will be retrieved. See the get_mode() method for more information. */
|
||||
int get_absolute_frame()
|
||||
{
|
||||
return bnode().custom2;
|
||||
return this->get_input("Frame").get_single_value_default(0);
|
||||
}
|
||||
|
||||
/* CMP_NODE_TRACK_POSITION_ABSOLUTE:
|
||||
* Returns the position and speed of the marker at the current scene frame relative to the zero
|
||||
* origin of the tracking space.
|
||||
*
|
||||
* CMP_NODE_TRACK_POSITION_RELATIVE_START:
|
||||
* Returns the position and speed of the marker at the current scene frame relative to the
|
||||
* position of the first non-disabled marker in the track.
|
||||
*
|
||||
* CMP_NODE_TRACK_POSITION_RELATIVE_FRAME:
|
||||
* Returns the position and speed of the marker at the current scene frame relative to the
|
||||
* position of the marker at the current scene frame plus the user given relative frame.
|
||||
*
|
||||
* CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME:
|
||||
* Returns the position and speed of the marker at the given absolute frame. */
|
||||
CMPNodeTrackPositionMode get_mode()
|
||||
{
|
||||
return static_cast<CMPNodeTrackPositionMode>(bnode().custom1);
|
||||
const Result &input = this->get_input("Mode");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_TRACK_POSITION_ABSOLUTE);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
return static_cast<CMPNodeTrackPositionMode>(menu_value.value);
|
||||
}
|
||||
|
||||
MovieClip *get_movie_clip()
|
||||
|
||||
@@ -6,40 +6,29 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BKE_node.hh"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
|
||||
#include "COM_node_operation.hh"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "COM_node_operation.hh"
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Transform ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_transform_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTransformData)
|
||||
|
||||
static void cmp_node_init_transform(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
NodeTransformData *data = MEM_callocN<NodeTransformData>(__func__);
|
||||
data->interpolation = CMP_NODE_INTERPOLATION_NEAREST;
|
||||
data->extension_x = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
data->extension_y = CMP_NODE_EXTENSION_MODE_CLIP;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void cmp_node_transform_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({0.8f, 0.8f, 0.8f, 1.0f})
|
||||
.compositor_realization_mode(CompositorInputRealizationMode::None)
|
||||
@@ -50,16 +39,26 @@ static void cmp_node_transform_declare(NodeDeclarationBuilder &b)
|
||||
PROP_ANGLE);
|
||||
b.add_input<decl::Float>("Scale").default_value(1.0f).min(0.0001f).max(CMP_SCALE_MAX);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void node_composit_buts_transform(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
static void cmp_node_init_transform(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
uiLayout &column = layout->column(true);
|
||||
column.prop(ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiLayout &row = column.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeTransformData *data = MEM_callocN<NodeTransformData>(__func__);
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
@@ -86,39 +85,13 @@ class TransformOperation : public NodeOperation {
|
||||
output.get_realization_options().extension_y = this->get_extension_mode_y();
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(node_storage(bnode()).interpolation)) {
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
@@ -128,9 +101,44 @@ class TransformOperation : public NodeOperation {
|
||||
return Interpolation::Bicubic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
return ExtensionMode::Repeat;
|
||||
case CMP_NODE_EXTENSION_MODE_EXTEND:
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
@@ -152,7 +160,6 @@ static void register_node_type_cmp_transform()
|
||||
ntype.enum_name_legacy = "TRANSFORM";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_transform_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_transform;
|
||||
ntype.get_compositor_operation = file_ns::get_compositor_operation;
|
||||
ntype.initfunc = file_ns::cmp_node_init_transform;
|
||||
blender::bke::node_type_storage(
|
||||
|
||||
@@ -6,27 +6,25 @@
|
||||
* \ingroup cmpnodes
|
||||
*/
|
||||
|
||||
#include "BLI_assert.h"
|
||||
#include "BLI_math_matrix.hh"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "UI_interface_layout.hh"
|
||||
#include "UI_resources.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include "COM_domain.hh"
|
||||
#include "COM_node_operation.hh"
|
||||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Translate ******************** */
|
||||
|
||||
namespace blender::nodes::node_composite_translate_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTranslateData)
|
||||
|
||||
static void cmp_node_translate_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.use_custom_socket_order();
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
|
||||
b.add_input<decl::Color>("Image")
|
||||
.default_value({1.0f, 1.0f, 1.0f, 1.0f})
|
||||
.compositor_realization_mode(CompositorInputRealizationMode::None)
|
||||
@@ -34,24 +32,28 @@ static void cmp_node_translate_declare(NodeDeclarationBuilder &b)
|
||||
b.add_input<decl::Float>("X").default_value(0.0f).min(-10000.0f).max(10000.0f);
|
||||
b.add_input<decl::Float>("Y").default_value(0.0f).min(-10000.0f).max(10000.0f);
|
||||
|
||||
b.add_output<decl::Color>("Image").structure_type(StructureType::Dynamic);
|
||||
PanelDeclarationBuilder &sampling_panel = b.add_panel("Sampling").default_closed(true);
|
||||
sampling_panel.add_input<decl::Menu>("Interpolation")
|
||||
.default_value(CMP_NODE_INTERPOLATION_BILINEAR)
|
||||
.static_items(rna_enum_node_compositor_interpolation_items)
|
||||
.description("Interpolation method");
|
||||
sampling_panel.add_input<decl::Menu>("Extension X")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the X axis");
|
||||
sampling_panel.add_input<decl::Menu>("Extension Y")
|
||||
.default_value(CMP_NODE_EXTENSION_MODE_CLIP)
|
||||
.static_items(rna_enum_node_compositor_extension_items)
|
||||
.description("The extension mode applied to the Y axis");
|
||||
}
|
||||
|
||||
static void node_composit_init_translate(bNodeTree * /*ntree*/, bNode *node)
|
||||
{
|
||||
/* Unused, kept for forward compatibility. */
|
||||
NodeTranslateData *data = MEM_callocN<NodeTranslateData>(__func__);
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static void node_composit_buts_translate(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout &column = layout->column(true);
|
||||
column.prop(ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiLayout &row = column.row(true);
|
||||
row.prop(ptr, "extension_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
row.prop(ptr, "extension_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
using namespace blender::compositor;
|
||||
|
||||
class TranslateOperation : public NodeOperation {
|
||||
@@ -76,7 +78,11 @@ class TranslateOperation : public NodeOperation {
|
||||
|
||||
Interpolation get_interpolation()
|
||||
{
|
||||
switch (static_cast<CMPNodeInterpolation>(node_storage(bnode()).interpolation)) {
|
||||
const Result &input = this->get_input("Interpolation");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_INTERPOLATION_BILINEAR);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPNodeInterpolation interpolation = static_cast<CMPNodeInterpolation>(menu_value.value);
|
||||
switch (interpolation) {
|
||||
case CMP_NODE_INTERPOLATION_NEAREST:
|
||||
return Interpolation::Nearest;
|
||||
case CMP_NODE_INTERPOLATION_BILINEAR:
|
||||
@@ -86,13 +92,16 @@ class TranslateOperation : public NodeOperation {
|
||||
return Interpolation::Bicubic;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return Interpolation::Nearest;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_x()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_x)) {
|
||||
const Result &input = this->get_input("Extension X");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_x = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_x) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -101,13 +110,16 @@ class TranslateOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
|
||||
ExtensionMode get_extension_mode_y()
|
||||
{
|
||||
switch (static_cast<CMPExtensionMode>(node_storage(bnode()).extension_y)) {
|
||||
const Result &input = this->get_input("Extension Y");
|
||||
const MenuValue default_menu_value = MenuValue(CMP_NODE_EXTENSION_MODE_CLIP);
|
||||
const MenuValue menu_value = input.get_single_value_default(default_menu_value);
|
||||
const CMPExtensionMode extension_y = static_cast<CMPExtensionMode>(menu_value.value);
|
||||
switch (extension_y) {
|
||||
case CMP_NODE_EXTENSION_MODE_CLIP:
|
||||
return ExtensionMode::Clip;
|
||||
case CMP_NODE_EXTENSION_MODE_REPEAT:
|
||||
@@ -116,7 +128,6 @@ class TranslateOperation : public NodeOperation {
|
||||
return ExtensionMode::Extend;
|
||||
}
|
||||
|
||||
BLI_assert_unreachable();
|
||||
return ExtensionMode::Clip;
|
||||
}
|
||||
};
|
||||
@@ -140,7 +151,6 @@ static void register_node_type_cmp_translate()
|
||||
ntype.enum_name_legacy = "TRANSLATE";
|
||||
ntype.nclass = NODE_CLASS_DISTORT;
|
||||
ntype.declare = file_ns::cmp_node_translate_declare;
|
||||
ntype.draw_buttons = file_ns::node_composit_buts_translate;
|
||||
ntype.initfunc = file_ns::node_composit_init_translate;
|
||||
blender::bke::node_type_storage(
|
||||
ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -828,6 +828,44 @@ BaseSocketDeclarationBuilder &BaseSocketDeclarationBuilder::usage_by_single_menu
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseSocketDeclarationBuilder &BaseSocketDeclarationBuilder::usage_by_menu(
|
||||
const StringRef menu_input_identifier, const int menu_value)
|
||||
{
|
||||
this->make_available([menu_input_identifier, menu_value](bNode &node) {
|
||||
bNodeSocket &socket = *blender::bke::node_find_socket(node, SOCK_IN, menu_input_identifier);
|
||||
bNodeSocketValueMenu *value = socket.default_value_typed<bNodeSocketValueMenu>();
|
||||
value->value = menu_value;
|
||||
});
|
||||
this->usage_inference(
|
||||
[menu_input_identifier, menu_value](
|
||||
const socket_usage_inference::InputSocketUsageParams ¶ms) -> std::optional<bool> {
|
||||
return params.menu_input_may_be(menu_input_identifier, menu_value);
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseSocketDeclarationBuilder &BaseSocketDeclarationBuilder::usage_by_menu(
|
||||
const StringRef menu_input_identifier, const Array<int> menu_values)
|
||||
{
|
||||
this->make_available([menu_input_identifier, menu_values](bNode &node) {
|
||||
bNodeSocket &socket = *blender::bke::node_find_socket(node, SOCK_IN, menu_input_identifier);
|
||||
bNodeSocketValueMenu *value = socket.default_value_typed<bNodeSocketValueMenu>();
|
||||
value->value = menu_values[0];
|
||||
});
|
||||
this->usage_inference(
|
||||
[menu_input_identifier, menu_values](
|
||||
const socket_usage_inference::InputSocketUsageParams ¶ms) -> std::optional<bool> {
|
||||
for (const int menu_value : menu_values) {
|
||||
const bool might_be = params.menu_input_may_be(menu_input_identifier, menu_value);
|
||||
if (might_be) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseSocketDeclarationBuilder &BaseSocketDeclarationBuilder::align_with_previous(const bool value)
|
||||
{
|
||||
decl_base_->align_with_previous_socket = value;
|
||||
|
||||
@@ -224,19 +224,6 @@ void node_vector_math_label(const bNodeTree * /*ntree*/,
|
||||
BLI_strncpy_utf8(label, CTX_IFACE_(BLT_I18NCONTEXT_ID_NODETREE, name), label_maxncpy);
|
||||
}
|
||||
|
||||
void node_filter_label(const bNodeTree * /*ntree*/,
|
||||
const bNode *node,
|
||||
char *label,
|
||||
int label_maxncpy)
|
||||
{
|
||||
const char *name;
|
||||
bool enum_label = RNA_enum_name(rna_enum_node_filter_items, node->custom1, &name);
|
||||
if (!enum_label) {
|
||||
name = N_("Unknown");
|
||||
}
|
||||
BLI_strncpy_utf8(label, IFACE_(name), label_maxncpy);
|
||||
}
|
||||
|
||||
void node_combsep_color_label(const ListBase *sockets, NodeCombSepColorMode mode)
|
||||
{
|
||||
bNodeSocket *sock1 = (bNodeSocket *)sockets->first;
|
||||
|
||||
@@ -45,7 +45,6 @@ void node_vector_math_label(const bNodeTree *ntree,
|
||||
const bNode *node,
|
||||
char *label,
|
||||
int label_maxncpy);
|
||||
void node_filter_label(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy);
|
||||
void node_combsep_color_label(const ListBase *sockets, NodeCombSepColorMode mode);
|
||||
|
||||
/*** Link Handling */
|
||||
|
||||
Reference in New Issue
Block a user