diff options
Diffstat (limited to 'source/blender/nodes/composite/nodes')
52 files changed, 103 insertions, 435 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc index e2f4e80270e..dffdc4a9408 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc @@ -108,7 +108,7 @@ void register_node_type_cmp_alphaover() cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::cmp_node_alphaover_declare; ntype.draw_buttons = file_ns::node_composit_buts_alphaover; - node_type_init(&ntype, file_ns::node_alphaover_init); + ntype.initfunc = file_ns::node_alphaover_init; node_type_storage( &ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc index 25fefd33199..8c77df08211 100644 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -74,7 +74,7 @@ void register_node_type_cmp_antialiasing() ntype.draw_buttons = file_ns::node_composit_buts_antialiasing; ntype.flag |= NODE_PREVIEW; node_type_size(&ntype, 170, 140, 200); - node_type_init(&ntype, file_ns::node_composit_init_antialiasing); + ntype.initfunc = file_ns::node_composit_init_antialiasing; node_type_storage( &ntype, "NodeAntiAliasingData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc index af7581d845f..65990677ae3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -119,7 +119,7 @@ void register_node_type_cmp_bilateralblur() cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_bilateralblur_declare; ntype.draw_buttons = file_ns::node_composit_buts_bilateralblur; - node_type_init(&ntype, file_ns::node_composit_init_bilateralblur); + ntype.initfunc = file_ns::node_composit_init_bilateralblur; node_type_storage( &ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc index a9372bdcfb7..6eacc685c7e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -5,11 +5,7 @@ * \ingroup cmpnodes */ -#include <cstdint> - -#include "BLI_array.hh" #include "BLI_assert.h" -#include "BLI_index_range.hh" #include "BLI_math_base.hh" #include "BLI_math_vec_types.hh" #include "BLI_math_vector.hh" @@ -19,12 +15,13 @@ #include "UI_interface.h" #include "UI_resources.h" -#include "RE_pipeline.h" - +#include "GPU_shader.h" #include "GPU_state.h" #include "GPU_texture.h" #include "COM_node_operation.hh" +#include "COM_symmetric_blur_weights.hh" +#include "COM_symmetric_separable_blur_weights.hh" #include "COM_utilities.hh" #include "node_composite_util.hh" @@ -92,192 +89,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext * /*C*/, PointerR using namespace blender::realtime_compositor; -/* A helper class that computes and caches a 1D GPU texture containing the weights of the separable - * filter of the given type and radius. The filter is assumed to be symmetric, because the filter - * functions are all even functions. Consequently, only the positive half of the filter is computed - * and the shader takes that into consideration. */ -class SymmetricSeparableBlurWeights { - private: - float radius_ = 1.0f; - int type_ = R_FILTER_GAUSS; - GPUTexture *texture_ = nullptr; - - public: - ~SymmetricSeparableBlurWeights() - { - if (texture_) { - GPU_texture_free(texture_); - } - } - - /* Check if a texture containing the weights was already computed for the given filter type and - * radius. If such texture exists, do nothing, otherwise, free the already computed texture and - * recompute it with the given filter type and radius. */ - void update(float radius, int type) - { - if (texture_ && type == type_ && radius == radius_) { - return; - } - - if (texture_) { - GPU_texture_free(texture_); - } - - /* The size of filter is double the radius plus 1, but since the filter is symmetric, we only - * compute half of it and no doubling happens. We add 1 to make sure the filter size is always - * odd and there is a center weight. */ - const int size = math::ceil(radius) + 1; - Array<float> weights(size); - - float sum = 0.0f; - - /* First, compute the center weight. */ - const float center_weight = RE_filter_value(type, 0.0f); - weights[0] = center_weight; - sum += center_weight; - - /* Second, compute the other weights in the positive direction, making sure to add double the - * weight to the sum of weights because the filter is symmetric and we only loop over half of - * it. Skip the center weight already computed by dropping the front index. */ - const float scale = radius > 0.0f ? 1.0f / radius : 0.0f; - for (const int i : weights.index_range().drop_front(1)) { - const float weight = RE_filter_value(type, i * scale); - weights[i] = weight; - sum += weight * 2.0f; - } - - /* Finally, normalize the weights. */ - for (const int i : weights.index_range()) { - weights[i] /= sum; - } - - texture_ = GPU_texture_create_1d("Weights", size, 1, GPU_R16F, weights.data()); - - type_ = type; - radius_ = radius; - } - - void bind_as_texture(GPUShader *shader, const char *texture_name) - { - const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name); - GPU_texture_bind(texture_, texture_image_unit); - } - - void unbind_as_texture() - { - GPU_texture_unbind(texture_); - } -}; - -/* A helper class that computes and caches a 2D GPU texture containing the weights of the filter of - * the given type and radius. The filter is assumed to be symmetric, because the filter functions - * are evaluated on the normalized distance to the center. Consequently, only the upper right - * quadrant are computed and the shader takes that into consideration. */ -class SymmetricBlurWeights { - private: - int type_ = R_FILTER_GAUSS; - float2 radius_ = float2(1.0f); - GPUTexture *texture_ = nullptr; - - public: - ~SymmetricBlurWeights() - { - if (texture_) { - GPU_texture_free(texture_); - } - } - - /* Check if a texture containing the weights was already computed for the given filter type and - * radius. If such texture exists, do nothing, otherwise, free the already computed texture and - * recompute it with the given filter type and radius. */ - void update(float2 radius, int type) - { - if (texture_ && type == type_ && radius == radius_) { - return; - } - - if (texture_) { - GPU_texture_free(texture_); - } - - /* The full size of filter is double the radius plus 1, but since the filter is symmetric, we - * only compute a single quadrant of it and so no doubling happens. We add 1 to make sure the - * filter size is always odd and there is a center weight. */ - const float2 scale = math::safe_divide(float2(1.0f), radius); - const int2 size = int2(math::ceil(radius)) + int2(1); - Array<float> weights(size.x * size.y); - - float sum = 0.0f; - - /* First, compute the center weight. */ - const float center_weight = RE_filter_value(type, 0.0f); - weights[0] = center_weight; - sum += center_weight; - - /* Then, compute the weights along the positive x axis, making sure to add double the weight to - * the sum of weights because the filter is symmetric and we only loop over the positive half - * of the x axis. Skip the center weight already computed by dropping the front index. */ - for (const int x : IndexRange(size.x).drop_front(1)) { - const float weight = RE_filter_value(type, x * scale.x); - weights[x] = weight; - sum += weight * 2.0f; - } - - /* Then, compute the weights along the positive y axis, making sure to add double the weight to - * the sum of weights because the filter is symmetric and we only loop over the positive half - * of the y axis. Skip the center weight already computed by dropping the front index. */ - for (const int y : IndexRange(size.y).drop_front(1)) { - const float weight = RE_filter_value(type, y * scale.y); - weights[size.x * y] = weight; - sum += weight * 2.0f; - } - - /* Then, compute the other weights in the upper right quadrant, making sure to add quadruple - * the weight to the sum of weights because the filter is symmetric and we only loop over one - * quadrant of it. Skip the weights along the y and x axis already computed by dropping the - * front index. */ - for (const int y : IndexRange(size.y).drop_front(1)) { - for (const int x : IndexRange(size.x).drop_front(1)) { - const float weight = RE_filter_value(type, math::length(float2(x, y) * scale)); - weights[size.x * y + x] = weight; - sum += weight * 4.0f; - } - } - - /* Finally, normalize the weights. */ - for (const int y : IndexRange(size.y)) { - for (const int x : IndexRange(size.x)) { - weights[size.x * y + x] /= sum; - } - } - - texture_ = GPU_texture_create_2d("Weights", size.x, size.y, 1, GPU_R16F, weights.data()); - - type_ = type; - radius_ = radius; - } - - void bind_as_texture(GPUShader *shader, const char *texture_name) - { - const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name); - GPU_texture_bind(texture_, texture_image_unit); - } - - void unbind_as_texture() - { - GPU_texture_unbind(texture_); - } -}; - class BlurOperation : public NodeOperation { - private: - /* Cached symmetric blur weights. */ - SymmetricBlurWeights blur_weights_; - /* Cached symmetric blur weights for the separable horizontal pass. */ - SymmetricSeparableBlurWeights blur_horizontal_weights_; - /* Cached symmetric blur weights for the separable vertical pass. */ - SymmetricSeparableBlurWeights blur_vertical_weights_; - public: using NodeOperation::NodeOperation; @@ -308,13 +120,16 @@ class BlurOperation : public NodeOperation { const Result &input_image = get_input("Image"); input_image.bind_as_texture(shader, "input_tx"); - blur_weights_.update(compute_blur_radius(), node_storage(bnode()).filtertype); - blur_weights_.bind_as_texture(shader, "weights_tx"); + const float2 blur_radius = compute_blur_radius(); + + const SymmetricBlurWeights &weights = context().cache_manager().get_symmetric_blur_weights( + node_storage(bnode()).filtertype, blur_radius); + weights.bind_as_texture(shader, "weights_tx"); Domain domain = compute_domain(); if (get_extend_bounds()) { /* Add a radius amount of pixels in both sides of the image, hence the multiply by 2. */ - domain.size += int2(math::ceil(compute_blur_radius())) * 2; + domain.size += int2(math::ceil(blur_radius)) * 2; } Result &output_image = get_result("Image"); @@ -326,7 +141,7 @@ class BlurOperation : public NodeOperation { GPU_shader_unbind(); output_image.unbind_as_image(); input_image.unbind_as_texture(); - blur_weights_.unbind_as_texture(); + weights.unbind_as_texture(); } GPUTexture *execute_separable_blur_horizontal_pass() @@ -341,12 +156,16 @@ class BlurOperation : public NodeOperation { const Result &input_image = get_input("Image"); input_image.bind_as_texture(shader, "input_tx"); - blur_horizontal_weights_.update(compute_blur_radius().x, node_storage(bnode()).filtertype); - blur_horizontal_weights_.bind_as_texture(shader, "weights_tx"); + const float2 blur_radius = compute_blur_radius(); + + const SymmetricSeparableBlurWeights &weights = + context().cache_manager().get_symmetric_separable_blur_weights( + node_storage(bnode()).filtertype, blur_radius.x); + weights.bind_as_texture(shader, "weights_tx"); Domain domain = compute_domain(); if (get_extend_bounds()) { - domain.size.x += int(math::ceil(compute_blur_radius().x)) * 2; + domain.size.x += int(math::ceil(blur_radius.x)) * 2; } /* We allocate an output image of a transposed size, that is, with a height equivalent to the @@ -367,7 +186,7 @@ class BlurOperation : public NodeOperation { GPU_shader_unbind(); input_image.unbind_as_texture(); - blur_horizontal_weights_.unbind_as_texture(); + weights.unbind_as_texture(); GPU_texture_image_unbind(horizontal_pass_result); return horizontal_pass_result; @@ -386,8 +205,12 @@ class BlurOperation : public NodeOperation { const int texture_image_unit = GPU_shader_get_texture_binding(shader, "input_tx"); GPU_texture_bind(horizontal_pass_result, texture_image_unit); - blur_vertical_weights_.update(compute_blur_radius().y, node_storage(bnode()).filtertype); - blur_vertical_weights_.bind_as_texture(shader, "weights_tx"); + const float2 blur_radius = compute_blur_radius(); + + const SymmetricSeparableBlurWeights &weights = + context().cache_manager().get_symmetric_separable_blur_weights( + node_storage(bnode()).filtertype, blur_radius.y); + weights.bind_as_texture(shader, "weights_tx"); Domain domain = compute_domain(); if (get_extend_bounds()) { @@ -405,7 +228,7 @@ class BlurOperation : public NodeOperation { GPU_shader_unbind(); output_image.unbind_as_image(); - blur_vertical_weights_.unbind_as_texture(); + weights.unbind_as_texture(); GPU_texture_unbind(horizontal_pass_result); } @@ -501,7 +324,7 @@ void register_node_type_cmp_blur() ntype.declare = file_ns::cmp_node_blur_declare; ntype.draw_buttons = file_ns::node_composit_buts_blur; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_blur); + ntype.initfunc = file_ns::node_composit_init_blur; node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc index a581d87a463..f09bf1f5afd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc @@ -215,7 +215,7 @@ void register_node_type_cmp_bokehblur() cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_bokehblur_declare; ntype.draw_buttons = file_ns::node_composit_buts_bokehblur; - node_type_init(&ntype, file_ns::node_composit_init_bokehblur); + ntype.initfunc = file_ns::node_composit_init_bokehblur; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc index eb35b933d1b..8b817d3a677 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc @@ -122,7 +122,7 @@ void register_node_type_cmp_bokehimage() ntype.declare = file_ns::cmp_node_bokehimage_declare; ntype.draw_buttons = file_ns::node_composit_buts_bokehimage; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_bokehimage); + ntype.initfunc = file_ns::node_composit_init_bokehimage; node_type_storage( &ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc index 668dc9d92de..17b5d64de91 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -157,7 +157,7 @@ void register_node_type_cmp_boxmask() cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE); ntype.declare = file_ns::cmp_node_boxmask_declare; ntype.draw_buttons = file_ns::node_composit_buts_boxmask; - node_type_init(&ntype, file_ns::node_composit_init_boxmask); + ntype.initfunc = file_ns::node_composit_init_boxmask; node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc index 6b9fef75524..08794914e91 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -81,7 +81,7 @@ void register_node_type_cmp_brightcontrast() cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::cmp_node_brightcontrast_declare; ntype.draw_buttons = file_ns::node_composit_buts_brightcontrast; - node_type_init(&ntype, file_ns::node_composit_init_brightcontrast); + ntype.initfunc = file_ns::node_composit_init_brightcontrast; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc b/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc index 2fd2d6c8f71..be02f1ecd00 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc @@ -182,7 +182,7 @@ void register_node_type_cmp_channel_matte() ntype.declare = file_ns::cmp_node_channel_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_channel_matte; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_channel_matte); + ntype.initfunc = file_ns::node_composit_init_channel_matte; node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc index e2ef96ea95e..4e035fcf5e0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc @@ -121,7 +121,7 @@ void register_node_type_cmp_chroma_matte() ntype.declare = file_ns::cmp_node_chroma_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_chroma_matte; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_chroma_matte); + ntype.initfunc = file_ns::node_composit_init_chroma_matte; node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_color_matte.cc b/source/blender/nodes/composite/nodes/node_composite_color_matte.cc index 2a20a4d995f..9233f61205d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_color_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_color_matte.cc @@ -119,7 +119,7 @@ void register_node_type_cmp_color_matte() ntype.declare = file_ns::cmp_node_color_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_color_matte; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_color_matte); + ntype.initfunc = file_ns::node_composit_init_color_matte; node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_color_spill.cc b/source/blender/nodes/composite/nodes/node_composite_color_spill.cc index ba829da83ed..cd129d53d6b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_color_spill.cc +++ b/source/blender/nodes/composite/nodes/node_composite_color_spill.cc @@ -196,7 +196,7 @@ void register_node_type_cmp_color_spill() cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE); ntype.declare = file_ns::cmp_node_color_spill_declare; ntype.draw_buttons = file_ns::node_composit_buts_color_spill; - node_type_init(&ntype, file_ns::node_composit_init_color_spill); + ntype.initfunc = file_ns::node_composit_init_color_spill; node_type_storage( &ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc index 3300896bfdf..aade1b639ab 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc @@ -210,7 +210,7 @@ void register_node_type_cmp_colorbalance() ntype.draw_buttons = file_ns::node_composit_buts_colorbalance; ntype.draw_buttons_ex = file_ns::node_composit_buts_colorbalance_ex; node_type_size(&ntype, 400, 200, 400); - node_type_init(&ntype, file_ns::node_composit_init_colorbalance); + ntype.initfunc = file_ns::node_composit_init_colorbalance; node_type_storage( &ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc index c6051a42df6..5ff190ac2e4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc @@ -353,7 +353,7 @@ void register_node_type_cmp_colorcorrection() ntype.draw_buttons = file_ns::node_composit_buts_colorcorrection; ntype.draw_buttons_ex = file_ns::node_composit_buts_colorcorrection_ex; node_type_size(&ntype, 400, 200, 600); - node_type_init(&ntype, file_ns::node_composit_init_colorcorrection); + ntype.initfunc = file_ns::node_composit_init_colorcorrection; node_type_storage( &ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc index 8dd88d098c4..cd119684a79 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.cc +++ b/source/blender/nodes/composite/nodes/node_composite_common.cc @@ -32,7 +32,7 @@ void register_node_type_cmp_group() node_type_size(&ntype, 140, 60, 400); ntype.labelfunc = node_group_label; - node_type_group_update(&ntype, node_group_update); + ntype.group_update_func = node_group_update; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc b/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc index 3e521144b8d..24928acedd9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc +++ b/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc @@ -78,7 +78,7 @@ void register_node_type_cmp_convert_color_space(void) ntype.declare = file_ns::CMP_NODE_CONVERT_COLOR_SPACE_declare; ntype.draw_buttons = file_ns::node_composit_buts_convert_colorspace; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, file_ns::node_composit_init_convert_colorspace); + ntype.initfunc = file_ns::node_composit_init_convert_colorspace; node_type_storage( &ntype, "NodeConvertColorSpace", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc index 96a5443921b..4539d2af92d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.cc +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -230,7 +230,7 @@ void register_node_type_cmp_crop() cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT); ntype.declare = file_ns::cmp_node_crop_declare; ntype.draw_buttons = file_ns::node_composit_buts_crop; - node_type_init(&ntype, file_ns::node_composit_init_crop); + ntype.initfunc = file_ns::node_composit_init_crop; node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index fa3b14ae015..e95a306976c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -331,7 +331,7 @@ void register_node_type_cmp_cryptomatte() node_type_socket_templates( &ntype, file_ns::cmp_node_cryptomatte_in, file_ns::cmp_node_cryptomatte_out); node_type_size(&ntype, 240, 100, 700); - node_type_init(&ntype, file_ns::node_init_cryptomatte); + ntype.initfunc = file_ns::node_init_cryptomatte; ntype.initfunc_api = file_ns::node_init_api_cryptomatte; ntype.poll = file_ns::node_poll_cryptomatte; node_type_storage( @@ -418,7 +418,7 @@ void register_node_type_cmp_cryptomatte_legacy() cmp_node_type_base( &ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte (Legacy)", NODE_CLASS_MATTE); node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_cryptomatte_out); - node_type_init(&ntype, legacy_file_ns::node_init_cryptomatte_legacy); + ntype.initfunc = legacy_file_ns::node_init_cryptomatte_legacy; node_type_storage( &ntype, "NodeCryptomatte", file_ns::node_free_cryptomatte, file_ns::node_copy_cryptomatte); ntype.gather_link_search_ops = nullptr; diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc index b631f75e879..5799c6c1a09 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.cc +++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc @@ -100,7 +100,7 @@ void register_node_type_cmp_curve_time() cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time Curve", NODE_CLASS_INPUT); ntype.declare = file_ns::cmp_node_time_declare; node_type_size(&ntype, 200, 140, 320); - node_type_init(&ntype, file_ns::node_composit_init_curves_time); + ntype.initfunc = file_ns::node_composit_init_curves_time; node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); ntype.get_compositor_operation = file_ns::get_compositor_operation; @@ -195,7 +195,7 @@ void register_node_type_cmp_curve_vec() ntype.declare = file_ns::cmp_node_curve_vec_declare; ntype.draw_buttons = file_ns::node_buts_curvevec; node_type_size(&ntype, 200, 140, 320); - node_type_init(&ntype, file_ns::node_composit_init_curve_vec); + ntype.initfunc = file_ns::node_composit_init_curve_vec; node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; @@ -332,7 +332,7 @@ void register_node_type_cmp_curve_rgb() cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::cmp_node_rgbcurves_declare; node_type_size(&ntype, 200, 140, 320); - node_type_init(&ntype, file_ns::node_composit_init_curve_rgb); + ntype.initfunc = file_ns::node_composit_init_curve_rgb; node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc index 197e02bebad..584cca87740 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -111,7 +111,7 @@ void register_node_type_cmp_defocus() cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_defocus_declare; ntype.draw_buttons = file_ns::node_composit_buts_defocus; - node_type_init(&ntype, file_ns::node_composit_init_defocus); + ntype.initfunc = file_ns::node_composit_init_defocus; node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc index 821b3c23a7b..9ae02dab505 100644 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -82,7 +82,7 @@ void register_node_type_cmp_denoise() cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_denoise_declare; ntype.draw_buttons = file_ns::node_composit_buts_denoise; - node_type_init(&ntype, file_ns::node_composit_init_denonise); + ntype.initfunc = file_ns::node_composit_init_denonise; node_type_storage(&ntype, "NodeDenoise", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc index 1e15f9709fe..28ef022459b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc @@ -115,7 +115,7 @@ void register_node_type_cmp_despeckle() ntype.declare = file_ns::cmp_node_despeckle_declare; ntype.draw_buttons = file_ns::node_composit_buts_despeckle; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_despeckle); + ntype.initfunc = file_ns::node_composit_init_despeckle; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc b/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc index cde537f7d4c..c3fb0885c4d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc @@ -101,7 +101,7 @@ void register_node_type_cmp_diff_matte() ntype.declare = file_ns::cmp_node_diff_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_diff_matte; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_diff_matte); + ntype.initfunc = file_ns::node_composit_init_diff_matte; node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc index d659c46721d..cc4e09d4d0d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -5,25 +5,20 @@ * \ingroup cmpnodes */ -#include <cmath> - -#include "BLI_array.hh" #include "BLI_assert.h" #include "BLI_math_base.hh" - -#include "DNA_scene_types.h" +#include "BLI_math_vec_types.hh" #include "RNA_access.h" #include "UI_interface.h" #include "UI_resources.h" -#include "RE_pipeline.h" - #include "GPU_shader.h" #include "GPU_state.h" #include "GPU_texture.h" +#include "COM_morphological_distance_feather_weights.hh" #include "COM_node_operation.hh" #include "COM_utilities.hh" @@ -64,161 +59,7 @@ static void node_composit_buts_dilateerode(uiLayout *layout, bContext * /*C*/, P using namespace blender::realtime_compositor; -/* Computes a falloff that is equal to 1 at an input of zero and decrease to zero at an input of 1, - * with the rate of decrease depending on the falloff type. */ -static float compute_distance_falloff(float x, int falloff_type) -{ - x = 1.0f - x; - - switch (falloff_type) { - case PROP_SMOOTH: - return 3.0f * x * x - 2.0f * x * x * x; - case PROP_SPHERE: - return std::sqrt(2.0f * x - x * x); - case PROP_ROOT: - return std::sqrt(x); - case PROP_SHARP: - return x * x; - case PROP_INVSQUARE: - return x * (2.0f - x); - case PROP_LIN: - return x; - default: - BLI_assert_unreachable(); - return x; - } -} - -/* A helper class that computes and caches 1D GPU textures containing the weights of the separable - * Gaussian filter of the given radius as well as an inverse distance falloff of the given type and - * radius. The weights and falloffs are symmetric, because the Gaussian and falloff functions are - * all even functions. Consequently, only the positive half of the filter is computed and the - * shader takes that into consideration. */ -class SymmetricSeparableMorphologicalDistanceFeatherWeights { - private: - int radius_ = 1; - int falloff_type_ = PROP_SMOOTH; - GPUTexture *weights_texture_ = nullptr; - GPUTexture *distance_falloffs_texture_ = nullptr; - - public: - ~SymmetricSeparableMorphologicalDistanceFeatherWeights() - { - if (weights_texture_) { - GPU_texture_free(weights_texture_); - } - - if (distance_falloffs_texture_) { - GPU_texture_free(distance_falloffs_texture_); - } - } - - /* Check if textures containing the weights and distance falloffs were already computed for the - * given distance falloff type and radius. If such textures exists, do nothing, otherwise, free - * the already computed textures and recompute it with the given distance falloff type and - * radius. */ - void update(int radius, int falloff_type) - { - if (weights_texture_ && distance_falloffs_texture_ && falloff_type == falloff_type_ && - radius == radius_) { - return; - } - - radius_ = radius; - falloff_type_ = falloff_type; - - compute_weights(); - compute_distance_falloffs(); - } - - void compute_weights() - { - if (weights_texture_) { - GPU_texture_free(weights_texture_); - } - - /* The size of filter is double the radius plus 1, but since the filter is symmetric, we only - * compute half of it and no doubling happens. We add 1 to make sure the filter size is always - * odd and there is a center weight. */ - const int size = radius_ + 1; - Array<float> weights(size); - - float sum = 0.0f; - - /* First, compute the center weight. */ - const float center_weight = RE_filter_value(R_FILTER_GAUSS, 0.0f); - weights[0] = center_weight; - sum += center_weight; - - /* Second, compute the other weights in the positive direction, making sure to add double the - * weight to the sum of weights because the filter is symmetric and we only loop over half of - * it. Skip the center weight already computed by dropping the front index. */ - const float scale = radius_ > 0.0f ? 1.0f / radius_ : 0.0f; - for (const int i : weights.index_range().drop_front(1)) { - const float weight = RE_filter_value(R_FILTER_GAUSS, i * scale); - weights[i] = weight; - sum += weight * 2.0f; - } - - /* Finally, normalize the weights. */ - for (const int i : weights.index_range()) { - weights[i] /= sum; - } - - weights_texture_ = GPU_texture_create_1d("Weights", size, 1, GPU_R16F, weights.data()); - } - - void compute_distance_falloffs() - { - if (distance_falloffs_texture_) { - GPU_texture_free(distance_falloffs_texture_); - } - - /* The size of the distance falloffs is double the radius plus 1, but since the falloffs are - * symmetric, we only compute half of them and no doubling happens. We add 1 to make sure the - * falloffs size is always odd and there is a center falloff. */ - const int size = radius_ + 1; - Array<float> falloffs(size); - - /* Compute the distance falloffs in the positive direction only, because the falloffs are - * symmetric. */ - const float scale = radius_ > 0.0f ? 1.0f / radius_ : 0.0f; - for (const int i : falloffs.index_range()) { - falloffs[i] = compute_distance_falloff(i * scale, falloff_type_); - } - - distance_falloffs_texture_ = GPU_texture_create_1d( - "Distance Factors", size, 1, GPU_R16F, falloffs.data()); - } - - void bind_weights_as_texture(GPUShader *shader, const char *texture_name) - { - const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name); - GPU_texture_bind(weights_texture_, texture_image_unit); - } - - void unbind_weights_as_texture() - { - GPU_texture_unbind(weights_texture_); - } - - void bind_distance_falloffs_as_texture(GPUShader *shader, const char *texture_name) - { - const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name); - GPU_texture_bind(distance_falloffs_texture_, texture_image_unit); - } - - void unbind_distance_falloffs_as_texture() - { - GPU_texture_unbind(distance_falloffs_texture_); - } -}; - class DilateErodeOperation : public NodeOperation { - private: - /* Cached symmetric blur weights and distance falloffs for the distance feature method. */ - SymmetricSeparableMorphologicalDistanceFeatherWeights distance_feather_weights_; - public: using NodeOperation::NodeOperation; @@ -414,9 +255,11 @@ class DilateErodeOperation : public NodeOperation { const Result &input_image = get_input("Mask"); input_image.bind_as_texture(shader, "input_tx"); - distance_feather_weights_.update(math::abs(get_distance()), node_storage(bnode()).falloff); - distance_feather_weights_.bind_weights_as_texture(shader, "weights_tx"); - distance_feather_weights_.bind_distance_falloffs_as_texture(shader, "falloffs_tx"); + const MorphologicalDistanceFeatherWeights &weights = + context().cache_manager().get_morphological_distance_feather_weights( + node_storage(bnode()).falloff, math::abs(get_distance())); + weights.bind_weights_as_texture(shader, "weights_tx"); + weights.bind_distance_falloffs_as_texture(shader, "falloffs_tx"); /* We allocate an output image of a transposed size, that is, with a height equivalent to the * width of the input and vice versa. This is done as a performance optimization. The shader @@ -437,8 +280,8 @@ class DilateErodeOperation : public NodeOperation { GPU_shader_unbind(); input_image.unbind_as_texture(); - distance_feather_weights_.unbind_weights_as_texture(); - distance_feather_weights_.unbind_distance_falloffs_as_texture(); + weights.unbind_weights_as_texture(); + weights.unbind_distance_falloffs_as_texture(); GPU_texture_image_unbind(horizontal_pass_result); return horizontal_pass_result; @@ -453,9 +296,11 @@ class DilateErodeOperation : public NodeOperation { const int texture_image_unit = GPU_shader_get_texture_binding(shader, "input_tx"); GPU_texture_bind(horizontal_pass_result, texture_image_unit); - distance_feather_weights_.update(math::abs(get_distance()), node_storage(bnode()).falloff); - distance_feather_weights_.bind_weights_as_texture(shader, "weights_tx"); - distance_feather_weights_.bind_distance_falloffs_as_texture(shader, "falloffs_tx"); + const MorphologicalDistanceFeatherWeights &weights = + context().cache_manager().get_morphological_distance_feather_weights( + node_storage(bnode()).falloff, math::abs(get_distance())); + weights.bind_weights_as_texture(shader, "weights_tx"); + weights.bind_distance_falloffs_as_texture(shader, "falloffs_tx"); const Domain domain = compute_domain(); Result &output_image = get_result("Mask"); @@ -468,8 +313,8 @@ class DilateErodeOperation : public NodeOperation { GPU_shader_unbind(); output_image.unbind_as_image(); - distance_feather_weights_.unbind_weights_as_texture(); - distance_feather_weights_.unbind_distance_falloffs_as_texture(); + weights.unbind_weights_as_texture(); + weights.unbind_distance_falloffs_as_texture(); GPU_texture_unbind(horizontal_pass_result); } @@ -535,7 +380,7 @@ void register_node_type_cmp_dilateerode() cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER); ntype.draw_buttons = file_ns::node_composit_buts_dilateerode; ntype.declare = file_ns::cmp_node_dilate_declare; - node_type_init(&ntype, file_ns::node_composit_init_dilateerode); + ntype.initfunc = file_ns::node_composit_init_dilateerode; node_type_storage( &ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc index a5a253c2cca..452c83ef1b5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -199,7 +199,7 @@ void register_node_type_cmp_dblur() cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_directional_blur_declare; ntype.draw_buttons = file_ns::node_composit_buts_dblur; - node_type_init(&ntype, file_ns::node_composit_init_dblur); + ntype.initfunc = file_ns::node_composit_init_dblur; node_type_storage( &ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc b/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc index 87b66810fe3..16f79f4e730 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc @@ -123,7 +123,7 @@ void register_node_type_cmp_distance_matte() ntype.declare = file_ns::cmp_node_distance_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_distance_matte; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_distance_matte); + ntype.initfunc = file_ns::node_composit_init_distance_matte; node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc index 120b4d0d976..f06b64f10b5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -156,7 +156,7 @@ void register_node_type_cmp_ellipsemask() ntype.declare = file_ns::cmp_node_ellipsemask_declare; ntype.draw_buttons = file_ns::node_composit_buts_ellipsemask; node_type_size(&ntype, 260, 110, 320); - node_type_init(&ntype, file_ns::node_composit_init_ellipsemask); + ntype.initfunc = file_ns::node_composit_init_ellipsemask; node_type_storage( &ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index 60d149a32b9..4352f519e4c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -105,7 +105,7 @@ void register_node_type_cmp_glare() cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_glare_declare; ntype.draw_buttons = file_ns::node_composit_buts_glare; - node_type_init(&ntype, file_ns::node_composit_init_glare); + ntype.initfunc = file_ns::node_composit_init_glare; node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc index a365929138c..2e09e44eddc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc @@ -106,7 +106,7 @@ void register_node_type_cmp_huecorrect() cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::cmp_node_huecorrect_declare; node_type_size(&ntype, 320, 140, 500); - node_type_init(&ntype, file_ns::node_composit_init_huecorrect); + ntype.initfunc = file_ns::node_composit_init_huecorrect; node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 9efedf744ec..322f1eecf91 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -660,10 +660,10 @@ void register_node_type_cmp_image() static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT); - node_type_init(&ntype, file_ns::node_composit_init_image); + ntype.initfunc = file_ns::node_composit_init_image; node_type_storage( &ntype, "ImageUser", file_ns::node_composit_free_image, file_ns::node_composit_copy_image); - node_type_update(&ntype, file_ns::cmp_node_image_update); + ntype.updatefunc = file_ns::cmp_node_image_update; ntype.get_compositor_operation = file_ns::get_compositor_operation; ntype.labelfunc = node_image_label; ntype.flag |= NODE_PREVIEW; @@ -879,8 +879,8 @@ void register_node_type_cmp_rlayers() ntype.flag |= NODE_PREVIEW; node_type_storage( &ntype, nullptr, file_ns::node_composit_free_rlayers, file_ns::node_composit_copy_rlayers); - node_type_update(&ntype, file_ns::cmp_node_rlayers_update); - node_type_init(&ntype, node_cmp_rlayers_outputs); + ntype.updatefunc = file_ns::cmp_node_rlayers_update; + ntype.initfunc = node_cmp_rlayers_outputs; node_type_size_preset(&ntype, NODE_SIZE_LARGE); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.cc b/source/blender/nodes/composite/nodes/node_composite_invert.cc index bbb2808c4ea..c8787ebb01b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.cc +++ b/source/blender/nodes/composite/nodes/node_composite_invert.cc @@ -96,7 +96,7 @@ void register_node_type_cmp_invert() cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::cmp_node_invert_declare; ntype.draw_buttons = file_ns::node_composit_buts_invert; - node_type_init(&ntype, file_ns::node_composit_init_invert); + ntype.initfunc = file_ns::node_composit_init_invert; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index 4b61e06a232..b2add06c541 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -95,7 +95,7 @@ void register_node_type_cmp_keying() cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE); ntype.declare = file_ns::cmp_node_keying_declare; ntype.draw_buttons = file_ns::node_composit_buts_keying; - node_type_init(&ntype, file_ns::node_composit_init_keying); + ntype.initfunc = file_ns::node_composit_init_keying; node_type_storage( &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index 1cf482ff6ff..e11ed0fbfb6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -250,7 +250,7 @@ void register_node_type_cmp_lensdist() cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT); ntype.declare = file_ns::cmp_node_lensdist_declare; ntype.draw_buttons = file_ns::node_composit_buts_lensdist; - node_type_init(&ntype, file_ns::node_composit_init_lensdist); + ntype.initfunc = file_ns::node_composit_init_lensdist; node_type_storage( &ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.cc b/source/blender/nodes/composite/nodes/node_composite_levels.cc index 4c901372b9f..29212c7a76f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.cc +++ b/source/blender/nodes/composite/nodes/node_composite_levels.cc @@ -201,7 +201,7 @@ void register_node_type_cmp_view_levels() ntype.declare = file_ns::cmp_node_levels_declare; ntype.draw_buttons = file_ns::node_composit_buts_view_levels; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_view_levels); + ntype.initfunc = file_ns::node_composit_init_view_levels; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc index 8426efb0f1f..325f5dbd870 100644 --- a/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc @@ -104,7 +104,7 @@ void register_node_type_cmp_luma_matte() ntype.declare = file_ns::cmp_node_luma_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_luma_matte; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_luma_matte); + ntype.initfunc = file_ns::node_composit_init_luma_matte; node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_map_value.cc b/source/blender/nodes/composite/nodes/node_composite_map_value.cc index eacc003378a..ea80e7b03a8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_map_value.cc +++ b/source/blender/nodes/composite/nodes/node_composite_map_value.cc @@ -116,7 +116,7 @@ void register_node_type_cmp_map_value() cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::cmp_node_map_value_declare; ntype.draw_buttons = file_ns::node_composit_buts_map_value; - node_type_init(&ntype, file_ns::node_composit_init_map_value); + ntype.initfunc = file_ns::node_composit_init_map_value; node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc index 5dfcc9a9ecf..895ef62a82d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc @@ -104,7 +104,7 @@ void register_node_type_cmp_mask() cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT); ntype.declare = file_ns::cmp_node_mask_declare; ntype.draw_buttons = file_ns::node_composit_buts_mask; - node_type_init(&ntype, file_ns::node_composit_init_mask); + ntype.initfunc = file_ns::node_composit_init_mask; ntype.labelfunc = file_ns::node_mask_label; ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc index 4baf057913e..e1dda06a41e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.cc +++ b/source/blender/nodes/composite/nodes/node_composite_math.cc @@ -96,7 +96,7 @@ void register_node_type_cmp_math() cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_math_declare; ntype.labelfunc = node_math_label; - node_type_update(&ntype, node_math_update); + ntype.updatefunc = node_math_update; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_output_file.cc b/source/blender/nodes/composite/nodes/node_composite_output_file.cc index f27dec91b1c..f64e448842d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_output_file.cc +++ b/source/blender/nodes/composite/nodes/node_composite_output_file.cc @@ -470,7 +470,7 @@ void register_node_type_cmp_output_file() ntype.flag |= NODE_PREVIEW; node_type_storage( &ntype, "NodeImageMultiFile", file_ns::free_output_file, file_ns::copy_output_file); - node_type_update(&ntype, file_ns::update_output_file); + ntype.updatefunc = file_ns::update_output_file; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc index 5f3df3abd35..4cc1166b373 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc @@ -95,7 +95,7 @@ void register_node_type_cmp_rotate() cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT); ntype.declare = file_ns::cmp_node_rotate_declare; ntype.draw_buttons = file_ns::node_composit_buts_rotate; - node_type_init(&ntype, file_ns::node_composit_init_rotate); + ntype.initfunc = file_ns::node_composit_init_rotate; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc index c524d7b8da9..a4e28326d9d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.cc +++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc @@ -221,7 +221,7 @@ void register_node_type_cmp_scale() cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT); ntype.declare = file_ns::cmp_node_scale_declare; ntype.draw_buttons = file_ns::node_composit_buts_scale; - node_type_update(&ntype, file_ns::node_composite_update_scale); + ntype.updatefunc = file_ns::node_composite_update_scale; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc index d3f8530ae8b..118ab6ccdf8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc @@ -137,10 +137,10 @@ void register_node_type_cmp_separate_color() cmp_node_type_base(&ntype, CMP_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_separate_color_declare; - node_type_init(&ntype, node_cmp_combsep_color_init); + ntype.initfunc = node_cmp_combsep_color_init; node_type_storage( &ntype, "NodeCMPCombSepColor", node_free_standard_storage, node_copy_standard_storage); - node_type_update(&ntype, file_ns::cmp_node_separate_color_update); + ntype.updatefunc = file_ns::cmp_node_separate_color_update; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); @@ -243,10 +243,10 @@ void register_node_type_cmp_combine_color() cmp_node_type_base(&ntype, CMP_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_combine_color_declare; - node_type_init(&ntype, node_cmp_combsep_color_init); + ntype.initfunc = node_cmp_combsep_color_init; node_type_storage( &ntype, "NodeCMPCombSepColor", node_free_standard_storage, node_copy_standard_storage); - node_type_update(&ntype, file_ns::cmp_node_combine_color_update); + ntype.updatefunc = file_ns::cmp_node_combine_color_update; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc index 82fc37a18f6..7c1461b4f6e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc @@ -84,7 +84,7 @@ void register_node_type_cmp_sepycca() cmp_node_type_base( &ntype, CMP_NODE_SEPYCCA_LEGACY, "Separate YCbCrA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_sepycca_declare; - node_type_init(&ntype, file_ns::node_composit_init_mode_sepycca); + ntype.initfunc = file_ns::node_composit_init_mode_sepycca; ntype.gather_link_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; @@ -172,7 +172,7 @@ void register_node_type_cmp_combycca() cmp_node_type_base( &ntype, CMP_NODE_COMBYCCA_LEGACY, "Combine YCbCrA (Legacy)", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_combycca_declare; - node_type_init(&ntype, file_ns::node_composit_init_mode_combycca); + ntype.initfunc = file_ns::node_composit_init_mode_combycca; ntype.gather_link_search_ops = nullptr; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc index 725ae6e3fcb..99c4dae4a92 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc @@ -81,7 +81,7 @@ void register_node_type_cmp_setalpha() cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_setalpha_declare; ntype.draw_buttons = file_ns::node_composit_buts_set_alpha; - node_type_init(&ntype, file_ns::node_composit_init_setalpha); + ntype.initfunc = file_ns::node_composit_init_setalpha; node_type_storage( &ntype, "NodeSetAlpha", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc index f25d33033a2..b4e698f5096 100644 --- a/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc @@ -125,7 +125,7 @@ void register_node_type_cmp_splitviewer() ntype.declare = file_ns::cmp_node_split_viewer_declare; ntype.draw_buttons = file_ns::node_composit_buts_splitviewer; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_splitviewer); + ntype.initfunc = file_ns::node_composit_init_splitviewer; node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc index d2ee9f567f2..798e60e9482 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -68,7 +68,7 @@ void register_node_type_cmp_sunbeams() cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_sunbeams_declare; ntype.draw_buttons = file_ns::node_composit_buts_sunbeams; - node_type_init(&ntype, file_ns::init); + ntype.initfunc = file_ns::init; node_type_storage( &ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.cc b/source/blender/nodes/composite/nodes/node_composite_switchview.cc index 9b21ecab335..9974e55cc1a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.cc @@ -173,7 +173,7 @@ void register_node_type_cmp_switch_view() node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_switch_view_out); ntype.draw_buttons_ex = file_ns::node_composit_buts_switch_view_ex; ntype.initfunc_api = file_ns::init_switch_view; - node_type_update(&ntype, file_ns::cmp_node_switch_view_update); + ntype.updatefunc = file_ns::cmp_node_switch_view_update; ntype.get_compositor_operation = file_ns::get_compositor_operation; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc index d26a01bb3c9..febbb9ddec5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc @@ -332,7 +332,7 @@ void register_node_type_cmp_tonemap() cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR); ntype.declare = file_ns::cmp_node_tonemap_declare; ntype.draw_buttons = file_ns::node_composit_buts_tonemap; - node_type_init(&ntype, file_ns::node_composit_init_tonemap); + ntype.initfunc = file_ns::node_composit_init_tonemap; node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc index c8f9f8ee666..154be2d428a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -110,7 +110,7 @@ void register_node_type_cmp_translate() cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT); ntype.declare = file_ns::cmp_node_translate_declare; ntype.draw_buttons = file_ns::node_composit_buts_translate; - node_type_init(&ntype, file_ns::node_composit_init_translate); + ntype.initfunc = file_ns::node_composit_init_translate; node_type_storage( &ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc b/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc index 2870b07f207..d083051e9d2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc @@ -134,7 +134,7 @@ void register_node_type_cmp_valtorgb() cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER); ntype.declare = file_ns::cmp_node_valtorgb_declare; node_type_size(&ntype, 240, 200, 320); - node_type_init(&ntype, file_ns::node_composit_init_valtorgb); + ntype.initfunc = file_ns::node_composit_init_valtorgb; node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc b/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc index 6d43647020f..6a44fcb1650 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc @@ -81,7 +81,7 @@ void register_node_type_cmp_vecblur() cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER); ntype.declare = file_ns::cmp_node_vec_blur_declare; ntype.draw_buttons = file_ns::node_composit_buts_vecblur; - node_type_init(&ntype, file_ns::node_composit_init_vecblur); + ntype.initfunc = file_ns::node_composit_init_vecblur; node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc index c83674fa9c1..682b0626ccd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc @@ -196,7 +196,7 @@ void register_node_type_cmp_viewer() ntype.draw_buttons = file_ns::node_composit_buts_viewer; ntype.draw_buttons_ex = file_ns::node_composit_buts_viewer_ex; ntype.flag |= NODE_PREVIEW; - node_type_init(&ntype, file_ns::node_composit_init_viewer); + ntype.initfunc = file_ns::node_composit_init_viewer; node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); ntype.get_compositor_operation = file_ns::get_compositor_operation; |