diff options
Diffstat (limited to 'source/blender/compositor')
115 files changed, 414 insertions, 331 deletions
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index 0fdd7647f8d..fd53460f854 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -12,8 +12,8 @@ extern "C" { /* Keep ascii art. */ /* clang-format off */ + /** - * * \defgroup Model The data model of the compositor * \ingroup compositor * \defgroup Memory The memory management stuff diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index ae910c28342..364f9439366 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -31,7 +31,7 @@ class Node { /** * \brief stores the reference to the SDNA bNode struct */ - bNode *editor_node_; + const bNode *editor_node_; /** * \brief Is this node part of the active group @@ -61,7 +61,7 @@ class Node { /** * \brief get the reference to the SDNA bNode struct */ - bNode *get_bnode() const + const bNode *get_bnode() const { return editor_node_; } diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cc b/source/blender/compositor/nodes/COM_AlphaOverNode.cc index 5b0f7a1d0e6..8f9f6f07395 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.cc +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cc @@ -14,10 +14,10 @@ void AlphaOverNode::convert_to_operations(NodeConverter &converter, { NodeInput *color1Socket = this->get_input_socket(1); NodeInput *color2Socket = this->get_input_socket(2); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); MixBaseOperation *convert_prog; - NodeTwoFloats *ntf = (NodeTwoFloats *)editor_node->storage; + const NodeTwoFloats *ntf = (const NodeTwoFloats *)editor_node->storage; if (ntf->x != 0.0f) { AlphaOverMixedOperation *mix_operation = new AlphaOverMixedOperation(); mix_operation->setX(ntf->x); diff --git a/source/blender/compositor/nodes/COM_AntiAliasingNode.cc b/source/blender/compositor/nodes/COM_AntiAliasingNode.cc index e201720c53b..eb71b70d0bb 100644 --- a/source/blender/compositor/nodes/COM_AntiAliasingNode.cc +++ b/source/blender/compositor/nodes/COM_AntiAliasingNode.cc @@ -9,8 +9,8 @@ namespace blender::compositor { void AntiAliasingNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *node = this->get_bnode(); - NodeAntiAliasingData *data = (NodeAntiAliasingData *)node->storage; + const bNode *node = this->get_bnode(); + const NodeAntiAliasingData *data = (const NodeAntiAliasingData *)node->storage; /* Edge Detection (First Pass) */ SMAAEdgeDetectionOperation *operation1 = nullptr; diff --git a/source/blender/compositor/nodes/COM_BlurNode.cc b/source/blender/compositor/nodes/COM_BlurNode.cc index a8148d7abd7..9377cfa783c 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cc +++ b/source/blender/compositor/nodes/COM_BlurNode.cc @@ -22,8 +22,8 @@ BlurNode::BlurNode(bNode *editor_node) : Node(editor_node) void BlurNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); - NodeBlurData *data = (NodeBlurData *)editor_node->storage; + const bNode *editor_node = this->get_bnode(); + const NodeBlurData *data = (const NodeBlurData *)editor_node->storage; NodeInput *input_size_socket = this->get_input_socket(1); bool connected_size_socket = input_size_socket->is_linked(); diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cc b/source/blender/compositor/nodes/COM_BokehBlurNode.cc index 31258ddb56a..ebdc82b0d19 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cc +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cc @@ -15,7 +15,7 @@ BokehBlurNode::BokehBlurNode(bNode *editor_node) : Node(editor_node) void BokehBlurNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *b_node = this->get_bnode(); + const bNode *b_node = this->get_bnode(); NodeInput *input_size_socket = this->get_input_socket(2); diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cc b/source/blender/compositor/nodes/COM_BokehImageNode.cc index 6bc56aa5184..f25ac47fef9 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.cc +++ b/source/blender/compositor/nodes/COM_BokehImageNode.cc @@ -15,7 +15,7 @@ void BokehImageNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { BokehImageOperation *operation = new BokehImageOperation(); - operation->set_data((NodeBokehImage *)this->get_bnode()->storage); + operation->set_data((const NodeBokehImage *)this->get_bnode()->storage); converter.add_operation(operation); converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cc b/source/blender/compositor/nodes/COM_BoxMaskNode.cc index 41717804dba..c1a1b72d063 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cc +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cc @@ -22,7 +22,7 @@ void BoxMaskNode::convert_to_operations(NodeConverter &converter, BoxMaskOperation *operation; operation = new BoxMaskOperation(); - operation->set_data((NodeBoxMask *)this->get_bnode()->storage); + operation->set_data((const NodeBoxMask *)this->get_bnode()->storage); operation->set_mask_type(this->get_bnode()->custom1); converter.add_operation(operation); diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.cc b/source/blender/compositor/nodes/COM_BrightnessNode.cc index 88efd541fe9..a7877ca9378 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.cc +++ b/source/blender/compositor/nodes/COM_BrightnessNode.cc @@ -14,7 +14,7 @@ BrightnessNode::BrightnessNode(bNode *editor_node) : Node(editor_node) void BrightnessNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *bnode = this->get_bnode(); + const bNode *bnode = this->get_bnode(); BrightnessOperation *operation = new BrightnessOperation(); operation->set_use_premultiply((bnode->custom1 & 1) != 0); converter.add_operation(operation); diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cc b/source/blender/compositor/nodes/COM_ChannelMatteNode.cc index 81fc638970f..6a0a28cd171 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cc @@ -16,14 +16,14 @@ ChannelMatteNode::ChannelMatteNode(bNode *editor_node) : Node(editor_node) void ChannelMatteNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *node = this->get_bnode(); + const bNode *node = this->get_bnode(); NodeInput *input_socket_image = this->get_input_socket(0); NodeOutput *output_socket_image = this->get_output_socket(0); NodeOutput *output_socket_matte = this->get_output_socket(1); NodeOperation *convert = nullptr, *inv_convert = nullptr; - /* colorspace */ + /* color-space */ switch (node->custom1) { case CMP_NODE_CHANNEL_MATTE_CS_RGB: break; diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cc b/source/blender/compositor/nodes/COM_ChromaMatteNode.cc index cbc5a06ce11..35bf6210da5 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cc @@ -16,7 +16,7 @@ ChromaMatteNode::ChromaMatteNode(bNode *editor_node) : Node(editor_node) void ChromaMatteNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editorsnode = get_bnode(); + const bNode *editorsnode = get_bnode(); NodeInput *input_socket_image = this->get_input_socket(0); NodeInput *input_socket_key = this->get_input_socket(1); diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cc b/source/blender/compositor/nodes/COM_ColorBalanceNode.cc index cb009ecc634..f3f5aa4e49b 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cc +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cc @@ -15,7 +15,7 @@ ColorBalanceNode::ColorBalanceNode(bNode *editor_node) : Node(editor_node) void ColorBalanceNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *node = this->get_bnode(); + const bNode *node = this->get_bnode(); NodeColorBalance *n = (NodeColorBalance *)node->storage; NodeInput *input_socket = this->get_input_socket(0); diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc index 2497f1d57bc..3e021296fee 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc @@ -14,7 +14,7 @@ ColorCorrectionNode::ColorCorrectionNode(bNode *editor_node) : Node(editor_node) void ColorCorrectionNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editor_node = get_bnode(); + const bNode *editor_node = get_bnode(); ColorCorrectionOperation *operation = new ColorCorrectionOperation(); operation->set_data((NodeColorCorrection *)editor_node->storage); diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.cc b/source/blender/compositor/nodes/COM_ColorCurveNode.cc index ba81d375846..5275bfcab84 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.cc +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cc @@ -16,7 +16,7 @@ void ColorCurveNode::convert_to_operations(NodeConverter &converter, { if (this->get_input_socket(2)->is_linked() || this->get_input_socket(3)->is_linked()) { ColorCurveOperation *operation = new ColorCurveOperation(); - operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage); + operation->set_curve_mapping((const CurveMapping *)this->get_bnode()->storage); converter.add_operation(operation); converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); @@ -33,7 +33,7 @@ void ColorCurveNode::convert_to_operations(NodeConverter &converter, operation->set_black_level(col); this->get_input_socket(3)->get_editor_value_color(col); operation->set_white_level(col); - operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage); + operation->set_curve_mapping((const CurveMapping *)this->get_bnode()->storage); converter.add_operation(operation); converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cc b/source/blender/compositor/nodes/COM_ColorMatteNode.cc index f8fccd53a91..163ca4c7573 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cc @@ -16,7 +16,7 @@ ColorMatteNode::ColorMatteNode(bNode *editor_node) : Node(editor_node) void ColorMatteNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editorsnode = get_bnode(); + const bNode *editorsnode = get_bnode(); NodeInput *input_socket_image = this->get_input_socket(0); NodeInput *input_socket_key = this->get_input_socket(1); diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cc b/source/blender/compositor/nodes/COM_ColorRampNode.cc index fd91678800a..c2569a27fe6 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.cc +++ b/source/blender/compositor/nodes/COM_ColorRampNode.cc @@ -18,7 +18,7 @@ void ColorRampNode::convert_to_operations(NodeConverter &converter, NodeInput *input_socket = this->get_input_socket(0); NodeOutput *output_socket = this->get_output_socket(0); NodeOutput *output_socket_alpha = this->get_output_socket(1); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); ColorRampOperation *operation = new ColorRampOperation(); operation->set_color_band((ColorBand *)editor_node->storage); diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cc b/source/blender/compositor/nodes/COM_ColorSpillNode.cc index 118879ebdcc..448c3db6c46 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cc +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cc @@ -14,7 +14,7 @@ ColorSpillNode::ColorSpillNode(bNode *editor_node) : Node(editor_node) void ColorSpillNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editorsnode = get_bnode(); + const bNode *editorsnode = get_bnode(); NodeInput *input_socket_image = this->get_input_socket(0); NodeInput *input_socket_fac = this->get_input_socket(1); diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.cc b/source/blender/compositor/nodes/COM_CombineColorNode.cc index ca2c59478fd..36ff24cb9c3 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.cc +++ b/source/blender/compositor/nodes/COM_CombineColorNode.cc @@ -40,7 +40,7 @@ void CombineColorNode::convert_to_operations(NodeConverter &converter, converter.map_input_socket(input_bsocket, operation->get_input_socket(2)); converter.map_input_socket(input_asocket, operation->get_input_socket(3)); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); NodeCMPCombSepColor *storage = (NodeCMPCombSepColor *)editor_node->storage; NodeOperation *color_conv = nullptr; diff --git a/source/blender/compositor/nodes/COM_CombineColorNodeLegacy.cc b/source/blender/compositor/nodes/COM_CombineColorNodeLegacy.cc index d5ba379bfc2..8ab84715179 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNodeLegacy.cc +++ b/source/blender/compositor/nodes/COM_CombineColorNodeLegacy.cc @@ -65,7 +65,7 @@ NodeOperation *CombineHSVANode::get_color_converter(const CompositorContext & /* NodeOperation *CombineYCCANode::get_color_converter(const CompositorContext & /*context*/) const { ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation(); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); operation->set_mode(editor_node->custom1); return operation; } diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cc b/source/blender/compositor/nodes/COM_CompositorNode.cc index d9009e313dd..444dcbd5c6c 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cc +++ b/source/blender/compositor/nodes/COM_CompositorNode.cc @@ -14,7 +14,7 @@ CompositorNode::CompositorNode(bNode *editor_node) : Node(editor_node) void CompositorNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); bool is_active = (editor_node->flag & NODE_DO_OUTPUT_RECALC) || context.is_rendering(); bool ignore_alpha = (editor_node->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc index 690be1c4551..98fae0a47bf 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc @@ -10,7 +10,7 @@ void ConvertAlphaNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { NodeOperation *operation = nullptr; - bNode *node = this->get_bnode(); + const bNode *node = this->get_bnode(); /* value hardcoded in rna_nodetree.c */ if (node->custom1 == 1) { diff --git a/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc b/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc index 219b3acbd04..7d557de66e4 100644 --- a/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc +++ b/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc @@ -27,7 +27,7 @@ ConvertColorSpaceNode::ConvertColorSpaceNode(bNode *editorNode) : Node(editorNod void ConvertColorSpaceNode::convert_to_operations(NodeConverter &converter, const CompositorContext &UNUSED(context)) const { - bNode *b_node = get_bnode(); + const bNode *b_node = get_bnode(); NodeInput *inputSocketImage = this->get_input_socket(0); NodeOutput *outputSocketImage = this->get_output_socket(0); @@ -50,7 +50,7 @@ void ConvertColorSpaceNode::convert_to_operations(NodeConverter &converter, bool ConvertColorSpaceNode::performs_conversion(NodeConvertColorSpace &settings) const { - bNode *b_node = get_bnode(); + const bNode *b_node = get_bnode(); if (IMB_colormanagement_space_name_is_data(settings.from_color_space)) { CLOG_INFO(&LOG, diff --git a/source/blender/compositor/nodes/COM_CropNode.cc b/source/blender/compositor/nodes/COM_CropNode.cc index fd07b028a01..849fb80a8a8 100644 --- a/source/blender/compositor/nodes/COM_CropNode.cc +++ b/source/blender/compositor/nodes/COM_CropNode.cc @@ -14,7 +14,7 @@ CropNode::CropNode(bNode *editor_node) : Node(editor_node) void CropNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *node = get_bnode(); + const bNode *node = get_bnode(); NodeTwoXYs *crop_settings = (NodeTwoXYs *)node->storage; bool relative = (bool)node->custom2; bool crop_image = (bool)node->custom1; diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index b1cae5bfc24..42d699af01b 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -23,8 +23,9 @@ void CryptomatteBaseNode::convert_to_operations(NodeConverter &converter, { NodeOutput *output_image_socket = this->get_output_socket(0); - bNode *node = this->get_bnode(); - NodeCryptomatte *cryptomatte_settings = static_cast<NodeCryptomatte *>(node->storage); + const bNode *node = this->get_bnode(); + const NodeCryptomatte *cryptomatte_settings = static_cast<const NodeCryptomatte *>( + node->storage); CryptomatteOperation *cryptomatte_operation = create_cryptomatte_operation( converter, context, *node, cryptomatte_settings); diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cc b/source/blender/compositor/nodes/COM_DefocusNode.cc index 26bb79a5846..40ccf0fad15 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cc +++ b/source/blender/compositor/nodes/COM_DefocusNode.cc @@ -19,8 +19,8 @@ DefocusNode::DefocusNode(bNode *editor_node) : Node(editor_node) void DefocusNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *node = this->get_bnode(); - NodeDefocus *data = (NodeDefocus *)node->storage; + const bNode *node = this->get_bnode(); + const NodeDefocus *data = (const NodeDefocus *)node->storage; Scene *scene = node->id ? (Scene *)node->id : context.get_scene(); Object *camob = scene ? scene->camera : nullptr; diff --git a/source/blender/compositor/nodes/COM_DenoiseNode.cc b/source/blender/compositor/nodes/COM_DenoiseNode.cc index 301cb123359..81f45da475d 100644 --- a/source/blender/compositor/nodes/COM_DenoiseNode.cc +++ b/source/blender/compositor/nodes/COM_DenoiseNode.cc @@ -19,8 +19,8 @@ void DenoiseNode::convert_to_operations(NodeConverter &converter, return; } - bNode *node = this->get_bnode(); - NodeDenoise *denoise = (NodeDenoise *)node->storage; + const bNode *node = this->get_bnode(); + const NodeDenoise *denoise = (const NodeDenoise *)node->storage; DenoiseOperation *operation = new DenoiseOperation(); converter.add_operation(operation); diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cc b/source/blender/compositor/nodes/COM_DespeckleNode.cc index cbdff384eda..c2601435f34 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.cc +++ b/source/blender/compositor/nodes/COM_DespeckleNode.cc @@ -14,7 +14,7 @@ DespeckleNode::DespeckleNode(bNode *editor_node) : Node(editor_node) void DespeckleNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); NodeInput *input_socket = this->get_input_socket(0); NodeInput *input_image_socket = this->get_input_socket(1); NodeOutput *output_socket = this->get_output_socket(0); diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc index 7c5d1f69fb1..7ec90cb33d8 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc @@ -19,7 +19,7 @@ void DifferenceMatteNode::convert_to_operations(NodeConverter &converter, NodeInput *input_socket2 = this->get_input_socket(1); NodeOutput *output_socket_image = this->get_output_socket(0); NodeOutput *output_socket_matte = this->get_output_socket(1); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); DifferenceMatteOperation *operation_set = new DifferenceMatteOperation(); operation_set->set_settings((NodeChroma *)editor_node->storage); diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cc b/source/blender/compositor/nodes/COM_DilateErodeNode.cc index ee3ad8f4639..1b8c9d3b0a0 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cc +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cc @@ -27,9 +27,8 @@ DilateErodeNode::DilateErodeNode(bNode *editor_node) : Node(editor_node) void DilateErodeNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - - bNode *editor_node = this->get_bnode(); - if (editor_node->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { + const bNode *editor_node = this->get_bnode(); + if (editor_node->custom1 == CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD) { DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); operation->set_distance(editor_node->custom2); operation->set_inset(editor_node->custom3); @@ -48,7 +47,7 @@ void DilateErodeNode::convert_to_operations(NodeConverter &converter, converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } - else if (editor_node->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { + else if (editor_node->custom1 == CMP_NODE_DILATE_ERODE_DISTANCE) { if (editor_node->custom2 > 0) { DilateDistanceOperation *operation = new DilateDistanceOperation(); operation->set_distance(editor_node->custom2); @@ -66,7 +65,7 @@ void DilateErodeNode::convert_to_operations(NodeConverter &converter, converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } - else if (editor_node->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { + else if (editor_node->custom1 == CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER) { /* this uses a modified gaussian blur function otherwise its far too slow */ eCompositorQuality quality = context.get_quality(); diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc index b9477cc6783..52df671674b 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc @@ -14,7 +14,7 @@ DirectionalBlurNode::DirectionalBlurNode(bNode *editor_node) : Node(editor_node) void DirectionalBlurNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - NodeDBlurData *data = (NodeDBlurData *)this->get_bnode()->storage; + const NodeDBlurData *data = (const NodeDBlurData *)this->get_bnode()->storage; DirectionalBlurOperation *operation = new DirectionalBlurOperation(); operation->set_quality(context.get_quality()); operation->set_data(data); diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cc b/source/blender/compositor/nodes/COM_DistanceMatteNode.cc index ea0327d3d46..249fc48ab67 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cc @@ -16,8 +16,8 @@ DistanceMatteNode::DistanceMatteNode(bNode *editor_node) : Node(editor_node) void DistanceMatteNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editorsnode = get_bnode(); - NodeChroma *storage = (NodeChroma *)editorsnode->storage; + const bNode *editorsnode = this->get_bnode(); + const NodeChroma *storage = (const NodeChroma *)editorsnode->storage; NodeInput *input_socket_image = this->get_input_socket(0); NodeInput *input_socket_key = this->get_input_socket(1); diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc index eb4510a104c..7bd14d7a8d4 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc @@ -15,7 +15,7 @@ void DoubleEdgeMaskNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { DoubleEdgeMaskOperation *operation; - bNode *bnode = this->get_bnode(); + const bNode *bnode = this->get_bnode(); operation = new DoubleEdgeMaskOperation(); operation->set_adjecent_only(bnode->custom1); diff --git a/source/blender/compositor/nodes/COM_FilterNode.cc b/source/blender/compositor/nodes/COM_FilterNode.cc index f2efa8caefd..dce08b4cf2c 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cc +++ b/source/blender/compositor/nodes/COM_FilterNode.cc @@ -21,7 +21,7 @@ void FilterNode::convert_to_operations(NodeConverter &converter, ConvolutionFilterOperation *operation = nullptr; switch (this->get_bnode()->custom1) { - case CMP_FILT_SOFT: + case CMP_NODE_FILTER_SOFT: operation = new ConvolutionFilterOperation(); operation->set3x3Filter(1 / 16.0f, 2 / 16.0f, @@ -33,11 +33,11 @@ void FilterNode::convert_to_operations(NodeConverter &converter, 2 / 16.0f, 1 / 16.0f); break; - case CMP_FILT_SHARP_BOX: + case CMP_NODE_FILTER_SHARP_BOX: operation = new ConvolutionFilterOperation(); operation->set3x3Filter(-1, -1, -1, -1, 9, -1, -1, -1, -1); break; - case CMP_FILT_LAPLACE: + case CMP_NODE_FILTER_LAPLACE: operation = new ConvolutionEdgeFilterOperation(); operation->set3x3Filter(-1 / 8.0f, -1 / 8.0f, @@ -49,23 +49,23 @@ void FilterNode::convert_to_operations(NodeConverter &converter, -1 / 8.0f, -1 / 8.0f); break; - case CMP_FILT_SOBEL: + case CMP_NODE_FILTER_SOBEL: operation = new ConvolutionEdgeFilterOperation(); operation->set3x3Filter(1, 2, 1, 0, 0, 0, -1, -2, -1); break; - case CMP_FILT_PREWITT: + case CMP_NODE_FILTER_PREWITT: operation = new ConvolutionEdgeFilterOperation(); operation->set3x3Filter(1, 1, 1, 0, 0, 0, -1, -1, -1); break; - case CMP_FILT_KIRSCH: + case CMP_NODE_FILTER_KIRSCH: operation = new ConvolutionEdgeFilterOperation(); operation->set3x3Filter(5, 5, 5, -3, -3, -3, -2, -2, -2); break; - case CMP_FILT_SHADOW: + case CMP_NODE_FILTER_SHADOW: operation = new ConvolutionFilterOperation(); operation->set3x3Filter(1, 2, 1, 0, 1, 0, -1, -2, -1); break; - case CMP_FILT_SHARP_DIAMOND: + case CMP_NODE_FILTER_SHARP_DIAMOND: operation = new ConvolutionFilterOperation(); operation->set3x3Filter(0, -1, 0, -1, 5, -1, 0, -1, 0); break; diff --git a/source/blender/compositor/nodes/COM_GlareNode.cc b/source/blender/compositor/nodes/COM_GlareNode.cc index 0d7be486b9b..d80e6f9543f 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cc +++ b/source/blender/compositor/nodes/COM_GlareNode.cc @@ -20,8 +20,8 @@ GlareNode::GlareNode(bNode *editor_node) : Node(editor_node) void GlareNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *node = this->get_bnode(); - NodeGlare *glare = (NodeGlare *)node->storage; + const bNode *node = this->get_bnode(); + const NodeGlare *glare = (const NodeGlare *)node->storage; GlareBaseOperation *glareoperation = nullptr; switch (glare->type) { diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc index 8ae415b9c28..163cddb6f46 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc @@ -21,7 +21,7 @@ void HueSaturationValueCorrectNode::convert_to_operations( NodeInput *value_socket = this->get_input_socket(0); NodeInput *color_socket = this->get_input_socket(1); NodeOutput *output_socket = this->get_output_socket(0); - bNode *editorsnode = get_bnode(); + const bNode *editorsnode = get_bnode(); CurveMapping *storage = (CurveMapping *)editorsnode->storage; ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cc b/source/blender/compositor/nodes/COM_IDMaskNode.cc index f9c284b916c..a1e08bee0cb 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.cc +++ b/source/blender/compositor/nodes/COM_IDMaskNode.cc @@ -14,7 +14,7 @@ IDMaskNode::IDMaskNode(bNode *editor_node) : Node(editor_node) void IDMaskNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *bnode = this->get_bnode(); + const bNode *bnode = this->get_bnode(); IDMaskOperation *operation; operation = new IDMaskOperation(); diff --git a/source/blender/compositor/nodes/COM_ImageNode.cc b/source/blender/compositor/nodes/COM_ImageNode.cc index 35031888d5c..a7cc6bf39df 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cc +++ b/source/blender/compositor/nodes/COM_ImageNode.cc @@ -55,7 +55,7 @@ void ImageNode::convert_to_operations(NodeConverter &converter, { /** Image output */ NodeOutput *output_image = this->get_output_socket(0); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); Image *image = (Image *)editor_node->id; ImageUser *imageuser = (ImageUser *)editor_node->storage; int framenumber = context.get_framenumber(); diff --git a/source/blender/compositor/nodes/COM_InpaintNode.cc b/source/blender/compositor/nodes/COM_InpaintNode.cc index 1b899163e4d..dd80380387f 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.cc +++ b/source/blender/compositor/nodes/COM_InpaintNode.cc @@ -15,7 +15,7 @@ void InpaintNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); /* if (editor_node->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ if (true) { diff --git a/source/blender/compositor/nodes/COM_InvertNode.cc b/source/blender/compositor/nodes/COM_InvertNode.cc index 002136e5c2a..ce5c4f48f9e 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.cc +++ b/source/blender/compositor/nodes/COM_InvertNode.cc @@ -16,7 +16,7 @@ void InvertNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { InvertOperation *operation = new InvertOperation(); - bNode *node = this->get_bnode(); + const bNode *node = this->get_bnode(); operation->set_color(node->custom1 & CMP_CHAN_RGB); operation->set_alpha(node->custom1 & CMP_CHAN_A); converter.add_operation(operation); diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cc b/source/blender/compositor/nodes/COM_KeyingNode.cc index 10e6b5597f2..a9138f026f7 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingNode.cc @@ -205,8 +205,8 @@ NodeOperationOutput *KeyingNode::setup_clip(NodeConverter &converter, void KeyingNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); - NodeKeyingData *keying_data = (NodeKeyingData *)editor_node->storage; + const bNode *editor_node = this->get_bnode(); + const NodeKeyingData *keying_data = (const NodeKeyingData *)editor_node->storage; NodeInput *input_image = this->get_input_socket(0); NodeInput *input_screen = this->get_input_socket(1); diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc index 1e159e11966..7470d49bc1b 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc @@ -14,7 +14,7 @@ KeyingScreenNode::KeyingScreenNode(bNode *editor_node) : Node(editor_node) void KeyingScreenNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); MovieClip *clip = (MovieClip *)editor_node->id; NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *)editor_node->storage; diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cc b/source/blender/compositor/nodes/COM_LensDistortionNode.cc index 3fe1125382e..5ed97c614ed 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cc +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cc @@ -15,7 +15,7 @@ LensDistortionNode::LensDistortionNode(bNode *editor_node) : Node(editor_node) void LensDistortionNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); NodeLensDist *data = (NodeLensDist *)editor_node->storage; if (data->proj) { ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation(); diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc index 00ae679581c..06e8eb58c4d 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc @@ -15,7 +15,7 @@ LuminanceMatteNode::LuminanceMatteNode(bNode *editor_node) : Node(editor_node) void LuminanceMatteNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *editorsnode = get_bnode(); + const bNode *editorsnode = get_bnode(); NodeInput *input_socket = this->get_input_socket(0); NodeOutput *output_socket_image = this->get_output_socket(0); NodeOutput *output_socket_matte = this->get_output_socket(1); diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cc b/source/blender/compositor/nodes/COM_MapUVNode.cc index 54a24a94ad1..ed9bff657f3 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.cc +++ b/source/blender/compositor/nodes/COM_MapUVNode.cc @@ -14,7 +14,7 @@ MapUVNode::MapUVNode(bNode *editor_node) : Node(editor_node) void MapUVNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - bNode *node = this->get_bnode(); + const bNode *node = this->get_bnode(); MapUVOperation *operation = new MapUVOperation(); operation->set_alpha((float)node->custom1); diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cc b/source/blender/compositor/nodes/COM_MapValueNode.cc index be7289e61b1..8b3c3cc3ec6 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.cc +++ b/source/blender/compositor/nodes/COM_MapValueNode.cc @@ -15,7 +15,7 @@ MapValueNode::MapValueNode(bNode *editor_node) : Node(editor_node) void MapValueNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - TexMapping *storage = (TexMapping *)this->get_bnode()->storage; + const TexMapping *storage = (const TexMapping *)this->get_bnode()->storage; NodeInput *color_socket = this->get_input_socket(0); NodeOutput *value_socket = this->get_output_socket(0); diff --git a/source/blender/compositor/nodes/COM_MaskNode.cc b/source/blender/compositor/nodes/COM_MaskNode.cc index 01f98416a9e..f92e307328d 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cc +++ b/source/blender/compositor/nodes/COM_MaskNode.cc @@ -19,8 +19,8 @@ void MaskNode::convert_to_operations(NodeConverter &converter, NodeOutput *output_mask = this->get_output_socket(0); - bNode *editor_node = this->get_bnode(); - NodeMask *data = (NodeMask *)editor_node->storage; + const bNode *editor_node = this->get_bnode(); + const NodeMask *data = (const NodeMask *)editor_node->storage; Mask *mask = (Mask *)editor_node->id; /* Always connect the output image. */ diff --git a/source/blender/compositor/nodes/COM_MixNode.cc b/source/blender/compositor/nodes/COM_MixNode.cc index a44dfc6caa6..e9179d7063c 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cc +++ b/source/blender/compositor/nodes/COM_MixNode.cc @@ -21,7 +21,7 @@ void MixNode::convert_to_operations(NodeConverter &converter, NodeInput *color1Socket = this->get_input_socket(1); NodeInput *color2Socket = this->get_input_socket(2); NodeOutput *output_socket = this->get_output_socket(0); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); bool use_alpha_premultiply = (this->get_bnode()->custom2 & 1) != 0; bool use_clamp = (this->get_bnode()->custom2 & 2) != 0; diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cc b/source/blender/compositor/nodes/COM_MovieClipNode.cc index d3f522fd8cd..e870cd7e0da 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cc +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cc @@ -29,7 +29,7 @@ void MovieClipNode::convert_to_operations(NodeConverter &converter, NodeOutput *scale_movie_clip = this->get_output_socket(4); NodeOutput *angle_movie_clip = this->get_output_socket(5); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); MovieClip *movie_clip = (MovieClip *)editor_node->id; MovieClipUser *movie_clip_user = (MovieClipUser *)editor_node->storage; bool cache_frame = !context.is_rendering(); diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cc b/source/blender/compositor/nodes/COM_MovieDistortionNode.cc index 41ecfc24a8a..7c6e19c03dd 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cc +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cc @@ -15,7 +15,7 @@ MovieDistortionNode::MovieDistortionNode(bNode *editor_node) : Node(editor_node) void MovieDistortionNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *bnode = this->get_bnode(); + const bNode *bnode = this->get_bnode(); MovieClip *clip = (MovieClip *)bnode->id; NodeInput *input_socket = this->get_input_socket(0); diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cc b/source/blender/compositor/nodes/COM_OutputFileNode.cc index a62d21bb657..c83bcf42efd 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cc +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cc @@ -50,7 +50,7 @@ void OutputFileNode::add_preview_to_first_linked_input(NodeConverter &converter) void OutputFileNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - NodeImageMultiFile *storage = (NodeImageMultiFile *)this->get_bnode()->storage; + const NodeImageMultiFile *storage = (const NodeImageMultiFile *)this->get_bnode()->storage; const bool is_multiview = (context.get_render_data()->scemode & R_MULTIVIEW) != 0; add_preview_to_first_linked_input(converter); @@ -99,8 +99,8 @@ void OutputFileNode::convert_to_operations(NodeConverter &converter, if (input->is_linked()) { NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->get_bnode_socket()->storage; - ImageFormatData *format = (sockdata->use_node_format ? &storage->format : - &sockdata->format); + const ImageFormatData *format = (sockdata->use_node_format ? &storage->format : + &sockdata->format); char path[FILE_MAX]; /* combine file path for the input */ diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc index a2037812677..308fd81a12d 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc @@ -15,7 +15,7 @@ PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editor_node) : Node(editor_nod void PlaneTrackDeformNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); MovieClip *clip = (MovieClip *)editor_node->id; NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)editor_node->storage; diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cc b/source/blender/compositor/nodes/COM_ScaleNode.cc index 6eea61b1568..1d613a030d7 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cc +++ b/source/blender/compositor/nodes/COM_ScaleNode.cc @@ -17,7 +17,7 @@ ScaleNode::ScaleNode(bNode *editor_node) : Node(editor_node) void ScaleNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *bnode = this->get_bnode(); + const bNode *bnode = this->get_bnode(); NodeInput *input_socket = this->get_input_socket(0); NodeInput *input_xsocket = this->get_input_socket(1); @@ -25,7 +25,7 @@ void ScaleNode::convert_to_operations(NodeConverter &converter, NodeOutput *output_socket = this->get_output_socket(0); switch (bnode->custom1) { - case CMP_SCALE_RELATIVE: { + case CMP_NODE_SCALE_RELATIVE: { ScaleRelativeOperation *operation = new ScaleRelativeOperation(); converter.add_operation(operation); @@ -39,7 +39,7 @@ void ScaleNode::convert_to_operations(NodeConverter &converter, break; } - case CMP_SCALE_SCENEPERCENT: { + case CMP_NODE_SCALE_RENDER_PERCENT: { SetValueOperation *scale_factor_operation = new SetValueOperation(); scale_factor_operation->set_value(context.get_render_percentage_as_factor()); converter.add_operation(scale_factor_operation); @@ -59,13 +59,14 @@ void ScaleNode::convert_to_operations(NodeConverter &converter, break; } - case CMP_SCALE_RENDERPERCENT: { + case CMP_NODE_SCALE_RENDER_SIZE: { const RenderData *rd = context.get_render_data(); const float render_size_factor = context.get_render_percentage_as_factor(); ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); /* framing options */ - operation->set_is_aspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); - operation->set_is_crop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); + operation->set_is_aspect( + ELEM(bnode->custom2, CMP_NODE_SCALE_RENDER_SIZE_FIT, CMP_NODE_SCALE_RENDER_SIZE_CROP)); + operation->set_is_crop(bnode->custom2 == CMP_NODE_SCALE_RENDER_SIZE_CROP); operation->set_offset(bnode->custom3, bnode->custom4); operation->set_new_width(rd->xsch * render_size_factor); operation->set_new_height(rd->ysch * render_size_factor); @@ -79,7 +80,7 @@ void ScaleNode::convert_to_operations(NodeConverter &converter, break; } - case CMP_SCALE_ABSOLUTE: { + case CMP_NODE_SCALE_ABSOLUTE: { /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); converter.add_operation(operation); diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.cc b/source/blender/compositor/nodes/COM_SeparateColorNode.cc index a956c02ed42..28ebbb35e9a 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.cc +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cc @@ -20,8 +20,8 @@ void SeparateColorNode::convert_to_operations(NodeConverter &converter, NodeOutput *output_bsocket = this->get_output_socket(2); NodeOutput *output_asocket = this->get_output_socket(3); - bNode *editor_node = this->get_bnode(); - NodeCMPCombSepColor *storage = (NodeCMPCombSepColor *)editor_node->storage; + const bNode *editor_node = this->get_bnode(); + const NodeCMPCombSepColor *storage = (const NodeCMPCombSepColor *)editor_node->storage; NodeOperation *color_conv = nullptr; switch (storage->mode) { diff --git a/source/blender/compositor/nodes/COM_SeparateColorNodeLegacy.cc b/source/blender/compositor/nodes/COM_SeparateColorNodeLegacy.cc index c3728bc152f..11d8ca31d35 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNodeLegacy.cc +++ b/source/blender/compositor/nodes/COM_SeparateColorNodeLegacy.cc @@ -97,7 +97,7 @@ NodeOperation *SeparateHSVANode::get_color_converter(const CompositorContext & / NodeOperation *SeparateYCCANode::get_color_converter(const CompositorContext & /*context*/) const { ConvertRGBToYCCOperation *operation = new ConvertRGBToYCCOperation(); - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); operation->set_mode(editor_node->custom1); return operation; } diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cc b/source/blender/compositor/nodes/COM_SplitViewerNode.cc index d02bc6e773d..0f21bd6e50d 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.cc +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cc @@ -16,7 +16,7 @@ SplitViewerNode::SplitViewerNode(bNode *editor_node) : Node(editor_node) void SplitViewerNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); bool do_output = (editor_node->flag & NODE_DO_OUTPUT_RECALC || context.is_rendering()) && (editor_node->flag & NODE_DO_OUTPUT); diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc index bcb1cf2accc..360e9e0bce3 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc @@ -18,7 +18,7 @@ Stabilize2dNode::Stabilize2dNode(bNode *editor_node) : Node(editor_node) void Stabilize2dNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); NodeInput *image_input = this->get_input_socket(0); MovieClip *clip = (MovieClip *)editor_node->id; bool invert = (editor_node->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0; diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.cc b/source/blender/compositor/nodes/COM_SunBeamsNode.cc index 197098f2ff4..c33d9d0faf5 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.cc +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.cc @@ -16,7 +16,7 @@ void SunBeamsNode::convert_to_operations(NodeConverter &converter, { NodeInput *input_socket = this->get_input_socket(0); NodeOutput *output_socket = this->get_output_socket(0); - NodeSunBeams *data = (NodeSunBeams *)get_bnode()->storage; + const NodeSunBeams *data = (const NodeSunBeams *)get_bnode()->storage; SunBeamsOperation *operation = new SunBeamsOperation(); operation->set_data(*data); diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.cc b/source/blender/compositor/nodes/COM_SwitchViewNode.cc index ed9e311f1b4..9507b35b4ca 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.cc +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.cc @@ -15,7 +15,7 @@ void SwitchViewNode::convert_to_operations(NodeConverter &converter, { NodeOperationOutput *result; const char *view_name = context.get_view_name(); - bNode *bnode = this->get_bnode(); + const bNode *bnode = this->get_bnode(); /* get the internal index of the socket with a matching name */ int nr = BLI_findstringindex(&bnode->inputs, view_name, offsetof(bNodeSocket, name)); diff --git a/source/blender/compositor/nodes/COM_TextureNode.cc b/source/blender/compositor/nodes/COM_TextureNode.cc index be5f7b90e11..44d4a41fcec 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.cc +++ b/source/blender/compositor/nodes/COM_TextureNode.cc @@ -14,7 +14,7 @@ TextureNode::TextureNode(bNode *editor_node) : Node(editor_node) void TextureNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); Tex *texture = (Tex *)editor_node->id; TextureOperation *operation = new TextureOperation(); bool scene_color_manage = !STREQ(context.get_scene()->display_settings.display_device, "None"); diff --git a/source/blender/compositor/nodes/COM_TimeNode.cc b/source/blender/compositor/nodes/COM_TimeNode.cc index b3dbd74b795..4f4f6f7bf8a 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cc +++ b/source/blender/compositor/nodes/COM_TimeNode.cc @@ -18,7 +18,7 @@ void TimeNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { SetValueOperation *operation = new SetValueOperation(); - bNode *node = this->get_bnode(); + const bNode *node = this->get_bnode(); /* stack order output: fac */ float fac = 0.0f; diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cc b/source/blender/compositor/nodes/COM_TonemapNode.cc index d20b9698163..f08798db19c 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.cc +++ b/source/blender/compositor/nodes/COM_TonemapNode.cc @@ -14,7 +14,7 @@ TonemapNode::TonemapNode(bNode *editor_node) : Node(editor_node) void TonemapNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { - NodeTonemap *data = (NodeTonemap *)this->get_bnode()->storage; + const NodeTonemap *data = (const NodeTonemap *)this->get_bnode()->storage; TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation(); diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cc b/source/blender/compositor/nodes/COM_TrackPositionNode.cc index 1143ce81c80..da12f72b451 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cc +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cc @@ -40,7 +40,7 @@ static TrackPositionOperation *create_motion_operation(NodeConverter &converter, void TrackPositionNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); MovieClip *clip = (MovieClip *)editor_node->id; NodeTrackPosData *trackpos_data = (NodeTrackPosData *)editor_node->storage; diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cc b/source/blender/compositor/nodes/COM_TranslateNode.cc index 50c5b4c0d2c..8c53d773ad2 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.cc +++ b/source/blender/compositor/nodes/COM_TranslateNode.cc @@ -17,8 +17,8 @@ TranslateNode::TranslateNode(bNode *editor_node) : Node(editor_node) void TranslateNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *bnode = this->get_bnode(); - NodeTranslateData *data = (NodeTranslateData *)bnode->storage; + const bNode *bnode = this->get_bnode(); + const NodeTranslateData *data = (const NodeTranslateData *)bnode->storage; NodeInput *input_socket = this->get_input_socket(0); NodeInput *input_xsocket = this->get_input_socket(1); diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cc b/source/blender/compositor/nodes/COM_VectorBlurNode.cc index f8a2a90ca81..90b8d5a2012 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cc +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cc @@ -14,8 +14,8 @@ VectorBlurNode::VectorBlurNode(bNode *editor_node) : Node(editor_node) void VectorBlurNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *node = this->get_bnode(); - NodeBlurData *vector_blur_settings = (NodeBlurData *)node->storage; + const bNode *node = this->get_bnode(); + const NodeBlurData *vector_blur_settings = (const NodeBlurData *)node->storage; VectorBlurOperation *operation = new VectorBlurOperation(); operation->set_vector_blur_settings(vector_blur_settings); diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.cc b/source/blender/compositor/nodes/COM_VectorCurveNode.cc index c0871ab21e1..d42d2831bc9 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.cc +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cc @@ -15,7 +15,7 @@ void VectorCurveNode::convert_to_operations(NodeConverter &converter, const CompositorContext & /*context*/) const { VectorCurveOperation *operation = new VectorCurveOperation(); - operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage); + operation->set_curve_mapping((const CurveMapping *)this->get_bnode()->storage); converter.add_operation(operation); converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cc b/source/blender/compositor/nodes/COM_ViewerNode.cc index ebef331c62f..47056bcd8c4 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.cc +++ b/source/blender/compositor/nodes/COM_ViewerNode.cc @@ -15,7 +15,7 @@ ViewerNode::ViewerNode(bNode *editor_node) : Node(editor_node) void ViewerNode::convert_to_operations(NodeConverter &converter, const CompositorContext &context) const { - bNode *editor_node = this->get_bnode(); + const bNode *editor_node = this->get_bnode(); bool do_output = (editor_node->flag & NODE_DO_OUTPUT_RECALC || context.is_rendering()) && (editor_node->flag & NODE_DO_OUTPUT); bool ignore_alpha = (editor_node->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index 751f1ad8d8e..28506ba36b5 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -39,7 +39,7 @@ class BokehImageOperation : public MultiThreadedOperation { /** * \brief Settings of the bokeh image */ - NodeBokehImage *data_; + const NodeBokehImage *data_; /** * \brief precalculate center of the image @@ -119,7 +119,7 @@ class BokehImageOperation : public MultiThreadedOperation { * \brief set the node data * \param data: */ - void set_data(NodeBokehImage *data) + void set_data(const NodeBokehImage *data) { data_ = data; } diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index 9f18d110f3c..7e976cab6b6 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -22,7 +22,7 @@ class BoxMaskOperation : public MultiThreadedOperation { float aspect_ratio_; int mask_type_; - NodeBoxMask *data_; + const NodeBoxMask *data_; public: BoxMaskOperation(); @@ -42,7 +42,7 @@ class BoxMaskOperation : public MultiThreadedOperation { */ void deinit_execution() override; - void set_data(NodeBoxMask *data) + void set_data(const NodeBoxMask *data) { data_ = data; } diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cc b/source/blender/compositor/operations/COM_BrightnessOperation.cc index 764d5d64046..07d8035e615 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cc +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cc @@ -47,7 +47,7 @@ void BrightnessOperation::execute_pixel_sampled(float output[4], /* * The algorithm is by Werner D. Streidt * (http://visca.com/ffactory/archives/5-99/msg00021.html) - * Extracted of OpenCV demhist.c + * Extracted of OpenCV `demhist.c`. */ if (contrast > 0) { a = 1.0f - delta * 2.0f; @@ -84,7 +84,7 @@ void BrightnessOperation::update_memory_buffer_partial(MemoryBuffer *output, /* * The algorithm is by Werner D. Streidt * (http://visca.com/ffactory/archives/5-99/msg00021.html) - * Extracted of OpenCV demhist.c + * Extracted of OpenCV `demhist.c`. */ float a, b; if (contrast > 0) { diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cc b/source/blender/compositor/operations/COM_CurveBaseOperation.cc index e92a2f08ed4..e7cbf0d28d5 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.cc +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cc @@ -33,7 +33,7 @@ void CurveBaseOperation::deinit_execution() } } -void CurveBaseOperation::set_curve_mapping(CurveMapping *mapping) +void CurveBaseOperation::set_curve_mapping(const CurveMapping *mapping) { /* duplicate the curve to avoid glitches while drawing, see bug T32374. */ if (curve_mapping_) { diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h index d30c64e3282..4a745c34f24 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -26,7 +26,7 @@ class CurveBaseOperation : public MultiThreadedOperation { void init_execution() override; void deinit_execution() override; - void set_curve_mapping(CurveMapping *mapping); + void set_curve_mapping(const CurveMapping *mapping); }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cc b/source/blender/compositor/operations/COM_DenoiseOperation.cc index 1a199ba2eab..3f32eced0f8 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.cc +++ b/source/blender/compositor/operations/COM_DenoiseOperation.cc @@ -163,7 +163,7 @@ void DenoiseOperation::deinit_execution() SingleThreadedOperation::deinit_execution(); } -static bool are_guiding_passes_noise_free(NodeDenoise *settings) +static bool are_guiding_passes_noise_free(const NodeDenoise *settings) { switch (settings->prefilter) { case CMP_NODE_DENOISE_PREFILTER_NONE: @@ -201,7 +201,7 @@ void DenoiseOperation::generate_denoise(MemoryBuffer *output, MemoryBuffer *input_color, MemoryBuffer *input_normal, MemoryBuffer *input_albedo, - NodeDenoise *settings) + const NodeDenoise *settings) { BLI_assert(input_color->get_buffer()); if (!input_color->get_buffer()) { diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.h b/source/blender/compositor/operations/COM_DenoiseOperation.h index 2b170bb9bb7..709b8843b93 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.h +++ b/source/blender/compositor/operations/COM_DenoiseOperation.h @@ -37,7 +37,7 @@ class DenoiseOperation : public DenoiseBaseOperation { /** * \brief settings of the denoise node. */ - NodeDenoise *settings_; + const NodeDenoise *settings_; public: DenoiseOperation(); @@ -51,7 +51,7 @@ class DenoiseOperation : public DenoiseBaseOperation { */ void deinit_execution() override; - void set_denoise_settings(NodeDenoise *settings) + void set_denoise_settings(const NodeDenoise *settings) { settings_ = settings; } @@ -66,7 +66,7 @@ class DenoiseOperation : public DenoiseBaseOperation { MemoryBuffer *input_color, MemoryBuffer *input_normal, MemoryBuffer *input_albedo, - NodeDenoise *settings); + const NodeDenoise *settings); MemoryBuffer *create_memory_buffer(rcti *rect) override; }; diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index e209bac2305..4e0b072dec9 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -11,7 +11,7 @@ namespace blender::compositor { class DirectionalBlurOperation : public MultiThreadedOperation, public QualityStepHelper { private: SocketReader *input_program_; - NodeDBlurData *data_; + const NodeDBlurData *data_; float center_x_pix_, center_y_pix_; float tx_, ty_; @@ -39,7 +39,7 @@ class DirectionalBlurOperation : public MultiThreadedOperation, public QualitySt ReadBufferOperation *read_operation, rcti *output) override; - void set_data(NodeDBlurData *data) + void set_data(const NodeDBlurData *data) { data_ = data; } diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h index 2cb21be43ad..7b1a38618fd 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h @@ -13,7 +13,7 @@ namespace blender::compositor { */ class DistanceRGBMatteOperation : public MultiThreadedOperation { protected: - NodeChroma *settings_; + const NodeChroma *settings_; SocketReader *input_image_program_; SocketReader *input_key_program_; @@ -33,7 +33,7 @@ class DistanceRGBMatteOperation : public MultiThreadedOperation { void init_execution() override; void deinit_execution() override; - void set_settings(NodeChroma *node_chroma) + void set_settings(const NodeChroma *node_chroma) { settings_ = node_chroma; } diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc index ea156cd19db..fed11d59b50 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc @@ -812,7 +812,7 @@ static void do_allEdgeDetection(unsigned int t, if (!limask[a]) { /* If the inner mask is empty. */ if (lomask[a]) { /* If the outer mask is full. */ /* - * Next we test all 4 directions around the current pixel: next/prev/up/down + * Next we test all 4 directions around the current pixel: next/previous/up/down * The test ensures that the outer mask is empty and that the inner mask * is also empty. If both conditions are true for any one of the 4 adjacent pixels * then the current pixel is counted as being a true outer edge pixel. @@ -882,7 +882,7 @@ static void do_adjacentEdgeDetection(unsigned int t, if (!limask[a]) { /* If the inner mask is empty. */ if (lomask[a]) { /* If the outer mask is full. */ /* - * Next we test all 4 directions around the current pixel: next/prev/up/down + * Next we test all 4 directions around the current pixel: next/previous/up/down * The test ensures that the outer mask is empty and that the inner mask * is also empty. If both conditions are true for any one of the 4 adjacent pixels * then the current pixel is counted as being a true outer edge pixel. diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index 4750086a119..0a2c5507a76 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -32,7 +32,7 @@ class GlareBaseOperation : public SingleThreadedOperation { /** * \brief settings of the glare node. */ - NodeGlare *settings_; + const NodeGlare *settings_; bool is_output_rendered_; @@ -47,7 +47,7 @@ class GlareBaseOperation : public SingleThreadedOperation { */ void deinit_execution() override; - void set_glare_settings(NodeGlare *settings) + void set_glare_settings(const NodeGlare *settings) { settings_ = settings; } @@ -64,7 +64,9 @@ class GlareBaseOperation : public SingleThreadedOperation { protected: GlareBaseOperation(); - virtual void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings) = 0; + virtual void generate_glare(float *data, + MemoryBuffer *input_tile, + const NodeGlare *settings) = 0; MemoryBuffer *create_memory_buffer(rcti *rect) override; }; diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 8b52123b2f0..ade3f11a8b3 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -391,7 +391,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) void GlareFogGlowOperation::generate_glare(float *data, MemoryBuffer *input_tile, - NodeGlare *settings) + const NodeGlare *settings) { int x, y; float scale, u, v, r, w, d; diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h index 5e19f2ab2aa..2a74aeef048 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h @@ -16,7 +16,7 @@ class GlareFogGlowOperation : public GlareBaseOperation { } protected: - void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, const NodeGlare *settings) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cc b/source/blender/compositor/operations/COM_GlareGhostOperation.cc index e863f74d98a..13b7af2329e 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.cc +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cc @@ -20,7 +20,7 @@ static float smooth_mask(float x, float y) void GlareGhostOperation::generate_glare(float *data, MemoryBuffer *input_tile, - NodeGlare *settings) + const NodeGlare *settings) { const int qt = 1 << settings->quality; const float s1 = 4.0f / (float)qt, s2 = 2.0f * s1; diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.h b/source/blender/compositor/operations/COM_GlareGhostOperation.h index 644c2975676..db79358034a 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.h +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.h @@ -16,7 +16,7 @@ class GlareGhostOperation : public GlareBaseOperation { } protected: - void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, const NodeGlare *settings) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc index a656eb3c706..69182b56bee 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc @@ -7,7 +7,7 @@ namespace blender::compositor { void GlareSimpleStarOperation::generate_glare(float *data, MemoryBuffer *input_tile, - NodeGlare *settings) + const NodeGlare *settings) { int i, x, y, ym, yp, xm, xp; float c[4] = {0, 0, 0, 0}, tc[4] = {0, 0, 0, 0}; diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h index 3c2d2fe2d0f..470af780eb2 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h @@ -16,7 +16,7 @@ class GlareSimpleStarOperation : public GlareBaseOperation { } protected: - void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, const NodeGlare *settings) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index 233eb8caf38..e4f06eb0e50 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -7,7 +7,7 @@ namespace blender::compositor { void GlareStreaksOperation::generate_glare(float *data, MemoryBuffer *input_tile, - NodeGlare *settings) + const NodeGlare *settings) { int x, y, n; unsigned int nump = 0; diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.h b/source/blender/compositor/operations/COM_GlareStreaksOperation.h index 09ef30c339d..56afe3d8462 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.h +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.h @@ -16,7 +16,7 @@ class GlareStreaksOperation : public GlareBaseOperation { } protected: - void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, const NodeGlare *settings) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index 90870e3cca9..7930e32eda7 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -18,7 +18,7 @@ class GlareThresholdOperation : public MultiThreadedOperation { /** * \brief settings of the glare node. */ - NodeGlare *settings_; + const NodeGlare *settings_; public: GlareThresholdOperation(); @@ -38,7 +38,7 @@ class GlareThresholdOperation : public MultiThreadedOperation { */ void deinit_execution() override; - void set_glare_settings(NodeGlare *settings) + void set_glare_settings(const NodeGlare *settings) { settings_ = settings; } diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cc b/source/blender/compositor/operations/COM_MapValueOperation.cc index 1353e0391a3..f55d394baa8 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cc +++ b/source/blender/compositor/operations/COM_MapValueOperation.cc @@ -25,7 +25,7 @@ void MapValueOperation::execute_pixel_sampled(float output[4], { float src[4]; input_operation_->read_sampled(src, x, y, sampler); - TexMapping *texmap = settings_; + const TexMapping *texmap = settings_; float value = (src[0] + texmap->loc[0]) * texmap->size[0]; if (texmap->flag & TEXMAP_CLIP_MIN) { if (value < texmap->min[0]) { @@ -52,7 +52,7 @@ void MapValueOperation::update_memory_buffer_partial(MemoryBuffer *output, { for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const float input = *it.in(0); - TexMapping *texmap = settings_; + const TexMapping *texmap = settings_; float value = (input + texmap->loc[0]) * texmap->size[0]; if (texmap->flag & TEXMAP_CLIP_MIN) { if (value < texmap->min[0]) { diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index 4c384e52c95..5c1f425c5bd 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -18,7 +18,7 @@ class MapValueOperation : public MultiThreadedOperation { * Cached reference to the input_program */ SocketReader *input_operation_; - TexMapping *settings_; + const TexMapping *settings_; public: /** @@ -44,7 +44,7 @@ class MapValueOperation : public MultiThreadedOperation { /** * \brief set the TexMapping settings */ - void set_settings(TexMapping *settings) + void set_settings(const TexMapping *settings) { settings_ = settings; } diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc index 11e51e81ef0..261426b31e2 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.cc +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -12,7 +12,7 @@ extern "C" { namespace blender::compositor { /* - * An implementation of Enhanced Subpixel Morphological Antialiasing (SMAA) + * An implementation of Enhanced Sub-pixel Morphological Anti-aliasing (SMAA) * * The algorithm was proposed by: * Jorge Jimenez, Jose I. Echevarria, Tiago Sousa, Diego Gutierrez diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cc b/source/blender/compositor/operations/COM_TonemapOperation.cc index fa40cd36f4c..714625e483d 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cc +++ b/source/blender/compositor/operations/COM_TonemapOperation.cc @@ -46,7 +46,7 @@ void TonemapOperation::execute_pixel(float output[4], int x, int y, void *data) void PhotoreceptorTonemapOperation::execute_pixel(float output[4], int x, int y, void *data) { AvgLogLum *avg = (AvgLogLum *)data; - NodeTonemap *ntm = data_; + const NodeTonemap *ntm = data_; const float f = expf(-data_->f); const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f)); @@ -233,7 +233,7 @@ void PhotoreceptorTonemapOperation::update_memory_buffer_partial(MemoryBuffer *o Span<MemoryBuffer *> inputs) { AvgLogLum *avg = cached_instance_; - NodeTonemap *ntm = data_; + const NodeTonemap *ntm = data_; const float f = expf(-data_->f); const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f)); const float ic = 1.0f - ntm->c; diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index 7868aa140dc..4e68d432985 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -21,7 +21,7 @@ typedef struct AvgLogLum { } AvgLogLum; /** - * \brief base class of tonemap, implementing the simple tonemap + * \brief base class of tone-map, implementing the simple tone-map * \ingroup operation */ class TonemapOperation : public MultiThreadedOperation { @@ -32,9 +32,9 @@ class TonemapOperation : public MultiThreadedOperation { SocketReader *image_reader_; /** - * \brief settings of the Tonemap + * \brief settings of the Tone-map */ - NodeTonemap *data_; + const NodeTonemap *data_; /** * \brief temporarily cache of the execution storage @@ -62,7 +62,7 @@ class TonemapOperation : public MultiThreadedOperation { */ void deinit_execution() override; - void set_data(NodeTonemap *data) + void set_data(const NodeTonemap *data) { data_ = data; } diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index 71c61a6e588..8add3924033 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -190,7 +190,10 @@ struct ZSpan { float clipcrop; }; -/* each zbuffer has coordinates transformed to local rect coordinates, so we can simply clip */ +/** + * Each Z-buffer has coordinates transformed to local rectangle coordinates, + * so we can simply clip. + */ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, float clipcrop) { memset(zspan, 0, sizeof(ZSpan)); @@ -528,7 +531,7 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove) } } - /* last: pixels with 0 we fill in zbuffer, with 1 we skip for mask */ + /* last: pixels with 0 we fill in Z-buffer, with 1 we skip for mask */ for (y = 2; y < ysize; y++) { /* setup rows */ row1 = rectmove + (y - 2) * xsize; diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index 9c83c0645c2..0c4d215b6d3 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -25,7 +25,7 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { /** * \brief settings of the glare node. */ - NodeBlurData *settings_; + const NodeBlurData *settings_; float *cached_instance_; @@ -49,7 +49,7 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { void *initialize_tile_data(rcti *rect) override; - void set_vector_blur_settings(NodeBlurData *settings) + void set_vector_blur_settings(const NodeBlurData *settings) { settings_ = settings; } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index aeadf8f255d..3bd5fa4ad14 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -156,7 +156,7 @@ void ViewerOperation::init_image() ibuf->y = display_height_; /* zero size can happen if no image buffers exist to define a sensible resolution */ if (ibuf->x > 0 && ibuf->y > 0) { - imb_addrectfloatImBuf(ibuf); + imb_addrectfloatImBuf(ibuf, 4); } ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index 9fe156c3ef2..1f1333332f5 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -2,13 +2,13 @@ set(INC . + ../../blenkernel + ../../blenlib ../../gpu - ../../nodes ../../imbuf - ../../blenlib ../../makesdna ../../makesrna - ../../blenkernel + ../../nodes ../../gpu/intern ../../../../intern/guardedalloc ) diff --git a/source/blender/compositor/realtime_compositor/COM_compile_state.hh b/source/blender/compositor/realtime_compositor/COM_compile_state.hh index ed6ad414e3b..924919bbef6 100644 --- a/source/blender/compositor/realtime_compositor/COM_compile_state.hh +++ b/source/blender/compositor/realtime_compositor/COM_compile_state.hh @@ -143,7 +143,7 @@ class CompileState { * the give node. */ void add_node_to_shader_compile_unit(DNode node); - /* Get a reference to the shader compile unit. */ + /* Get a reference to the shader compile unit. */ ShaderCompileUnit &get_shader_compile_unit(); /* Clear the compile unit. This should be called once the compile unit is compiled to ready it to diff --git a/source/blender/compositor/realtime_compositor/COM_conversion_operation.hh b/source/blender/compositor/realtime_compositor/COM_conversion_operation.hh index 15e1d0722ea..310333aea5a 100644 --- a/source/blender/compositor/realtime_compositor/COM_conversion_operation.hh +++ b/source/blender/compositor/realtime_compositor/COM_conversion_operation.hh @@ -11,11 +11,13 @@ namespace blender::realtime_compositor { -/* ------------------------------------------------------------------------------------------------- - * Conversion Operation +/* -------------------------------------------------------------------- */ +/** \name Conversion Operation * * A simple operation that converts a result from a certain type to another. See the derived - * classes for more details. */ + * classes for more details. + * \{ */ + class ConversionOperation : public SimpleOperation { public: using SimpleOperation::SimpleOperation; @@ -37,13 +39,18 @@ class ConversionOperation : public SimpleOperation { /* Get the shader the will be used for conversion. */ virtual GPUShader *get_conversion_shader() const = 0; -}; -/* ------------------------------------------------------------------------------------------------- - * Convert Float To Vector Operation + /** \} */ + +}; // namespace blender::realtime_compositorclassConversionOperation:publicSimpleOperation + +/* -------------------------------------------------------------------- */ +/** \name Convert Float to Vector Operation * * Takes a float result and outputs a vector result. All three components of the output are filled - * with the input float. */ + * with the input float. + * \{ */ + class ConvertFloatToVectorOperation : public ConversionOperation { public: ConvertFloatToVectorOperation(Context &context); @@ -53,11 +60,15 @@ class ConvertFloatToVectorOperation : public ConversionOperation { GPUShader *get_conversion_shader() const override; }; -/* ------------------------------------------------------------------------------------------------- - * Convert Float To Color Operation +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Float to Color Operation * * Takes a float result and outputs a color result. All three color channels of the output are - * filled with the input float and the alpha channel is set to 1. */ + * filled with the input float and the alpha channel is set to 1. + * \{ */ + class ConvertFloatToColorOperation : public ConversionOperation { public: ConvertFloatToColorOperation(Context &context); @@ -67,11 +78,15 @@ class ConvertFloatToColorOperation : public ConversionOperation { GPUShader *get_conversion_shader() const override; }; -/* ------------------------------------------------------------------------------------------------- - * Convert Color To Float Operation +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Color to Float Operation * * Takes a color result and outputs a float result. The output is the average of the three color - * channels, the alpha channel is ignored. */ + * channels, the alpha channel is ignored. + * \{ */ + class ConvertColorToFloatOperation : public ConversionOperation { public: ConvertColorToFloatOperation(Context &context); @@ -81,11 +96,15 @@ class ConvertColorToFloatOperation : public ConversionOperation { GPUShader *get_conversion_shader() const override; }; -/* ------------------------------------------------------------------------------------------------- - * Convert Color To Vector Operation +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Color to Vector Operation * * Takes a color result and outputs a vector result. The output is a copy of the three color - * channels to the three vector components. */ + * channels to the three vector components. + * \{ */ + class ConvertColorToVectorOperation : public ConversionOperation { public: ConvertColorToVectorOperation(Context &context); @@ -95,11 +114,18 @@ class ConvertColorToVectorOperation : public ConversionOperation { GPUShader *get_conversion_shader() const override; }; -/* ------------------------------------------------------------------------------------------------- - * Convert Vector To Float Operation +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Vector to Float Operation * * Takes a vector result and outputs a float result. The output is the average of the three - * components. */ + * components. + * \{ */ + +/* + * + * */ class ConvertVectorToFloatOperation : public ConversionOperation { public: ConvertVectorToFloatOperation(Context &context); @@ -109,11 +135,15 @@ class ConvertVectorToFloatOperation : public ConversionOperation { GPUShader *get_conversion_shader() const override; }; -/* ------------------------------------------------------------------------------------------------- - * Convert Vector To Color Operation +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Vector to Color Operation * * Takes a vector result and outputs a color result. The output is a copy of the three vector - * components to the three color channels with the alpha channel set to 1. */ + * components to the three color channels with the alpha channel set to 1. + * \{ */ + class ConvertVectorToColorOperation : public ConversionOperation { public: ConvertVectorToColorOperation(Context &context); @@ -123,4 +153,6 @@ class ConvertVectorToColorOperation : public ConversionOperation { GPUShader *get_conversion_shader() const override; }; +/** \} */ + } // namespace blender::realtime_compositor diff --git a/source/blender/compositor/realtime_compositor/COM_domain.hh b/source/blender/compositor/realtime_compositor/COM_domain.hh index a4f9eb68db4..54d712f7578 100644 --- a/source/blender/compositor/realtime_compositor/COM_domain.hh +++ b/source/blender/compositor/realtime_compositor/COM_domain.hh @@ -149,7 +149,7 @@ class Domain { /* Transform the domain by the given transformation. This effectively pre-multiply the given * transformation by the current transformation of the domain. */ - void transform(const float3x3 &transformation); + void transform(const float3x3 &input_transformation); /* Returns a domain of size 1x1 and an identity transformation. */ static Domain identity(); diff --git a/source/blender/compositor/realtime_compositor/COM_evaluator.hh b/source/blender/compositor/realtime_compositor/COM_evaluator.hh index fd6feb0948b..258a2a038c4 100644 --- a/source/blender/compositor/realtime_compositor/COM_evaluator.hh +++ b/source/blender/compositor/realtime_compositor/COM_evaluator.hh @@ -104,9 +104,6 @@ class Evaluator { Context &context_; /* A reference to the compositor node tree. */ bNodeTree &node_tree_; - /* The derived and reference node trees representing the compositor node tree. Those are - * initialized when the node tree is compiled and freed when the evaluator resets. */ - NodeTreeRefMap node_tree_reference_map_; std::unique_ptr<DerivedNodeTree> derived_node_tree_; /* The compiled operations stream. This contains ordered pointers to the operations that were * compiled. This is initialized when the node tree is compiled and freed when the evaluator diff --git a/source/blender/compositor/realtime_compositor/COM_shader_node.hh b/source/blender/compositor/realtime_compositor/COM_shader_node.hh index 453226ec452..50337935d03 100644 --- a/source/blender/compositor/realtime_compositor/COM_shader_node.hh +++ b/source/blender/compositor/realtime_compositor/COM_shader_node.hh @@ -73,7 +73,7 @@ class ShaderNode { const DNode &node() const; /* Returns a reference to the node this operations represents. */ - bNode &bnode() const; + const bNode &bnode() const; private: /* Populate the inputs of the node. The input link is set to nullptr and is expected to be diff --git a/source/blender/compositor/realtime_compositor/COM_shader_operation.hh b/source/blender/compositor/realtime_compositor/COM_shader_operation.hh index a33dcbf25be..d03e52ac8f2 100644 --- a/source/blender/compositor/realtime_compositor/COM_shader_operation.hh +++ b/source/blender/compositor/realtime_compositor/COM_shader_operation.hh @@ -224,7 +224,7 @@ class ShaderOperation : public Operation { * * This method first generates the necessary code to load the inputs and store the outputs. Then, * it creates a compute shader from the generated sources. Finally, it adds the necessary GPU - * resources to the shader. */ + * resources to the shader. */ static void generate_code(void *thunk, GPUMaterial *material, GPUCodegenOutput *code_generator); /* Add an image in the shader for each of the declared outputs. Additionally, emit code to define diff --git a/source/blender/compositor/realtime_compositor/COM_simple_operation.hh b/source/blender/compositor/realtime_compositor/COM_simple_operation.hh index 1655e52ac9a..0061986ce42 100644 --- a/source/blender/compositor/realtime_compositor/COM_simple_operation.hh +++ b/source/blender/compositor/realtime_compositor/COM_simple_operation.hh @@ -15,7 +15,7 @@ namespace blender::realtime_compositor { * A simple operation is an operation that takes exactly one input and computes exactly one output. * Moreover, the output is guaranteed to only have a single user, that is, its reference count will * be one. Such operations can be attached to the inputs of operations to pre-process the inputs to - * prepare them before the operation is executed.*/ + * prepare them before the operation is executed. */ class SimpleOperation : public Operation { private: /* The identifier of the output. This is constant for all operations. */ diff --git a/source/blender/compositor/realtime_compositor/COM_utilities.hh b/source/blender/compositor/realtime_compositor/COM_utilities.hh index 4bd61aab5cb..efd1bc2b6b0 100644 --- a/source/blender/compositor/realtime_compositor/COM_utilities.hh +++ b/source/blender/compositor/realtime_compositor/COM_utilities.hh @@ -16,44 +16,54 @@ namespace blender::realtime_compositor { using namespace nodes::derived_node_tree_types; -/* Get the origin socket of the given node input. If the input is not linked, the socket itself is +/** + * Get the origin socket of the given node input. If the input is not linked, the socket itself is * returned. If the input is linked, the socket that is linked to it is returned, which could * either be an input or an output. An input socket is returned when the given input is connected - * to an unlinked input of a group input node. */ + * to an unlinked input of a group input node. + */ DSocket get_input_origin_socket(DInputSocket input); -/* Get the output socket linked to the given node input. If the input is not linked to an output, a - * null output is returned. */ +/** + * Get the output socket linked to the given node input. If the input is not linked to an output, + * a null output is returned. + */ DOutputSocket get_output_linked_to_input(DInputSocket input); -/* Get the result type that corresponds to the type of the given socket. */ -ResultType get_node_socket_result_type(const SocketRef *socket); +/** Get the result type that corresponds to the type of the given socket. */ +ResultType get_node_socket_result_type(const bNodeSocket *socket); -/* Returns true if any of the nodes linked to the given output satisfies the given condition, and - * false otherwise. */ +/** + * Returns true if any of the nodes linked to the given output satisfies the given condition, + * and false otherwise. + */ bool is_output_linked_to_node_conditioned(DOutputSocket output, FunctionRef<bool(DNode)> condition); -/* Returns the number of inputs linked to the given output that satisfy the given condition. */ +/** Returns the number of inputs linked to the given output that satisfy the given condition. */ int number_of_inputs_linked_to_output_conditioned(DOutputSocket output, FunctionRef<bool(DInputSocket)> condition); -/* A node is a shader node if it defines a method to get a shader node operation. */ +/** A node is a shader node if it defines a method to get a shader node operation. */ bool is_shader_node(DNode node); -/* Returns true if the given node is supported, that is, have an implementation. Returns false - * otherwise. */ +/** + * Returns true if the given node is supported, that is, have an implementation. + * Returns false otherwise. + */ bool is_node_supported(DNode node); -/* Get the input descriptor of the given input socket. */ -InputDescriptor input_descriptor_from_input_socket(const InputSocketRef *socket); +/** Get the input descriptor of the given input socket. */ +InputDescriptor input_descriptor_from_input_socket(const bNodeSocket *socket); -/* Dispatch the given compute shader in a 2D compute space such that the number of threads in both +/** + * Dispatch the given compute shader in a 2D compute space such that the number of threads in both * dimensions is as small as possible but at least covers the entirety of threads_range assuming * the shader has a local group size given by local_size. That means that the number of threads * might be a bit larger than threads_range, so shaders has to put that into consideration. A * default local size of 16x16 is assumed, which is the optimal local size for many image - * processing shaders. */ + * processing shaders. + */ void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size = int2(16)); diff --git a/source/blender/compositor/realtime_compositor/intern/compile_state.cc b/source/blender/compositor/realtime_compositor/intern/compile_state.cc index 5b485224111..5fa2fc9d544 100644 --- a/source/blender/compositor/realtime_compositor/intern/compile_state.cc +++ b/source/blender/compositor/realtime_compositor/intern/compile_state.cc @@ -46,7 +46,7 @@ Result &CompileState::get_result_from_output_socket(DOutputSocket output) * reference to the result from that operation using the output identifier. */ if (node_operations_.contains(output.node())) { NodeOperation *operation = node_operations_.lookup(output.node()); - return operation->get_result(output->identifier()); + return operation->get_result(output->identifier); } /* Otherwise, the output belongs to a node that was compiled into a shader operation, so @@ -113,17 +113,17 @@ Domain CompileState::compute_shader_node_domain(DNode node) /* Go over the inputs and find the domain of the non single value input with the highest domain * priority. */ - for (const InputSocketRef *input_ref : node->inputs()) { - const DInputSocket input{node.context(), input_ref}; + for (const bNodeSocket *input : node->input_sockets()) { + const DInputSocket dinput{node.context(), input}; /* Get the output linked to the input. If it is null, that means the input is unlinked, so skip * it. */ - const DOutputSocket output = get_output_linked_to_input(input); + const DOutputSocket output = get_output_linked_to_input(dinput); if (!output) { continue; } - const InputDescriptor input_descriptor = input_descriptor_from_input_socket(input_ref); + const InputDescriptor input_descriptor = input_descriptor_from_input_socket(input); /* If the output belongs to a node that is part of the shader compile unit, then the domain of * the input is the domain of the compile unit itself. */ @@ -149,6 +149,11 @@ Domain CompileState::compute_shader_node_domain(DNode node) continue; } + /* An input that skips realization can't be a domain input. */ + if (input_descriptor.skip_realization) { + continue; + } + /* Notice that the lower the domain priority value is, the higher the priority is, hence the * less than comparison. */ if (input_descriptor.domain_priority < current_domain_priority) { diff --git a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc index d6bf74ffbee..3743b9bba87 100644 --- a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc @@ -12,9 +12,9 @@ namespace blender::realtime_compositor { -/* ------------------------------------------------------------------------------------------------- - * Conversion Operation. - */ +/* -------------------------------------------------------------------- */ +/** \name Conversion Operation + * \{ */ void ConversionOperation::execute() { @@ -79,9 +79,11 @@ SimpleOperation *ConversionOperation::construct_if_needed(Context &context, return nullptr; } -/* ------------------------------------------------------------------------------------------------- - * Convert Float To Vector Operation. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Float to Vector Operation + * \{ */ ConvertFloatToVectorOperation::ConvertFloatToVectorOperation(Context &context) : ConversionOperation(context) @@ -102,9 +104,11 @@ GPUShader *ConvertFloatToVectorOperation::get_conversion_shader() const return shader_manager().get("compositor_convert_float_to_vector"); } -/* ------------------------------------------------------------------------------------------------- - * Convert Float To Color Operation. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Float to Color Operation + * \{ */ ConvertFloatToColorOperation::ConvertFloatToColorOperation(Context &context) : ConversionOperation(context) @@ -127,9 +131,11 @@ GPUShader *ConvertFloatToColorOperation::get_conversion_shader() const return shader_manager().get("compositor_convert_float_to_color"); } -/* ------------------------------------------------------------------------------------------------- - * Convert Color To Float Operation. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Color to Float Operation + * \{ */ ConvertColorToFloatOperation::ConvertColorToFloatOperation(Context &context) : ConversionOperation(context) @@ -151,9 +157,11 @@ GPUShader *ConvertColorToFloatOperation::get_conversion_shader() const return shader_manager().get("compositor_convert_color_to_float"); } -/* ------------------------------------------------------------------------------------------------- - * Convert Color To Vector Operation. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Color to Vector Operation + * \{ */ ConvertColorToVectorOperation::ConvertColorToVectorOperation(Context &context) : ConversionOperation(context) @@ -175,9 +183,11 @@ GPUShader *ConvertColorToVectorOperation::get_conversion_shader() const return shader_manager().get("compositor_convert_color_to_vector"); } -/* ------------------------------------------------------------------------------------------------- - * Convert Vector To Float Operation. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Vector to Float Operation + * \{ */ ConvertVectorToFloatOperation::ConvertVectorToFloatOperation(Context &context) : ConversionOperation(context) @@ -199,9 +209,11 @@ GPUShader *ConvertVectorToFloatOperation::get_conversion_shader() const return shader_manager().get("compositor_convert_vector_to_float"); } -/* ------------------------------------------------------------------------------------------------- - * Convert Vector To Color Operation. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Convert Vector to Color Operation + * \{ */ ConvertVectorToColorOperation::ConvertVectorToColorOperation(Context &context) : ConversionOperation(context) @@ -222,4 +234,6 @@ GPUShader *ConvertVectorToColorOperation::get_conversion_shader() const return shader_manager().get("compositor_convert_vector_to_color"); } +/** \} */ + } // namespace blender::realtime_compositor diff --git a/source/blender/compositor/realtime_compositor/intern/evaluator.cc b/source/blender/compositor/realtime_compositor/intern/evaluator.cc index d358389f2e9..48457bec199 100644 --- a/source/blender/compositor/realtime_compositor/intern/evaluator.cc +++ b/source/blender/compositor/realtime_compositor/intern/evaluator.cc @@ -45,7 +45,6 @@ void Evaluator::reset() { operations_stream_.clear(); derived_node_tree_.reset(); - node_tree_reference_map_.clear(); is_compiled_ = false; } @@ -67,7 +66,7 @@ bool Evaluator::validate_node_tree() void Evaluator::compile_and_evaluate() { - derived_node_tree_ = std::make_unique<DerivedNodeTree>(node_tree_, node_tree_reference_map_); + derived_node_tree_ = std::make_unique<DerivedNodeTree>(node_tree_); if (!validate_node_tree()) { return; @@ -93,7 +92,7 @@ void Evaluator::compile_and_evaluate() void Evaluator::compile_and_evaluate_node(DNode node, CompileState &compile_state) { - NodeOperation *operation = node->typeinfo()->get_compositor_operation(context_, node); + NodeOperation *operation = node->typeinfo->get_compositor_operation(context_, node); compile_state.map_node_to_node_operation(node, operation); @@ -113,16 +112,16 @@ void Evaluator::map_node_operation_inputs_to_their_results(DNode node, NodeOperation *operation, CompileState &compile_state) { - for (const InputSocketRef *input_ref : node->inputs()) { - const DInputSocket input{node.context(), input_ref}; + for (const bNodeSocket *input : node->input_sockets()) { + const DInputSocket dinput{node.context(), input}; - DSocket origin = get_input_origin_socket(input); + DSocket dorigin = get_input_origin_socket(dinput); /* The origin socket is an output, which means the input is linked. So map the input to the * result we get from the output. */ - if (origin->is_output()) { - Result &result = compile_state.get_result_from_output_socket(DOutputSocket(origin)); - operation->map_input_to_result(input->identifier(), &result); + if (dorigin->is_output()) { + Result &result = compile_state.get_result_from_output_socket(DOutputSocket(dorigin)); + operation->map_input_to_result(input->identifier, &result); continue; } @@ -130,8 +129,8 @@ void Evaluator::map_node_operation_inputs_to_their_results(DNode node, * origin is the input socket itself or the input is connected to an unlinked input of a group * input node and the origin is the input of the group input node. So map the input to the * result of a newly created Input Single Value Operation. */ - auto *input_operation = new InputSingleValueOperation(context_, DInputSocket(origin)); - operation->map_input_to_result(input->identifier(), &input_operation->get_result()); + auto *input_operation = new InputSingleValueOperation(context_, DInputSocket(dorigin)); + operation->map_input_to_result(input->identifier, &input_operation->get_result()); operations_stream_.append(std::unique_ptr<InputSingleValueOperation>(input_operation)); diff --git a/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc b/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc index 0bdd40e3636..b3cc86b5f79 100644 --- a/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc @@ -14,7 +14,7 @@ const StringRef InputSingleValueOperation::output_identifier_ = StringRef("Outpu InputSingleValueOperation::InputSingleValueOperation(Context &context, DInputSocket input_socket) : Operation(context), input_socket_(input_socket) { - const ResultType result_type = get_node_socket_result_type(input_socket_.socket_ref()); + const ResultType result_type = get_node_socket_result_type(input_socket_.bsocket()); Result result = Result(result_type, texture_pool()); /* The result of an input single value operation is guaranteed to have a single user. */ @@ -29,17 +29,19 @@ void InputSingleValueOperation::execute() Result &result = get_result(); result.allocate_single_value(); + const bNodeSocket *bsocket = input_socket_.bsocket(); + /* Set the value of the result to the default value of the input socket. */ switch (result.type()) { case ResultType::Float: - result.set_float_value(input_socket_->default_value<bNodeSocketValueFloat>()->value); + result.set_float_value(bsocket->default_value_typed<bNodeSocketValueFloat>()->value); break; case ResultType::Vector: result.set_vector_value( - float3(input_socket_->default_value<bNodeSocketValueVector>()->value)); + float3(bsocket->default_value_typed<bNodeSocketValueVector>()->value)); break; case ResultType::Color: - result.set_color_value(float4(input_socket_->default_value<bNodeSocketValueRGBA>()->value)); + result.set_color_value(float4(bsocket->default_value_typed<bNodeSocketValueRGBA>()->value)); break; } } diff --git a/source/blender/compositor/realtime_compositor/intern/node_operation.cc b/source/blender/compositor/realtime_compositor/intern/node_operation.cc index f02d0906447..1c20c967ddb 100644 --- a/source/blender/compositor/realtime_compositor/intern/node_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/node_operation.cc @@ -25,27 +25,27 @@ using namespace nodes::derived_node_tree_types; NodeOperation::NodeOperation(Context &context, DNode node) : Operation(context), node_(node) { - for (const OutputSocketRef *output : node->outputs()) { + for (const bNodeSocket *output : node->output_sockets()) { const ResultType result_type = get_node_socket_result_type(output); const Result result = Result(result_type, texture_pool()); - populate_result(output->identifier(), result); + populate_result(output->identifier, result); } - for (const InputSocketRef *input : node->inputs()) { + for (const bNodeSocket *input : node->input_sockets()) { const InputDescriptor input_descriptor = input_descriptor_from_input_socket(input); - declare_input_descriptor(input->identifier(), input_descriptor); + declare_input_descriptor(input->identifier, input_descriptor); } } void NodeOperation::compute_results_reference_counts(const Schedule &schedule) { - for (const OutputSocketRef *output_ref : node()->outputs()) { - const DOutputSocket output{node().context(), output_ref}; + for (const bNodeSocket *output : this->node()->output_sockets()) { + const DOutputSocket doutput{node().context(), output}; const int reference_count = number_of_inputs_linked_to_output_conditioned( - output, [&](DInputSocket input) { return schedule.contains(input.node()); }); + doutput, [&](DInputSocket input) { return schedule.contains(input.node()); }); - get_result(output->identifier()).set_initial_reference_count(reference_count); + get_result(doutput->identifier).set_initial_reference_count(reference_count); } } @@ -56,7 +56,7 @@ const DNode &NodeOperation::node() const const bNode &NodeOperation::bnode() const { - return *node_->bnode(); + return *node_; } bool NodeOperation::should_compute_output(StringRef identifier) diff --git a/source/blender/compositor/realtime_compositor/intern/operation.cc b/source/blender/compositor/realtime_compositor/intern/operation.cc index 42dd5aeebe8..832196cc5ef 100644 --- a/source/blender/compositor/realtime_compositor/intern/operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/operation.cc @@ -66,6 +66,11 @@ Domain Operation::compute_domain() continue; } + /* An input that skips realization can't be a domain input. */ + if (descriptor.skip_realization) { + continue; + } + /* Notice that the lower the domain priority value is, the higher the priority is, hence the * less than comparison. */ if (descriptor.domain_priority < current_domain_priority) { @@ -83,7 +88,7 @@ void Operation::add_and_evaluate_input_processors() * because the construction of the input processors may depend on the result of previous input * processors for all inputs. For instance, the realize on domain input processor considers the * value of all inputs, so previous input processors for all inputs needs to be added and - * evaluated first. */ + * evaluated first. */ for (const StringRef &identifier : results_mapped_to_inputs_.keys()) { SimpleOperation *single_value = ReduceToSingleValueOperation::construct_if_needed( diff --git a/source/blender/compositor/realtime_compositor/intern/realize_on_domain_operation.cc b/source/blender/compositor/realtime_compositor/intern/realize_on_domain_operation.cc index 47993060a74..817293c0fa6 100644 --- a/source/blender/compositor/realtime_compositor/intern/realize_on_domain_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/realize_on_domain_operation.cc @@ -41,7 +41,7 @@ void RealizeOnDomainOperation::execute() const float3x3 local_transformation = input.domain().transformation * domain_.transformation.inverted(); - /* Set the origin of the transformation to be the center of the domain. */ + /* Set the origin of the transformation to be the center of the domain. */ const float3x3 transformation = float3x3::from_origin_transformation( local_transformation, float2(domain_.size) / 2.0f); diff --git a/source/blender/compositor/realtime_compositor/intern/scheduler.cc b/source/blender/compositor/realtime_compositor/intern/scheduler.cc index ce8b9330541..ac5cc55a73f 100644 --- a/source/blender/compositor/realtime_compositor/intern/scheduler.cc +++ b/source/blender/compositor/realtime_compositor/intern/scheduler.cc @@ -8,6 +8,8 @@ #include "NOD_derived_node_tree.hh" +#include "BKE_node_runtime.hh" + #include "COM_scheduler.hh" #include "COM_utilities.hh" @@ -21,22 +23,22 @@ using namespace nodes::derived_node_tree_types; * node will be returned. */ static DNode compute_output_node(DerivedNodeTree &tree) { - const NodeTreeRef &root_tree = tree.root_context().tree(); + const bNodeTree &root_tree = tree.root_context().btree(); - for (const NodeRef *node : root_tree.nodes_by_type("CompositorNodeComposite")) { - if (node->bnode()->flag & NODE_DO_OUTPUT) { + for (const bNode *node : root_tree.nodes_by_type("CompositorNodeComposite")) { + if (node->flag & NODE_DO_OUTPUT) { return DNode(&tree.root_context(), node); } } - for (const NodeRef *node : root_tree.nodes_by_type("CompositorNodeViewer")) { - if (node->bnode()->flag & NODE_DO_OUTPUT) { + for (const bNode *node : root_tree.nodes_by_type("CompositorNodeViewer")) { + if (node->flag & NODE_DO_OUTPUT) { return DNode(&tree.root_context(), node); } } - for (const NodeRef *node : root_tree.nodes_by_type("CompositorNodeSplitViewer")) { - if (node->bnode()->flag & NODE_DO_OUTPUT) { + for (const bNode *node : root_tree.nodes_by_type("CompositorNodeSplitViewer")) { + if (node->flag & NODE_DO_OUTPUT) { return DNode(&tree.root_context(), node); } } @@ -120,25 +122,25 @@ static NeededBuffers compute_number_of_needed_buffers(DNode output_node) /* Go over the node dependencies connected to the inputs of the node and push them to the node * stack if they were not computed already. */ Set<DNode> pushed_nodes; - for (const InputSocketRef *input_ref : node->inputs()) { - const DInputSocket input{node.context(), input_ref}; + for (const bNodeSocket *input : node->input_sockets()) { + const DInputSocket dinput{node.context(), input}; /* Get the output linked to the input. If it is null, that means the input is unlinked and * has no dependency node. */ - const DOutputSocket output = get_output_linked_to_input(input); - if (!output) { + const DOutputSocket doutput = get_output_linked_to_input(dinput); + if (!doutput) { continue; } /* The node dependency was already computed or pushed before, so skip it. */ - if (needed_buffers.contains(output.node()) || pushed_nodes.contains(output.node())) { + if (needed_buffers.contains(doutput.node()) || pushed_nodes.contains(doutput.node())) { continue; } /* The output node needs to be computed, push the node dependency to the node stack and * indicate that it was pushed. */ - node_stack.push(output.node()); - pushed_nodes.add_new(output.node()); + node_stack.push(doutput.node()); + pushed_nodes.add_new(doutput.node()); } /* If any of the node dependencies were pushed, that means that not all of them were computed @@ -154,26 +156,26 @@ static NeededBuffers compute_number_of_needed_buffers(DNode output_node) * buffers needed to compute the most demanding of the node dependencies. */ int number_of_input_buffers = 0; int buffers_needed_by_dependencies = 0; - for (const InputSocketRef *input_ref : node->inputs()) { - const DInputSocket input{node.context(), input_ref}; + for (const bNodeSocket *input : node->input_sockets()) { + const DInputSocket dinput{node.context(), input}; /* Get the output linked to the input. If it is null, that means the input is unlinked. * Unlinked inputs do not take a buffer, so skip those inputs. */ - const DOutputSocket output = get_output_linked_to_input(input); - if (!output) { + const DOutputSocket doutput = get_output_linked_to_input(dinput); + if (!doutput) { continue; } /* Since this input is linked, if the link is not between two shader nodes, it means that the * node takes a buffer through this input and so we increment the number of input buffers. */ - if (!is_shader_node(node) || !is_shader_node(output.node())) { + if (!is_shader_node(node) || !is_shader_node(doutput.node())) { number_of_input_buffers++; } /* If the number of buffers needed by the node dependency is more than the total number of * buffers needed by the dependencies, then update the latter to be the former. This is * computing the "d" in the aforementioned equation "max(n + m, d)". */ - const int buffers_needed_by_dependency = needed_buffers.lookup(output.node()); + const int buffers_needed_by_dependency = needed_buffers.lookup(doutput.node()); if (buffers_needed_by_dependency > buffers_needed_by_dependencies) { buffers_needed_by_dependencies = buffers_needed_by_dependency; } @@ -181,17 +183,18 @@ static NeededBuffers compute_number_of_needed_buffers(DNode output_node) /* Compute the number of buffers that will be computed/output by this node. */ int number_of_output_buffers = 0; - for (const OutputSocketRef *output_ref : node->outputs()) { - const DOutputSocket output{node.context(), output_ref}; + for (const bNodeSocket *output : node->output_sockets()) { + const DOutputSocket doutput{node.context(), output}; /* The output is not linked, it outputs no buffer. */ - if (output->logically_linked_sockets().is_empty()) { + if (!output->is_logically_linked()) { continue; } /* If any of the links is not between two shader nodes, it means that the node outputs * a buffer through this output and so we increment the number of output buffers. */ - if (!is_output_linked_to_node_conditioned(output, is_shader_node) || !is_shader_node(node)) { + if (!is_output_linked_to_node_conditioned(doutput, is_shader_node) || + !is_shader_node(node)) { number_of_output_buffers++; } } @@ -255,24 +258,24 @@ Schedule compute_schedule(DerivedNodeTree &tree) * want the node with the highest number of needed buffers to be schedule first, but since * those are pushed to the traversal stack, we need to push them in reverse order. */ Vector<DNode> sorted_dependency_nodes; - for (const InputSocketRef *input_ref : node->inputs()) { - const DInputSocket input{node.context(), input_ref}; + for (const bNodeSocket *input : node->input_sockets()) { + const DInputSocket dinput{node.context(), input}; /* Get the output linked to the input. If it is null, that means the input is unlinked and * has no dependency node, so skip it. */ - const DOutputSocket output = get_output_linked_to_input(input); - if (!output) { + const DOutputSocket doutput = get_output_linked_to_input(dinput); + if (!doutput) { continue; } /* The dependency node was added before, so skip it. The number of dependency nodes is very * small, typically less than 3, so a linear search is okay. */ - if (sorted_dependency_nodes.contains(output.node())) { + if (sorted_dependency_nodes.contains(doutput.node())) { continue; } /* The dependency node was already schedule, so skip it. */ - if (schedule.contains(output.node())) { + if (schedule.contains(doutput.node())) { continue; } @@ -280,7 +283,7 @@ Schedule compute_schedule(DerivedNodeTree &tree) * typically less than 3, so insertion sort is okay. */ int insertion_position = 0; for (int i = 0; i < sorted_dependency_nodes.size(); i++) { - if (needed_buffers.lookup(output.node()) > + if (needed_buffers.lookup(doutput.node()) > needed_buffers.lookup(sorted_dependency_nodes[i])) { insertion_position++; } @@ -288,7 +291,7 @@ Schedule compute_schedule(DerivedNodeTree &tree) break; } } - sorted_dependency_nodes.insert(insertion_position, output.node()); + sorted_dependency_nodes.insert(insertion_position, doutput.node()); } /* Push the sorted dependency nodes to the node stack in order. */ diff --git a/source/blender/compositor/realtime_compositor/intern/shader_node.cc b/source/blender/compositor/realtime_compositor/intern/shader_node.cc index f23485cee96..96dd50790c3 100644 --- a/source/blender/compositor/realtime_compositor/intern/shader_node.cc +++ b/source/blender/compositor/realtime_compositor/intern/shader_node.cc @@ -57,9 +57,9 @@ const DNode &ShaderNode::node() const return node_; } -bNode &ShaderNode::bnode() const +const bNode &ShaderNode::bnode() const { - return *node_->bnode(); + return *node_; } static eGPUType gpu_type_from_socket_type(eNodeSocketDatatype type) @@ -77,17 +77,17 @@ static eGPUType gpu_type_from_socket_type(eNodeSocketDatatype type) } } -static void gpu_stack_vector_from_socket(float *vector, const SocketRef *socket) +static void gpu_stack_vector_from_socket(float *vector, const bNodeSocket *socket) { - switch (socket->bsocket()->type) { + switch (socket->type) { case SOCK_FLOAT: - vector[0] = socket->default_value<bNodeSocketValueFloat>()->value; + vector[0] = socket->default_value_typed<bNodeSocketValueFloat>()->value; return; case SOCK_VECTOR: - copy_v3_v3(vector, socket->default_value<bNodeSocketValueVector>()->value); + copy_v3_v3(vector, socket->default_value_typed<bNodeSocketValueVector>()->value); return; case SOCK_RGBA: - copy_v4_v4(vector, socket->default_value<bNodeSocketValueRGBA>()->value); + copy_v4_v4(vector, socket->default_value_typed<bNodeSocketValueRGBA>()->value); return; default: BLI_assert_unreachable(); @@ -101,8 +101,8 @@ static void populate_gpu_node_stack(DSocket socket, GPUNodeStack &stack) /* This will be initialized later by the GPU material compiler or the compile method. */ stack.link = nullptr; - stack.sockettype = socket->bsocket()->type; - stack.type = gpu_type_from_socket_type((eNodeSocketDatatype)socket->bsocket()->type); + stack.sockettype = socket->type; + stack.type = gpu_type_from_socket_type((eNodeSocketDatatype)socket->type); if (socket->is_input()) { const DInputSocket input(socket); @@ -117,10 +117,10 @@ static void populate_gpu_node_stack(DSocket socket, GPUNodeStack &stack) * unlinked input or an unlinked input of a group input node that the socket is linked to, * otherwise, get the value from the socket itself. */ if (origin->is_input()) { - gpu_stack_vector_from_socket(stack.vec, origin.socket_ref()); + gpu_stack_vector_from_socket(stack.vec, origin.bsocket()); } else { - gpu_stack_vector_from_socket(stack.vec, socket.socket_ref()); + gpu_stack_vector_from_socket(stack.vec, socket.bsocket()); } } else { @@ -132,10 +132,11 @@ void ShaderNode::populate_inputs() { /* Reserve a stack for each input in addition to an extra stack at the end to mark the end of the * array, as this is what the GPU module functions expect. */ - inputs_.resize(node_->inputs().size() + 1); + const int num_input_sockets = node_->input_sockets().size(); + inputs_.resize(num_input_sockets + 1); inputs_.last().end = true; - for (int i = 0; i < node_->inputs().size(); i++) { + for (int i = 0; i < num_input_sockets; i++) { populate_gpu_node_stack(node_.input(i), inputs_[i]); } } @@ -144,10 +145,11 @@ void ShaderNode::populate_outputs() { /* Reserve a stack for each output in addition to an extra stack at the end to mark the end of * the array, as this is what the GPU module functions expect. */ - outputs_.resize(node_->outputs().size() + 1); + const int num_output_sockets = node_->output_sockets().size(); + outputs_.resize(num_output_sockets + 1); outputs_.last().end = true; - for (int i = 0; i < node_->outputs().size(); i++) { + for (int i = 0; i < num_output_sockets; i++) { populate_gpu_node_stack(node_.output(i), outputs_[i]); } } diff --git a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc index a097c81a4c5..8e52baf63ec 100644 --- a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc +++ b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc @@ -128,7 +128,7 @@ void ShaderOperation::construct_material(void *thunk, GPUMaterial *material) { ShaderOperation *operation = static_cast<ShaderOperation *>(thunk); for (DNode node : operation->compile_unit_) { - ShaderNode *shader_node = node->typeinfo()->get_compositor_shader_node(node); + ShaderNode *shader_node = node->typeinfo->get_compositor_shader_node(node); operation->shader_nodes_.add_new(node, std::unique_ptr<ShaderNode>(shader_node)); operation->link_node_inputs(node, material); @@ -141,27 +141,27 @@ void ShaderOperation::construct_material(void *thunk, GPUMaterial *material) void ShaderOperation::link_node_inputs(DNode node, GPUMaterial *material) { - for (const InputSocketRef *input_ref : node->inputs()) { - const DInputSocket input{node.context(), input_ref}; + for (const bNodeSocket *input : node->input_sockets()) { + const DInputSocket dinput{node.context(), input}; /* Get the output linked to the input. If it is null, that means the input is unlinked. * Unlinked inputs are linked by the node compile method, so skip this here. */ - const DOutputSocket output = get_output_linked_to_input(input); - if (!output) { + const DOutputSocket doutput = get_output_linked_to_input(dinput); + if (!doutput) { continue; } /* If the origin node is part of the shader operation, then the link is internal to the GPU * material graph and is linked appropriately. */ - if (compile_unit_.contains(output.node())) { - link_node_input_internal(input, output); + if (compile_unit_.contains(doutput.node())) { + link_node_input_internal(dinput, doutput); continue; } /* Otherwise, the origin node is not part of the shader operation, then the link is external to * the GPU material graph and an input to the shader operation must be declared and linked to * the node input. */ - link_node_input_external(input, output, material); + link_node_input_external(dinput, doutput, material); } } @@ -169,10 +169,10 @@ void ShaderOperation::link_node_input_internal(DInputSocket input_socket, DOutputSocket output_socket) { ShaderNode &output_node = *shader_nodes_.lookup(output_socket.node()); - GPUNodeStack &output_stack = output_node.get_output(output_socket->identifier()); + GPUNodeStack &output_stack = output_node.get_output(output_socket->identifier); ShaderNode &input_node = *shader_nodes_.lookup(input_socket.node()); - GPUNodeStack &input_stack = input_node.get_input(input_socket->identifier()); + GPUNodeStack &input_stack = input_node.get_input(input_socket->identifier); input_stack.link = output_stack.link; } @@ -183,7 +183,7 @@ void ShaderOperation::link_node_input_external(DInputSocket input_socket, { ShaderNode &node = *shader_nodes_.lookup(input_socket.node()); - GPUNodeStack &stack = node.get_input(input_socket->identifier()); + GPUNodeStack &stack = node.get_input(input_socket->identifier); /* An input was already declared for that same output socket, so no need to declare it again. */ if (!output_to_material_attribute_map_.contains(output_socket)) { @@ -219,8 +219,8 @@ void ShaderOperation::declare_operation_input(DInputSocket input_socket, /* Declare the input descriptor for this input and prefer to declare its type to be the same as * the type of the output socket because doing type conversion in the shader is much cheaper. */ - InputDescriptor input_descriptor = input_descriptor_from_input_socket(input_socket.socket_ref()); - input_descriptor.type = get_node_socket_result_type(output_socket.socket_ref()); + InputDescriptor input_descriptor = input_descriptor_from_input_socket(input_socket.bsocket()); + input_descriptor.type = get_node_socket_result_type(output_socket.bsocket()); declare_input_descriptor(input_identifier, input_descriptor); /* Add a new GPU attribute representing an input to the GPU material. Instead of using the @@ -242,16 +242,16 @@ void ShaderOperation::declare_operation_input(DInputSocket input_socket, void ShaderOperation::populate_results_for_node(DNode node, GPUMaterial *material) { - for (const OutputSocketRef *output_ref : node->outputs()) { - const DOutputSocket output{node.context(), output_ref}; + for (const bNodeSocket *output : node->output_sockets()) { + const DOutputSocket doutput{node.context(), output}; /* If any of the nodes linked to the output are not part of the shader operation, then an * output result needs to be populated for it. */ const bool need_to_populate_result = is_output_linked_to_node_conditioned( - output, [&](DNode node) { return !compile_unit_.contains(node); }); + doutput, [&](DNode node) { return !compile_unit_.contains(node); }); if (need_to_populate_result) { - populate_operation_result(output, material); + populate_operation_result(doutput, material); } } } @@ -276,7 +276,7 @@ void ShaderOperation::populate_operation_result(DOutputSocket output_socket, GPU const unsigned int output_id = output_sockets_to_output_identifiers_map_.size(); std::string output_identifier = "output" + std::to_string(output_id); - const ResultType result_type = get_node_socket_result_type(output_socket.socket_ref()); + const ResultType result_type = get_node_socket_result_type(output_socket.bsocket()); const Result result = Result(result_type, texture_pool()); populate_result(output_identifier, result); @@ -284,7 +284,7 @@ void ShaderOperation::populate_operation_result(DOutputSocket output_socket, GPU output_sockets_to_output_identifiers_map_.add_new(output_socket, output_identifier); ShaderNode &node = *shader_nodes_.lookup(output_socket.node()); - GPUNodeLink *output_link = node.get_output(output_socket->identifier()).link; + GPUNodeLink *output_link = node.get_output(output_socket->identifier).link; /* Link the output node stack to an output storer storing in the appropriate result. The result * is identified by its index in the operation and the index is encoded as a float to be passed @@ -481,6 +481,10 @@ void ShaderOperation::generate_code_for_inputs(GPUMaterial *material, /* The attributes of the GPU material represents the inputs of the operation. */ ListBase attributes = GPU_material_attributes(material); + if (BLI_listbase_is_empty(&attributes)) { + return; + } + /* Add a texture sampler for each of the inputs with the same name as the attribute. */ LISTBASE_FOREACH (GPUMaterialAttribute *, attribute, &attributes) { shader_create_info.sampler(0, ImageType::FLOAT_2D, attribute->name, Frequency::BATCH); diff --git a/source/blender/compositor/realtime_compositor/intern/texture_pool.cc b/source/blender/compositor/realtime_compositor/intern/texture_pool.cc index 1568970a030..6bf2041e6ba 100644 --- a/source/blender/compositor/realtime_compositor/intern/texture_pool.cc +++ b/source/blender/compositor/realtime_compositor/intern/texture_pool.cc @@ -13,9 +13,9 @@ namespace blender::realtime_compositor { -/* -------------------------------------------------------------------- - * Texture Pool Key. - */ +/* -------------------------------------------------------------------- */ +/** \name Texture Pool Key + * \{ */ TexturePoolKey::TexturePoolKey(int2 size, eGPUTextureFormat format) : size(size), format(format) { @@ -37,9 +37,11 @@ bool operator==(const TexturePoolKey &a, const TexturePoolKey &b) return a.size == b.size && a.format == b.format; } -/* -------------------------------------------------------------------- - * Texture Pool. - */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Texture Pool + * \{ */ GPUTexture *TexturePool::acquire(int2 size, eGPUTextureFormat format) { @@ -81,4 +83,6 @@ void TexturePool::reset() textures_.clear(); } +/** \} */ + } // namespace blender::realtime_compositor diff --git a/source/blender/compositor/realtime_compositor/intern/utilities.cc b/source/blender/compositor/realtime_compositor/intern/utilities.cc index 169ba70e9eb..1a5823b8441 100644 --- a/source/blender/compositor/realtime_compositor/intern/utilities.cc +++ b/source/blender/compositor/realtime_compositor/intern/utilities.cc @@ -26,7 +26,7 @@ using TargetSocketPathInfo = DOutputSocket::TargetSocketPathInfo; DSocket get_input_origin_socket(DInputSocket input) { /* The input is unlinked. Return the socket itself. */ - if (input->logically_linked_sockets().is_empty()) { + if (!input->is_logically_linked()) { return input; } @@ -52,9 +52,9 @@ DOutputSocket get_output_linked_to_input(DInputSocket input) return DOutputSocket(origin); } -ResultType get_node_socket_result_type(const SocketRef *socket) +ResultType get_node_socket_result_type(const bNodeSocket *socket) { - switch (socket->bsocket()->type) { + switch (socket->type) { case SOCK_FLOAT: return ResultType::Float; case SOCK_VECTOR: @@ -95,21 +95,20 @@ int number_of_inputs_linked_to_output_conditioned(DOutputSocket output, bool is_shader_node(DNode node) { - return node->typeinfo()->get_compositor_shader_node; + return node->typeinfo->get_compositor_shader_node; } bool is_node_supported(DNode node) { - return node->typeinfo()->get_compositor_operation || - node->typeinfo()->get_compositor_shader_node; + return node->typeinfo->get_compositor_operation || node->typeinfo->get_compositor_shader_node; } -InputDescriptor input_descriptor_from_input_socket(const InputSocketRef *socket) +InputDescriptor input_descriptor_from_input_socket(const bNodeSocket *socket) { using namespace nodes; InputDescriptor input_descriptor; input_descriptor.type = get_node_socket_result_type(socket); - const NodeDeclaration *node_declaration = socket->node().declaration(); + const NodeDeclaration *node_declaration = socket->owner_node().declaration(); /* Not every node have a declaration, in which case, we assume the default values for the rest of * the properties. */ if (!node_declaration) { @@ -117,6 +116,7 @@ InputDescriptor input_descriptor_from_input_socket(const InputSocketRef *socket) } const SocketDeclarationPtr &socket_declaration = node_declaration->inputs()[socket->index()]; input_descriptor.domain_priority = socket_declaration->compositor_domain_priority(); + input_descriptor.skip_realization = socket_declaration->compositor_skip_realization(); input_descriptor.expects_single_value = socket_declaration->compositor_expects_single_value(); return input_descriptor; } |