From c7a7c3f5e5ddd5d8919da84e75c1a277ba0b6de9 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Tue, 28 Sep 2021 15:29:16 -0400 Subject: Cleanup: convert compositor nodes to c++ - Many cleanups of to use list base - Some variable changes These change is needed to migrate to the new socket builder API Reviewed By: manzanilla Differential Revision: https://developer.blender.org/D12366 --- .../blender/nodes/composite/node_composite_tree.c | 351 ------------- .../blender/nodes/composite/node_composite_tree.cc | 339 ++++++++++++ .../blender/nodes/composite/node_composite_util.c | 57 -- .../blender/nodes/composite/node_composite_util.cc | 56 ++ .../blender/nodes/composite/node_composite_util.h | 66 --- .../blender/nodes/composite/node_composite_util.hh | 58 +++ .../composite/nodes/node_composite_alphaOver.c | 54 -- .../composite/nodes/node_composite_alphaOver.cc | 54 ++ .../composite/nodes/node_composite_antialiasing.c | 59 --- .../composite/nodes/node_composite_antialiasing.cc | 60 +++ .../composite/nodes/node_composite_bilateralblur.c | 58 --- .../nodes/node_composite_bilateralblur.cc | 58 +++ .../nodes/composite/nodes/node_composite_blur.c | 52 -- .../nodes/composite/nodes/node_composite_blur.cc | 52 ++ .../composite/nodes/node_composite_bokehblur.c | 53 -- .../composite/nodes/node_composite_bokehblur.cc | 53 ++ .../composite/nodes/node_composite_bokehimage.c | 55 -- .../composite/nodes/node_composite_bokehimage.cc | 55 ++ .../nodes/composite/nodes/node_composite_boxmask.c | 56 -- .../composite/nodes/node_composite_boxmask.cc | 56 ++ .../composite/nodes/node_composite_brightness.c | 53 -- .../composite/nodes/node_composite_brightness.cc | 53 ++ .../composite/nodes/node_composite_channelMatte.c | 64 --- .../composite/nodes/node_composite_channelMatte.cc | 64 +++ .../composite/nodes/node_composite_chromaMatte.c | 60 --- .../composite/nodes/node_composite_chromaMatte.cc | 60 +++ .../composite/nodes/node_composite_colorMatte.c | 60 --- .../composite/nodes/node_composite_colorMatte.cc | 60 +++ .../composite/nodes/node_composite_colorSpill.c | 60 --- .../composite/nodes/node_composite_colorSpill.cc | 60 +++ .../composite/nodes/node_composite_colorbalance.c | 94 ---- .../composite/nodes/node_composite_colorbalance.cc | 94 ++++ .../nodes/node_composite_colorcorrection.c | 79 --- .../nodes/node_composite_colorcorrection.cc | 80 +++ .../nodes/composite/nodes/node_composite_common.c | 72 --- .../nodes/composite/nodes/node_composite_common.cc | 72 +++ .../composite/nodes/node_composite_composite.c | 45 -- .../composite/nodes/node_composite_composite.cc | 45 ++ .../composite/nodes/node_composite_cornerpin.c | 49 -- .../composite/nodes/node_composite_cornerpin.cc | 49 ++ .../nodes/composite/nodes/node_composite_crop.c | 57 -- .../nodes/composite/nodes/node_composite_crop.cc | 57 ++ .../composite/nodes/node_composite_cryptomatte.cc | 2 +- .../nodes/composite/nodes/node_composite_curves.c | 113 ---- .../nodes/composite/nodes/node_composite_curves.cc | 113 ++++ .../nodes/composite/nodes/node_composite_defocus.c | 66 --- .../composite/nodes/node_composite_defocus.cc | 66 +++ .../nodes/composite/nodes/node_composite_denoise.c | 53 -- .../composite/nodes/node_composite_denoise.cc | 53 ++ .../composite/nodes/node_composite_despeckle.c | 52 -- .../composite/nodes/node_composite_despeckle.cc | 52 ++ .../composite/nodes/node_composite_diffMatte.c | 58 --- .../composite/nodes/node_composite_diffMatte.cc | 58 +++ .../nodes/composite/nodes/node_composite_dilate.c | 50 -- .../nodes/composite/nodes/node_composite_dilate.cc | 51 ++ .../nodes/node_composite_directionalblur.c | 51 -- .../nodes/node_composite_directionalblur.cc | 51 ++ .../composite/nodes/node_composite_displace.c | 48 -- .../composite/nodes/node_composite_displace.cc | 48 ++ .../composite/nodes/node_composite_distanceMatte.c | 58 --- .../nodes/node_composite_distanceMatte.cc | 58 +++ .../nodes/node_composite_doubleEdgeMask.c | 50 -- .../nodes/node_composite_doubleEdgeMask.cc | 50 ++ .../composite/nodes/node_composite_ellipsemask.c | 58 --- .../composite/nodes/node_composite_ellipsemask.cc | 59 +++ .../composite/nodes/node_composite_exposure.c | 46 -- .../composite/nodes/node_composite_exposure.cc | 46 ++ .../nodes/composite/nodes/node_composite_filter.c | 46 -- .../nodes/composite/nodes/node_composite_filter.cc | 46 ++ .../nodes/composite/nodes/node_composite_flip.c | 45 -- .../nodes/composite/nodes/node_composite_flip.cc | 45 ++ .../nodes/composite/nodes/node_composite_gamma.c | 46 -- .../nodes/composite/nodes/node_composite_gamma.cc | 46 ++ .../nodes/composite/nodes/node_composite_glare.c | 62 --- .../nodes/composite/nodes/node_composite_glare.cc | 62 +++ .../composite/nodes/node_composite_hueSatVal.c | 48 -- .../composite/nodes/node_composite_hueSatVal.cc | 48 ++ .../composite/nodes/node_composite_huecorrect.c | 64 --- .../composite/nodes/node_composite_huecorrect.cc | 65 +++ .../nodes/composite/nodes/node_composite_idMask.c | 45 -- .../nodes/composite/nodes/node_composite_idMask.cc | 45 ++ .../nodes/composite/nodes/node_composite_image.c | 574 --------------------- .../nodes/composite/nodes/node_composite_image.cc | 573 ++++++++++++++++++++ .../nodes/composite/nodes/node_composite_inpaint.c | 40 -- .../composite/nodes/node_composite_inpaint.cc | 40 ++ .../nodes/composite/nodes/node_composite_invert.c | 49 -- .../nodes/composite/nodes/node_composite_invert.cc | 49 ++ .../nodes/composite/nodes/node_composite_keying.c | 77 --- .../nodes/composite/nodes/node_composite_keying.cc | 74 +++ .../composite/nodes/node_composite_keyingscreen.c | 58 --- .../composite/nodes/node_composite_keyingscreen.cc | 56 ++ .../composite/nodes/node_composite_lensdist.c | 55 -- .../composite/nodes/node_composite_lensdist.cc | 55 ++ .../nodes/composite/nodes/node_composite_levels.c | 52 -- .../nodes/composite/nodes/node_composite_levels.cc | 52 ++ .../composite/nodes/node_composite_lummaMatte.c | 56 -- .../composite/nodes/node_composite_lummaMatte.cc | 56 ++ .../composite/nodes/node_composite_mapRange.c | 48 -- .../composite/nodes/node_composite_mapRange.cc | 48 ++ .../nodes/composite/nodes/node_composite_mapUV.c | 46 -- .../nodes/composite/nodes/node_composite_mapUV.cc | 46 ++ .../composite/nodes/node_composite_mapValue.c | 51 -- .../composite/nodes/node_composite_mapValue.cc | 51 ++ .../nodes/composite/nodes/node_composite_mask.c | 64 --- .../nodes/composite/nodes/node_composite_mask.cc | 64 +++ .../nodes/composite/nodes/node_composite_math.c | 45 -- .../nodes/composite/nodes/node_composite_math.cc | 45 ++ .../nodes/composite/nodes/node_composite_mixrgb.c | 48 -- .../nodes/composite/nodes/node_composite_mixrgb.cc | 48 ++ .../composite/nodes/node_composite_movieclip.c | 62 --- .../composite/nodes/node_composite_movieclip.cc | 63 +++ .../nodes/node_composite_moviedistortion.c | 88 ---- .../nodes/node_composite_moviedistortion.cc | 88 ++++ .../nodes/composite/nodes/node_composite_normal.c | 46 -- .../nodes/composite/nodes/node_composite_normal.cc | 46 ++ .../composite/nodes/node_composite_normalize.c | 39 -- .../composite/nodes/node_composite_normalize.cc | 39 ++ .../composite/nodes/node_composite_outputFile.c | 290 ----------- .../composite/nodes/node_composite_outputFile.cc | 289 +++++++++++ .../composite/nodes/node_composite_pixelate.c | 40 -- .../composite/nodes/node_composite_pixelate.cc | 40 ++ .../nodes/node_composite_planetrackdeform.c | 56 -- .../nodes/node_composite_planetrackdeform.cc | 56 ++ .../composite/nodes/node_composite_posterize.c | 46 -- .../composite/nodes/node_composite_posterize.cc | 46 ++ .../composite/nodes/node_composite_premulkey.c | 45 -- .../composite/nodes/node_composite_premulkey.cc | 45 ++ .../nodes/composite/nodes/node_composite_rgb.c | 41 -- .../nodes/composite/nodes/node_composite_rgb.cc | 41 ++ .../nodes/composite/nodes/node_composite_rotate.c | 52 -- .../nodes/composite/nodes/node_composite_rotate.cc | 52 ++ .../nodes/composite/nodes/node_composite_scale.c | 62 --- .../nodes/composite/nodes/node_composite_scale.cc | 62 +++ .../composite/nodes/node_composite_sepcombHSVA.c | 70 --- .../composite/nodes/node_composite_sepcombHSVA.cc | 70 +++ .../composite/nodes/node_composite_sepcombRGBA.c | 70 --- .../composite/nodes/node_composite_sepcombRGBA.cc | 70 +++ .../composite/nodes/node_composite_sepcombYCCA.c | 80 --- .../composite/nodes/node_composite_sepcombYCCA.cc | 80 +++ .../composite/nodes/node_composite_sepcombYUVA.c | 68 --- .../composite/nodes/node_composite_sepcombYUVA.cc | 68 +++ .../composite/nodes/node_composite_setalpha.c | 55 -- .../composite/nodes/node_composite_setalpha.cc | 55 ++ .../composite/nodes/node_composite_splitViewer.c | 61 --- .../composite/nodes/node_composite_splitViewer.cc | 61 +++ .../composite/nodes/node_composite_stabilize2d.c | 62 --- .../composite/nodes/node_composite_stabilize2d.cc | 62 +++ .../composite/nodes/node_composite_sunbeams.c | 56 -- .../composite/nodes/node_composite_sunbeams.cc | 55 ++ .../nodes/composite/nodes/node_composite_switch.c | 47 -- .../nodes/composite/nodes/node_composite_switch.cc | 47 ++ .../composite/nodes/node_composite_switchview.c | 157 ------ .../composite/nodes/node_composite_switchview.cc | 152 ++++++ .../nodes/composite/nodes/node_composite_texture.c | 46 -- .../composite/nodes/node_composite_texture.cc | 46 ++ .../nodes/composite/nodes/node_composite_tonemap.c | 61 --- .../composite/nodes/node_composite_tonemap.cc | 61 +++ .../composite/nodes/node_composite_trackpos.c | 51 -- .../composite/nodes/node_composite_trackpos.cc | 52 ++ .../composite/nodes/node_composite_transform.c | 50 -- .../composite/nodes/node_composite_transform.cc | 50 ++ .../composite/nodes/node_composite_translate.c | 56 -- .../composite/nodes/node_composite_translate.cc | 57 ++ .../composite/nodes/node_composite_valToRgb.c | 74 --- .../composite/nodes/node_composite_valToRgb.cc | 74 +++ .../nodes/composite/nodes/node_composite_value.c | 41 -- .../nodes/composite/nodes/node_composite_value.cc | 41 ++ .../nodes/composite/nodes/node_composite_vecBlur.c | 54 -- .../composite/nodes/node_composite_vecBlur.cc | 54 ++ .../nodes/composite/nodes/node_composite_viewer.c | 60 --- .../nodes/composite/nodes/node_composite_viewer.cc | 60 +++ .../composite/nodes/node_composite_zcombine.c | 49 -- .../composite/nodes/node_composite_zcombine.cc | 49 ++ 173 files changed, 5986 insertions(+), 6012 deletions(-) delete mode 100644 source/blender/nodes/composite/node_composite_tree.c create mode 100644 source/blender/nodes/composite/node_composite_tree.cc delete mode 100644 source/blender/nodes/composite/node_composite_util.c create mode 100644 source/blender/nodes/composite/node_composite_util.cc delete mode 100644 source/blender/nodes/composite/node_composite_util.h create mode 100644 source/blender/nodes/composite/node_composite_util.hh delete mode 100644 source/blender/nodes/composite/nodes/node_composite_alphaOver.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_alphaOver.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_antialiasing.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_antialiasing.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_bilateralblur.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_blur.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_blur.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_bokehblur.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_bokehblur.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_bokehimage.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_bokehimage.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_boxmask.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_boxmask.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_brightness.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_brightness.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_channelMatte.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_channelMatte.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_chromaMatte.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_colorMatte.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_colorMatte.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_colorSpill.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_colorSpill.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_colorbalance.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_colorbalance.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_colorcorrection.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_common.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_common.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_composite.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_composite.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_cornerpin.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_cornerpin.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_crop.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_crop.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_curves.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_curves.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_defocus.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_defocus.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_denoise.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_denoise.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_despeckle.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_despeckle.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_diffMatte.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_diffMatte.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_dilate.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_dilate.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_directionalblur.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_directionalblur.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_displace.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_displace.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_distanceMatte.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_ellipsemask.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_exposure.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_exposure.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_filter.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_filter.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_flip.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_flip.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_gamma.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_gamma.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_glare.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_glare.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_hueSatVal.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_huecorrect.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_huecorrect.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_idMask.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_idMask.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_image.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_image.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_inpaint.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_inpaint.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_invert.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_invert.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_keying.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_keying.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_keyingscreen.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_lensdist.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_lensdist.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_levels.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_levels.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_lummaMatte.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_mapRange.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_mapRange.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_mapUV.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_mapUV.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_mapValue.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_mapValue.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_mask.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_mask.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_math.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_math.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_mixrgb.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_mixrgb.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_movieclip.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_movieclip.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_moviedistortion.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_normal.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_normal.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_normalize.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_normalize.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_outputFile.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_outputFile.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_pixelate.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_pixelate.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_posterize.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_posterize.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_premulkey.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_premulkey.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_rgb.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_rgb.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_rotate.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_rotate.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_scale.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_scale.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_setalpha.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_setalpha.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_splitViewer.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_splitViewer.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_stabilize2d.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_sunbeams.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_sunbeams.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_switch.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_switch.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_switchview.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_switchview.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_texture.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_texture.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_tonemap.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_tonemap.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_trackpos.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_trackpos.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_transform.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_transform.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_translate.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_translate.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_valToRgb.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_valToRgb.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_value.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_value.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_vecBlur.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_vecBlur.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_viewer.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_viewer.cc delete mode 100644 source/blender/nodes/composite/nodes/node_composite_zcombine.c create mode 100644 source/blender/nodes/composite/nodes/node_composite_zcombine.cc (limited to 'source/blender/nodes/composite') diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c deleted file mode 100644 index cc657d6f91d..00000000000 --- a/source/blender/nodes/composite/node_composite_tree.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2007 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup nodes - */ - -#include - -#include "DNA_color_types.h" -#include "DNA_node_types.h" -#include "DNA_scene_types.h" - -#include "BLT_translation.h" - -#include "BKE_context.h" -#include "BKE_global.h" -#include "BKE_main.h" -#include "BKE_node.h" -#include "BKE_tracking.h" - -#include "node_common.h" -#include "node_util.h" - -#include "RNA_access.h" - -#include "NOD_composite.h" -#include "node_composite_util.h" - -#ifdef WITH_COMPOSITOR -# include "COM_compositor.h" -#endif - -static void composite_get_from_context(const bContext *C, - bNodeTreeType *UNUSED(treetype), - bNodeTree **r_ntree, - ID **r_id, - ID **r_from) -{ - Scene *scene = CTX_data_scene(C); - - *r_from = NULL; - *r_id = &scene->id; - *r_ntree = scene->nodetree; -} - -static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) -{ - func(calldata, NODE_CLASS_INPUT, N_("Input")); - func(calldata, NODE_CLASS_OUTPUT, N_("Output")); - func(calldata, NODE_CLASS_OP_COLOR, N_("Color")); - func(calldata, NODE_CLASS_OP_VECTOR, N_("Vector")); - func(calldata, NODE_CLASS_OP_FILTER, N_("Filter")); - func(calldata, NODE_CLASS_CONVERTER, N_("Converter")); - func(calldata, NODE_CLASS_MATTE, N_("Matte")); - func(calldata, NODE_CLASS_DISTORT, N_("Distort")); - func(calldata, NODE_CLASS_GROUP, N_("Group")); - func(calldata, NODE_CLASS_INTERFACE, N_("Interface")); - func(calldata, NODE_CLASS_LAYOUT, N_("Layout")); -} - -static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node) -{ - bNodeSocket *sock; - - for (sock = node->outputs.first; sock; sock = sock->next) { - if (sock->cache) { - sock->cache = NULL; - } - } -} - -static void free_cache(bNodeTree *ntree) -{ - bNode *node; - for (node = ntree->nodes.first; node; node = node->next) { - free_node_cache(ntree, node); - } -} - -/* local tree then owns all compbufs */ -static void localize(bNodeTree *localtree, bNodeTree *ntree) -{ - - bNode *node = ntree->nodes.first; - bNode *local_node = localtree->nodes.first; - while (node != NULL) { - - /* Ensure new user input gets handled ok. */ - node->need_exec = 0; - local_node->original = node; - - /* move over the compbufs */ - /* right after ntreeCopyTree() oldsock pointers are valid */ - - if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { - if (node->id) { - if (node->flag & NODE_DO_OUTPUT) { - local_node->id = (ID *)node->id; - } - else { - local_node->id = NULL; - } - } - } - - bNodeSocket *output_sock = node->outputs.first; - bNodeSocket *local_output_sock = local_node->outputs.first; - while (output_sock != NULL) { - local_output_sock->cache = output_sock->cache; - output_sock->cache = NULL; - /* This is actually link to original: someone was just lazy enough and tried to save few - * bytes in the cost of readability. */ - local_output_sock->new_sock = output_sock; - - output_sock = output_sock->next; - local_output_sock = local_output_sock->next; - } - - node = node->next; - local_node = local_node->next; - } -} - -static void local_sync(bNodeTree *localtree, bNodeTree *ntree) -{ - BKE_node_preview_sync_tree(ntree, localtree); -} - -static void local_merge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree) -{ - bNode *lnode; - bNodeSocket *lsock; - - /* move over the compbufs and previews */ - BKE_node_preview_merge_tree(ntree, localtree, true); - - for (lnode = localtree->nodes.first; lnode; lnode = lnode->next) { - if (ntreeNodeExists(ntree, lnode->new_node)) { - if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { - if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) { - /* image_merge does sanity check for pointers */ - BKE_image_merge(bmain, (Image *)lnode->new_node->id, (Image *)lnode->id); - } - } - else if (lnode->type == CMP_NODE_MOVIEDISTORTION) { - /* special case for distortion node: distortion context is allocating in exec function - * and to achieve much better performance on further calls this context should be - * copied back to original node */ - if (lnode->storage) { - if (lnode->new_node->storage) { - BKE_tracking_distortion_free(lnode->new_node->storage); - } - - lnode->new_node->storage = BKE_tracking_distortion_copy(lnode->storage); - } - } - - for (lsock = lnode->outputs.first; lsock; lsock = lsock->next) { - if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) { - lsock->new_sock->cache = lsock->cache; - lsock->cache = NULL; - lsock->new_sock = NULL; - } - } - } - } -} - -static void update(bNodeTree *ntree) -{ - ntreeSetOutput(ntree); - - ntree_update_reroute_nodes(ntree); - - if (ntree->update & NTREE_UPDATE_NODES) { - /* clean up preview cache, in case nodes have been removed */ - BKE_node_preview_remove_unused(ntree); - } -} - -static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode) -{ - /* Composite node will only show previews for input classes - * by default, other will be hidden - * but can be made visible with the show_preview option */ - if (bnode->typeinfo->nclass != NODE_CLASS_INPUT) { - bnode->flag &= ~NODE_PREVIEW; - } -} - -static bool composite_node_tree_socket_type_valid(bNodeTreeType *UNUSED(ntreetype), - bNodeSocketType *socket_type) -{ - return nodeIsStaticSocketType(socket_type) && - ELEM(socket_type->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA); -} - -bNodeTreeType *ntreeType_Composite; - -void register_node_tree_type_cmp(void) -{ - bNodeTreeType *tt = ntreeType_Composite = MEM_callocN(sizeof(bNodeTreeType), - "compositor node tree type"); - - tt->type = NTREE_COMPOSIT; - strcpy(tt->idname, "CompositorNodeTree"); - strcpy(tt->ui_name, N_("Compositor")); - tt->ui_icon = 0; /* defined in drawnode.c */ - strcpy(tt->ui_description, N_("Compositing nodes")); - - tt->free_cache = free_cache; - tt->free_node_cache = free_node_cache; - tt->foreach_nodeclass = foreach_nodeclass; - tt->localize = localize; - tt->local_sync = local_sync; - tt->local_merge = local_merge; - tt->update = update; - tt->get_from_context = composite_get_from_context; - tt->node_add_init = composite_node_add_init; - tt->valid_socket_type = composite_node_tree_socket_type_valid; - - tt->rna_ext.srna = &RNA_CompositorNodeTree; - - ntreeTypeAdd(tt); -} - -extern void *COM_linker_hack; /* Quiet warning. */ -void *COM_linker_hack = NULL; - -void ntreeCompositExecTree(Scene *scene, - bNodeTree *ntree, - RenderData *rd, - int rendering, - int do_preview, - const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings, - const char *view_name) -{ -#ifdef WITH_COMPOSITOR - COM_execute(rd, scene, ntree, rendering, view_settings, display_settings, view_name); -#else - UNUSED_VARS(scene, ntree, rd, rendering, view_settings, display_settings, view_name); -#endif - - UNUSED_VARS(do_preview); -} - -/* *********************************************** */ - -/** - * Update the outputs of the render layer nodes. - * Since the outputs depend on the render engine, this part is a bit complex: - * - #ntreeCompositUpdateRLayers is called and loops over all render layer nodes. - * - Each render layer node calls the update function of the - * render engine that's used for its scene. - * - The render engine calls RE_engine_register_pass for each pass. - * - #RE_engine_register_pass calls #ntreeCompositRegisterPass, - * which calls #node_cmp_rlayers_register_pass for every render layer node. - */ -void ntreeCompositUpdateRLayers(bNodeTree *ntree) -{ - bNode *node; - - if (ntree == NULL) { - return; - } - - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == CMP_NODE_R_LAYERS) { - node_cmp_rlayers_outputs(ntree, node); - } - } -} - -void ntreeCompositRegisterPass(bNodeTree *ntree, - Scene *scene, - ViewLayer *view_layer, - const char *name, - eNodeSocketDatatype type) -{ - bNode *node; - - if (ntree == NULL) { - return; - } - - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == CMP_NODE_R_LAYERS) { - node_cmp_rlayers_register_pass(ntree, node, scene, view_layer, name, type); - } - } -} - -/* called from render pipeline, to tag render input and output */ -/* need to do all scenes, to prevent errors when you re-render 1 scene */ -void ntreeCompositTagRender(Scene *scene) -{ - /* XXX Think using G_MAIN here is valid, since you want to update current file's scene nodes, - * not the ones in temp main generated for rendering? - * This is still rather weak though, - * ideally render struct would store own main AND original G_MAIN. */ - - for (Scene *sce_iter = G_MAIN->scenes.first; sce_iter; sce_iter = sce_iter->id.next) { - if (sce_iter->nodetree) { - bNode *node; - - for (node = sce_iter->nodetree->nodes.first; node; node = node->next) { - if (node->id == (ID *)scene || node->type == CMP_NODE_COMPOSITE) { - nodeUpdate(sce_iter->nodetree, node); - } - else if (node->type == CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ { - nodeUpdate(sce_iter->nodetree, node); - } - } - } - } -} - -/* XXX after render animation system gets a refresh, this call allows composite to end clean */ -void ntreeCompositClearTags(bNodeTree *ntree) -{ - bNode *node; - - if (ntree == NULL) { - return; - } - - for (node = ntree->nodes.first; node; node = node->next) { - node->need_exec = 0; - if (node->type == NODE_GROUP) { - ntreeCompositClearTags((bNodeTree *)node->id); - } - } -} diff --git a/source/blender/nodes/composite/node_composite_tree.cc b/source/blender/nodes/composite/node_composite_tree.cc new file mode 100644 index 00000000000..d695096903f --- /dev/null +++ b/source/blender/nodes/composite/node_composite_tree.cc @@ -0,0 +1,339 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2007 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup nodes + */ + +#include + +#include "DNA_color_types.h" +#include "DNA_node_types.h" +#include "DNA_scene_types.h" + +#include "BLT_translation.h" + +#include "BKE_context.h" +#include "BKE_global.h" +#include "BKE_main.h" +#include "BKE_node.h" +#include "BKE_tracking.h" + +#include "node_common.h" +#include "node_util.h" + +#include "RNA_access.h" + +#include "NOD_composite.h" +#include "node_composite_util.hh" + +#ifdef WITH_COMPOSITOR +# include "COM_compositor.h" +#endif + +static void composite_get_from_context(const bContext *C, + bNodeTreeType *UNUSED(treetype), + bNodeTree **r_ntree, + ID **r_id, + ID **r_from) +{ + Scene *scene = CTX_data_scene(C); + + *r_from = nullptr; + *r_id = &scene->id; + *r_ntree = scene->nodetree; +} + +static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) +{ + func(calldata, NODE_CLASS_INPUT, N_("Input")); + func(calldata, NODE_CLASS_OUTPUT, N_("Output")); + func(calldata, NODE_CLASS_OP_COLOR, N_("Color")); + func(calldata, NODE_CLASS_OP_VECTOR, N_("Vector")); + func(calldata, NODE_CLASS_OP_FILTER, N_("Filter")); + func(calldata, NODE_CLASS_CONVERTER, N_("Converter")); + func(calldata, NODE_CLASS_MATTE, N_("Matte")); + func(calldata, NODE_CLASS_DISTORT, N_("Distort")); + func(calldata, NODE_CLASS_GROUP, N_("Group")); + func(calldata, NODE_CLASS_INTERFACE, N_("Interface")); + func(calldata, NODE_CLASS_LAYOUT, N_("Layout")); +} + +static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node) +{ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { + if (sock->cache) { + sock->cache = nullptr; + } + } +} + +static void free_cache(bNodeTree *ntree) +{ + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + free_node_cache(ntree, node); + } +} + +/* local tree then owns all compbufs */ +static void localize(bNodeTree *localtree, bNodeTree *ntree) +{ + + bNode *node = (bNode *)ntree->nodes.first; + bNode *local_node = (bNode *)localtree->nodes.first; + while (node != nullptr) { + + /* Ensure new user input gets handled ok. */ + node->need_exec = 0; + local_node->original = node; + + /* move over the compbufs */ + /* right after ntreeCopyTree() oldsock pointers are valid */ + + if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { + if (node->id) { + if (node->flag & NODE_DO_OUTPUT) { + local_node->id = (ID *)node->id; + } + else { + local_node->id = nullptr; + } + } + } + + bNodeSocket *output_sock = (bNodeSocket *)node->outputs.first; + bNodeSocket *local_output_sock = (bNodeSocket *)local_node->outputs.first; + while (output_sock != nullptr) { + local_output_sock->cache = output_sock->cache; + output_sock->cache = nullptr; + /* This is actually link to original: someone was just lazy enough and tried to save few + * bytes in the cost of readability. */ + local_output_sock->new_sock = output_sock; + + output_sock = output_sock->next; + local_output_sock = local_output_sock->next; + } + + node = node->next; + local_node = local_node->next; + } +} + +static void local_sync(bNodeTree *localtree, bNodeTree *ntree) +{ + BKE_node_preview_sync_tree(ntree, localtree); +} + +static void local_merge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree) +{ + bNode *lnode; + bNodeSocket *lsock; + + /* move over the compbufs and previews */ + BKE_node_preview_merge_tree(ntree, localtree, true); + + for (lnode = (bNode *)localtree->nodes.first; lnode; lnode = lnode->next) { + if (ntreeNodeExists(ntree, lnode->new_node)) { + if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { + if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) { + /* image_merge does sanity check for pointers */ + BKE_image_merge(bmain, (Image *)lnode->new_node->id, (Image *)lnode->id); + } + } + else if (lnode->type == CMP_NODE_MOVIEDISTORTION) { + /* special case for distortion node: distortion context is allocating in exec function + * and to achieve much better performance on further calls this context should be + * copied back to original node */ + if (lnode->storage) { + if (lnode->new_node->storage) { + BKE_tracking_distortion_free((MovieDistortion *)lnode->new_node->storage); + } + + lnode->new_node->storage = BKE_tracking_distortion_copy( + (MovieDistortion *)lnode->storage); + } + } + + for (lsock = (bNodeSocket *)lnode->outputs.first; lsock; lsock = lsock->next) { + if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) { + lsock->new_sock->cache = lsock->cache; + lsock->cache = nullptr; + lsock->new_sock = nullptr; + } + } + } + } +} + +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); + + ntree_update_reroute_nodes(ntree); + + if (ntree->update & NTREE_UPDATE_NODES) { + /* clean up preview cache, in case nodes have been removed */ + BKE_node_preview_remove_unused(ntree); + } +} + +static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode) +{ + /* Composite node will only show previews for input classes + * by default, other will be hidden + * but can be made visible with the show_preview option */ + if (bnode->typeinfo->nclass != NODE_CLASS_INPUT) { + bnode->flag &= ~NODE_PREVIEW; + } +} + +static bool composite_node_tree_socket_type_valid(bNodeTreeType *UNUSED(ntreetype), + bNodeSocketType *socket_type) +{ + return nodeIsStaticSocketType(socket_type) && + ELEM(socket_type->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA); +} + +bNodeTreeType *ntreeType_Composite; + +void register_node_tree_type_cmp(void) +{ + bNodeTreeType *tt = ntreeType_Composite = (bNodeTreeType *)MEM_callocN( + sizeof(bNodeTreeType), "compositor node tree type"); + + tt->type = NTREE_COMPOSIT; + strcpy(tt->idname, "CompositorNodeTree"); + strcpy(tt->ui_name, N_("Compositor")); + tt->ui_icon = 0; /* defined in drawnode.c */ + strcpy(tt->ui_description, N_("Compositing nodes")); + + tt->free_cache = free_cache; + tt->free_node_cache = free_node_cache; + tt->foreach_nodeclass = foreach_nodeclass; + tt->localize = localize; + tt->local_sync = local_sync; + tt->local_merge = local_merge; + tt->update = update; + tt->get_from_context = composite_get_from_context; + tt->node_add_init = composite_node_add_init; + tt->valid_socket_type = composite_node_tree_socket_type_valid; + + tt->rna_ext.srna = &RNA_CompositorNodeTree; + + ntreeTypeAdd(tt); +} + +void ntreeCompositExecTree(Scene *scene, + bNodeTree *ntree, + RenderData *rd, + int rendering, + int do_preview, + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name) +{ +#ifdef WITH_COMPOSITOR + COM_execute(rd, scene, ntree, rendering, view_settings, display_settings, view_name); +#else + UNUSED_VARS(scene, ntree, rd, rendering, view_settings, display_settings, view_name); +#endif + + UNUSED_VARS(do_preview); +} + +/* *********************************************** */ + +/** + * Update the outputs of the render layer nodes. + * Since the outputs depend on the render engine, this part is a bit complex: + * - #ntreeCompositUpdateRLayers is called and loops over all render layer nodes. + * - Each render layer node calls the update function of the + * render engine that's used for its scene. + * - The render engine calls RE_engine_register_pass for each pass. + * - #RE_engine_register_pass calls #ntreeCompositRegisterPass, + * which calls #node_cmp_rlayers_register_pass for every render layer node. + */ +void ntreeCompositUpdateRLayers(bNodeTree *ntree) +{ + if (ntree == nullptr) { + return; + } + + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type == CMP_NODE_R_LAYERS) { + node_cmp_rlayers_outputs(ntree, node); + } + } +} + +void ntreeCompositRegisterPass(bNodeTree *ntree, + Scene *scene, + ViewLayer *view_layer, + const char *name, + eNodeSocketDatatype type) +{ + if (ntree == nullptr) { + return; + } + + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type == CMP_NODE_R_LAYERS) { + node_cmp_rlayers_register_pass(ntree, node, scene, view_layer, name, type); + } + } +} + +/* called from render pipeline, to tag render input and output */ +/* need to do all scenes, to prevent errors when you re-render 1 scene */ +void ntreeCompositTagRender(Scene *scene) +{ + /* XXX Think using G_MAIN here is valid, since you want to update current file's scene nodes, + * not the ones in temp main generated for rendering? + * This is still rather weak though, + * ideally render struct would store own main AND original G_MAIN. */ + + for (Scene *sce_iter = (Scene *)G_MAIN->scenes.first; sce_iter; + sce_iter = (Scene *)sce_iter->id.next) { + if (sce_iter->nodetree) { + LISTBASE_FOREACH (bNode *, node, &sce_iter->nodetree->nodes) { + if (node->id == (ID *)scene || node->type == CMP_NODE_COMPOSITE) { + nodeUpdate(sce_iter->nodetree, node); + } + else if (node->type == CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ { + nodeUpdate(sce_iter->nodetree, node); + } + } + } + } +} + +/* XXX after render animation system gets a refresh, this call allows composite to end clean */ +void ntreeCompositClearTags(bNodeTree *ntree) +{ + if (ntree == nullptr) { + return; + } + + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + node->need_exec = 0; + if (node->type == NODE_GROUP) { + ntreeCompositClearTags((bNodeTree *)node->id); + } + } +} diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c deleted file mode 100644 index 6cc17d8c272..00000000000 --- a/source/blender/nodes/composite/node_composite_util.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup nodes - */ - -#include "node_composite_util.h" - -bool cmp_node_poll_default(bNodeType *UNUSED(ntype), - bNodeTree *ntree, - const char **r_disabled_hint) -{ - if (!STREQ(ntree->idname, "CompositorNodeTree")) { - *r_disabled_hint = "Not a compositor node tree"; - return false; - } - return true; -} - -void cmp_node_update_default(bNodeTree *UNUSED(ntree), bNode *node) -{ - bNodeSocket *sock; - for (sock = node->outputs.first; sock; sock = sock->next) { - if (sock->cache) { - // free_compbuf(sock->cache); - // sock->cache = NULL; - } - } - node->need_exec = 1; -} - -void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) -{ - node_type_base(ntype, type, name, nclass, flag); - - ntype->poll = cmp_node_poll_default; - ntype->updatefunc = cmp_node_update_default; - ntype->insert_link = node_insert_link_default; - ntype->update_internal_links = node_update_internal_links_default; -} diff --git a/source/blender/nodes/composite/node_composite_util.cc b/source/blender/nodes/composite/node_composite_util.cc new file mode 100644 index 00000000000..86aaec61bc3 --- /dev/null +++ b/source/blender/nodes/composite/node_composite_util.cc @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup nodes + */ + +#include "node_composite_util.hh" + +bool cmp_node_poll_default(bNodeType *UNUSED(ntype), + bNodeTree *ntree, + const char **r_disabled_hint) +{ + if (!STREQ(ntree->idname, "CompositorNodeTree")) { + *r_disabled_hint = "Not a compositor node tree"; + return false; + } + return true; +} + +void cmp_node_update_default(bNodeTree *UNUSED(ntree), bNode *node) +{ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { + if (sock->cache) { + // free_compbuf(sock->cache); + // sock->cache = nullptr; + } + } + node->need_exec = 1; +} + +void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag) +{ + node_type_base(ntype, type, name, nclass, flag); + + ntype->poll = cmp_node_poll_default; + ntype->updatefunc = cmp_node_update_default; + ntype->insert_link = node_insert_link_default; + ntype->update_internal_links = node_update_internal_links_default; +} diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h deleted file mode 100644 index 4fcccbb79f0..00000000000 --- a/source/blender/nodes/composite/node_composite_util.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup nodes - */ - -#pragma once - -#include "DNA_ID.h" -#include "DNA_movieclip_types.h" -#include "DNA_node_types.h" - -#include "BLI_blenlib.h" -#include "BLI_math.h" - -#include "BLT_translation.h" - -#include "BKE_colorband.h" -#include "BKE_colortools.h" -#include "BKE_image.h" -#include "BKE_texture.h" -#include "BKE_tracking.h" - -#include "node_util.h" - -#include "IMB_imbuf.h" -#include "IMB_imbuf_types.h" - -#include "RE_pipeline.h" - -/* only for forward declarations */ -#include "NOD_composite.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define CMP_SCALE_MAX 12000 - -bool cmp_node_poll_default(struct bNodeType *ntype, - struct bNodeTree *ntree, - const char **r_disabled_info); -void cmp_node_update_default(struct bNodeTree *ntree, struct bNode *node); -void cmp_node_type_base( - struct bNodeType *ntype, int type, const char *name, short nclass, short flag); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/nodes/composite/node_composite_util.hh b/source/blender/nodes/composite/node_composite_util.hh new file mode 100644 index 00000000000..62ef9570358 --- /dev/null +++ b/source/blender/nodes/composite/node_composite_util.hh @@ -0,0 +1,58 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup nodes + */ + +#pragma once + +#include "DNA_ID.h" +#include "DNA_movieclip_types.h" +#include "DNA_node_types.h" + +#include "BLI_blenlib.h" +#include "BLI_math.h" + +#include "BLT_translation.h" + +#include "BKE_colorband.h" +#include "BKE_colortools.h" +#include "BKE_image.h" +#include "BKE_texture.h" +#include "BKE_tracking.h" + +#include "node_util.h" + +#include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" + +#include "RE_pipeline.h" + +/* only for forward declarations */ +#include "NOD_composite.h" + +#define CMP_SCALE_MAX 12000 + +bool cmp_node_poll_default(struct bNodeType *ntype, + struct bNodeTree *ntree, + const char **r_disabled_hint); +void cmp_node_update_default(struct bNodeTree *ntree, struct bNode *node); +void cmp_node_type_base( + struct bNodeType *ntype, int type, const char *name, short nclass, short flag); diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c deleted file mode 100644 index 7a08bd51575..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** ALPHAOVER ******************** */ -static bNodeSocketTemplate cmp_node_alphaover_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_alphaover_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->storage = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); -} - -void register_node_type_cmp_alphaover(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out); - node_type_init(&ntype, node_alphaover_init); - node_type_storage( - &ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc new file mode 100644 index 00000000000..156faed8524 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc @@ -0,0 +1,54 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** ALPHAOVER ******************** */ +static bNodeSocketTemplate cmp_node_alphaover_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_alphaover_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->storage = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); +} + +void register_node_type_cmp_alphaover(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out); + node_type_init(&ntype, node_alphaover_init); + node_type_storage( + &ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.c b/source/blender/nodes/composite/nodes/node_composite_antialiasing.c deleted file mode 100644 index a5906c31093..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2017 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Anti-Aliasing (SMAA 1x) ******************** */ - -static bNodeSocketTemplate cmp_node_antialiasing_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; - -static bNodeSocketTemplate cmp_node_antialiasing_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -static void node_composit_init_antialiasing(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeAntiAliasingData *data = MEM_callocN(sizeof(NodeAntiAliasingData), "node antialiasing data"); - - data->threshold = CMP_DEFAULT_SMAA_THRESHOLD; - data->contrast_limit = CMP_DEFAULT_SMAA_CONTRAST_LIMIT; - data->corner_rounding = CMP_DEFAULT_SMAA_CORNER_ROUNDING; - - node->storage = data; -} - -void register_node_type_cmp_antialiasing(void) -{ - static bNodeType ntype; - - cmp_node_type_base( - &ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_antialiasing_in, cmp_node_antialiasing_out); - node_type_size(&ntype, 170, 140, 200); - node_type_init(&ntype, node_composit_init_antialiasing); - node_type_storage( - &ntype, "NodeAntiAliasingData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc new file mode 100644 index 00000000000..23e63b9a53b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -0,0 +1,60 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2017 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Anti-Aliasing (SMAA 1x) ******************** */ + +static bNodeSocketTemplate cmp_node_antialiasing_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; + +static bNodeSocketTemplate cmp_node_antialiasing_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +static void node_composit_init_antialiasing(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeAntiAliasingData *data = (NodeAntiAliasingData *)MEM_callocN(sizeof(NodeAntiAliasingData), + "node antialiasing data"); + + data->threshold = CMP_DEFAULT_SMAA_THRESHOLD; + data->contrast_limit = CMP_DEFAULT_SMAA_CONTRAST_LIMIT; + data->corner_rounding = CMP_DEFAULT_SMAA_CORNER_ROUNDING; + + node->storage = data; +} + +void register_node_type_cmp_antialiasing(void) +{ + static bNodeType ntype; + + cmp_node_type_base( + &ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_antialiasing_in, cmp_node_antialiasing_out); + node_type_size(&ntype, 170, 140, 200); + node_type_init(&ntype, node_composit_init_antialiasing); + node_type_storage( + &ntype, "NodeAntiAliasingData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c deleted file mode 100644 index 270a137280c..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** BILATERALBLUR ******************** */ -static bNodeSocketTemplate cmp_node_bilateralblur_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Determinator"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_bilateralblur_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeBilateralBlurData *nbbd = MEM_callocN(sizeof(NodeBilateralBlurData), - "node bilateral blur data"); - node->storage = nbbd; - nbbd->iter = 1; - nbbd->sigma_color = 0.3; - nbbd->sigma_space = 5.0; -} - -void register_node_type_cmp_bilateralblur(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out); - node_type_init(&ntype, node_composit_init_bilateralblur); - node_type_storage( - &ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc new file mode 100644 index 00000000000..3e724d17a10 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -0,0 +1,58 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** BILATERALBLUR ******************** */ +static bNodeSocketTemplate cmp_node_bilateralblur_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Determinator"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_bilateralblur_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeBilateralBlurData *nbbd = (NodeBilateralBlurData *)MEM_callocN(sizeof(NodeBilateralBlurData), + "node bilateral blur data"); + node->storage = nbbd; + nbbd->iter = 1; + nbbd->sigma_color = 0.3; + nbbd->sigma_space = 5.0; +} + +void register_node_type_cmp_bilateralblur(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out); + node_type_init(&ntype, node_composit_init_bilateralblur); + node_type_storage( + &ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c deleted file mode 100644 index 92379f4552b..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - * Juho Vepsäläinen - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** BLUR ******************** */ -static bNodeSocketTemplate cmp_node_blur_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_blur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeBlurData *data = MEM_callocN(sizeof(NodeBlurData), "node blur data"); - data->filtertype = R_FILTER_GAUSS; - node->storage = data; -} - -void register_node_type_cmp_blur(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out); - node_type_init(&ntype, node_composit_init_blur); - node_type_storage( - &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc new file mode 100644 index 00000000000..c5c0c21929e --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -0,0 +1,52 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * Juho Vepsäläinen + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** BLUR ******************** */ +static bNodeSocketTemplate cmp_node_blur_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}}; +static bNodeSocketTemplate cmp_node_blur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeBlurData *data = (NodeBlurData *)MEM_callocN(sizeof(NodeBlurData), "node blur data"); + data->filtertype = R_FILTER_GAUSS; + node->storage = data; +} + +void register_node_type_cmp_blur(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out); + node_type_init(&ntype, node_composit_init_blur); + node_type_storage( + &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c deleted file mode 100644 index d724a83e5a2..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - * Juho Vepsäläinen - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "../node_composite_util.h" - -/* **************** BLUR ******************** */ -static bNodeSocketTemplate cmp_node_bokehblur_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("Bokeh"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, - {SOCK_FLOAT, N_("Bounding box"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_bokehblur_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; - -static void node_composit_init_bokehblur(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom3 = 4.0f; - node->custom4 = 16.0f; -} - -void register_node_type_cmp_bokehblur(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out); - node_type_init(&ntype, node_composit_init_bokehblur); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc new file mode 100644 index 00000000000..f130a642e20 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc @@ -0,0 +1,53 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * Juho Vepsäläinen + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "../node_composite_util.hh" + +/* **************** BLUR ******************** */ +static bNodeSocketTemplate cmp_node_bokehblur_in[] = { + {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_("Bokeh"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, + {SOCK_FLOAT, N_("Bounding box"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_bokehblur_out[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; + +static void node_composit_init_bokehblur(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom3 = 4.0f; + node->custom4 = 16.0f; +} + +void register_node_type_cmp_bokehblur(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out); + node_type_init(&ntype, node_composit_init_bokehblur); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c deleted file mode 100644 index 744aba417be..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "../node_composite_util.h" - -/* **************** Bokeh image Tools ******************** */ - -static bNodeSocketTemplate cmp_node_bokehimage_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeBokehImage *data = MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage"); - data->angle = 0.0f; - data->flaps = 5; - data->rounding = 0.0f; - data->catadioptric = 0.0f; - data->lensshift = 0.0f; - node->storage = data; -} - -void register_node_type_cmp_bokehimage(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, NULL, cmp_node_bokehimage_out); - node_type_init(&ntype, node_composit_init_bokehimage); - node_type_storage( - &ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc new file mode 100644 index 00000000000..230f466594b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc @@ -0,0 +1,55 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "../node_composite_util.hh" + +/* **************** Bokeh image Tools ******************** */ + +static bNodeSocketTemplate cmp_node_bokehimage_out[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeBokehImage *data = (NodeBokehImage *)MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage"); + data->angle = 0.0f; + data->flaps = 5; + data->rounding = 0.0f; + data->catadioptric = 0.0f; + data->lensshift = 0.0f; + node->storage = data; +} + +void register_node_type_cmp_bokehimage(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, nullptr, cmp_node_bokehimage_out); + node_type_init(&ntype, node_composit_init_bokehimage); + node_type_storage( + &ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c deleted file mode 100644 index e646b9a9adf..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "../node_composite_util.h" - -/* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate cmp_node_boxmask_in[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_boxmask_out[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; - -static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeBoxMask *data = MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask"); - data->x = 0.5; - data->y = 0.5; - data->width = 0.2; - data->height = 0.1; - data->rotation = 0.0; - node->storage = data; -} - -void register_node_type_cmp_boxmask(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out); - node_type_init(&ntype, node_composit_init_boxmask); - node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc new file mode 100644 index 00000000000..cdf96065f97 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "../node_composite_util.hh" + +/* **************** SCALAR MATH ******************** */ +static bNodeSocketTemplate cmp_node_boxmask_in[] = { + {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_boxmask_out[] = { + {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; + +static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeBoxMask *data = (NodeBoxMask *)MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask"); + data->x = 0.5; + data->y = 0.5; + data->width = 0.2; + data->height = 0.1; + data->rotation = 0.0; + node->storage = data; +} + +void register_node_type_cmp_boxmask(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); + node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out); + node_type_init(&ntype, node_composit_init_boxmask); + node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c deleted file mode 100644 index 5beecb55665..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Brigh and contrsast ******************** */ - -static bNodeSocketTemplate cmp_node_brightcontrast_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_brightcontrast_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = 1; -} - -void register_node_type_cmp_brightcontrast(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); - node_type_init(&ntype, node_composit_init_brightcontrast); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc new file mode 100644 index 00000000000..9c0716169c6 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -0,0 +1,53 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Brigh and contrsast ******************** */ + +static bNodeSocketTemplate cmp_node_brightcontrast_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_brightcontrast_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; +} + +void register_node_type_cmp_brightcontrast(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); + node_type_init(&ntype, node_composit_init_brightcontrast); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c deleted file mode 100644 index 9912c10b368..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Channel Matte Node ********************************* */ -static bNodeSocketTemplate cmp_node_channel_matte_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_channel_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; - -static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage = c; - c->t1 = 1.0f; - c->t2 = 0.0f; - c->t3 = 0.0f; - c->fsize = 0.0f; - c->fstrength = 0.0f; - c->algorithm = 1; /* Max channel limiting. */ - c->channel = 1; /* Limit by red. */ - node->custom1 = 1; /* RGB channel. */ - node->custom2 = 2; /* Green Channel. */ -} - -void register_node_type_cmp_channel_matte(void) -{ - static bNodeType ntype; - - cmp_node_type_base( - &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out); - node_type_init(&ntype, node_composit_init_channel_matte); - node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc new file mode 100644 index 00000000000..e211bc45b17 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc @@ -0,0 +1,64 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Channel Matte Node ********************************* */ +static bNodeSocketTemplate cmp_node_channel_matte_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_channel_matte_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Matte")}, + {-1, ""}, +}; + +static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + node->storage = c; + c->t1 = 1.0f; + c->t2 = 0.0f; + c->t3 = 0.0f; + c->fsize = 0.0f; + c->fstrength = 0.0f; + c->algorithm = 1; /* Max channel limiting. */ + c->channel = 1; /* Limit by red. */ + node->custom1 = 1; /* RGB channel. */ + node->custom2 = 2; /* Green Channel. */ +} + +void register_node_type_cmp_channel_matte(void) +{ + static bNodeType ntype; + + cmp_node_type_base( + &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out); + node_type_init(&ntype, node_composit_init_channel_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c deleted file mode 100644 index 705566df35a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Chroma Key ********************************************************** */ -static bNodeSocketTemplate cmp_node_chroma_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_chroma_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; - -static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage = c; - c->t1 = DEG2RADF(30.0f); - c->t2 = DEG2RADF(10.0f); - c->t3 = 0.0f; - c->fsize = 0.0f; - c->fstrength = 1.0f; -} - -void register_node_type_cmp_chroma_matte(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out); - node_type_init(&ntype, node_composit_init_chroma_matte); - node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc new file mode 100644 index 00000000000..990778160df --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc @@ -0,0 +1,60 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Chroma Key ********************************************************** */ +static bNodeSocketTemplate cmp_node_chroma_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_chroma_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Matte")}, + {-1, ""}, +}; + +static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + node->storage = c; + c->t1 = DEG2RADF(30.0f); + c->t2 = DEG2RADF(10.0f); + c->t3 = 0.0f; + c->fsize = 0.0f; + c->fstrength = 1.0f; +} + +void register_node_type_cmp_chroma_matte(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out); + node_type_init(&ntype, node_composit_init_chroma_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c deleted file mode 100644 index f5cf7bcbf22..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Color Key ********************************************************** */ -static bNodeSocketTemplate cmp_node_color_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_color_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; - -static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node color"); - node->storage = c; - c->t1 = 0.01f; - c->t2 = 0.1f; - c->t3 = 0.1f; - c->fsize = 0.0f; - c->fstrength = 1.0f; -} - -void register_node_type_cmp_color_matte(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out); - node_type_init(&ntype, node_composit_init_color_matte); - node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc new file mode 100644 index 00000000000..fc9a0075b14 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc @@ -0,0 +1,60 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Color Key ********************************************************** */ +static bNodeSocketTemplate cmp_node_color_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_color_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Matte")}, + {-1, ""}, +}; + +static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node color"); + node->storage = c; + c->t1 = 0.01f; + c->t2 = 0.1f; + c->t3 = 0.1f; + c->fsize = 0.0f; + c->fstrength = 1.0f; +} + +void register_node_type_cmp_color_matte(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out); + node_type_init(&ntype, node_composit_init_color_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c deleted file mode 100644 index 8ff4bcdced3..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Color Spill Suppression ********************************* */ -static bNodeSocketTemplate cmp_node_color_spill_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_color_spill_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeColorspill *ncs = MEM_callocN(sizeof(NodeColorspill), "node colorspill"); - node->storage = ncs; - node->custom1 = 2; /* green channel */ - node->custom2 = 0; /* simple limit algorithm */ - ncs->limchan = 0; /* limit by red */ - ncs->limscale = 1.0f; /* limit scaling factor */ - ncs->unspill = 0; /* do not use unspill */ -} - -void register_node_type_cmp_color_spill(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out); - node_type_init(&ntype, node_composit_init_color_spill); - node_type_storage( - &ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc new file mode 100644 index 00000000000..7bdc2e8289e --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc @@ -0,0 +1,60 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Color Spill Suppression ********************************* */ +static bNodeSocketTemplate cmp_node_color_spill_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_color_spill_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeColorspill *ncs = (NodeColorspill *)MEM_callocN(sizeof(NodeColorspill), "node colorspill"); + node->storage = ncs; + node->custom1 = 2; /* green channel */ + node->custom2 = 0; /* simple limit algorithm */ + ncs->limchan = 0; /* limit by red */ + ncs->limscale = 1.0f; /* limit scaling factor */ + ncs->unspill = 0; /* do not use unspill */ +} + +void register_node_type_cmp_color_spill(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, 0); + node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out); + node_type_init(&ntype, node_composit_init_color_spill); + node_type_storage( + &ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c deleted file mode 100644 index 0525229697a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Color Balance ********************************* */ -static bNodeSocketTemplate cmp_node_colorbalance_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_colorbalance_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -/* Sync functions update formula parameters for other modes, such that the result is comparable. - * Note that the results are not exactly the same due to differences in color handling - * (sRGB conversion happens for LGG), - * but this keeps settings comparable. - */ - -void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeColorBalance *n = node->storage; - int c; - - for (c = 0; c < 3; c++) { - n->slope[c] = (2.0f - n->lift[c]) * n->gain[c]; - n->offset[c] = (n->lift[c] - 1.0f) * n->gain[c]; - n->power[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f; - } -} - -void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeColorBalance *n = node->storage; - int c; - - for (c = 0; c < 3; c++) { - float d = n->slope[c] + n->offset[c]; - n->lift[c] = (d != 0.0f ? n->slope[c] + 2.0f * n->offset[c] / d : 0.0f); - n->gain[c] = d; - n->gamma[c] = (n->power[c] != 0.0f) ? 1.0f / n->power[c] : 1000000.0f; - } -} - -static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeColorBalance *n = node->storage = MEM_callocN(sizeof(NodeColorBalance), "node colorbalance"); - - n->lift[0] = n->lift[1] = n->lift[2] = 1.0f; - n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f; - n->gain[0] = n->gain[1] = n->gain[2] = 1.0f; - - n->slope[0] = n->slope[1] = n->slope[2] = 1.0f; - n->offset[0] = n->offset[1] = n->offset[2] = 0.0f; - n->power[0] = n->power[1] = n->power[2] = 1.0f; -} - -void register_node_type_cmp_colorbalance(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_colorbalance_in, cmp_node_colorbalance_out); - node_type_size(&ntype, 400, 200, 400); - node_type_init(&ntype, node_composit_init_colorbalance); - node_type_storage( - &ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc new file mode 100644 index 00000000000..0ca8eecd7db --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc @@ -0,0 +1,94 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Color Balance ********************************* */ +static bNodeSocketTemplate cmp_node_colorbalance_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_colorbalance_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +/* Sync functions update formula parameters for other modes, such that the result is comparable. + * Note that the results are not exactly the same due to differences in color handling + * (sRGB conversion happens for LGG), + * but this keeps settings comparable. + */ + +void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeColorBalance *n = (NodeColorBalance *)node->storage; + + for (int c = 0; c < 3; c++) { + n->slope[c] = (2.0f - n->lift[c]) * n->gain[c]; + n->offset[c] = (n->lift[c] - 1.0f) * n->gain[c]; + n->power[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f; + } +} + +void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeColorBalance *n = (NodeColorBalance *)node->storage; + + for (int c = 0; c < 3; c++) { + float d = n->slope[c] + n->offset[c]; + n->lift[c] = (d != 0.0f ? n->slope[c] + 2.0f * n->offset[c] / d : 0.0f); + n->gain[c] = d; + n->gamma[c] = (n->power[c] != 0.0f) ? 1.0f / n->power[c] : 1000000.0f; + } +} + +static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeColorBalance *n = (NodeColorBalance *)MEM_callocN(sizeof(NodeColorBalance), + "node colorbalance"); + + n->lift[0] = n->lift[1] = n->lift[2] = 1.0f; + n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f; + n->gain[0] = n->gain[1] = n->gain[2] = 1.0f; + + n->slope[0] = n->slope[1] = n->slope[2] = 1.0f; + n->offset[0] = n->offset[1] = n->offset[2] = 0.0f; + n->power[0] = n->power[1] = n->power[2] = 1.0f; + node->storage = n; +} + +void register_node_type_cmp_colorbalance(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_colorbalance_in, cmp_node_colorbalance_out); + node_type_size(&ntype, 400, 200, 400); + node_type_init(&ntype, node_composit_init_colorbalance); + node_type_storage( + &ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c deleted file mode 100644 index 45d39f8be8d..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Color Balance ********************************* */ -static bNodeSocketTemplate cmp_node_colorcorrection_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_colorcorrection_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeColorCorrection *n = node->storage = MEM_callocN(sizeof(NodeColorCorrection), - "node colorcorrection"); - n->startmidtones = 0.2f; - n->endmidtones = 0.7f; - n->master.contrast = 1.0f; - n->master.gain = 1.0f; - n->master.gamma = 1.0f; - n->master.lift = 0.0f; - n->master.saturation = 1.0f; - n->midtones.contrast = 1.0f; - n->midtones.gain = 1.0f; - n->midtones.gamma = 1.0f; - n->midtones.lift = 0.0f; - n->midtones.saturation = 1.0f; - n->shadows.contrast = 1.0f; - n->shadows.gain = 1.0f; - n->shadows.gamma = 1.0f; - n->shadows.lift = 0.0f; - n->shadows.saturation = 1.0f; - n->highlights.contrast = 1.0f; - n->highlights.gain = 1.0f; - n->highlights.gamma = 1.0f; - n->highlights.lift = 0.0f; - n->highlights.saturation = 1.0f; - node->custom1 = 7; // red + green + blue enabled -} - -void register_node_type_cmp_colorcorrection(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_colorcorrection_in, cmp_node_colorcorrection_out); - node_type_size(&ntype, 400, 200, 600); - node_type_init(&ntype, node_composit_init_colorcorrection); - node_type_storage( - &ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc new file mode 100644 index 00000000000..93f6af7bf81 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc @@ -0,0 +1,80 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Color Balance ********************************* */ +static bNodeSocketTemplate cmp_node_colorcorrection_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_colorcorrection_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeColorCorrection *n = (NodeColorCorrection *)MEM_callocN(sizeof(NodeColorCorrection), + "node colorcorrection"); + n->startmidtones = 0.2f; + n->endmidtones = 0.7f; + n->master.contrast = 1.0f; + n->master.gain = 1.0f; + n->master.gamma = 1.0f; + n->master.lift = 0.0f; + n->master.saturation = 1.0f; + n->midtones.contrast = 1.0f; + n->midtones.gain = 1.0f; + n->midtones.gamma = 1.0f; + n->midtones.lift = 0.0f; + n->midtones.saturation = 1.0f; + n->shadows.contrast = 1.0f; + n->shadows.gain = 1.0f; + n->shadows.gamma = 1.0f; + n->shadows.lift = 0.0f; + n->shadows.saturation = 1.0f; + n->highlights.contrast = 1.0f; + n->highlights.gain = 1.0f; + n->highlights.gamma = 1.0f; + n->highlights.lift = 0.0f; + n->highlights.saturation = 1.0f; + node->custom1 = 7; // red + green + blue enabled + node->storage = n; +} + +void register_node_type_cmp_colorcorrection(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_colorcorrection_in, cmp_node_colorcorrection_out); + node_type_size(&ntype, 400, 200, 600); + node_type_init(&ntype, node_composit_init_colorcorrection); + node_type_storage( + &ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c deleted file mode 100644 index 61abc80fe93..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - * Juho Vepsäläinen - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "DNA_node_types.h" - -#include "NOD_common.h" -#include "node_common.h" -#include "node_composite_util.h" - -#include "BKE_node.h" - -#include "RNA_access.h" - -void register_node_type_cmp_group(void) -{ - static bNodeType ntype; - - /* NOTE: Cannot use sh_node_type_base for node group, because it would map the node type - * to the shared NODE_GROUP integer type id. */ - node_type_base_custom( - &ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP, NODE_CONST_OUTPUT); - ntype.type = NODE_GROUP; - ntype.poll = cmp_node_poll_default; - ntype.poll_instance = node_group_poll_instance; - ntype.insert_link = node_insert_link_default; - ntype.update_internal_links = node_update_internal_links_default; - ntype.rna_ext.srna = RNA_struct_find("CompositorNodeGroup"); - BLI_assert(ntype.rna_ext.srna != NULL); - RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); - - node_type_socket_templates(&ntype, NULL, NULL); - node_type_size(&ntype, 140, 60, 400); - node_type_label(&ntype, node_group_label); - node_type_group_update(&ntype, node_group_update); - - nodeRegisterType(&ntype); -} - -void register_node_type_cmp_custom_group(bNodeType *ntype) -{ - /* These methods can be overridden but need a default implementation otherwise. */ - if (ntype->poll == NULL) { - ntype->poll = cmp_node_poll_default; - } - if (ntype->insert_link == NULL) { - ntype->insert_link = node_insert_link_default; - } - if (ntype->update_internal_links == NULL) { - ntype->update_internal_links = node_update_internal_links_default; - } -} diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc new file mode 100644 index 00000000000..fecf6795ef7 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_common.cc @@ -0,0 +1,72 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * Juho Vepsäläinen + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "DNA_node_types.h" + +#include "NOD_common.h" +#include "node_common.h" +#include "node_composite_util.hh" + +#include "BKE_node.h" + +#include "RNA_access.h" + +void register_node_type_cmp_group(void) +{ + static bNodeType ntype; + + /* NOTE: Cannot use sh_node_type_base for node group, because it would map the node type + * to the shared NODE_GROUP integer type id. */ + node_type_base_custom( + &ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP, NODE_CONST_OUTPUT); + ntype.type = NODE_GROUP; + ntype.poll = cmp_node_poll_default; + ntype.poll_instance = node_group_poll_instance; + ntype.insert_link = node_insert_link_default; + ntype.update_internal_links = node_update_internal_links_default; + ntype.rna_ext.srna = RNA_struct_find("CompositorNodeGroup"); + BLI_assert(ntype.rna_ext.srna != nullptr); + RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); + + node_type_socket_templates(&ntype, nullptr, nullptr); + node_type_size(&ntype, 140, 60, 400); + node_type_label(&ntype, node_group_label); + node_type_group_update(&ntype, node_group_update); + + nodeRegisterType(&ntype); +} + +void register_node_type_cmp_custom_group(bNodeType *ntype) +{ + /* These methods can be overridden but need a default implementation otherwise. */ + if (ntype->poll == nullptr) { + ntype->poll = cmp_node_poll_default; + } + if (ntype->insert_link == nullptr) { + ntype->insert_link = node_insert_link_default; + } + if (ntype->update_internal_links == nullptr) { + ntype->update_internal_links = node_update_internal_links_default; + } +} diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c deleted file mode 100644 index dee2ce6b3ec..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** COMPOSITE ******************** */ -static bNodeSocketTemplate cmp_node_composite_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; - -void register_node_type_cmp_composite(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_composite_in, NULL); - - /* Do not allow muting for this node. */ - node_type_internal_links(&ntype, NULL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.cc b/source/blender/nodes/composite/nodes/node_composite_composite.cc new file mode 100644 index 00000000000..68884321b20 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_composite.cc @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** COMPOSITE ******************** */ +static bNodeSocketTemplate cmp_node_composite_in[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; + +void register_node_type_cmp_composite(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_composite_in, nullptr); + + /* Do not allow muting for this node. */ + node_type_internal_links(&ntype, nullptr); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c deleted file mode 100644 index 135120c45aa..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2013 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate inputs[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Upper Left"), 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Upper Right"), 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Lower Left"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Lower Right"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate outputs[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Plane")}, - {-1, ""}, -}; - -void register_node_type_cmp_cornerpin(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, "Corner Pin", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, inputs, outputs); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc new file mode 100644 index 00000000000..b5ca1fb015e --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc @@ -0,0 +1,49 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate inputs[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_VECTOR, N_("Upper Left"), 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_VECTOR, N_("Upper Right"), 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_VECTOR, N_("Lower Left"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_VECTOR, N_("Lower Right"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; + +static bNodeSocketTemplate outputs[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Plane")}, + {-1, ""}, +}; + +void register_node_type_cmp_cornerpin(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, "Corner Pin", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, inputs, outputs); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c deleted file mode 100644 index 868df5367c4..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_crop.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Crop ******************** */ - -static bNodeSocketTemplate cmp_node_crop_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_crop_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeTwoXYs *nxy = MEM_callocN(sizeof(NodeTwoXYs), "node xy data"); - node->storage = nxy; - nxy->x1 = 0; - nxy->x2 = 0; - nxy->y1 = 0; - nxy->y2 = 0; -} - -void register_node_type_cmp_crop(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out); - node_type_init(&ntype, node_composit_init_crop); - node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc new file mode 100644 index 00000000000..f07dba8a74b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -0,0 +1,57 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Crop ******************** */ + +static bNodeSocketTemplate cmp_node_crop_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_crop_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeTwoXYs *nxy = (NodeTwoXYs *)MEM_callocN(sizeof(NodeTwoXYs), "node xy data"); + node->storage = nxy; + nxy->x1 = 0; + nxy->x2 = 0; + nxy->y1 = 0; + nxy->y2 = 0; +} + +void register_node_type_cmp_crop(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out); + node_type_init(&ntype, node_composit_init_crop); + node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index 51dd73a86af..6657267b016 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -21,7 +21,7 @@ * \ingroup cmpnodes */ -#include "node_composite_util.h" +#include "node_composite_util.hh" #include "BLI_assert.h" #include "BLI_dynstr.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c deleted file mode 100644 index 470540d3337..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** CURVE Time ******************** */ - -/* custom1 = sfra, custom2 = efra */ -static bNodeSocketTemplate cmp_node_time_out[] = { - {SOCK_FLOAT, N_("Fac")}, - {-1, ""}, -}; - -static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = 1; - node->custom2 = 250; - node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); -} - -void register_node_type_cmp_curve_time(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_time_out); - node_type_size(&ntype, 140, 100, 320); - node_type_init(&ntype, node_composit_init_curves_time); - node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - - nodeRegisterType(&ntype); -} - -/* **************** CURVE VEC ******************** */ -static bNodeSocketTemplate cmp_node_curve_vec_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_curve_vec_out[] = { - {SOCK_VECTOR, N_("Vector")}, - {-1, ""}, -}; - -static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); -} - -void register_node_type_cmp_curve_vec(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_curve_vec_in, cmp_node_curve_vec_out); - node_type_size(&ntype, 200, 140, 320); - node_type_init(&ntype, node_composit_init_curve_vec); - node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - - nodeRegisterType(&ntype); -} - -/* **************** CURVE RGB ******************** */ -static bNodeSocketTemplate cmp_node_curve_rgb_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_curve_rgb_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->storage = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); -} - -void register_node_type_cmp_curve_rgb(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_curve_rgb_in, cmp_node_curve_rgb_out); - node_type_size(&ntype, 200, 140, 320); - node_type_init(&ntype, node_composit_init_curve_rgb); - node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc new file mode 100644 index 00000000000..8a8a7624fce --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc @@ -0,0 +1,113 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** CURVE Time ******************** */ + +/* custom1 = sfra, custom2 = efra */ +static bNodeSocketTemplate cmp_node_time_out[] = { + {SOCK_FLOAT, N_("Fac")}, + {-1, ""}, +}; + +static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; + node->custom2 = 250; + node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); +} + +void register_node_type_cmp_curve_time(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_time_out); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_curves_time); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + + nodeRegisterType(&ntype); +} + +/* **************** CURVE VEC ******************** */ +static bNodeSocketTemplate cmp_node_curve_vec_in[] = { + {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_curve_vec_out[] = { + {SOCK_VECTOR, N_("Vector")}, + {-1, ""}, +}; + +static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); +} + +void register_node_type_cmp_curve_vec(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); + node_type_socket_templates(&ntype, cmp_node_curve_vec_in, cmp_node_curve_vec_out); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, node_composit_init_curve_vec); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + + nodeRegisterType(&ntype); +} + +/* **************** CURVE RGB ******************** */ +static bNodeSocketTemplate cmp_node_curve_rgb_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_curve_rgb_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->storage = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); +} + +void register_node_type_cmp_curve_rgb(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_curve_rgb_in, cmp_node_curve_rgb_out); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, node_composit_init_curve_rgb); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c deleted file mode 100644 index 3803f450f49..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include - -/* ************ qdn: Defocus node ****************** */ -static bNodeSocketTemplate cmp_node_defocus_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_defocus_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) -{ - /* qdn: defocus node */ - NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data"); - nbd->bktype = 0; - nbd->rotation = 0.0f; - nbd->preview = 1; - nbd->gamco = 0; - nbd->samples = 16; - nbd->fstop = 128.0f; - nbd->maxblur = 16; - nbd->bthresh = 1.0f; - nbd->scale = 1.0f; - nbd->no_zbuf = 1; - node->storage = nbd; -} - -void register_node_type_cmp_defocus(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); - node_type_init(&ntype, node_composit_init_defocus); - node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc new file mode 100644 index 00000000000..b1ac170217a --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -0,0 +1,66 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include + +/* ************ qdn: Defocus node ****************** */ +static bNodeSocketTemplate cmp_node_defocus_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_defocus_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) +{ + /* qdn: defocus node */ + NodeDefocus *nbd = (NodeDefocus *)MEM_callocN(sizeof(NodeDefocus), "node defocus data"); + nbd->bktype = 0; + nbd->rotation = 0.0f; + nbd->preview = 1; + nbd->gamco = 0; + nbd->samples = 16; + nbd->fstop = 128.0f; + nbd->maxblur = 16; + nbd->bthresh = 1.0f; + nbd->scale = 1.0f; + nbd->no_zbuf = 1; + node->storage = nbd; +} + +void register_node_type_cmp_defocus(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); + node_type_init(&ntype, node_composit_init_defocus); + node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.c b/source/blender/nodes/composite/nodes/node_composite_denoise.c deleted file mode 100644 index e2c7c7b995f..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2019 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_denoise_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_RGBA, N_("Albedo"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_denoise_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -static void node_composit_init_denonise(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeDenoise *ndg = MEM_callocN(sizeof(NodeDenoise), "node denoise data"); - ndg->hdr = true; - ndg->prefilter = CMP_NODE_DENOISE_PREFILTER_ACCURATE; - node->storage = ndg; -} - -void register_node_type_cmp_denoise(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_denoise_in, cmp_node_denoise_out); - node_type_init(&ntype, node_composit_init_denonise); - node_type_storage(&ntype, "NodeDenoise", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc new file mode 100644 index 00000000000..ec085794462 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -0,0 +1,53 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2019 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_denoise_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, + {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + {SOCK_RGBA, N_("Albedo"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + {-1, ""}}; +static bNodeSocketTemplate cmp_node_denoise_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +static void node_composit_init_denonise(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeDenoise *ndg = (NodeDenoise *)MEM_callocN(sizeof(NodeDenoise), "node denoise data"); + ndg->hdr = true; + ndg->prefilter = CMP_NODE_DENOISE_PREFILTER_ACCURATE; + node->storage = ndg; +} + +void register_node_type_cmp_denoise(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_denoise_in, cmp_node_denoise_out); + node_type_init(&ntype, node_composit_init_denonise); + node_type_storage(&ntype, "NodeDenoise", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c deleted file mode 100644 index 18567ee2006..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** FILTER ******************** */ -static bNodeSocketTemplate cmp_node_despeckle_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_despeckle_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom3 = 0.5f; - node->custom4 = 0.5f; -} - -void register_node_type_cmp_despeckle(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out); - node_type_init(&ntype, node_composit_init_despeckle); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc new file mode 100644 index 00000000000..52d91dabeb1 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc @@ -0,0 +1,52 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** FILTER ******************** */ +static bNodeSocketTemplate cmp_node_despeckle_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_despeckle_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom3 = 0.5f; + node->custom4 = 0.5f; +} + +void register_node_type_cmp_despeckle(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out); + node_type_init(&ntype, node_composit_init_despeckle); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c deleted file mode 100644 index 7871a9e8b04..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* channel Difference Matte ********************************* */ -static bNodeSocketTemplate cmp_node_diff_matte_in[] = { - {SOCK_RGBA, N_("Image 1"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Image 2"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_diff_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; - -static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage = c; - c->t1 = 0.1f; - c->t2 = 0.1f; -} - -void register_node_type_cmp_diff_matte(void) -{ - static bNodeType ntype; - - cmp_node_type_base( - &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out); - node_type_init(&ntype, node_composit_init_diff_matte); - node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc new file mode 100644 index 00000000000..1e1a48381b7 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc @@ -0,0 +1,58 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* channel Difference Matte ********************************* */ +static bNodeSocketTemplate cmp_node_diff_matte_in[] = { + {SOCK_RGBA, N_("Image 1"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Image 2"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_diff_matte_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Matte")}, + {-1, ""}, +}; + +static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + node->storage = c; + c->t1 = 0.1f; + c->t2 = 0.1f; +} + +void register_node_type_cmp_diff_matte(void) +{ + static bNodeType ntype; + + cmp_node_type_base( + &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out); + node_type_init(&ntype, node_composit_init_diff_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c deleted file mode 100644 index 12f1f229258..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Dilate/Erode ******************** */ - -static bNodeSocketTemplate cmp_node_dilateerode_in[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_dilateerode_out[] = {{SOCK_FLOAT, N_("Mask")}, {-1, ""}}; - -static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), "NodeDilateErode"); - data->falloff = PROP_SMOOTH; - node->storage = data; -} - -void register_node_type_cmp_dilateerode(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out); - node_type_init(&ntype, node_composit_init_dilateerode); - node_type_storage( - &ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc new file mode 100644 index 00000000000..57884a299da --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -0,0 +1,51 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Dilate/Erode ******************** */ + +static bNodeSocketTemplate cmp_node_dilateerode_in[] = { + {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; +static bNodeSocketTemplate cmp_node_dilateerode_out[] = {{SOCK_FLOAT, N_("Mask")}, {-1, ""}}; + +static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeDilateErode *data = (NodeDilateErode *)MEM_callocN(sizeof(NodeDilateErode), + "NodeDilateErode"); + data->falloff = PROP_SMOOTH; + node->storage = data; +} + +void register_node_type_cmp_dilateerode(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out); + node_type_init(&ntype, node_composit_init_dilateerode); + node_type_storage( + &ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c deleted file mode 100644 index 6dd60526edf..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_dblur_in[] = {{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_dblur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeDBlurData *ndbd = MEM_callocN(sizeof(NodeDBlurData), "node dblur data"); - node->storage = ndbd; - ndbd->iter = 1; - ndbd->center_x = 0.5; - ndbd->center_y = 0.5; -} - -void register_node_type_cmp_dblur(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out); - node_type_init(&ntype, node_composit_init_dblur); - node_type_storage( - &ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc new file mode 100644 index 00000000000..d9f82ba5009 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -0,0 +1,51 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_dblur_in[] = {{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_dblur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeDBlurData *ndbd = (NodeDBlurData *)MEM_callocN(sizeof(NodeDBlurData), "node dblur data"); + node->storage = ndbd; + ndbd->iter = 1; + ndbd->center_x = 0.5; + ndbd->center_y = 0.5; +} + +void register_node_type_cmp_dblur(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out); + node_type_init(&ntype, node_composit_init_dblur); + node_type_storage( + &ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c deleted file mode 100644 index 819a4f29b3a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Displace ******************** */ - -static bNodeSocketTemplate cmp_node_displace_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_VECTOR, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, - {SOCK_FLOAT, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_displace_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_displace(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.cc b/source/blender/nodes/composite/nodes/node_composite_displace.cc new file mode 100644 index 00000000000..b1ed7f05794 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_displace.cc @@ -0,0 +1,48 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Displace ******************** */ + +static bNodeSocketTemplate cmp_node_displace_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_VECTOR, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, + {SOCK_FLOAT, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_displace_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_displace(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c deleted file mode 100644 index 3e659fe662b..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* channel Distance Matte ********************************* */ -static bNodeSocketTemplate cmp_node_distance_matte_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_distance_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; - -static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage = c; - c->channel = 1; - c->t1 = 0.1f; - c->t2 = 0.1f; -} - -void register_node_type_cmp_distance_matte(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out); - node_type_init(&ntype, node_composit_init_distance_matte); - node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc new file mode 100644 index 00000000000..3f8767ecd08 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc @@ -0,0 +1,58 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* channel Distance Matte ********************************* */ +static bNodeSocketTemplate cmp_node_distance_matte_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_distance_matte_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Matte")}, + {-1, ""}, +}; + +static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + node->storage = c; + c->channel = 1; + c->t1 = 0.1f; + c->t2 = 0.1f; +} + +void register_node_type_cmp_distance_matte(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out); + node_type_init(&ntype, node_composit_init_distance_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c deleted file mode 100644 index 6f68b187775..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ -#include "node_composite_util.h" -/* **************** Double Edge Mask ******************** */ - -static bNodeSocketTemplate cmp_node_doubleedgemask_in[] = { - /* Inner mask socket definition. */ - {SOCK_FLOAT, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - /* Outer mask socket definition. */ - {SOCK_FLOAT, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - /* Input socket array terminator. */ - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_doubleedgemask_out[] = { - /* Output socket definition. */ - {SOCK_FLOAT, "Mask"}, - /* Output socket array terminator. */ - {-1, ""}, -}; - -void register_node_type_cmp_doubleedgemask(void) -{ - static bNodeType ntype; /* Allocate a node type data structure. */ - - cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); - node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc new file mode 100644 index 00000000000..7c9a48efc2d --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc @@ -0,0 +1,50 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ +#include "node_composite_util.hh" +/* **************** Double Edge Mask ******************** */ + +static bNodeSocketTemplate cmp_node_doubleedgemask_in[] = { + /* Inner mask socket definition. */ + {SOCK_FLOAT, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + /* Outer mask socket definition. */ + {SOCK_FLOAT, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + /* Input socket array terminator. */ + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_doubleedgemask_out[] = { + /* Output socket definition. */ + {SOCK_FLOAT, "Mask"}, + /* Output socket array terminator. */ + {-1, ""}, +}; + +void register_node_type_cmp_doubleedgemask(void) +{ + static bNodeType ntype; /* Allocate a node type data structure. */ + + cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, 0); + node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); + node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c deleted file mode 100644 index d5e1d519a1c..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "../node_composite_util.h" - -/* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate cmp_node_ellipsemask_in[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_ellipsemask_out[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; - -static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeEllipseMask *data = MEM_callocN(sizeof(NodeEllipseMask), "NodeEllipseMask"); - data->x = 0.5; - data->y = 0.5; - data->width = 0.2; - data->height = 0.1; - data->rotation = 0.0; - node->storage = data; -} - -void register_node_type_cmp_ellipsemask(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_ellipsemask_in, cmp_node_ellipsemask_out); - node_type_size(&ntype, 260, 110, 320); - node_type_init(&ntype, node_composit_init_ellipsemask); - node_type_storage( - &ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc new file mode 100644 index 00000000000..67196fb0d35 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -0,0 +1,59 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "../node_composite_util.hh" + +/* **************** SCALAR MATH ******************** */ +static bNodeSocketTemplate cmp_node_ellipsemask_in[] = { + {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_ellipsemask_out[] = { + {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; + +static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeEllipseMask *data = (NodeEllipseMask *)MEM_callocN(sizeof(NodeEllipseMask), + "NodeEllipseMask"); + data->x = 0.5; + data->y = 0.5; + data->width = 0.2; + data->height = 0.1; + data->rotation = 0.0; + node->storage = data; +} + +void register_node_type_cmp_ellipsemask(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, 0); + node_type_socket_templates(&ntype, cmp_node_ellipsemask_in, cmp_node_ellipsemask_out); + node_type_size(&ntype, 260, 110, 320); + node_type_init(&ntype, node_composit_init_ellipsemask); + node_type_storage( + &ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_exposure.c b/source/blender/nodes/composite/nodes/node_composite_exposure.c deleted file mode 100644 index bd27e4a3d76..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_exposure.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2020 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Exposure ******************** */ - -static bNodeSocketTemplate cmp_node_exposure_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Exposure"), 0.0f, 0.0f, 0.0f, 0.0f, -10.0f, 10.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_exposure_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_exposure(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, "Exposure", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_exposure_in, cmp_node_exposure_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_exposure.cc b/source/blender/nodes/composite/nodes/node_composite_exposure.cc new file mode 100644 index 00000000000..f0259f781a5 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_exposure.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2020 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Exposure ******************** */ + +static bNodeSocketTemplate cmp_node_exposure_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Exposure"), 0.0f, 0.0f, 0.0f, 0.0f, -10.0f, 10.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_exposure_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_exposure(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, "Exposure", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_exposure_in, cmp_node_exposure_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c deleted file mode 100644 index d0ad090ece4..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** FILTER ******************** */ -static bNodeSocketTemplate cmp_node_filter_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_filter_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_filter(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out); - node_type_label(&ntype, node_filter_label); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc new file mode 100644 index 00000000000..f07619877f4 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** FILTER ******************** */ +static bNodeSocketTemplate cmp_node_filter_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_filter_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_filter(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out); + node_type_label(&ntype, node_filter_label); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c deleted file mode 100644 index 91a91bb5f5f..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_flip.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Flip ******************** */ -static bNodeSocketTemplate cmp_node_flip_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_flip_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_flip(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.cc b/source/blender/nodes/composite/nodes/node_composite_flip.cc new file mode 100644 index 00000000000..42aa3141f5c --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_flip.cc @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Flip ******************** */ +static bNodeSocketTemplate cmp_node_flip_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_flip_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_flip(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c deleted file mode 100644 index ddcaf691fd2..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Gamma Tools ******************** */ - -static bNodeSocketTemplate cmp_node_gamma_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_gamma_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_gamma(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.cc b/source/blender/nodes/composite/nodes/node_composite_gamma.cc new file mode 100644 index 00000000000..b2b63c58411 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Gamma Tools ******************** */ + +static bNodeSocketTemplate cmp_node_gamma_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_gamma_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_gamma(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c deleted file mode 100644 index a792fcc86cd..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_glare_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_glare_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeGlare *ndg = MEM_callocN(sizeof(NodeGlare), "node glare data"); - ndg->quality = 1; - ndg->type = 2; - ndg->iter = 3; - ndg->colmod = 0.25; - ndg->mix = 0; - ndg->threshold = 1; - ndg->star_45 = true; - ndg->streaks = 4; - ndg->angle_ofs = 0.0f; - ndg->fade = 0.9; - ndg->size = 8; - node->storage = ndg; -} - -void register_node_type_cmp_glare(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out); - node_type_init(&ntype, node_composit_init_glare); - node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc new file mode 100644 index 00000000000..8a2fd1e1584 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -0,0 +1,62 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_glare_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_glare_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeGlare *ndg = (NodeGlare *)MEM_callocN(sizeof(NodeGlare), "node glare data"); + ndg->quality = 1; + ndg->type = 2; + ndg->iter = 3; + ndg->colmod = 0.25; + ndg->mix = 0; + ndg->threshold = 1; + ndg->star_45 = true; + ndg->streaks = 4; + ndg->angle_ofs = 0.0f; + ndg->fade = 0.9; + ndg->size = 8; + node->storage = ndg; +} + +void register_node_type_cmp_glare(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out); + node_type_init(&ntype, node_composit_init_glare); + node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c deleted file mode 100644 index 494b6136a6e..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Hue Saturation ******************** */ -static bNodeSocketTemplate cmp_node_hue_sat_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_hue_sat_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_hue_sat(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc new file mode 100644 index 00000000000..c0fb89bd3c4 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc @@ -0,0 +1,48 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Hue Saturation ******************** */ +static bNodeSocketTemplate cmp_node_hue_sat_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_FLOAT, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, + {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_hue_sat_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_hue_sat(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c deleted file mode 100644 index 6a5c918d9ae..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_huecorrect_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_huecorrect_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node) -{ - CurveMapping *cumapping = node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); - int c; - - cumapping->preset = CURVE_PRESET_MID9; - - for (c = 0; c < 3; c++) { - CurveMap *cuma = &cumapping->cm[c]; - BKE_curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE); - } - - /* default to showing Saturation */ - cumapping->cur = 1; -} - -void register_node_type_cmp_huecorrect(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out); - node_type_size(&ntype, 320, 140, 500); - node_type_init(&ntype, node_composit_init_huecorrect); - node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc new file mode 100644 index 00000000000..c577781d96d --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc @@ -0,0 +1,65 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_huecorrect_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_huecorrect_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); + + CurveMapping *cumapping = (CurveMapping *)node->storage; + + cumapping->preset = CURVE_PRESET_MID9; + + for (int c = 0; c < 3; c++) { + CurveMap *cuma = &cumapping->cm[c]; + BKE_curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE); + } + + /* default to showing Saturation */ + cumapping->cur = 1; +} + +void register_node_type_cmp_huecorrect(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out); + node_type_size(&ntype, 320, 140, 500); + node_type_init(&ntype, node_composit_init_huecorrect); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c deleted file mode 100644 index 84563e7560b..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** ID Mask ******************** */ - -static bNodeSocketTemplate cmp_node_idmask_in[] = { - {SOCK_FLOAT, N_("ID value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_idmask_out[] = { - {SOCK_FLOAT, N_("Alpha")}, - {-1, ""}, -}; - -void register_node_type_cmp_idmask(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.cc b/source/blender/nodes/composite/nodes/node_composite_idMask.cc new file mode 100644 index 00000000000..13e3536f9ee --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.cc @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** ID Mask ******************** */ + +static bNodeSocketTemplate cmp_node_idmask_in[] = { + {SOCK_FLOAT, N_("ID value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_idmask_out[] = { + {SOCK_FLOAT, N_("Alpha")}, + {-1, ""}, +}; + +void register_node_type_cmp_idmask(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c deleted file mode 100644 index a56dfea9dbf..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ /dev/null @@ -1,574 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include "BLI_linklist.h" -#include "BLI_utildefines.h" - -#include "DNA_scene_types.h" - -#include "RE_engine.h" - -#include "BKE_context.h" -#include "BKE_global.h" -#include "BKE_lib_id.h" -#include "BKE_main.h" -#include "BKE_scene.h" - -/* **************** IMAGE (and RenderResult, multilayer image) ******************** */ - -static bNodeSocketTemplate cmp_node_rlayers_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_(RE_PASSNAME_Z), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_(RE_PASSNAME_NORMAL), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_(RE_PASSNAME_UV), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_(RE_PASSNAME_VECTOR), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_(RE_PASSNAME_POSITION), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_SHADOW), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_AO), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_(RE_PASSNAME_INDEXOB), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_(RE_PASSNAME_INDEXMA), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_(RE_PASSNAME_MIST), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_EMIT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_ENVIRONMENT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DIFFUSE_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DIFFUSE_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_DIFFUSE_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_GLOSSY_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_GLOSSY_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_GLOSSY_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_TRANSM_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_TRANSM_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_TRANSM_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_SUBSURFACE_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_SUBSURFACE_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_(RE_PASSNAME_SUBSURFACE_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; -#define NUM_LEGACY_SOCKETS (ARRAY_SIZE(cmp_node_rlayers_out) - 1) - -static void cmp_node_image_add_pass_output(bNodeTree *ntree, - bNode *node, - const char *name, - const char *passname, - int rres_index, - eNodeSocketDatatype type, - int UNUSED(is_rlayers), - LinkNodePair *available_sockets, - int *prev_index) -{ - bNodeSocket *sock = BLI_findstring(&node->outputs, name, offsetof(bNodeSocket, name)); - - /* Replace if types don't match. */ - if (sock && sock->type != type) { - nodeRemoveSocket(ntree, node, sock); - sock = NULL; - } - - /* Create socket if it doesn't exist yet. */ - if (sock == NULL) { - if (rres_index >= 0) { - sock = node_add_socket_from_template( - ntree, node, &cmp_node_rlayers_out[rres_index], SOCK_OUT); - } - else { - sock = nodeAddStaticSocket(ntree, node, SOCK_OUT, type, PROP_NONE, name, name); - } - /* extra socket info */ - NodeImageLayer *sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer"); - sock->storage = sockdata; - } - - NodeImageLayer *sockdata = sock->storage; - if (sockdata) { - BLI_strncpy(sockdata->pass_name, passname, sizeof(sockdata->pass_name)); - } - - /* Reorder sockets according to order that passes are added. */ - const int after_index = (*prev_index)++; - bNodeSocket *after_sock = BLI_findlink(&node->outputs, after_index); - BLI_remlink(&node->outputs, sock); - BLI_insertlinkafter(&node->outputs, after_sock, sock); - - BLI_linklist_append(available_sockets, sock); -} - -static void cmp_node_image_create_outputs(bNodeTree *ntree, - bNode *node, - LinkNodePair *available_sockets) -{ - Image *ima = (Image *)node->id; - ImBuf *ibuf; - int prev_index = -1; - if (ima) { - ImageUser *iuser = node->storage; - ImageUser load_iuser = {NULL}; - int offset = BKE_image_sequence_guess_offset(ima); - - /* It is possible that image user in this node is not - * properly updated yet. In this case loading image will - * fail and sockets detection will go wrong. - * - * So we manually construct image user to be sure first - * image from sequence (that one which is set as filename - * for image datablock) is used for sockets detection - */ - load_iuser.ok = 1; - load_iuser.framenr = offset; - - /* make sure ima->type is correct */ - ibuf = BKE_image_acquire_ibuf(ima, &load_iuser, NULL); - - if (ima->rr) { - RenderLayer *rl = BLI_findlink(&ima->rr->layers, iuser->layer); - - if (rl) { - RenderPass *rpass; - for (rpass = rl->passes.first; rpass; rpass = rpass->next) { - int type; - if (rpass->channels == 1) { - type = SOCK_FLOAT; - } - else { - type = SOCK_RGBA; - } - - cmp_node_image_add_pass_output(ntree, - node, - rpass->name, - rpass->name, - -1, - type, - false, - available_sockets, - &prev_index); - /* Special handling for the Combined pass to ensure compatibility. */ - if (STREQ(rpass->name, RE_PASSNAME_COMBINED)) { - cmp_node_image_add_pass_output(ntree, - node, - "Alpha", - rpass->name, - -1, - SOCK_FLOAT, - false, - available_sockets, - &prev_index); - } - } - BKE_image_release_ibuf(ima, ibuf, NULL); - return; - } - } - } - - cmp_node_image_add_pass_output(ntree, - node, - "Image", - RE_PASSNAME_COMBINED, - -1, - SOCK_RGBA, - false, - available_sockets, - &prev_index); - cmp_node_image_add_pass_output(ntree, - node, - "Alpha", - RE_PASSNAME_COMBINED, - -1, - SOCK_FLOAT, - false, - available_sockets, - &prev_index); - - if (ima) { - if (!ima->rr) { - cmp_node_image_add_pass_output(ntree, - node, - RE_PASSNAME_Z, - RE_PASSNAME_Z, - -1, - SOCK_FLOAT, - false, - available_sockets, - &prev_index); - } - BKE_image_release_ibuf(ima, ibuf, NULL); - } -} - -typedef struct RLayerUpdateData { - LinkNodePair *available_sockets; - int prev_index; -} RLayerUpdateData; - -void node_cmp_rlayers_register_pass(bNodeTree *ntree, - bNode *node, - Scene *scene, - ViewLayer *view_layer, - const char *name, - eNodeSocketDatatype type) -{ - RLayerUpdateData *data = node->storage; - - if (scene == NULL || view_layer == NULL || data == NULL || node->id != (ID *)scene) { - return; - } - - ViewLayer *node_view_layer = BLI_findlink(&scene->view_layers, node->custom1); - if (node_view_layer != view_layer) { - return; - } - - /* Special handling for the Combined pass to ensure compatibility. */ - if (STREQ(name, RE_PASSNAME_COMBINED)) { - cmp_node_image_add_pass_output( - ntree, node, "Image", name, -1, type, true, data->available_sockets, &data->prev_index); - cmp_node_image_add_pass_output(ntree, - node, - "Alpha", - name, - -1, - SOCK_FLOAT, - true, - data->available_sockets, - &data->prev_index); - } - else { - cmp_node_image_add_pass_output( - ntree, node, name, name, -1, type, true, data->available_sockets, &data->prev_index); - } -} - -static void cmp_node_rlayer_create_outputs_cb(void *UNUSED(userdata), - Scene *scene, - ViewLayer *view_layer, - const char *name, - int UNUSED(channels), - const char *UNUSED(chanid), - eNodeSocketDatatype type) -{ - /* Register the pass in all scenes that have a render layer node for this layer. - * Since multiple scenes can be used in the compositor, the code must loop over all scenes - * and check whether their nodetree has a node that needs to be updated. */ - /* NOTE: using G_MAIN seems valid here, - * unless we want to register that for every other temp Main we could generate??? */ - ntreeCompositRegisterPass(scene->nodetree, scene, view_layer, name, type); - - for (Scene *sce = G_MAIN->scenes.first; sce; sce = sce->id.next) { - if (sce->nodetree && sce != scene) { - ntreeCompositRegisterPass(sce->nodetree, scene, view_layer, name, type); - } - } -} - -static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, - bNode *node, - LinkNodePair *available_sockets) -{ - Scene *scene = (Scene *)node->id; - - if (scene) { - RenderEngineType *engine_type = RE_engines_find(scene->r.engine); - if (engine_type && engine_type->update_render_passes) { - ViewLayer *view_layer = BLI_findlink(&scene->view_layers, node->custom1); - if (view_layer) { - RLayerUpdateData *data = MEM_mallocN(sizeof(RLayerUpdateData), "render layer update data"); - data->available_sockets = available_sockets; - data->prev_index = -1; - node->storage = data; - - RenderEngine *engine = RE_engine_create(engine_type); - RE_engine_update_render_passes( - engine, scene, view_layer, cmp_node_rlayer_create_outputs_cb, NULL); - RE_engine_free(engine); - - if ((scene->r.mode & R_EDGE_FRS) && - (view_layer->freestyle_config.flags & FREESTYLE_AS_RENDER_PASS)) { - ntreeCompositRegisterPass(ntree, scene, view_layer, RE_PASSNAME_FREESTYLE, SOCK_RGBA); - } - - MEM_freeN(data); - node->storage = NULL; - - return; - } - } - } - - int prev_index = -1; - cmp_node_image_add_pass_output(ntree, - node, - "Image", - RE_PASSNAME_COMBINED, - RRES_OUT_IMAGE, - SOCK_RGBA, - true, - available_sockets, - &prev_index); - cmp_node_image_add_pass_output(ntree, - node, - "Alpha", - RE_PASSNAME_COMBINED, - RRES_OUT_ALPHA, - SOCK_FLOAT, - true, - available_sockets, - &prev_index); -} - -/* XXX make this into a generic socket verification function for dynamic socket replacement - * (multilayer, groups, static templates) */ -static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node, bool rlayer) -{ - bNodeSocket *sock, *sock_next; - LinkNodePair available_sockets = {NULL, NULL}; - int sock_index; - - /* XXX make callback */ - if (rlayer) { - cmp_node_rlayer_create_outputs(ntree, node, &available_sockets); - } - else { - cmp_node_image_create_outputs(ntree, node, &available_sockets); - } - - /* Get rid of sockets whose passes are not available in the image. - * If sockets that are not available would be deleted, the connections to them would be lost - * when e.g. opening a file (since there's no render at all yet). - * Therefore, sockets with connected links will just be set as unavailable. - * - * Another important detail comes from compatibility with the older socket model, where there - * was a fixed socket per pass type that was just hidden or not. Therefore, older versions expect - * the first 31 passes to belong to a specific pass type. - * So, we keep those 31 always allocated before the others as well, - * even if they have no links attached. */ - sock_index = 0; - for (sock = node->outputs.first; sock; sock = sock_next, sock_index++) { - sock_next = sock->next; - if (BLI_linklist_index(available_sockets.list, sock) >= 0) { - sock->flag &= ~(SOCK_UNAVAIL | SOCK_HIDDEN); - } - else { - bNodeLink *link; - for (link = ntree->links.first; link; link = link->next) { - if (link->fromsock == sock) { - break; - } - } - if (!link && (!rlayer || sock_index >= NUM_LEGACY_SOCKETS)) { - MEM_freeN(sock->storage); - nodeRemoveSocket(ntree, node, sock); - } - else { - sock->flag |= SOCK_UNAVAIL; - } - } - } - - BLI_linklist_free(available_sockets.list, NULL); -} - -static void cmp_node_image_update(bNodeTree *ntree, bNode *node) -{ - /* avoid unnecessary updates, only changes to the image/image user data are of interest */ - if (node->update & NODE_UPDATE_ID) { - cmp_node_image_verify_outputs(ntree, node, false); - } - - cmp_node_update_default(ntree, node); -} - -static void node_composit_init_image(bNodeTree *ntree, bNode *node) -{ - ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user"); - node->storage = iuser; - iuser->frames = 1; - iuser->sfra = 1; - iuser->ok = 1; - iuser->flag |= IMA_ANIM_ALWAYS; - - /* setup initial outputs */ - cmp_node_image_verify_outputs(ntree, node, false); -} - -static void node_composit_free_image(bNode *node) -{ - bNodeSocket *sock; - - /* free extra socket info */ - for (sock = node->outputs.first; sock; sock = sock->next) { - MEM_freeN(sock->storage); - } - - MEM_freeN(node->storage); -} - -static void node_composit_copy_image(bNodeTree *UNUSED(dest_ntree), - bNode *dest_node, - const bNode *src_node) -{ - dest_node->storage = MEM_dupallocN(src_node->storage); - - const bNodeSocket *src_output_sock = src_node->outputs.first; - bNodeSocket *dest_output_sock = dest_node->outputs.first; - while (dest_output_sock != NULL) { - dest_output_sock->storage = MEM_dupallocN(src_output_sock->storage); - - src_output_sock = src_output_sock->next; - dest_output_sock = dest_output_sock->next; - } -} - -void register_node_type_cmp_image(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_init(&ntype, node_composit_init_image); - node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image); - node_type_update(&ntype, cmp_node_image_update); - node_type_label(&ntype, node_image_label); - - nodeRegisterType(&ntype); -} - -/* **************** RENDER RESULT ******************** */ - -void node_cmp_rlayers_outputs(bNodeTree *ntree, bNode *node) -{ - cmp_node_image_verify_outputs(ntree, node, true); -} - -const char *node_cmp_rlayers_sock_to_pass(int sock_index) -{ - if (sock_index >= NUM_LEGACY_SOCKETS) { - return NULL; - } - const char *name = cmp_node_rlayers_out[sock_index].name; - /* Exception for alpha, which is derived from Combined. */ - return (STREQ(name, "Alpha")) ? RE_PASSNAME_COMBINED : name; -} - -static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - bNode *node = ptr->data; - int sock_index = 0; - - node->id = &scene->id; - id_us_plus(node->id); - - for (bNodeSocket *sock = node->outputs.first; sock; sock = sock->next, sock_index++) { - NodeImageLayer *sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer"); - sock->storage = sockdata; - - BLI_strncpy(sockdata->pass_name, - node_cmp_rlayers_sock_to_pass(sock_index), - sizeof(sockdata->pass_name)); - } -} - -static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype), - bNodeTree *ntree, - const char **r_disabled_hint) -{ - if (!STREQ(ntree->idname, "CompositorNodeTree")) { - *r_disabled_hint = "Not a compositor node tree"; - return false; - } - - Scene *scene; - - /* XXX ugly: check if ntree is a local scene node tree. - * Render layers node can only be used in local scene->nodetree, - * since it directly links to the scene. - */ - for (scene = G.main->scenes.first; scene; scene = scene->id.next) { - if (scene->nodetree == ntree) { - break; - } - } - - if (scene == NULL) { - *r_disabled_hint = "The node tree must be the compositing node tree of any scene in the file"; - return false; - } - return true; -} - -static void node_composit_free_rlayers(bNode *node) -{ - bNodeSocket *sock; - - /* free extra socket info */ - for (sock = node->outputs.first; sock; sock = sock->next) { - if (sock->storage) { - MEM_freeN(sock->storage); - } - } -} - -static void node_composit_copy_rlayers(bNodeTree *UNUSED(dest_ntree), - bNode *dest_node, - const bNode *src_node) -{ - /* copy extra socket info */ - const bNodeSocket *src_output_sock = src_node->outputs.first; - bNodeSocket *dest_output_sock = dest_node->outputs.first; - while (dest_output_sock != NULL) { - dest_output_sock->storage = MEM_dupallocN(src_output_sock->storage); - - src_output_sock = src_output_sock->next; - dest_output_sock = dest_output_sock->next; - } -} - -static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node) -{ - cmp_node_image_verify_outputs(ntree, node, true); - - cmp_node_update_default(ntree, node); -} - -void register_node_type_cmp_rlayers(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out); - ntype.initfunc_api = node_composit_init_rlayers; - ntype.poll = node_composit_poll_rlayers; - node_type_storage(&ntype, NULL, node_composit_free_rlayers, node_composit_copy_rlayers); - node_type_update(&ntype, cmp_node_rlayers_update); - node_type_init(&ntype, node_cmp_rlayers_outputs); - node_type_size_preset(&ntype, NODE_SIZE_LARGE); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc new file mode 100644 index 00000000000..aee1c1d63fd --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -0,0 +1,573 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "BLI_linklist.h" +#include "BLI_utildefines.h" + +#include "DNA_scene_types.h" + +#include "RE_engine.h" + +#include "BKE_context.h" +#include "BKE_global.h" +#include "BKE_lib_id.h" +#include "BKE_main.h" +#include "BKE_scene.h" + +/* **************** IMAGE (and RenderResult, multilayer image) ******************** */ + +static bNodeSocketTemplate cmp_node_rlayers_out[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_(RE_PASSNAME_Z), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_VECTOR, N_(RE_PASSNAME_NORMAL), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_VECTOR, N_(RE_PASSNAME_UV), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_VECTOR, N_(RE_PASSNAME_VECTOR), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_VECTOR, N_(RE_PASSNAME_POSITION), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_SHADOW), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_AO), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_(RE_PASSNAME_INDEXOB), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_(RE_PASSNAME_INDEXMA), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_(RE_PASSNAME_MIST), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_EMIT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_ENVIRONMENT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DIFFUSE_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DIFFUSE_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_DIFFUSE_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_GLOSSY_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_GLOSSY_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_GLOSSY_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_TRANSM_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_TRANSM_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_TRANSM_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_SUBSURFACE_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_SUBSURFACE_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_(RE_PASSNAME_SUBSURFACE_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {-1, ""}, +}; +#define NUM_LEGACY_SOCKETS (ARRAY_SIZE(cmp_node_rlayers_out) - 1) + +static void cmp_node_image_add_pass_output(bNodeTree *ntree, + bNode *node, + const char *name, + const char *passname, + int rres_index, + eNodeSocketDatatype type, + int UNUSED(is_rlayers), + LinkNodePair *available_sockets, + int *prev_index) +{ + bNodeSocket *sock = (bNodeSocket *)BLI_findstring( + &node->outputs, name, offsetof(bNodeSocket, name)); + + /* Replace if types don't match. */ + if (sock && sock->type != type) { + nodeRemoveSocket(ntree, node, sock); + sock = nullptr; + } + + /* Create socket if it doesn't exist yet. */ + if (sock == nullptr) { + if (rres_index >= 0) { + sock = node_add_socket_from_template( + ntree, node, &cmp_node_rlayers_out[rres_index], SOCK_OUT); + } + else { + sock = nodeAddStaticSocket(ntree, node, SOCK_OUT, type, PROP_NONE, name, name); + } + /* extra socket info */ + NodeImageLayer *sockdata = (NodeImageLayer *)MEM_callocN(sizeof(NodeImageLayer), + "node image layer"); + sock->storage = sockdata; + } + + NodeImageLayer *sockdata = (NodeImageLayer *)sock->storage; + if (sockdata) { + BLI_strncpy(sockdata->pass_name, passname, sizeof(sockdata->pass_name)); + } + + /* Reorder sockets according to order that passes are added. */ + const int after_index = (*prev_index)++; + bNodeSocket *after_sock = (bNodeSocket *)BLI_findlink(&node->outputs, after_index); + BLI_remlink(&node->outputs, sock); + BLI_insertlinkafter(&node->outputs, after_sock, sock); + + BLI_linklist_append(available_sockets, sock); +} + +static void cmp_node_image_create_outputs(bNodeTree *ntree, + bNode *node, + LinkNodePair *available_sockets) +{ + Image *ima = (Image *)node->id; + ImBuf *ibuf; + int prev_index = -1; + if (ima) { + ImageUser *iuser = (ImageUser *)node->storage; + ImageUser load_iuser = {nullptr}; + int offset = BKE_image_sequence_guess_offset(ima); + + /* It is possible that image user in this node is not + * properly updated yet. In this case loading image will + * fail and sockets detection will go wrong. + * + * So we manually construct image user to be sure first + * image from sequence (that one which is set as filename + * for image datablock) is used for sockets detection + */ + load_iuser.ok = 1; + load_iuser.framenr = offset; + + /* make sure ima->type is correct */ + ibuf = BKE_image_acquire_ibuf(ima, &load_iuser, nullptr); + + if (ima->rr) { + RenderLayer *rl = (RenderLayer *)BLI_findlink(&ima->rr->layers, iuser->layer); + + if (rl) { + LISTBASE_FOREACH (RenderPass *, rpass, &rl->passes) { + eNodeSocketDatatype type; + if (rpass->channels == 1) { + type = SOCK_FLOAT; + } + else { + type = SOCK_RGBA; + } + + cmp_node_image_add_pass_output(ntree, + node, + rpass->name, + rpass->name, + -1, + type, + false, + available_sockets, + &prev_index); + /* Special handling for the Combined pass to ensure compatibility. */ + if (STREQ(rpass->name, RE_PASSNAME_COMBINED)) { + cmp_node_image_add_pass_output(ntree, + node, + "Alpha", + rpass->name, + -1, + SOCK_FLOAT, + false, + available_sockets, + &prev_index); + } + } + BKE_image_release_ibuf(ima, ibuf, nullptr); + return; + } + } + } + + cmp_node_image_add_pass_output(ntree, + node, + "Image", + RE_PASSNAME_COMBINED, + -1, + SOCK_RGBA, + false, + available_sockets, + &prev_index); + cmp_node_image_add_pass_output(ntree, + node, + "Alpha", + RE_PASSNAME_COMBINED, + -1, + SOCK_FLOAT, + false, + available_sockets, + &prev_index); + + if (ima) { + if (!ima->rr) { + cmp_node_image_add_pass_output(ntree, + node, + RE_PASSNAME_Z, + RE_PASSNAME_Z, + -1, + SOCK_FLOAT, + false, + available_sockets, + &prev_index); + } + BKE_image_release_ibuf(ima, ibuf, nullptr); + } +} + +struct RLayerUpdateData { + LinkNodePair *available_sockets; + int prev_index; +}; + +void node_cmp_rlayers_register_pass(bNodeTree *ntree, + bNode *node, + Scene *scene, + ViewLayer *view_layer, + const char *name, + eNodeSocketDatatype type) +{ + RLayerUpdateData *data = (RLayerUpdateData *)node->storage; + + if (scene == nullptr || view_layer == nullptr || data == nullptr || node->id != (ID *)scene) { + return; + } + + ViewLayer *node_view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, node->custom1); + if (node_view_layer != view_layer) { + return; + } + + /* Special handling for the Combined pass to ensure compatibility. */ + if (STREQ(name, RE_PASSNAME_COMBINED)) { + cmp_node_image_add_pass_output( + ntree, node, "Image", name, -1, type, true, data->available_sockets, &data->prev_index); + cmp_node_image_add_pass_output(ntree, + node, + "Alpha", + name, + -1, + SOCK_FLOAT, + true, + data->available_sockets, + &data->prev_index); + } + else { + cmp_node_image_add_pass_output( + ntree, node, name, name, -1, type, true, data->available_sockets, &data->prev_index); + } +} + +static void cmp_node_rlayer_create_outputs_cb(void *UNUSED(userdata), + Scene *scene, + ViewLayer *view_layer, + const char *name, + int UNUSED(channels), + const char *UNUSED(chanid), + eNodeSocketDatatype type) +{ + /* Register the pass in all scenes that have a render layer node for this layer. + * Since multiple scenes can be used in the compositor, the code must loop over all scenes + * and check whether their nodetree has a node that needs to be updated. */ + /* NOTE: using G_MAIN seems valid here, + * unless we want to register that for every other temp Main we could generate??? */ + ntreeCompositRegisterPass(scene->nodetree, scene, view_layer, name, type); + + for (Scene *sce = (Scene *)G_MAIN->scenes.first; sce; sce = (Scene *)sce->id.next) { + if (sce->nodetree && sce != scene) { + ntreeCompositRegisterPass(sce->nodetree, scene, view_layer, name, type); + } + } +} + +static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, + bNode *node, + LinkNodePair *available_sockets) +{ + Scene *scene = (Scene *)node->id; + + if (scene) { + RenderEngineType *engine_type = RE_engines_find(scene->r.engine); + if (engine_type && engine_type->update_render_passes) { + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, node->custom1); + if (view_layer) { + RLayerUpdateData *data = (RLayerUpdateData *)MEM_mallocN(sizeof(RLayerUpdateData), + "render layer update data"); + data->available_sockets = available_sockets; + data->prev_index = -1; + node->storage = data; + + RenderEngine *engine = RE_engine_create(engine_type); + RE_engine_update_render_passes( + engine, scene, view_layer, cmp_node_rlayer_create_outputs_cb, nullptr); + RE_engine_free(engine); + + if ((scene->r.mode & R_EDGE_FRS) && + (view_layer->freestyle_config.flags & FREESTYLE_AS_RENDER_PASS)) { + ntreeCompositRegisterPass(ntree, scene, view_layer, RE_PASSNAME_FREESTYLE, SOCK_RGBA); + } + + MEM_freeN(data); + node->storage = nullptr; + + return; + } + } + } + + int prev_index = -1; + cmp_node_image_add_pass_output(ntree, + node, + "Image", + RE_PASSNAME_COMBINED, + RRES_OUT_IMAGE, + SOCK_RGBA, + true, + available_sockets, + &prev_index); + cmp_node_image_add_pass_output(ntree, + node, + "Alpha", + RE_PASSNAME_COMBINED, + RRES_OUT_ALPHA, + SOCK_FLOAT, + true, + available_sockets, + &prev_index); +} + +/* XXX make this into a generic socket verification function for dynamic socket replacement + * (multilayer, groups, static templates) */ +static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node, bool rlayer) +{ + bNodeSocket *sock, *sock_next; + LinkNodePair available_sockets = {nullptr, nullptr}; + + /* XXX make callback */ + if (rlayer) { + cmp_node_rlayer_create_outputs(ntree, node, &available_sockets); + } + else { + cmp_node_image_create_outputs(ntree, node, &available_sockets); + } + + /* Get rid of sockets whose passes are not available in the image. + * If sockets that are not available would be deleted, the connections to them would be lost + * when e.g. opening a file (since there's no render at all yet). + * Therefore, sockets with connected links will just be set as unavailable. + * + * Another important detail comes from compatibility with the older socket model, where there + * was a fixed socket per pass type that was just hidden or not. Therefore, older versions expect + * the first 31 passes to belong to a specific pass type. + * So, we keep those 31 always allocated before the others as well, + * even if they have no links attached. */ + int sock_index = 0; + for (sock = (bNodeSocket *)node->outputs.first; sock; sock = sock_next, sock_index++) { + sock_next = sock->next; + if (BLI_linklist_index(available_sockets.list, sock) >= 0) { + sock->flag &= ~(SOCK_UNAVAIL | SOCK_HIDDEN); + } + else { + bNodeLink *link; + for (link = (bNodeLink *)ntree->links.first; link; link = link->next) { + if (link->fromsock == sock) { + break; + } + } + if (!link && (!rlayer || sock_index >= NUM_LEGACY_SOCKETS)) { + MEM_freeN(sock->storage); + nodeRemoveSocket(ntree, node, sock); + } + else { + sock->flag |= SOCK_UNAVAIL; + } + } + } + + BLI_linklist_free(available_sockets.list, nullptr); +} + +static void cmp_node_image_update(bNodeTree *ntree, bNode *node) +{ + /* avoid unnecessary updates, only changes to the image/image user data are of interest */ + if (node->update & NODE_UPDATE_ID) { + cmp_node_image_verify_outputs(ntree, node, false); + } + + cmp_node_update_default(ntree, node); +} + +static void node_composit_init_image(bNodeTree *ntree, bNode *node) +{ + ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user"); + node->storage = iuser; + iuser->frames = 1; + iuser->sfra = 1; + iuser->ok = 1; + iuser->flag |= IMA_ANIM_ALWAYS; + + /* setup initial outputs */ + cmp_node_image_verify_outputs(ntree, node, false); +} + +static void node_composit_free_image(bNode *node) +{ + /* free extra socket info */ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { + MEM_freeN(sock->storage); + } + + MEM_freeN(node->storage); +} + +static void node_composit_copy_image(bNodeTree *UNUSED(dest_ntree), + bNode *dest_node, + const bNode *src_node) +{ + dest_node->storage = MEM_dupallocN(src_node->storage); + + const bNodeSocket *src_output_sock = (bNodeSocket *)src_node->outputs.first; + bNodeSocket *dest_output_sock = (bNodeSocket *)dest_node->outputs.first; + while (dest_output_sock != nullptr) { + dest_output_sock->storage = MEM_dupallocN(src_output_sock->storage); + + src_output_sock = src_output_sock->next; + dest_output_sock = dest_output_sock->next; + } +} + +void register_node_type_cmp_image(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW); + node_type_init(&ntype, node_composit_init_image); + node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image); + node_type_update(&ntype, cmp_node_image_update); + node_type_label(&ntype, node_image_label); + + nodeRegisterType(&ntype); +} + +/* **************** RENDER RESULT ******************** */ + +void node_cmp_rlayers_outputs(bNodeTree *ntree, bNode *node) +{ + cmp_node_image_verify_outputs(ntree, node, true); +} + +const char *node_cmp_rlayers_sock_to_pass(int sock_index) +{ + if (sock_index >= NUM_LEGACY_SOCKETS) { + return nullptr; + } + const char *name = cmp_node_rlayers_out[sock_index].name; + /* Exception for alpha, which is derived from Combined. */ + return (STREQ(name, "Alpha")) ? RE_PASSNAME_COMBINED : name; +} + +static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr) +{ + Scene *scene = CTX_data_scene(C); + bNode *node = (bNode *)ptr->data; + int sock_index = 0; + + node->id = &scene->id; + id_us_plus(node->id); + + for (bNodeSocket *sock = (bNodeSocket *)node->outputs.first; sock; + sock = sock->next, sock_index++) { + NodeImageLayer *sockdata = (NodeImageLayer *)MEM_callocN(sizeof(NodeImageLayer), + "node image layer"); + sock->storage = sockdata; + + BLI_strncpy(sockdata->pass_name, + node_cmp_rlayers_sock_to_pass(sock_index), + sizeof(sockdata->pass_name)); + } +} + +static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype), + bNodeTree *ntree, + const char **r_disabled_hint) +{ + if (!STREQ(ntree->idname, "CompositorNodeTree")) { + *r_disabled_hint = "Not a compositor node tree"; + return false; + } + + Scene *scene; + + /* XXX ugly: check if ntree is a local scene node tree. + * Render layers node can only be used in local scene->nodetree, + * since it directly links to the scene. + */ + for (scene = (Scene *)G.main->scenes.first; scene; scene = (Scene *)scene->id.next) { + if (scene->nodetree == ntree) { + break; + } + } + + if (scene == nullptr) { + *r_disabled_hint = "The node tree must be the compositing node tree of any scene in the file"; + return false; + } + return true; +} + +static void node_composit_free_rlayers(bNode *node) +{ + /* free extra socket info */ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { + if (sock->storage) { + MEM_freeN(sock->storage); + } + } +} + +static void node_composit_copy_rlayers(bNodeTree *UNUSED(dest_ntree), + bNode *dest_node, + const bNode *src_node) +{ + /* copy extra socket info */ + const bNodeSocket *src_output_sock = (bNodeSocket *)src_node->outputs.first; + bNodeSocket *dest_output_sock = (bNodeSocket *)dest_node->outputs.first; + while (dest_output_sock != nullptr) { + dest_output_sock->storage = MEM_dupallocN(src_output_sock->storage); + + src_output_sock = src_output_sock->next; + dest_output_sock = dest_output_sock->next; + } +} + +static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node) +{ + cmp_node_image_verify_outputs(ntree, node, true); + + cmp_node_update_default(ntree, node); +} + +void register_node_type_cmp_rlayers(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, nullptr, cmp_node_rlayers_out); + ntype.initfunc_api = node_composit_init_rlayers; + ntype.poll = node_composit_poll_rlayers; + node_type_storage(&ntype, nullptr, node_composit_free_rlayers, node_composit_copy_rlayers); + node_type_update(&ntype, cmp_node_rlayers_update); + node_type_init(&ntype, node_cmp_rlayers_outputs); + node_type_size_preset(&ntype, NODE_SIZE_LARGE); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.c b/source/blender/nodes/composite/nodes/node_composite_inpaint.c deleted file mode 100644 index 6c02bca9b39..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Inpaint/ ******************** */ - -static bNodeSocketTemplate cmp_node_inpaint_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_inpaint_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -void register_node_type_cmp_inpaint(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_inpaint_in, cmp_node_inpaint_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc new file mode 100644 index 00000000000..d0ff97a2ca0 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc @@ -0,0 +1,40 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Inpaint/ ******************** */ + +static bNodeSocketTemplate cmp_node_inpaint_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; +static bNodeSocketTemplate cmp_node_inpaint_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +void register_node_type_cmp_inpaint(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_inpaint_in, cmp_node_inpaint_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c deleted file mode 100644 index d229261f208..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** INVERT ******************** */ -static bNodeSocketTemplate cmp_node_invert_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_invert_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; - -static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 |= CMP_CHAN_RGB; -} - -/* custom1 = mix type */ -void register_node_type_cmp_invert(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out); - node_type_init(&ntype, node_composit_init_invert); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.cc b/source/blender/nodes/composite/nodes/node_composite_invert.cc new file mode 100644 index 00000000000..88fd18326d9 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_invert.cc @@ -0,0 +1,49 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** INVERT ******************** */ +static bNodeSocketTemplate cmp_node_invert_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_invert_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; + +static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 |= CMP_CHAN_RGB; +} + +/* custom1 = mix type */ +void register_node_type_cmp_invert(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out); + node_type_init(&ntype, node_composit_init_invert); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c deleted file mode 100644 index 73e86a21ebe..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_keying.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "BLT_translation.h" - -#include "DNA_movieclip_types.h" - -#include "BLI_math_base.h" - -#include "node_composite_util.h" - -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_keying_in[] = { - {SOCK_RGBA, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, "Core Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_keying_out[] = { - {SOCK_RGBA, "Image"}, - {SOCK_FLOAT, "Matte"}, - {SOCK_FLOAT, "Edges"}, - {-1, ""}, -}; - -static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeKeyingData *data; - - data = MEM_callocN(sizeof(NodeKeyingData), "node keying data"); - - data->screen_balance = 0.5f; - data->despill_balance = 0.5f; - data->despill_factor = 1.0f; - data->edge_kernel_radius = 3; - data->edge_kernel_tolerance = 0.1f; - data->clip_black = 0.0f; - data->clip_white = 1.0f; - - node->storage = data; -} - -void register_node_type_cmp_keying(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_keying_in, cmp_node_keying_out); - node_type_init(&ntype, node_composit_init_keying); - node_type_storage( - &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc new file mode 100644 index 00000000000..d5547161069 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -0,0 +1,74 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "BLT_translation.h" + +#include "DNA_movieclip_types.h" + +#include "BLI_math_base.h" + +#include "node_composite_util.hh" + +/* **************** Translate ******************** */ + +static bNodeSocketTemplate cmp_node_keying_in[] = { + {SOCK_RGBA, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {SOCK_RGBA, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, "Core Matte", 0.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_keying_out[] = { + {SOCK_RGBA, "Image"}, + {SOCK_FLOAT, "Matte"}, + {SOCK_FLOAT, "Edges"}, + {-1, ""}, +}; + +static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeKeyingData *data = (NodeKeyingData *)MEM_callocN(sizeof(NodeKeyingData), "node keying data"); + + data->screen_balance = 0.5f; + data->despill_balance = 0.5f; + data->despill_factor = 1.0f; + data->edge_kernel_radius = 3; + data->edge_kernel_tolerance = 0.1f; + data->clip_black = 0.0f; + data->clip_white = 1.0f; + node->storage = data; +} + +void register_node_type_cmp_keying(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, 0); + node_type_socket_templates(&ntype, cmp_node_keying_in, cmp_node_keying_out); + node_type_init(&ntype, node_composit_init_keying); + node_type_storage( + &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c deleted file mode 100644 index e5e97cd72e4..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "DNA_movieclip_types.h" - -#include "BLI_math_base.h" -#include "BLI_math_color.h" - -#include "node_composite_util.h" - -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_keyingscreen_out[] = { - {SOCK_RGBA, "Screen"}, - {-1, ""}, -}; - -static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeKeyingScreenData *data; - - data = MEM_callocN(sizeof(NodeKeyingScreenData), "node keyingscreen data"); - - node->storage = data; -} - -void register_node_type_cmp_keyingscreen(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_keyingscreen_out); - node_type_init(&ntype, node_composit_init_keyingscreen); - node_type_storage( - &ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc new file mode 100644 index 00000000000..c976a92b92d --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "DNA_movieclip_types.h" + +#include "BLI_math_base.h" +#include "BLI_math_color.h" + +#include "node_composite_util.hh" + +/* **************** Translate ******************** */ + +static bNodeSocketTemplate cmp_node_keyingscreen_out[] = { + {SOCK_RGBA, "Screen"}, + {-1, ""}, +}; + +static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeKeyingScreenData *data = (NodeKeyingScreenData *)MEM_callocN(sizeof(NodeKeyingScreenData), + "node keyingscreen data"); + node->storage = data; +} + +void register_node_type_cmp_keyingscreen(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_keyingscreen_out); + node_type_init(&ntype, node_composit_init_keyingscreen); + node_type_storage( + &ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c deleted file mode 100644 index ce8c8c00e24..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_lensdist_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Distort"), 0.0f, 0.0f, 0.0f, 0.0f, -0.999f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Dispersion"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_lensdist_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeLensDist *nld = MEM_callocN(sizeof(NodeLensDist), "node lensdist data"); - nld->jit = nld->proj = nld->fit = 0; - node->storage = nld; -} - -void register_node_type_cmp_lensdist(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out); - node_type_init(&ntype, node_composit_init_lensdist); - node_type_storage( - &ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc new file mode 100644 index 00000000000..2a8dc035792 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -0,0 +1,55 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_lensdist_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Distort"), 0.0f, 0.0f, 0.0f, 0.0f, -0.999f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Dispersion"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_lensdist_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeLensDist *nld = (NodeLensDist *)MEM_callocN(sizeof(NodeLensDist), "node lensdist data"); + nld->jit = nld->proj = nld->fit = 0; + node->storage = nld; +} + +void register_node_type_cmp_lensdist(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out); + node_type_init(&ntype, node_composit_init_lensdist); + node_type_storage( + &ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c deleted file mode 100644 index 7c70ccf412a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** LEVELS ******************** */ -static bNodeSocketTemplate cmp_node_view_levels_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_view_levels_out[] = { - {SOCK_FLOAT, N_("Mean")}, - {SOCK_FLOAT, N_("Std Dev")}, - {-1, ""}, -}; - -static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = 1; /* All channels. */ -} - -void register_node_type_cmp_view_levels(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out); - node_type_init(&ntype, node_composit_init_view_levels); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.cc b/source/blender/nodes/composite/nodes/node_composite_levels.cc new file mode 100644 index 00000000000..3a3d8a3e99c --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_levels.cc @@ -0,0 +1,52 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** LEVELS ******************** */ +static bNodeSocketTemplate cmp_node_view_levels_in[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_view_levels_out[] = { + {SOCK_FLOAT, N_("Mean")}, + {SOCK_FLOAT, N_("Std Dev")}, + {-1, ""}, +}; + +static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; /* All channels. */ +} + +void register_node_type_cmp_view_levels(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out); + node_type_init(&ntype, node_composit_init_view_levels); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c deleted file mode 100644 index cb0f59c2f4a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* ******************* Luma Matte Node ********************************* */ -static bNodeSocketTemplate cmp_node_luma_matte_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_luma_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; - -static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage = c; - c->t1 = 1.0f; - c->t2 = 0.0f; -} - -void register_node_type_cmp_luma_matte(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out); - node_type_init(&ntype, node_composit_init_luma_matte); - node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc new file mode 100644 index 00000000000..600406d22b9 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* ******************* Luma Matte Node ********************************* */ +static bNodeSocketTemplate cmp_node_luma_matte_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_luma_matte_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Matte")}, + {-1, ""}, +}; + +static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + node->storage = c; + c->t1 = 1.0f; + c->t2 = 0.0f; +} + +void register_node_type_cmp_luma_matte(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out); + node_type_init(&ntype, node_composit_init_luma_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c deleted file mode 100644 index cd95e73ba5c..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_mapRange.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** MAP VALUE ******************** */ -static bNodeSocketTemplate cmp_node_map_range_in[] = { - {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("From Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("From Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("To Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("To Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_map_range_out[] = { - {SOCK_FLOAT, N_("Value")}, - {-1, ""}, -}; - -void register_node_type_cmp_map_range(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc new file mode 100644 index 00000000000..808ad538e55 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc @@ -0,0 +1,48 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** MAP VALUE ******************** */ +static bNodeSocketTemplate cmp_node_map_range_in[] = { + {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("From Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("From Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("To Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("To Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_map_range_out[] = { + {SOCK_FLOAT, N_("Value")}, + {-1, ""}, +}; + +void register_node_type_cmp_map_range(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, 0); + node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c deleted file mode 100644 index e88a303e449..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Map UV ******************** */ - -static bNodeSocketTemplate cmp_node_mapuv_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_VECTOR, N_("UV"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_mapuv_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_mapuv(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc new file mode 100644 index 00000000000..99032bd042e --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Map UV ******************** */ + +static bNodeSocketTemplate cmp_node_mapuv_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_VECTOR, N_("UV"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_mapuv_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_mapuv(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c deleted file mode 100644 index c93807c3801..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** MAP VALUE ******************** */ -static bNodeSocketTemplate cmp_node_map_value_in[] = { - {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_map_value_out[] = { - {SOCK_FLOAT, N_("Value")}, - {-1, ""}, -}; - -static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->storage = BKE_texture_mapping_add(TEXMAP_TYPE_POINT); -} - -void register_node_type_cmp_map_value(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out); - node_type_init(&ntype, node_composit_init_map_value); - node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc new file mode 100644 index 00000000000..25c00c2ba13 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc @@ -0,0 +1,51 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** MAP VALUE ******************** */ +static bNodeSocketTemplate cmp_node_map_value_in[] = { + {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_map_value_out[] = { + {SOCK_FLOAT, N_("Value")}, + {-1, ""}, +}; + +static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->storage = BKE_texture_mapping_add(TEXMAP_TYPE_POINT); +} + +void register_node_type_cmp_map_value(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, 0); + node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out); + node_type_init(&ntype, node_composit_init_map_value); + node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c deleted file mode 100644 index e6a5df6c24b..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_mask.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2012 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "DNA_mask_types.h" - -#include "node_composite_util.h" - -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_mask_out[] = {{SOCK_FLOAT, "Mask"}, {-1, ""}}; - -static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeMask *data = MEM_callocN(sizeof(NodeMask), "NodeMask"); - data->size_x = data->size_y = 256; - node->storage = data; - - node->custom2 = 16; /* samples */ - node->custom3 = 0.5f; /* shutter */ -} - -static void node_mask_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) -{ - if (node->id != NULL) { - BLI_strncpy(label, node->id->name + 2, maxlen); - } - else { - BLI_strncpy(label, IFACE_("Mask"), maxlen); - } -} - -void register_node_type_cmp_mask(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_mask_out); - node_type_init(&ntype, node_composit_init_mask); - node_type_label(&ntype, node_mask_label); - - node_type_storage(&ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc new file mode 100644 index 00000000000..bb33a874ae7 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc @@ -0,0 +1,64 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2012 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "DNA_mask_types.h" + +#include "node_composite_util.hh" + +/* **************** Translate ******************** */ + +static bNodeSocketTemplate cmp_node_mask_out[] = {{SOCK_FLOAT, "Mask"}, {-1, ""}}; + +static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeMask *data = (NodeMask *)MEM_callocN(sizeof(NodeMask), "NodeMask"); + data->size_x = data->size_y = 256; + node->storage = data; + + node->custom2 = 16; /* samples */ + node->custom3 = 0.5f; /* shutter */ +} + +static void node_mask_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) +{ + if (node->id != nullptr) { + BLI_strncpy(label, node->id->name + 2, maxlen); + } + else { + BLI_strncpy(label, IFACE_("Mask"), maxlen); + } +} + +void register_node_type_cmp_mask(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_mask_out); + node_type_init(&ntype, node_composit_init_mask); + node_type_label(&ntype, node_mask_label); + + node_type_storage(&ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c deleted file mode 100644 index 2191c6bcdc3..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate cmp_node_math_in[] = { - {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Value"), 0.0f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {-1, ""}}; - -static bNodeSocketTemplate cmp_node_math_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; - -void register_node_type_cmp_math(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); - node_type_label(&ntype, node_math_label); - node_type_update(&ntype, node_math_update); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc new file mode 100644 index 00000000000..ecddcc2ad32 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_math.cc @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** SCALAR MATH ******************** */ +static bNodeSocketTemplate cmp_node_math_in[] = { + {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Value"), 0.0f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + {-1, ""}}; + +static bNodeSocketTemplate cmp_node_math_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; + +void register_node_type_cmp_math(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); + node_type_label(&ntype, node_math_label); + node_type_update(&ntype, node_math_update); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c deleted file mode 100644 index 9d3751c7da3..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** MIX RGB ******************** */ -static bNodeSocketTemplate cmp_node_mix_rgb_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_mix_rgb_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -/* custom1 = mix type */ -void register_node_type_cmp_mix_rgb(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); - node_type_label(&ntype, node_blend_label); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc new file mode 100644 index 00000000000..985159c54c2 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc @@ -0,0 +1,48 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** MIX RGB ******************** */ +static bNodeSocketTemplate cmp_node_mix_rgb_in[] = { + {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_mix_rgb_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +/* custom1 = mix type */ +void register_node_type_cmp_mix_rgb(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); + node_type_label(&ntype, node_blend_label); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c deleted file mode 100644 index 4f5aef05425..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include "BKE_context.h" -#include "BKE_lib_id.h" - -static bNodeSocketTemplate cmp_node_movieclip_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Alpha")}, - {SOCK_FLOAT, N_("Offset X")}, - {SOCK_FLOAT, N_("Offset Y")}, - {SOCK_FLOAT, N_("Scale")}, - {SOCK_FLOAT, N_("Angle")}, - {-1, ""}, -}; - -static void init(const bContext *C, PointerRNA *ptr) -{ - bNode *node = ptr->data; - Scene *scene = CTX_data_scene(C); - MovieClipUser *user = MEM_callocN(sizeof(MovieClipUser), "node movie clip user"); - - node->id = (ID *)scene->clip; - id_us_plus(node->id); - node->storage = user; - user->framenr = 1; -} - -void register_node_type_cmp_movieclip(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, NULL, cmp_node_movieclip_out); - ntype.initfunc_api = init; - node_type_storage( - &ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc new file mode 100644 index 00000000000..2dffa8b4841 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -0,0 +1,63 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "BKE_context.h" +#include "BKE_lib_id.h" + +static bNodeSocketTemplate cmp_node_movieclip_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Alpha")}, + {SOCK_FLOAT, N_("Offset X")}, + {SOCK_FLOAT, N_("Offset Y")}, + {SOCK_FLOAT, N_("Scale")}, + {SOCK_FLOAT, N_("Angle")}, + {-1, ""}, +}; + +static void init(const bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + Scene *scene = CTX_data_scene(C); + MovieClipUser *user = (MovieClipUser *)MEM_callocN(sizeof(MovieClipUser), + "node movie clip user"); + + node->id = (ID *)scene->clip; + id_us_plus(node->id); + node->storage = user; + user->framenr = 1; +} + +void register_node_type_cmp_movieclip(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, nullptr, cmp_node_movieclip_out); + ntype.initfunc_api = init; + node_type_storage( + &ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c deleted file mode 100644 index 7e30d004b45..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include "BKE_context.h" -#include "BKE_lib_id.h" - -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_moviedistortion_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_moviedistortion_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) -{ - if (node->custom1 == 0) { - BLI_strncpy(label, IFACE_("Undistortion"), maxlen); - } - else { - BLI_strncpy(label, IFACE_("Distortion"), maxlen); - } -} - -static void init(const bContext *C, PointerRNA *ptr) -{ - bNode *node = ptr->data; - Scene *scene = CTX_data_scene(C); - - node->id = (ID *)scene->clip; - id_us_plus(node->id); -} - -static void storage_free(bNode *node) -{ - if (node->storage) { - BKE_tracking_distortion_free(node->storage); - } - - node->storage = NULL; -} - -static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node) -{ - if (src_node->storage) { - dest_node->storage = BKE_tracking_distortion_copy(src_node->storage); - } -} - -void register_node_type_cmp_moviedistortion(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); - node_type_label(&ntype, label); - - ntype.initfunc_api = init; - node_type_storage(&ntype, NULL, storage_free, storage_copy); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc new file mode 100644 index 00000000000..2bac30cc152 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc @@ -0,0 +1,88 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "BKE_context.h" +#include "BKE_lib_id.h" + +/* **************** Translate ******************** */ + +static bNodeSocketTemplate cmp_node_moviedistortion_in[] = { + {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_moviedistortion_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) +{ + if (node->custom1 == 0) { + BLI_strncpy(label, IFACE_("Undistortion"), maxlen); + } + else { + BLI_strncpy(label, IFACE_("Distortion"), maxlen); + } +} + +static void init(const bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + Scene *scene = CTX_data_scene(C); + + node->id = (ID *)scene->clip; + id_us_plus(node->id); +} + +static void storage_free(bNode *node) +{ + if (node->storage) { + BKE_tracking_distortion_free((MovieDistortion *)node->storage); + } + + node->storage = nullptr; +} + +static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node) +{ + if (src_node->storage) { + dest_node->storage = BKE_tracking_distortion_copy((MovieDistortion *)src_node->storage); + } +} + +void register_node_type_cmp_moviedistortion(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); + node_type_label(&ntype, label); + + ntype.initfunc_api = init; + node_type_storage(&ntype, nullptr, storage_free, storage_copy); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c deleted file mode 100644 index 91300e66339..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_normal.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** NORMAL ******************** */ -static bNodeSocketTemplate cmp_node_normal_in[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_normal_out[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {SOCK_FLOAT, N_("Dot")}, - {-1, ""}, -}; - -void register_node_type_cmp_normal(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.cc b/source/blender/nodes/composite/nodes/node_composite_normal.cc new file mode 100644 index 00000000000..7531025daa5 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_normal.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** NORMAL ******************** */ +static bNodeSocketTemplate cmp_node_normal_in[] = { + {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_normal_out[] = { + {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, + {SOCK_FLOAT, N_("Dot")}, + {-1, ""}, +}; + +void register_node_type_cmp_normal(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0); + node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c deleted file mode 100644 index 26f2abc745f..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** NORMALIZE single channel, useful for Z buffer ******************** */ -static bNodeSocketTemplate cmp_node_normalize_in[] = { - {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_normalize_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; - -void register_node_type_cmp_normalize(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.cc b/source/blender/nodes/composite/nodes/node_composite_normalize.cc new file mode 100644 index 00000000000..7cc54e4eed6 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.cc @@ -0,0 +1,39 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** NORMALIZE single channel, useful for Z buffer ******************** */ +static bNodeSocketTemplate cmp_node_normalize_in[] = { + {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; +static bNodeSocketTemplate cmp_node_normalize_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; + +void register_node_type_cmp_normalize(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, 0); + node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c deleted file mode 100644 index c10edd8d5ad..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "BLI_string_utils.h" -#include "BLI_utildefines.h" -#include - -#include "BKE_context.h" - -#include "RNA_access.h" - -#include "node_composite_util.h" - -#include "intern/openexr/openexr_multi.h" - -/* **************** OUTPUT FILE ******************** */ - -/* find unique path */ -static bool unique_path_unique_check(void *arg, const char *name) -{ - struct { - ListBase *lb; - bNodeSocket *sock; - } *data = arg; - bNodeSocket *sock; - for (sock = data->lb->first; sock; sock = sock->next) { - if (sock != data->sock) { - NodeImageMultiFileSocket *sockdata = sock->storage; - if (STREQ(sockdata->path, name)) { - return true; - } - } - } - return false; -} -void ntreeCompositOutputFileUniquePath(ListBase *list, - bNodeSocket *sock, - const char defname[], - char delim) -{ - NodeImageMultiFileSocket *sockdata; - struct { - ListBase *lb; - bNodeSocket *sock; - } data; - data.lb = list; - data.sock = sock; - - /* See if we are given an empty string */ - if (ELEM(NULL, sock, defname)) { - return; - } - - sockdata = sock->storage; - BLI_uniquename_cb( - unique_path_unique_check, &data, defname, delim, sockdata->path, sizeof(sockdata->path)); -} - -/* find unique EXR layer */ -static bool unique_layer_unique_check(void *arg, const char *name) -{ - struct { - ListBase *lb; - bNodeSocket *sock; - } *data = arg; - bNodeSocket *sock; - for (sock = data->lb->first; sock; sock = sock->next) { - if (sock != data->sock) { - NodeImageMultiFileSocket *sockdata = sock->storage; - if (STREQ(sockdata->layer, name)) { - return true; - } - } - } - return false; -} -void ntreeCompositOutputFileUniqueLayer(ListBase *list, - bNodeSocket *sock, - const char defname[], - char delim) -{ - NodeImageMultiFileSocket *sockdata; - struct { - ListBase *lb; - bNodeSocket *sock; - } data; - data.lb = list; - data.sock = sock; - - /* See if we are given an empty string */ - if (ELEM(NULL, sock, defname)) { - return; - } - - sockdata = sock->storage; - BLI_uniquename_cb( - unique_layer_unique_check, &data, defname, delim, sockdata->layer, sizeof(sockdata->layer)); -} - -bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, - bNode *node, - const char *name, - ImageFormatData *im_format) -{ - NodeImageMultiFile *nimf = node->storage; - bNodeSocket *sock = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, NULL, name); - - /* create format data for the input socket */ - NodeImageMultiFileSocket *sockdata = MEM_callocN(sizeof(NodeImageMultiFileSocket), - "socket image format"); - sock->storage = sockdata; - - BLI_strncpy_utf8(sockdata->path, name, sizeof(sockdata->path)); - ntreeCompositOutputFileUniquePath(&node->inputs, sock, name, '_'); - BLI_strncpy_utf8(sockdata->layer, name, sizeof(sockdata->layer)); - ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_'); - - if (im_format) { - sockdata->format = *im_format; - if (BKE_imtype_is_movie(sockdata->format.imtype)) { - sockdata->format.imtype = R_IMF_IMTYPE_OPENEXR; - } - } - else { - BKE_imformat_defaults(&sockdata->format); - } - /* use node data format by default */ - sockdata->use_node_format = true; - sockdata->save_as_render = true; - - nimf->active_input = BLI_findindex(&node->inputs, sock); - - return sock; -} - -int ntreeCompositOutputFileRemoveActiveSocket(bNodeTree *ntree, bNode *node) -{ - NodeImageMultiFile *nimf = node->storage; - bNodeSocket *sock = BLI_findlink(&node->inputs, nimf->active_input); - int totinputs = BLI_listbase_count(&node->inputs); - - if (!sock) { - return 0; - } - - if (nimf->active_input == totinputs - 1) { - --nimf->active_input; - } - - /* free format data */ - MEM_freeN(sock->storage); - - nodeRemoveSocket(ntree, node, sock); - return 1; -} - -void ntreeCompositOutputFileSetPath(bNode *node, bNodeSocket *sock, const char *name) -{ - NodeImageMultiFileSocket *sockdata = sock->storage; - BLI_strncpy_utf8(sockdata->path, name, sizeof(sockdata->path)); - ntreeCompositOutputFileUniquePath(&node->inputs, sock, name, '_'); -} - -void ntreeCompositOutputFileSetLayer(bNode *node, bNodeSocket *sock, const char *name) -{ - NodeImageMultiFileSocket *sockdata = sock->storage; - BLI_strncpy_utf8(sockdata->layer, name, sizeof(sockdata->layer)); - ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_'); -} - -/* XXX uses initfunc_api callback, regular initfunc does not support context yet */ -static void init_output_file(const bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - bNodeTree *ntree = (bNodeTree *)ptr->owner_id; - bNode *node = ptr->data; - NodeImageMultiFile *nimf = MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file"); - ImageFormatData *format = NULL; - node->storage = nimf; - - if (scene) { - RenderData *rd = &scene->r; - - BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path)); - nimf->format = rd->im_format; - if (BKE_imtype_is_movie(nimf->format.imtype)) { - nimf->format.imtype = R_IMF_IMTYPE_OPENEXR; - } - - format = &nimf->format; - } - else { - BKE_imformat_defaults(&nimf->format); - } - - /* add one socket by default */ - ntreeCompositOutputFileAddSocket(ntree, node, "Image", format); -} - -static void free_output_file(bNode *node) -{ - bNodeSocket *sock; - - /* free storage data in sockets */ - for (sock = node->inputs.first; sock; sock = sock->next) { - MEM_freeN(sock->storage); - } - - MEM_freeN(node->storage); -} - -static void copy_output_file(bNodeTree *UNUSED(dest_ntree), - bNode *dest_node, - const bNode *src_node) -{ - bNodeSocket *src_sock, *dest_sock; - - dest_node->storage = MEM_dupallocN(src_node->storage); - - /* duplicate storage data in sockets */ - for (src_sock = src_node->inputs.first, dest_sock = dest_node->inputs.first; - src_sock && dest_sock; - src_sock = src_sock->next, dest_sock = dest_sock->next) { - dest_sock->storage = MEM_dupallocN(src_sock->storage); - } -} - -static void update_output_file(bNodeTree *ntree, bNode *node) -{ - bNodeSocket *sock, *sock_next; - PointerRNA ptr; - - /* XXX fix for T36706: remove invalid sockets added with bpy API. - * This is not ideal, but prevents crashes from missing storage. - * FileOutput node needs a redesign to support this properly. - */ - for (sock = node->inputs.first; sock; sock = sock_next) { - sock_next = sock->next; - if (sock->storage == NULL) { - nodeRemoveSocket(ntree, node, sock); - } - } - for (sock = node->outputs.first; sock; sock = sock_next) { - sock_next = sock->next; - nodeRemoveSocket(ntree, node, sock); - } - - cmp_node_update_default(ntree, node); - - /* automatically update the socket type based on linked input */ - for (sock = node->inputs.first; sock; sock = sock->next) { - if (sock->link) { - RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); - RNA_enum_set(&ptr, "type", sock->link->fromsock->type); - } - } -} - -void register_node_type_cmp_output_file(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, NULL, NULL); - ntype.initfunc_api = init_output_file; - node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file); - node_type_update(&ntype, update_output_file); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc new file mode 100644 index 00000000000..a372d2f7419 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc @@ -0,0 +1,289 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "BLI_string_utils.h" +#include "BLI_utildefines.h" +#include + +#include "BKE_context.h" + +#include "RNA_access.h" + +#include "node_composite_util.hh" + +#include "intern/openexr/openexr_multi.h" + +/* **************** OUTPUT FILE ******************** */ + +/* find unique path */ +static bool unique_path_unique_check(void *arg, const char *name) +{ + struct Args { + ListBase *lb; + bNodeSocket *sock; + }; + Args *data = (Args *)arg; + + LISTBASE_FOREACH (bNodeSocket *, sock, data->lb) { + if (sock != data->sock) { + NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage; + if (STREQ(sockdata->path, name)) { + return true; + } + } + } + return false; +} +void ntreeCompositOutputFileUniquePath(ListBase *list, + bNodeSocket *sock, + const char defname[], + char delim) +{ + NodeImageMultiFileSocket *sockdata; + struct { + ListBase *lb; + bNodeSocket *sock; + } data; + data.lb = list; + data.sock = sock; + + /* See if we are given an empty string */ + if (ELEM(nullptr, sock, defname)) { + return; + } + + sockdata = (NodeImageMultiFileSocket *)sock->storage; + BLI_uniquename_cb( + unique_path_unique_check, &data, defname, delim, sockdata->path, sizeof(sockdata->path)); +} + +/* find unique EXR layer */ +static bool unique_layer_unique_check(void *arg, const char *name) +{ + struct Args { + ListBase *lb; + bNodeSocket *sock; + }; + Args *data = (Args *)arg; + + LISTBASE_FOREACH (bNodeSocket *, sock, data->lb) { + if (sock != data->sock) { + NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage; + if (STREQ(sockdata->layer, name)) { + return true; + } + } + } + return false; +} +void ntreeCompositOutputFileUniqueLayer(ListBase *list, + bNodeSocket *sock, + const char defname[], + char delim) +{ + struct { + ListBase *lb; + bNodeSocket *sock; + } data; + data.lb = list; + data.sock = sock; + + /* See if we are given an empty string */ + if (ELEM(nullptr, sock, defname)) { + return; + } + + NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage; + BLI_uniquename_cb( + unique_layer_unique_check, &data, defname, delim, sockdata->layer, sizeof(sockdata->layer)); +} + +bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, + bNode *node, + const char *name, + ImageFormatData *im_format) +{ + NodeImageMultiFile *nimf = (NodeImageMultiFile *)node->storage; + bNodeSocket *sock = nodeAddStaticSocket( + ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, nullptr, name); + + /* create format data for the input socket */ + NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)MEM_callocN( + sizeof(NodeImageMultiFileSocket), "socket image format"); + sock->storage = sockdata; + + BLI_strncpy_utf8(sockdata->path, name, sizeof(sockdata->path)); + ntreeCompositOutputFileUniquePath(&node->inputs, sock, name, '_'); + BLI_strncpy_utf8(sockdata->layer, name, sizeof(sockdata->layer)); + ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_'); + + if (im_format) { + sockdata->format = *im_format; + if (BKE_imtype_is_movie(sockdata->format.imtype)) { + sockdata->format.imtype = R_IMF_IMTYPE_OPENEXR; + } + } + else { + BKE_imformat_defaults(&sockdata->format); + } + /* use node data format by default */ + sockdata->use_node_format = true; + sockdata->save_as_render = true; + + nimf->active_input = BLI_findindex(&node->inputs, sock); + + return sock; +} + +int ntreeCompositOutputFileRemoveActiveSocket(bNodeTree *ntree, bNode *node) +{ + NodeImageMultiFile *nimf = (NodeImageMultiFile *)node->storage; + bNodeSocket *sock = (bNodeSocket *)BLI_findlink(&node->inputs, nimf->active_input); + int totinputs = BLI_listbase_count(&node->inputs); + + if (!sock) { + return 0; + } + + if (nimf->active_input == totinputs - 1) { + --nimf->active_input; + } + + /* free format data */ + MEM_freeN(sock->storage); + + nodeRemoveSocket(ntree, node, sock); + return 1; +} + +void ntreeCompositOutputFileSetPath(bNode *node, bNodeSocket *sock, const char *name) +{ + NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage; + BLI_strncpy_utf8(sockdata->path, name, sizeof(sockdata->path)); + ntreeCompositOutputFileUniquePath(&node->inputs, sock, name, '_'); +} + +void ntreeCompositOutputFileSetLayer(bNode *node, bNodeSocket *sock, const char *name) +{ + NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)sock->storage; + BLI_strncpy_utf8(sockdata->layer, name, sizeof(sockdata->layer)); + ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_'); +} + +/* XXX uses initfunc_api callback, regular initfunc does not support context yet */ +static void init_output_file(const bContext *C, PointerRNA *ptr) +{ + Scene *scene = CTX_data_scene(C); + bNodeTree *ntree = (bNodeTree *)ptr->owner_id; + bNode *node = (bNode *)ptr->data; + NodeImageMultiFile *nimf = (NodeImageMultiFile *)MEM_callocN(sizeof(NodeImageMultiFile), + "node image multi file"); + ImageFormatData *format = nullptr; + node->storage = nimf; + + if (scene) { + RenderData *rd = &scene->r; + + BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path)); + nimf->format = rd->im_format; + if (BKE_imtype_is_movie(nimf->format.imtype)) { + nimf->format.imtype = R_IMF_IMTYPE_OPENEXR; + } + + format = &nimf->format; + } + else { + BKE_imformat_defaults(&nimf->format); + } + + /* add one socket by default */ + ntreeCompositOutputFileAddSocket(ntree, node, "Image", format); +} + +static void free_output_file(bNode *node) +{ + /* free storage data in sockets */ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { + MEM_freeN(sock->storage); + } + + MEM_freeN(node->storage); +} + +static void copy_output_file(bNodeTree *UNUSED(dest_ntree), + bNode *dest_node, + const bNode *src_node) +{ + bNodeSocket *src_sock, *dest_sock; + + dest_node->storage = MEM_dupallocN(src_node->storage); + + /* duplicate storage data in sockets */ + for (src_sock = (bNodeSocket *)src_node->inputs.first, + dest_sock = (bNodeSocket *)dest_node->inputs.first; + src_sock && dest_sock; + src_sock = src_sock->next, dest_sock = (bNodeSocket *)dest_sock->next) { + dest_sock->storage = MEM_dupallocN(src_sock->storage); + } +} + +static void update_output_file(bNodeTree *ntree, bNode *node) +{ + PointerRNA ptr; + + /* XXX fix for T36706: remove invalid sockets added with bpy API. + * This is not ideal, but prevents crashes from missing storage. + * FileOutput node needs a redesign to support this properly. + */ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { + if (sock->storage == nullptr) { + nodeRemoveSocket(ntree, node, sock); + } + } + LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { + nodeRemoveSocket(ntree, node, sock); + } + + cmp_node_update_default(ntree, node); + + /* automatically update the socket type based on linked input */ + LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { + if (sock->link) { + RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); + RNA_enum_set(&ptr, "type", sock->link->fromsock->type); + } + } +} + +void register_node_type_cmp_output_file(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, nullptr, nullptr); + ntype.initfunc_api = init_output_file; + node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file); + node_type_update(&ntype, update_output_file); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c deleted file mode 100644 index 6e8a28df76f..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Pixelate ******************** */ - -static bNodeSocketTemplate cmp_node_pixelate_in[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_pixelate_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; - -void register_node_type_cmp_pixelate(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_pixelate_in, cmp_node_pixelate_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc new file mode 100644 index 00000000000..19975c21a0b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc @@ -0,0 +1,40 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Pixelate ******************** */ + +static bNodeSocketTemplate cmp_node_pixelate_in[] = { + {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; +static bNodeSocketTemplate cmp_node_pixelate_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; + +void register_node_type_cmp_pixelate(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_pixelate_in, cmp_node_pixelate_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c deleted file mode 100644 index ab5db41e5b5..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2013 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_planetrackdeform_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; - -static bNodeSocketTemplate cmp_node_planetrackdeform_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Plane")}, - {-1, ""}, -}; - -static void init(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodePlaneTrackDeformData *data = MEM_callocN(sizeof(NodePlaneTrackDeformData), - "node plane track deform data"); - data->motion_blur_samples = 16; - data->motion_blur_shutter = 0.5f; - node->storage = data; -} - -void register_node_type_cmp_planetrackdeform(void) -{ - static bNodeType ntype; - - cmp_node_type_base( - &ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_planetrackdeform_in, cmp_node_planetrackdeform_out); - node_type_init(&ntype, init); - node_type_storage( - &ntype, "NodePlaneTrackDeformData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc new file mode 100644 index 00000000000..e122b710b7b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_planetrackdeform_in[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; + +static bNodeSocketTemplate cmp_node_planetrackdeform_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Plane")}, + {-1, ""}, +}; + +static void init(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)MEM_callocN( + sizeof(NodePlaneTrackDeformData), "node plane track deform data"); + data->motion_blur_samples = 16; + data->motion_blur_shutter = 0.5f; + node->storage = data; +} + +void register_node_type_cmp_planetrackdeform(void) +{ + static bNodeType ntype; + + cmp_node_type_base( + &ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_planetrackdeform_in, cmp_node_planetrackdeform_out); + node_type_init(&ntype, init); + node_type_storage( + &ntype, "NodePlaneTrackDeformData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_posterize.c b/source/blender/nodes/composite/nodes/node_composite_posterize.c deleted file mode 100644 index 5093e581cdc..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_posterize.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2021 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Posterize ******************** */ - -static bNodeSocketTemplate cmp_node_posterize_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Steps"), 8.0f, 8.0f, 8.0f, 8.0f, 2.0f, 1024.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_posterize_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_posterize(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_posterize_in, cmp_node_posterize_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_posterize.cc b/source/blender/nodes/composite/nodes/node_composite_posterize.cc new file mode 100644 index 00000000000..45a98e68b4b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_posterize.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2021 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Posterize ******************** */ + +static bNodeSocketTemplate cmp_node_posterize_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Steps"), 8.0f, 8.0f, 8.0f, 8.0f, 2.0f, 1024.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_posterize_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_posterize(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_posterize_in, cmp_node_posterize_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c deleted file mode 100644 index be76bbf01cf..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Premul and Key Alpha Convert ******************** */ - -static bNodeSocketTemplate cmp_node_premulkey_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_premulkey_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_premulkey(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc new file mode 100644 index 00000000000..68716ee53b5 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Premul and Key Alpha Convert ******************** */ + +static bNodeSocketTemplate cmp_node_premulkey_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_premulkey_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_premulkey(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c deleted file mode 100644 index dae63f7a702..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** RGB ******************** */ -static bNodeSocketTemplate cmp_node_rgb_out[] = { - {SOCK_RGBA, N_("RGBA"), 0.5f, 0.5f, 0.5f, 1.0f}, - {-1, ""}, -}; - -void register_node_type_cmp_rgb(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out); - node_type_size_preset(&ntype, NODE_SIZE_SMALL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.cc b/source/blender/nodes/composite/nodes/node_composite_rgb.cc new file mode 100644 index 00000000000..c9c3dfcb019 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.cc @@ -0,0 +1,41 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** RGB ******************** */ +static bNodeSocketTemplate cmp_node_rgb_out[] = { + {SOCK_RGBA, N_("RGBA"), 0.5f, 0.5f, 0.5f, 1.0f}, + {-1, ""}, +}; + +void register_node_type_cmp_rgb(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_rgb_out); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c deleted file mode 100644 index 7dd39d5eaa1..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Rotate ******************** */ - -static bNodeSocketTemplate cmp_node_rotate_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Degr"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_rotate_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = 1; /* Bilinear Filter. */ -} - -void register_node_type_cmp_rotate(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out); - node_type_init(&ntype, node_composit_init_rotate); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc new file mode 100644 index 00000000000..d28b35ec9fb --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc @@ -0,0 +1,52 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Rotate ******************** */ + +static bNodeSocketTemplate cmp_node_rotate_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Degr"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_rotate_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; /* Bilinear Filter. */ +} + +void register_node_type_cmp_rotate(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out); + node_type_init(&ntype, node_composit_init_rotate); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c deleted file mode 100644 index 963832de03a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Scale ******************** */ - -static bNodeSocketTemplate cmp_node_scale_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, - {SOCK_FLOAT, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_scale_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -static void node_composite_update_scale(bNodeTree *UNUSED(ntree), bNode *node) -{ - bNodeSocket *sock; - bool use_xy_scale = ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_ABSOLUTE); - - /* Only show X/Y scale factor inputs for modes using them! */ - for (sock = node->inputs.first; sock; sock = sock->next) { - if (STR_ELEM(sock->name, "X", "Y")) { - if (use_xy_scale) { - sock->flag &= ~SOCK_UNAVAIL; - } - else { - sock->flag |= SOCK_UNAVAIL; - } - } - } -} - -void register_node_type_cmp_scale(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out); - node_type_update(&ntype, node_composite_update_scale); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc new file mode 100644 index 00000000000..3972fc0d949 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc @@ -0,0 +1,62 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Scale ******************** */ + +static bNodeSocketTemplate cmp_node_scale_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, + {SOCK_FLOAT, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, + {-1, ""}}; +static bNodeSocketTemplate cmp_node_scale_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +static void node_composite_update_scale(bNodeTree *UNUSED(ntree), bNode *node) +{ + bNodeSocket *sock; + bool use_xy_scale = ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_ABSOLUTE); + + /* Only show X/Y scale factor inputs for modes using them! */ + for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { + if (STR_ELEM(sock->name, "X", "Y")) { + if (use_xy_scale) { + sock->flag &= ~SOCK_UNAVAIL; + } + else { + sock->flag |= SOCK_UNAVAIL; + } + } + } +} + +void register_node_type_cmp_scale(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out); + node_type_update(&ntype, node_composite_update_scale); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c deleted file mode 100644 index 001b197e23a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** SEPARATE HSVA ******************** */ -static bNodeSocketTemplate cmp_node_sephsva_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_sephsva_out[] = { - {SOCK_FLOAT, N_("H")}, - {SOCK_FLOAT, N_("S")}, - {SOCK_FLOAT, N_("V")}, - {SOCK_FLOAT, N_("A")}, - {-1, ""}, -}; - -void register_node_type_cmp_sephsva(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out); - - nodeRegisterType(&ntype); -} - -/* **************** COMBINE HSVA ******************** */ -static bNodeSocketTemplate cmp_node_combhsva_in[] = { - {SOCK_FLOAT, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_combhsva_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_combhsva(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc new file mode 100644 index 00000000000..17b1ab9ac59 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc @@ -0,0 +1,70 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** SEPARATE HSVA ******************** */ +static bNodeSocketTemplate cmp_node_sephsva_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_sephsva_out[] = { + {SOCK_FLOAT, N_("H")}, + {SOCK_FLOAT, N_("S")}, + {SOCK_FLOAT, N_("V")}, + {SOCK_FLOAT, N_("A")}, + {-1, ""}, +}; + +void register_node_type_cmp_sephsva(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out); + + nodeRegisterType(&ntype); +} + +/* **************** COMBINE HSVA ******************** */ +static bNodeSocketTemplate cmp_node_combhsva_in[] = { + {SOCK_FLOAT, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_combhsva_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_combhsva(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c deleted file mode 100644 index e08f27db254..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** SEPARATE RGBA ******************** */ -static bNodeSocketTemplate cmp_node_seprgba_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_seprgba_out[] = { - {SOCK_FLOAT, N_("R")}, - {SOCK_FLOAT, N_("G")}, - {SOCK_FLOAT, N_("B")}, - {SOCK_FLOAT, N_("A")}, - {-1, ""}, -}; - -void register_node_type_cmp_seprgba(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out); - - nodeRegisterType(&ntype); -} - -/* **************** COMBINE RGBA ******************** */ -static bNodeSocketTemplate cmp_node_combrgba_in[] = { - {SOCK_FLOAT, N_("R"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("G"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("B"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_combrgba_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_combrgba(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc new file mode 100644 index 00000000000..d3a021ed7ba --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc @@ -0,0 +1,70 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** SEPARATE RGBA ******************** */ +static bNodeSocketTemplate cmp_node_seprgba_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_seprgba_out[] = { + {SOCK_FLOAT, N_("R")}, + {SOCK_FLOAT, N_("G")}, + {SOCK_FLOAT, N_("B")}, + {SOCK_FLOAT, N_("A")}, + {-1, ""}, +}; + +void register_node_type_cmp_seprgba(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out); + + nodeRegisterType(&ntype); +} + +/* **************** COMBINE RGBA ******************** */ +static bNodeSocketTemplate cmp_node_combrgba_in[] = { + {SOCK_FLOAT, N_("R"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("G"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("B"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_combrgba_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_combrgba(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c deleted file mode 100644 index b3884296600..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** SEPARATE YCCA ******************** */ -static bNodeSocketTemplate cmp_node_sepycca_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_sepycca_out[] = { - {SOCK_FLOAT, N_("Y")}, - {SOCK_FLOAT, N_("Cb")}, - {SOCK_FLOAT, N_("Cr")}, - {SOCK_FLOAT, N_("A")}, - {-1, ""}, -}; - -static void node_composit_init_mode_sepycca(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = 1; /* BLI_YCC_ITU_BT709 */ -} - -void register_node_type_cmp_sepycca(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out); - node_type_init(&ntype, node_composit_init_mode_sepycca); - - nodeRegisterType(&ntype); -} - -/* **************** COMBINE YCCA ******************** */ -static bNodeSocketTemplate cmp_node_combycca_in[] = { - {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Cb"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Cr"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_combycca_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_mode_combycca(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = 1; /* BLI_YCC_ITU_BT709 */ -} - -void register_node_type_cmp_combycca(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out); - node_type_init(&ntype, node_composit_init_mode_combycca); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc new file mode 100644 index 00000000000..2090841b3b9 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc @@ -0,0 +1,80 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** SEPARATE YCCA ******************** */ +static bNodeSocketTemplate cmp_node_sepycca_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; +static bNodeSocketTemplate cmp_node_sepycca_out[] = { + {SOCK_FLOAT, N_("Y")}, + {SOCK_FLOAT, N_("Cb")}, + {SOCK_FLOAT, N_("Cr")}, + {SOCK_FLOAT, N_("A")}, + {-1, ""}, +}; + +static void node_composit_init_mode_sepycca(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; /* BLI_YCC_ITU_BT709 */ +} + +void register_node_type_cmp_sepycca(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out); + node_type_init(&ntype, node_composit_init_mode_sepycca); + + nodeRegisterType(&ntype); +} + +/* **************** COMBINE YCCA ******************** */ +static bNodeSocketTemplate cmp_node_combycca_in[] = { + {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Cb"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Cr"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_combycca_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_mode_combycca(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; /* BLI_YCC_ITU_BT709 */ +} + +void register_node_type_cmp_combycca(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out); + node_type_init(&ntype, node_composit_init_mode_combycca); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c deleted file mode 100644 index 4da79ec7981..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** SEPARATE YUVA ******************** */ -static bNodeSocketTemplate cmp_node_sepyuva_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_sepyuva_out[] = { - {SOCK_FLOAT, N_("Y")}, - {SOCK_FLOAT, N_("U")}, - {SOCK_FLOAT, N_("V")}, - {SOCK_FLOAT, N_("A")}, - {-1, ""}, -}; - -void register_node_type_cmp_sepyuva(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out); - - nodeRegisterType(&ntype); -} - -/* **************** COMBINE YUVA ******************** */ -static bNodeSocketTemplate cmp_node_combyuva_in[] = { - {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("U"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_combyuva_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_combyuva(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc new file mode 100644 index 00000000000..59982b81468 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc @@ -0,0 +1,68 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** SEPARATE YUVA ******************** */ +static bNodeSocketTemplate cmp_node_sepyuva_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; +static bNodeSocketTemplate cmp_node_sepyuva_out[] = { + {SOCK_FLOAT, N_("Y")}, + {SOCK_FLOAT, N_("U")}, + {SOCK_FLOAT, N_("V")}, + {SOCK_FLOAT, N_("A")}, + {-1, ""}, +}; + +void register_node_type_cmp_sepyuva(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out); + + nodeRegisterType(&ntype); +} + +/* **************** COMBINE YUVA ******************** */ +static bNodeSocketTemplate cmp_node_combyuva_in[] = { + {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("U"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_combyuva_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_combyuva(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c deleted file mode 100644 index 1b44cc011e9..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** SET ALPHA ******************** */ -static bNodeSocketTemplate cmp_node_setalpha_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_setalpha_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_setalpha(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeSetAlpha *settings = MEM_callocN(sizeof(NodeSetAlpha), __func__); - node->storage = settings; - settings->mode = CMP_NODE_SETALPHA_MODE_APPLY; -} - -void register_node_type_cmp_setalpha(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out); - node_type_init(&ntype, node_composit_init_setalpha); - node_type_storage( - &ntype, "NodeSetAlpha", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc new file mode 100644 index 00000000000..a2089bd0913 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc @@ -0,0 +1,55 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** SET ALPHA ******************** */ +static bNodeSocketTemplate cmp_node_setalpha_in[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_setalpha_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_setalpha(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeSetAlpha *settings = (NodeSetAlpha *)MEM_callocN(sizeof(NodeSetAlpha), __func__); + node->storage = settings; + settings->mode = CMP_NODE_SETALPHA_MODE_APPLY; +} + +void register_node_type_cmp_setalpha(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out); + node_type_init(&ntype, node_composit_init_setalpha); + node_type_storage( + &ntype, "NodeSetAlpha", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c deleted file mode 100644 index 8afb3fd4841..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include "BKE_global.h" -#include "BKE_image.h" - -/* **************** SPLIT VIEWER ******************** */ -static bNodeSocketTemplate cmp_node_splitviewer_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node) -{ - ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user"); - node->storage = iuser; - iuser->sfra = 1; - iuser->ok = 1; - node->custom1 = 50; /* default 50% split */ - - node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node"); -} - -void register_node_type_cmp_splitviewer(void) -{ - static bNodeType ntype; - - cmp_node_type_base( - &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_splitviewer_in, NULL); - node_type_init(&ntype, node_composit_init_splitviewer); - node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); - - /* Do not allow muting for this node. */ - node_type_internal_links(&ntype, NULL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc new file mode 100644 index 00000000000..54a1c59fca6 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc @@ -0,0 +1,61 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "BKE_global.h" +#include "BKE_image.h" + +/* **************** SPLIT VIEWER ******************** */ +static bNodeSocketTemplate cmp_node_splitviewer_in[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node) +{ + ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user"); + node->storage = iuser; + iuser->sfra = 1; + iuser->ok = 1; + node->custom1 = 50; /* default 50% split */ + + node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node"); +} + +void register_node_type_cmp_splitviewer(void) +{ + static bNodeType ntype; + + cmp_node_type_base( + &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_splitviewer_in, nullptr); + node_type_init(&ntype, node_composit_init_splitviewer); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + + /* Do not allow muting for this node. */ + node_type_internal_links(&ntype, nullptr); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c deleted file mode 100644 index b89f245c542..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include "BKE_context.h" -#include "BKE_lib_id.h" - -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_stabilize2d_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_stabilize2d_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void init(const bContext *C, PointerRNA *ptr) -{ - bNode *node = ptr->data; - Scene *scene = CTX_data_scene(C); - - node->id = (ID *)scene->clip; - id_us_plus(node->id); - - /* default to bilinear, see node_sampler_type_items in rna_nodetree.c */ - node->custom1 = 1; -} - -void register_node_type_cmp_stabilize2d(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out); - ntype.initfunc_api = init; - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc new file mode 100644 index 00000000000..e5ce2e8ceb9 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc @@ -0,0 +1,62 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "BKE_context.h" +#include "BKE_lib_id.h" + +/* **************** Translate ******************** */ + +static bNodeSocketTemplate cmp_node_stabilize2d_in[] = { + {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_stabilize2d_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void init(const bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + Scene *scene = CTX_data_scene(C); + + node->id = (ID *)scene->clip; + id_us_plus(node->id); + + /* default to bilinear, see node_sampler_type_items in rna_nodetree.c */ + node->custom1 = 1; +} + +void register_node_type_cmp_stabilize2d(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out); + ntype.initfunc_api = init; + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.c b/source/blender/nodes/composite/nodes/node_composite_sunbeams.c deleted file mode 100644 index 84ab2d30d34..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2014 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate inputs[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate outputs[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void init(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeSunBeams *data = MEM_callocN(sizeof(NodeSunBeams), "sun beams node"); - - data->source[0] = 0.5f; - data->source[1] = 0.5f; - - node->storage = data; -} - -void register_node_type_cmp_sunbeams(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, inputs, outputs); - node_type_init(&ntype, init); - node_type_storage( - &ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc new file mode 100644 index 00000000000..73907d2e27f --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -0,0 +1,55 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2014 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate inputs[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate outputs[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void init(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeSunBeams *data = (NodeSunBeams *)MEM_callocN(sizeof(NodeSunBeams), "sun beams node"); + + data->source[0] = 0.5f; + data->source[1] = 0.5f; + node->storage = data; +} + +void register_node_type_cmp_sunbeams(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, inputs, outputs); + node_type_init(&ntype, init); + node_type_storage( + &ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c deleted file mode 100644 index efbb3390e06..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_switch.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "../node_composite_util.h" - -/* **************** MIX RGB ******************** */ -static bNodeSocketTemplate cmp_node_switch_in[] = { - {SOCK_RGBA, N_("Off"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("On"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_switch_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -/* custom1 = mix type */ -void register_node_type_cmp_switch(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, 0); - node_type_socket_templates(&ntype, cmp_node_switch_in, cmp_node_switch_out); - node_type_size_preset(&ntype, NODE_SIZE_SMALL); - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.cc b/source/blender/nodes/composite/nodes/node_composite_switch.cc new file mode 100644 index 00000000000..71226a6da0b --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_switch.cc @@ -0,0 +1,47 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "../node_composite_util.hh" + +/* **************** MIX RGB ******************** */ +static bNodeSocketTemplate cmp_node_switch_in[] = { + {SOCK_RGBA, N_("Off"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {SOCK_RGBA, N_("On"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_switch_out[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +/* custom1 = mix type */ +void register_node_type_cmp_switch(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, 0); + node_type_socket_templates(&ntype, cmp_node_switch_in, cmp_node_switch_out); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.c b/source/blender/nodes/composite/nodes/node_composite_switchview.c deleted file mode 100644 index b09d5119bc4..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - * Dalai Felinto - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "BKE_context.h" -#include "BKE_lib_id.h" - -#include "../node_composite_util.h" - -/* **************** SWITCH VIEW ******************** */ -static bNodeSocketTemplate cmp_node_switch_view_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocket *ntreeCompositSwitchViewAddSocket(bNodeTree *ntree, - bNode *node, - const char *name) -{ - bNodeSocket *sock = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, NULL, name); - return sock; -} - -static void cmp_node_switch_view_sanitycheck(bNodeTree *ntree, bNode *node) -{ - bNodeSocket *sock; - - if (!BLI_listbase_is_empty(&node->inputs)) { - return; - } - - sock = ntreeCompositSwitchViewAddSocket(ntree, node, "No View"); - sock->flag |= SOCK_HIDDEN; -} - -static void cmp_node_switch_view_update(bNodeTree *ntree, bNode *node) -{ - bNodeSocket *sock; - SceneRenderView *srv; - Scene *scene = (Scene *)node->id; - - /* only update when called from the operator button */ - if (node->update != NODE_UPDATE_OPERATOR) { - return; - } - - if (scene == NULL) { - nodeRemoveAllSockets(ntree, node); - /* make sure there is always one socket */ - cmp_node_switch_view_sanitycheck(ntree, node); - return; - } - - /* remove the views that were removed */ - sock = node->inputs.last; - while (sock) { - srv = BLI_findstring(&scene->r.views, sock->name, offsetof(SceneRenderView, name)); - - if (srv == NULL) { - bNodeSocket *sock_del = sock; - sock = sock->prev; - nodeRemoveSocket(ntree, node, sock_del); - } - else { - if (srv->viewflag & SCE_VIEW_DISABLE) { - sock->flag |= SOCK_HIDDEN; - } - else { - sock->flag &= ~SOCK_HIDDEN; - } - - sock = sock->prev; - } - } - - /* add the new views */ - for (srv = scene->r.views.first; srv; srv = srv->next) { - sock = BLI_findstring(&node->inputs, srv->name, offsetof(bNodeSocket, name)); - - if (sock == NULL) { - sock = ntreeCompositSwitchViewAddSocket(ntree, node, srv->name); - } - - if (srv->viewflag & SCE_VIEW_DISABLE) { - sock->flag |= SOCK_HIDDEN; - } - else { - sock->flag &= ~SOCK_HIDDEN; - } - } - - /* make sure there is always one socket */ - cmp_node_switch_view_sanitycheck(ntree, node); -} - -static void init_switch_view(const bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - bNodeTree *ntree = (bNodeTree *)ptr->owner_id; - bNode *node = ptr->data; - SceneRenderView *srv; - bNodeSocket *sock; - int nr; - - /* store scene for updates */ - node->id = (ID *)scene; - id_us_plus(node->id); - - if (scene) { - RenderData *rd = &scene->r; - - for (nr = 0, srv = rd->views.first; srv; srv = srv->next, nr++) { - sock = ntreeCompositSwitchViewAddSocket(ntree, node, srv->name); - - if (srv->viewflag & SCE_VIEW_DISABLE) { - sock->flag |= SOCK_HIDDEN; - } - } - } - - /* make sure there is always one socket */ - cmp_node_switch_view_sanitycheck(ntree, node); -} - -void register_node_type_cmp_switch_view(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, "Switch View", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_switch_view_out); - - ntype.initfunc_api = init_switch_view; - - node_type_update(&ntype, cmp_node_switch_view_update); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.cc b/source/blender/nodes/composite/nodes/node_composite_switchview.cc new file mode 100644 index 00000000000..a61712f7f8d --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.cc @@ -0,0 +1,152 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * Dalai Felinto + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "BKE_context.h" +#include "BKE_lib_id.h" + +#include "../node_composite_util.hh" + +/* **************** SWITCH VIEW ******************** */ +static bNodeSocketTemplate cmp_node_switch_view_out[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +static bNodeSocket *ntreeCompositSwitchViewAddSocket(bNodeTree *ntree, + bNode *node, + const char *name) +{ + bNodeSocket *sock = nodeAddStaticSocket( + ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, nullptr, name); + return sock; +} + +static void cmp_node_switch_view_sanitycheck(bNodeTree *ntree, bNode *node) +{ + if (!BLI_listbase_is_empty(&node->inputs)) { + return; + } + + bNodeSocket *sock = ntreeCompositSwitchViewAddSocket(ntree, node, "No View"); + sock->flag |= SOCK_HIDDEN; +} + +static void cmp_node_switch_view_update(bNodeTree *ntree, bNode *node) +{ + Scene *scene = (Scene *)node->id; + + /* only update when called from the operator button */ + if (node->update != NODE_UPDATE_OPERATOR) { + return; + } + + if (scene == nullptr) { + nodeRemoveAllSockets(ntree, node); + /* make sure there is always one socket */ + cmp_node_switch_view_sanitycheck(ntree, node); + return; + } + + /* remove the views that were removed */ + bNodeSocket *sock = (bNodeSocket *)node->inputs.last; + while (sock) { + SceneRenderView *srv = (SceneRenderView *)BLI_findstring( + &scene->r.views, sock->name, offsetof(SceneRenderView, name)); + + if (srv == nullptr) { + bNodeSocket *sock_del = sock; + sock = sock->prev; + nodeRemoveSocket(ntree, node, sock_del); + } + else { + if (srv->viewflag & SCE_VIEW_DISABLE) { + sock->flag |= SOCK_HIDDEN; + } + else { + sock->flag &= ~SOCK_HIDDEN; + } + + sock = sock->prev; + } + } + + /* add the new views */ + LISTBASE_FOREACH (SceneRenderView *, srv, &scene->r.views) { + sock = (bNodeSocket *)BLI_findstring(&node->inputs, srv->name, offsetof(bNodeSocket, name)); + + if (sock == nullptr) { + sock = ntreeCompositSwitchViewAddSocket(ntree, node, srv->name); + } + + if (srv->viewflag & SCE_VIEW_DISABLE) { + sock->flag |= SOCK_HIDDEN; + } + else { + sock->flag &= ~SOCK_HIDDEN; + } + } + + /* make sure there is always one socket */ + cmp_node_switch_view_sanitycheck(ntree, node); +} + +static void init_switch_view(const bContext *C, PointerRNA *ptr) +{ + Scene *scene = CTX_data_scene(C); + bNodeTree *ntree = (bNodeTree *)ptr->owner_id; + bNode *node = (bNode *)ptr->data; + + /* store scene for updates */ + node->id = (ID *)scene; + id_us_plus(node->id); + + if (scene) { + RenderData *rd = &scene->r; + + LISTBASE_FOREACH (SceneRenderView *, srv, &rd->views) { + bNodeSocket *sock = ntreeCompositSwitchViewAddSocket(ntree, node, srv->name); + + if (srv->viewflag & SCE_VIEW_DISABLE) { + sock->flag |= SOCK_HIDDEN; + } + } + } + + /* make sure there is always one socket */ + cmp_node_switch_view_sanitycheck(ntree, node); +} + +void register_node_type_cmp_switch_view(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, "Switch View", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_switch_view_out); + + ntype.initfunc_api = init_switch_view; + + node_type_update(&ntype, cmp_node_switch_view_update); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c deleted file mode 100644 index 50be05fe5a6..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_texture.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** TEXTURE ******************** */ -static bNodeSocketTemplate cmp_node_texture_in[] = { - {SOCK_VECTOR, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION}, - {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_texture_out[] = { - {SOCK_FLOAT, N_("Value")}, - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; - -void register_node_type_cmp_texture(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.cc b/source/blender/nodes/composite/nodes/node_composite_texture.cc new file mode 100644 index 00000000000..4421abdf998 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_texture.cc @@ -0,0 +1,46 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** TEXTURE ******************** */ +static bNodeSocketTemplate cmp_node_texture_in[] = { + {SOCK_VECTOR, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION}, + {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_texture_out[] = { + {SOCK_FLOAT, N_("Value")}, + {SOCK_RGBA, N_("Color")}, + {-1, ""}, +}; + +void register_node_type_cmp_texture(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c deleted file mode 100644 index 5fc86c997f5..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_tonemap_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_tonemap_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeTonemap *ntm = MEM_callocN(sizeof(NodeTonemap), "node tonemap data"); - ntm->type = 1; - ntm->key = 0.18; - ntm->offset = 1; - ntm->gamma = 1; - ntm->f = 0; - ntm->m = 0; /* Actual value is set according to input. */ - /* Default a of 1 works well with natural HDR images, but not always so for CGI. - * Maybe should use 0 or at least lower initial value instead. */ - ntm->a = 1; - ntm->c = 0; - node->storage = ntm; -} - -void register_node_type_cmp_tonemap(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out); - node_type_init(&ntype, node_composit_init_tonemap); - node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc new file mode 100644 index 00000000000..29984e3687c --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc @@ -0,0 +1,61 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_tonemap_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_tonemap_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeTonemap *ntm = (NodeTonemap *)MEM_callocN(sizeof(NodeTonemap), "node tonemap data"); + ntm->type = 1; + ntm->key = 0.18; + ntm->offset = 1; + ntm->gamma = 1; + ntm->f = 0; + ntm->m = 0; /* Actual value is set according to input. */ + /* Default a of 1 works well with natural HDR images, but not always so for CGI. + * Maybe should use 0 or at least lower initial value instead. */ + ntm->a = 1; + ntm->c = 0; + node->storage = ntm; +} + +void register_node_type_cmp_tonemap(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out); + node_type_init(&ntype, node_composit_init_tonemap); + node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c deleted file mode 100644 index d59ce9b8b7a..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -static bNodeSocketTemplate cmp_node_trackpos_out[] = { - {SOCK_FLOAT, N_("X")}, - {SOCK_FLOAT, N_("Y")}, - {SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, - {-1, ""}, -}; - -static void init(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeTrackPosData *data = MEM_callocN(sizeof(NodeTrackPosData), "node track position data"); - - node->storage = data; -} - -void register_node_type_cmp_trackpos(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_trackpos_out); - node_type_init(&ntype, init); - node_type_storage( - &ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc new file mode 100644 index 00000000000..32bf1b5c0d1 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc @@ -0,0 +1,52 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +static bNodeSocketTemplate cmp_node_trackpos_out[] = { + {SOCK_FLOAT, N_("X")}, + {SOCK_FLOAT, N_("Y")}, + {SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, + {-1, ""}, +}; + +static void init(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeTrackPosData *data = (NodeTrackPosData *)MEM_callocN(sizeof(NodeTrackPosData), + "node track position data"); + + node->storage = data; +} + +void register_node_type_cmp_trackpos(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_trackpos_out); + node_type_init(&ntype, init); + node_type_storage( + &ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c deleted file mode 100644 index be526c1059c..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_transform.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2011 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Transform ******************** */ - -static bNodeSocketTemplate cmp_node_transform_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_FLOAT, N_("Angle"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, - {SOCK_FLOAT, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_transform_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -void register_node_type_cmp_transform(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.cc b/source/blender/nodes/composite/nodes/node_composite_transform.cc new file mode 100644 index 00000000000..1695101cdbf --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_transform.cc @@ -0,0 +1,50 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Transform ******************** */ + +static bNodeSocketTemplate cmp_node_transform_in[] = { + {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, + {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, + {SOCK_FLOAT, N_("Angle"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, + {SOCK_FLOAT, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX}, + {-1, ""}, +}; + +static bNodeSocketTemplate cmp_node_transform_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +void register_node_type_cmp_transform(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c deleted file mode 100644 index 43337ec6f7e..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_translate.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_translate_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_translate_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; - -static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeTranslateData *data = MEM_callocN(sizeof(NodeTranslateData), "node translate data"); - node->storage = data; -} - -void register_node_type_cmp_translate(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out); - node_type_init(&ntype, node_composit_init_translate); - node_type_storage( - &ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc new file mode 100644 index 00000000000..0ee8a41a5ea --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -0,0 +1,57 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Translate ******************** */ + +static bNodeSocketTemplate cmp_node_translate_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_translate_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeTranslateData *data = (NodeTranslateData *)MEM_callocN(sizeof(NodeTranslateData), + "node translate data"); + node->storage = data; +} + +void register_node_type_cmp_translate(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, 0); + node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out); + node_type_init(&ntype, node_composit_init_translate); + node_type_storage( + &ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c deleted file mode 100644 index ed6dbfa2bf3..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** VALTORGB ******************** */ -static bNodeSocketTemplate cmp_node_valtorgb_in[] = { - {SOCK_FLOAT, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_valtorgb_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Alpha")}, - {-1, ""}, -}; - -static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->storage = BKE_colorband_add(true); -} - -void register_node_type_cmp_valtorgb(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_valtorgb_in, cmp_node_valtorgb_out); - node_type_size(&ntype, 240, 200, 320); - node_type_init(&ntype, node_composit_init_valtorgb); - node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} - -/* **************** RGBTOBW ******************** */ -static bNodeSocketTemplate cmp_node_rgbtobw_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_rgbtobw_out[] = { - {SOCK_FLOAT, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -void register_node_type_cmp_rgbtobw(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out); - node_type_size_preset(&ntype, NODE_SIZE_SMALL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc b/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc new file mode 100644 index 00000000000..ece52dea269 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc @@ -0,0 +1,74 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** VALTORGB ******************** */ +static bNodeSocketTemplate cmp_node_valtorgb_in[] = { + {SOCK_FLOAT, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_valtorgb_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Alpha")}, + {-1, ""}, +}; + +static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->storage = BKE_colorband_add(true); +} + +void register_node_type_cmp_valtorgb(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_valtorgb_in, cmp_node_valtorgb_out); + node_type_size(&ntype, 240, 200, 320); + node_type_init(&ntype, node_composit_init_valtorgb); + node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} + +/* **************** RGBTOBW ******************** */ +static bNodeSocketTemplate cmp_node_rgbtobw_in[] = { + {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_rgbtobw_out[] = { + {SOCK_FLOAT, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + {-1, ""}, +}; + +void register_node_type_cmp_rgbtobw(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c deleted file mode 100644 index 2ede2cb8c83..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_value.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** VALUE ******************** */ -static bNodeSocketTemplate cmp_node_value_out[] = { - {SOCK_FLOAT, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE}, - {-1, ""}, -}; - -void register_node_type_cmp_value(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, NULL, cmp_node_value_out); - node_type_size_preset(&ntype, NODE_SIZE_SMALL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_value.cc b/source/blender/nodes/composite/nodes/node_composite_value.cc new file mode 100644 index 00000000000..7aab78e6d91 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_value.cc @@ -0,0 +1,41 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** VALUE ******************** */ +static bNodeSocketTemplate cmp_node_value_out[] = { + {SOCK_FLOAT, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE}, + {-1, ""}, +}; + +void register_node_type_cmp_value(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); + node_type_socket_templates(&ntype, nullptr, cmp_node_value_out); + node_type_size_preset(&ntype, NODE_SIZE_SMALL); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c deleted file mode 100644 index 7005ea42afe..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** VECTOR BLUR ******************** */ -static bNodeSocketTemplate cmp_node_vecblur_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_vecblur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; - -static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeBlurData *nbd = MEM_callocN(sizeof(NodeBlurData), "node blur data"); - node->storage = nbd; - nbd->samples = 32; - nbd->fac = 1.0f; -} - -/* custom1: iterations, custom2: maxspeed (0 = nolimit) */ -void register_node_type_cmp_vecblur(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out); - node_type_init(&ntype, node_composit_init_vecblur); - node_type_storage( - &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc new file mode 100644 index 00000000000..c34fdcabc0a --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc @@ -0,0 +1,54 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** VECTOR BLUR ******************** */ +static bNodeSocketTemplate cmp_node_vecblur_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Z"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, + {-1, ""}}; +static bNodeSocketTemplate cmp_node_vecblur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeBlurData *nbd = (NodeBlurData *)MEM_callocN(sizeof(NodeBlurData), "node blur data"); + node->storage = nbd; + nbd->samples = 32; + nbd->fac = 1.0f; +} + +/* custom1: iterations, custom2: maxspeed (0 = nolimit) */ +void register_node_type_cmp_vecblur(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, 0); + node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out); + node_type_init(&ntype, node_composit_init_vecblur); + node_type_storage( + &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c deleted file mode 100644 index b5f74d5c937..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -#include "BKE_global.h" -#include "BKE_image.h" - -/* **************** VIEWER ******************** */ -static bNodeSocketTemplate cmp_node_viewer_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}}; - -static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) -{ - ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user"); - node->storage = iuser; - iuser->sfra = 1; - iuser->ok = 1; - node->custom3 = 0.5f; - node->custom4 = 0.5f; - - node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node"); -} - -void register_node_type_cmp_viewer(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_viewer_in, NULL); - node_type_init(&ntype, node_composit_init_viewer); - node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); - - node_type_internal_links(&ntype, NULL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc new file mode 100644 index 00000000000..a73a7c81357 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc @@ -0,0 +1,60 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "BKE_global.h" +#include "BKE_image.h" + +/* **************** VIEWER ******************** */ +static bNodeSocketTemplate cmp_node_viewer_in[] = { + {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + {-1, ""}}; + +static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) +{ + ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user"); + node->storage = iuser; + iuser->sfra = 1; + iuser->ok = 1; + node->custom3 = 0.5f; + node->custom4 = 0.5f; + + node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node"); +} + +void register_node_type_cmp_viewer(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); + node_type_socket_templates(&ntype, cmp_node_viewer_in, nullptr); + node_type_init(&ntype, node_composit_init_viewer); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + + node_type_internal_links(&ntype, nullptr); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c deleted file mode 100644 index 5041b16c303..00000000000 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2006 Blender Foundation. - * All rights reserved. - */ - -/** \file - * \ingroup cmpnodes - */ - -#include "node_composite_util.h" - -/* **************** Z COMBINE ******************** */ -/* lazy coder NOTE: node->custom2 is abused to send signal. */ -static bNodeSocketTemplate cmp_node_zcombine_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_zcombine_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Z")}, - {-1, ""}, -}; - -void register_node_type_cmp_zcombine(void) -{ - static bNodeType ntype; - - cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc new file mode 100644 index 00000000000..990f9fcd366 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc @@ -0,0 +1,49 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Z COMBINE ******************** */ +/* lazy coder NOTE: node->custom2 is abused to send signal. */ +static bNodeSocketTemplate cmp_node_zcombine_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_zcombine_out[] = { + {SOCK_RGBA, N_("Image")}, + {SOCK_FLOAT, N_("Z")}, + {-1, ""}, +}; + +void register_node_type_cmp_zcombine(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out); + + nodeRegisterType(&ntype); +} -- cgit v1.2.3