Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/CMakeLists.txt230
-rw-r--r--source/blender/nodes/NOD_composite.h (renamed from source/blender/nodes/CMP_node.h)14
-rw-r--r--source/blender/nodes/NOD_shader.h (renamed from source/blender/nodes/SHD_node.h)14
-rw-r--r--source/blender/nodes/NOD_socket.h89
-rw-r--r--source/blender/nodes/NOD_texture.h (renamed from source/blender/nodes/TEX_node.h)14
-rw-r--r--source/blender/nodes/SConscript8
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c811
-rw-r--r--source/blender/nodes/composite/node_composite_util.c (renamed from source/blender/nodes/intern/CMP_util.c)12
-rw-r--r--source/blender/nodes/composite/node_composite_util.h (renamed from source/blender/nodes/intern/CMP_util.h)9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_blur.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_brightness.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.c373
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_composite.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_crop.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_curves.c)50
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_defocus.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_dilate.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_displace.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_displace.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_filter.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_flip.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_flip.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_gamma.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_glare.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_idMask.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_image.c)32
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_invert.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lensdist.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_levels.c)37
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_math.c)21
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_normal.c)36
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_normalize.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_premulkey.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rgb.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_rgb.c)29
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_rotate.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_scale.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c)42
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c)42
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c)42
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c)42
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c)20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_texture.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c)18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_translate.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_valToRgb.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c)32
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_value.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_value.c)26
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_vecBlur.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c)24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_viewer.c)22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_zcombine.c (renamed from source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c)26
-rw-r--r--source/blender/nodes/intern/SHD_util.c219
-rw-r--r--source/blender/nodes/intern/node_common.c982
-rw-r--r--source/blender/nodes/intern/node_common.h65
-rw-r--r--source/blender/nodes/intern/node_exec.c308
-rw-r--r--source/blender/nodes/intern/node_exec.h89
-rw-r--r--source/blender/nodes/intern/node_socket.c428
-rw-r--r--source/blender/nodes/intern/node_util.c18
-rw-r--r--source/blender/nodes/intern/node_util.h13
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c212
-rw-r--r--source/blender/nodes/shader/node_shader_util.c287
-rw-r--r--source/blender/nodes/shader/node_shader_util.h (renamed from source/blender/nodes/intern/SHD_util.h)15
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_camera.c)18
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.c327
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_curves.c)38
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_dynamic.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c)10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geom.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_geom.c)30
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c)24
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_invert.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_invert.c)20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_mapping.c)20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_material.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_material.c)86
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_math.c)20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mixRgb.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c)24
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_normal.c)36
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_output.c)18
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_rgb.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_rgb.c)32
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c)36
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_squeeze.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c)28
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_texture.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_texture.c)22
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_valToRgb.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c)34
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_value.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_value.c)29
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c (renamed from source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c)22
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c237
-rw-r--r--source/blender/nodes/texture/node_texture_util.c (renamed from source/blender/nodes/intern/TEX_util.c)52
-rw-r--r--source/blender/nodes/texture/node_texture_util.h (renamed from source/blender/nodes/intern/TEX_util.h)9
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_at.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_at.c)20
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_bricks.c)33
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_checker.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_checker.c)22
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c271
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_compose.c)24
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_coord.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_coord.c)14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_curves.c)30
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_decompose.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_decompose.c)24
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_distance.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_distance.c)20
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c)26
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_image.c)18
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_invert.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_invert.c)18
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_math.c)20
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c)22
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_output.c)18
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_proc.c)87
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_rotate.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_rotate.c)22
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_scale.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_scale.c)18
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_texture.c)24
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_translate.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_translate.c)20
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToNor.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c)20
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToRgb.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c)32
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_viewer.c (renamed from source/blender/nodes/intern/TEX_nodes/TEX_viewer.c)16
122 files changed, 5939 insertions, 1595 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index c3bd37c18ee..82848c6a5d7 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -38,117 +38,137 @@ set(INC
set(INC_SYS
${GLEW_INCLUDE_PATH}
+ intern
+ composite
+ shader
+ texture
)
set(SRC
- intern/CMP_nodes/CMP_alphaOver.c
- intern/CMP_nodes/CMP_bilateralblur.c
- intern/CMP_nodes/CMP_blur.c
- intern/CMP_nodes/CMP_brightness.c
- intern/CMP_nodes/CMP_channelMatte.c
- intern/CMP_nodes/CMP_chromaMatte.c
- intern/CMP_nodes/CMP_colorMatte.c
- intern/CMP_nodes/CMP_colorSpill.c
- intern/CMP_nodes/CMP_colorbalance.c
- intern/CMP_nodes/CMP_composite.c
- intern/CMP_nodes/CMP_crop.c
- intern/CMP_nodes/CMP_curves.c
- intern/CMP_nodes/CMP_defocus.c
- intern/CMP_nodes/CMP_diffMatte.c
- intern/CMP_nodes/CMP_dilate.c
- intern/CMP_nodes/CMP_directionalblur.c
- intern/CMP_nodes/CMP_displace.c
- intern/CMP_nodes/CMP_distanceMatte.c
- intern/CMP_nodes/CMP_filter.c
- intern/CMP_nodes/CMP_flip.c
- intern/CMP_nodes/CMP_gamma.c
- intern/CMP_nodes/CMP_glare.c
- intern/CMP_nodes/CMP_hueSatVal.c
- intern/CMP_nodes/CMP_huecorrect.c
- intern/CMP_nodes/CMP_idMask.c
- intern/CMP_nodes/CMP_image.c
- intern/CMP_nodes/CMP_invert.c
- intern/CMP_nodes/CMP_lensdist.c
- intern/CMP_nodes/CMP_levels.c
- intern/CMP_nodes/CMP_lummaMatte.c
- intern/CMP_nodes/CMP_mapUV.c
- intern/CMP_nodes/CMP_mapValue.c
- intern/CMP_nodes/CMP_math.c
- intern/CMP_nodes/CMP_mixrgb.c
- intern/CMP_nodes/CMP_normal.c
- intern/CMP_nodes/CMP_normalize.c
- intern/CMP_nodes/CMP_outputFile.c
- intern/CMP_nodes/CMP_premulkey.c
- intern/CMP_nodes/CMP_rgb.c
- intern/CMP_nodes/CMP_rotate.c
- intern/CMP_nodes/CMP_scale.c
- intern/CMP_nodes/CMP_sepcombHSVA.c
- intern/CMP_nodes/CMP_sepcombRGBA.c
- intern/CMP_nodes/CMP_sepcombYCCA.c
- intern/CMP_nodes/CMP_sepcombYUVA.c
- intern/CMP_nodes/CMP_setalpha.c
- intern/CMP_nodes/CMP_splitViewer.c
- intern/CMP_nodes/CMP_texture.c
- intern/CMP_nodes/CMP_tonemap.c
- intern/CMP_nodes/CMP_translate.c
- intern/CMP_nodes/CMP_valToRgb.c
- intern/CMP_nodes/CMP_value.c
- intern/CMP_nodes/CMP_vecBlur.c
- intern/CMP_nodes/CMP_viewer.c
- intern/CMP_nodes/CMP_zcombine.c
- intern/CMP_util.c
- intern/SHD_nodes/SHD_camera.c
- intern/SHD_nodes/SHD_curves.c
- intern/SHD_nodes/SHD_dynamic.c
- intern/SHD_nodes/SHD_geom.c
- intern/SHD_nodes/SHD_hueSatVal.c
- intern/SHD_nodes/SHD_invert.c
- intern/SHD_nodes/SHD_mapping.c
- intern/SHD_nodes/SHD_material.c
- intern/SHD_nodes/SHD_math.c
- intern/SHD_nodes/SHD_mixRgb.c
- intern/SHD_nodes/SHD_normal.c
- intern/SHD_nodes/SHD_output.c
- intern/SHD_nodes/SHD_rgb.c
- intern/SHD_nodes/SHD_sepcombRGB.c
- intern/SHD_nodes/SHD_squeeze.c
- intern/SHD_nodes/SHD_texture.c
- intern/SHD_nodes/SHD_valToRgb.c
- intern/SHD_nodes/SHD_value.c
- intern/SHD_nodes/SHD_vectMath.c
- intern/SHD_util.c
- intern/TEX_nodes/TEX_at.c
- intern/TEX_nodes/TEX_bricks.c
- intern/TEX_nodes/TEX_checker.c
- intern/TEX_nodes/TEX_compose.c
- intern/TEX_nodes/TEX_coord.c
- intern/TEX_nodes/TEX_curves.c
- intern/TEX_nodes/TEX_decompose.c
- intern/TEX_nodes/TEX_distance.c
- intern/TEX_nodes/TEX_hueSatVal.c
- intern/TEX_nodes/TEX_image.c
- intern/TEX_nodes/TEX_invert.c
- intern/TEX_nodes/TEX_math.c
- intern/TEX_nodes/TEX_mixRgb.c
- intern/TEX_nodes/TEX_output.c
- intern/TEX_nodes/TEX_proc.c
- intern/TEX_nodes/TEX_rotate.c
- intern/TEX_nodes/TEX_scale.c
- intern/TEX_nodes/TEX_texture.c
- intern/TEX_nodes/TEX_translate.c
- intern/TEX_nodes/TEX_valToNor.c
- intern/TEX_nodes/TEX_valToRgb.c
- intern/TEX_nodes/TEX_viewer.c
- intern/TEX_util.c
+ composite/nodes/node_composite_alphaOver.c
+ composite/nodes/node_composite_bilateralblur.c
+ composite/nodes/node_composite_blur.c
+ composite/nodes/node_composite_brightness.c
+ composite/nodes/node_composite_channelMatte.c
+ composite/nodes/node_composite_chromaMatte.c
+ composite/nodes/node_composite_colorMatte.c
+ composite/nodes/node_composite_colorSpill.c
+ composite/nodes/node_composite_colorbalance.c
+ composite/nodes/node_composite_common.c
+ composite/nodes/node_composite_composite.c
+ composite/nodes/node_composite_crop.c
+ composite/nodes/node_composite_curves.c
+ composite/nodes/node_composite_defocus.c
+ composite/nodes/node_composite_diffMatte.c
+ composite/nodes/node_composite_dilate.c
+ composite/nodes/node_composite_directionalblur.c
+ composite/nodes/node_composite_displace.c
+ composite/nodes/node_composite_distanceMatte.c
+ composite/nodes/node_composite_filter.c
+ composite/nodes/node_composite_flip.c
+ composite/nodes/node_composite_gamma.c
+ composite/nodes/node_composite_glare.c
+ composite/nodes/node_composite_hueSatVal.c
+ composite/nodes/node_composite_huecorrect.c
+ composite/nodes/node_composite_idMask.c
+ composite/nodes/node_composite_image.c
+ composite/nodes/node_composite_invert.c
+ composite/nodes/node_composite_lensdist.c
+ composite/nodes/node_composite_levels.c
+ composite/nodes/node_composite_lummaMatte.c
+ composite/nodes/node_composite_mapUV.c
+ composite/nodes/node_composite_mapValue.c
+ composite/nodes/node_composite_math.c
+ composite/nodes/node_composite_mixrgb.c
+ composite/nodes/node_composite_normal.c
+ composite/nodes/node_composite_normalize.c
+ composite/nodes/node_composite_outputFile.c
+ composite/nodes/node_composite_premulkey.c
+ composite/nodes/node_composite_rgb.c
+ composite/nodes/node_composite_rotate.c
+ composite/nodes/node_composite_scale.c
+ composite/nodes/node_composite_sepcombHSVA.c
+ composite/nodes/node_composite_sepcombRGBA.c
+ composite/nodes/node_composite_sepcombYCCA.c
+ composite/nodes/node_composite_sepcombYUVA.c
+ composite/nodes/node_composite_setalpha.c
+ composite/nodes/node_composite_splitViewer.c
+ composite/nodes/node_composite_texture.c
+ composite/nodes/node_composite_tonemap.c
+ composite/nodes/node_composite_translate.c
+ composite/nodes/node_composite_valToRgb.c
+ composite/nodes/node_composite_value.c
+ composite/nodes/node_composite_vecBlur.c
+ composite/nodes/node_composite_viewer.c
+ composite/nodes/node_composite_zcombine.c
+ composite/node_composite_tree.c
+ composite/node_composite_util.c
+
+ shader/nodes/node_shader_camera.c
+ shader/nodes/node_shader_common.c
+ shader/nodes/node_shader_curves.c
+ shader/nodes/node_shader_dynamic.c
+ shader/nodes/node_shader_geom.c
+ shader/nodes/node_shader_hueSatVal.c
+ shader/nodes/node_shader_invert.c
+ shader/nodes/node_shader_mapping.c
+ shader/nodes/node_shader_material.c
+ shader/nodes/node_shader_math.c
+ shader/nodes/node_shader_mixRgb.c
+ shader/nodes/node_shader_normal.c
+ shader/nodes/node_shader_output.c
+ shader/nodes/node_shader_rgb.c
+ shader/nodes/node_shader_sepcombRGB.c
+ shader/nodes/node_shader_squeeze.c
+ shader/nodes/node_shader_texture.c
+ shader/nodes/node_shader_valToRgb.c
+ shader/nodes/node_shader_value.c
+ shader/nodes/node_shader_vectMath.c
+ shader/node_shader_tree.c
+ shader/node_shader_util.c
+
+ texture/nodes/node_texture_at.c
+ texture/nodes/node_texture_bricks.c
+ texture/nodes/node_texture_checker.c
+ texture/nodes/node_texture_common.c
+ texture/nodes/node_texture_compose.c
+ texture/nodes/node_texture_coord.c
+ texture/nodes/node_texture_curves.c
+ texture/nodes/node_texture_decompose.c
+ texture/nodes/node_texture_distance.c
+ texture/nodes/node_texture_hueSatVal.c
+ texture/nodes/node_texture_image.c
+ texture/nodes/node_texture_invert.c
+ texture/nodes/node_texture_math.c
+ texture/nodes/node_texture_mixRgb.c
+ texture/nodes/node_texture_output.c
+ texture/nodes/node_texture_proc.c
+ texture/nodes/node_texture_rotate.c
+ texture/nodes/node_texture_scale.c
+ texture/nodes/node_texture_texture.c
+ texture/nodes/node_texture_translate.c
+ texture/nodes/node_texture_valToNor.c
+ texture/nodes/node_texture_valToRgb.c
+ texture/nodes/node_texture_viewer.c
+ texture/node_texture_tree.c
+ texture/node_texture_util.c
+
intern/node_util.c
+ intern/node_exec.c
+ intern/node_common.c
+ intern/node_socket.c
+
+ composite/node_composite_util.h
+ shader/node_shader_util.h
+ texture/node_texture_util.h
- CMP_node.h
- SHD_node.h
- TEX_node.h
- intern/CMP_util.h
- intern/SHD_util.h
- intern/TEX_util.h
+ NOD_composite.h
+ NOD_shader.h
+ NOD_texture.h
+ NOD_socket.h
intern/node_util.h
+ intern/node_exec.h
+ intern/node_common.h
)
if(WITH_PYTHON)
diff --git a/source/blender/nodes/CMP_node.h b/source/blender/nodes/NOD_composite.h
index 65c9236710f..ab56199079e 100644
--- a/source/blender/nodes/CMP_node.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_node.h 36550 2011-05-08 16:08:08Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -30,18 +30,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file CMP_node.h
+/** \file NOD_composite.h
* \ingroup nodes
*/
-#ifndef CMP_NODE_H
-#define CMP_NODE_H
+#ifndef NOD_composite_H
+#define NOD_composite_H
#include "BKE_node.h"
+extern bNodeTreeType ntreeType_Composite;
+
/* ****************** types array for all composite nodes ****************** */
+void register_node_type_cmp_group(ListBase *lb);
+void register_node_type_cmp_forloop(ListBase *lb);
+void register_node_type_cmp_whileloop(ListBase *lb);
+
void register_node_type_cmp_rlayers(ListBase *lb);
void register_node_type_cmp_image(ListBase *lb);
void register_node_type_cmp_texture(ListBase *lb);
diff --git a/source/blender/nodes/SHD_node.h b/source/blender/nodes/NOD_shader.h
index 80e5eec6893..5bc0c381f0b 100644
--- a/source/blender/nodes/SHD_node.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_node.h 36550 2011-05-08 16:08:08Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -30,19 +30,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file SHD_node.h
+/** \file NOD_shader.h
* \ingroup nodes
*/
-#ifndef SHD_NODE_H
-#define SHD_NODE_H
+#ifndef NOD_SHADER_H
+#define NOD_SHADER_H
#include "BKE_node.h"
+extern struct bNodeTreeType ntreeType_Shader;
+
/* the type definitions array */
/* ****************** types array for all shaders ****************** */
+void register_node_type_sh_group(ListBase *lb);
+void register_node_type_sh_forloop(ListBase *lb);
+void register_node_type_sh_whileloop(ListBase *lb);
+
void register_node_type_sh_output(ListBase *lb);
void register_node_type_sh_material(ListBase *lb);
void register_node_type_sh_camera(ListBase *lb);
diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h
new file mode 100644
index 00000000000..92e8a8e058d
--- /dev/null
+++ b/source/blender/nodes/NOD_socket.h
@@ -0,0 +1,89 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file NOD_socket.h
+ * \ingroup nodes
+ */
+
+
+#ifndef NOD_SOCKET_H_
+#define NOD_SOCKET_H_
+
+#include "DNA_listBase.h"
+
+#include "BLI_utildefines.h"
+
+#include "BKE_node.h"
+
+#include "RNA_types.h"
+
+struct bNodeTree;
+struct bNode;
+struct bNodeStack;
+
+void node_socket_type_init(struct bNodeSocketType *types[]);
+
+struct bNodeSocket *nodeAddInputInt(struct bNodeTree *ntree, struct bNode *node, const char *name, PropertySubType subtype, int value, int min, int max);
+struct bNodeSocket *nodeAddOutputInt(struct bNodeTree *ntree, struct bNode *node, const char *name);
+
+struct bNodeSocket *nodeAddInputFloat(struct bNodeTree *ntree, struct bNode *node, const char *name, PropertySubType subtype, float value, float min, float max);
+struct bNodeSocket *nodeAddOutputFloat(struct bNodeTree *ntree, struct bNode *node, const char *name);
+
+struct bNodeSocket *nodeAddInputBoolean(struct bNodeTree *ntree, struct bNode *node, const char *name, char value);
+struct bNodeSocket *nodeAddOutputBoolean(struct bNodeTree *ntree, struct bNode *node, const char *name);
+
+struct bNodeSocket *nodeAddInputVector(struct bNodeTree *ntree, struct bNode *node, const char *name, PropertySubType subtype, float x, float y, float z, float min, float max);
+struct bNodeSocket *nodeAddOutputVector(struct bNodeTree *ntree, struct bNode *node, const char *name);
+
+struct bNodeSocket *nodeAddInputRGBA(struct bNodeTree *ntree, struct bNode *node, const char *name, float r, float g, float b, float a);
+struct bNodeSocket *nodeAddOutputRGBA(struct bNodeTree *ntree, struct bNode *node, const char *name);
+
+struct bNodeSocket *nodeAddInputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name);
+struct bNodeSocket *nodeAddOutputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name);
+
+struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp);
+struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp);
+
+void node_verify_socket_templates(struct bNodeTree *ntree, struct bNode *node);
+
+
+/* Socket Converters */
+
+#define SOCK_VECTOR_X 1
+#define SOCK_VECTOR_Y 2
+#define SOCK_VECTOR_Z 3
+
+#define SOCK_RGBA_R 1
+#define SOCK_RGBA_G 2
+#define SOCK_RGBA_B 3
+#define SOCK_RGBA_A 4
+
+#define SOCK_MESH_VERT_CO 1
+#define SOCK_MESH_VERT_NO 2
+
+#endif
diff --git a/source/blender/nodes/TEX_node.h b/source/blender/nodes/NOD_texture.h
index 23a6b4427af..6f30685aff1 100644
--- a/source/blender/nodes/TEX_node.h
+++ b/source/blender/nodes/NOD_texture.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: TEX_node.h 36550 2011-05-08 16:08:08Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -30,18 +30,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file TEX_node.h
+/** \file NOD_texture.h
* \ingroup nodes
*/
-#ifndef TEX_NODE_H
-#define TEX_NODE_H
+#ifndef NOD_TEXTURE_H
+#define NOD_TEXTURE_H
#include "BKE_node.h"
+extern bNodeTreeType ntreeType_Texture;
+
/* ****************** types array for all texture nodes ****************** */
+void register_node_type_tex_group(ListBase *lb);
+void register_node_type_tex_forloop(ListBase *lb);
+void register_node_type_tex_whileloop(ListBase *lb);
+
void register_node_type_tex_math(ListBase *lb);
void register_node_type_tex_mix_rgb(ListBase *lb);
void register_node_type_tex_valtorgb(ListBase *lb);
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index 8d17c6f5e16..0cbc7b80933 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -2,11 +2,11 @@
Import ('env')
sources = env.Glob('intern/*.c')
-cmpsources = env.Glob('intern/CMP_nodes/*.c')
-shdsources = env.Glob('intern/SHD_nodes/*.c')
-texsources = env.Glob('intern/TEX_nodes/*.c')
-
+cmpsources = env.Glob('composite/*.c') + env.Glob('composite/nodes/*.c')
+shdsources = env.Glob('shader/*.c') + env.Glob('shader/nodes/*.c')
+texsources = env.Glob('texture/*.c') + env.Glob('texture/nodes/*.c')
incs = '. ./intern '
+incs += './composite ./shader ./texture '
incs += '#/intern/guardedalloc ../editors/include ../blenlib ../makesdna'
incs += ' ../render/extern/include ../makesrna '
incs += ' ../imbuf ../avi '
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
new file mode 100644
index 00000000000..1a2fb04be8c
--- /dev/null
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -0,0 +1,811 @@
+/**
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/node_composite_tree.c
+ * \ingroup nodes
+ */
+
+
+#include <stdio.h>
+
+#include "DNA_anim_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_threads.h"
+
+#include "BKE_animsys.h"
+#include "BKE_colortools.h"
+#include "BKE_fcurve.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_utildefines.h"
+
+#include "node_exec.h"
+#include "node_util.h"
+
+#include "PIL_time.h"
+
+#include "RNA_access.h"
+
+#include "NOD_composite.h"
+#include "node_composite_util.h"
+
+static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
+{
+ Scene *sce;
+ for(sce= main->scene.first; sce; sce= sce->id.next) {
+ if(sce->nodetree) {
+ func(calldata, &sce->id, sce->nodetree);
+ }
+ }
+}
+
+static void free_node_cache(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;
+ }
+ }
+}
+
+static void free_cache(bNodeTree *ntree)
+{
+ bNode *node;
+ for(node= ntree->nodes.first; node; node= node->next)
+ free_node_cache(ntree, node);
+}
+
+static void update_node(bNodeTree *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;
+
+ /* individual node update call */
+ if (node->typeinfo->updatefunc)
+ node->typeinfo->updatefunc(ntree, node);
+}
+
+/* local tree then owns all compbufs */
+static void localize(bNodeTree *UNUSED(localtree), bNodeTree *ntree)
+{
+ bNode *node;
+ bNodeSocket *sock;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ /* ensure new user input gets handled ok */
+ node->need_exec= 0;
+
+ /* 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)
+ node->new_node->id= (ID *)copy_image((Image *)node->id);
+ else
+ node->new_node->id= NULL;
+ }
+ }
+
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ sock->new_sock->cache= sock->cache;
+ compbuf_set_node(sock->new_sock->cache, node->new_node);
+
+ sock->cache= NULL;
+ sock->new_sock->new_sock= sock;
+ }
+ }
+}
+
+static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
+{
+ bNode *lnode;
+
+ /* move over the compbufs and previews */
+ for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
+ if(ntreeNodeExists(ntree, lnode->new_node)) {
+
+ if(lnode->preview && lnode->preview->rect) {
+ nodeFreePreview(lnode->new_node);
+ lnode->new_node->preview= lnode->preview;
+ lnode->preview= NULL;
+ }
+ }
+ }
+ }
+}
+
+static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
+{
+ bNode *lnode;
+ bNodeSocket *lsock;
+
+ /* move over the compbufs and previews */
+ 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((Image *)lnode->new_node->id, (Image *)lnode->id);
+ }
+ }
+
+ for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
+ if(ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
+ lsock->new_sock->cache= lsock->cache;
+ compbuf_set_node(lsock->new_sock->cache, lnode->new_node);
+ lsock->cache= NULL;
+ lsock->new_sock= NULL;
+ }
+ }
+ }
+ }
+}
+
+bNodeTreeType ntreeType_Composite = {
+ /* type */ NTREE_COMPOSIT,
+ /* idname */ "NTCompositing Nodetree",
+
+ /* node_types */ { NULL, NULL },
+
+ /* free_cache */ free_cache,
+ /* free_node_cache */ free_node_cache,
+ /* foreach_nodetree */ foreach_nodetree,
+ /* localize */ localize,
+ /* local_sync */ local_sync,
+ /* local_merge */ local_merge,
+ /* update */ NULL,
+ /* update_node */ update_node
+};
+
+
+struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree)
+{
+ bNodeTreeExec *exec;
+ bNode *node;
+ bNodeSocket *sock;
+
+ /* XXX hack: prevent exec data from being generated twice.
+ * this should be handled by the renderer!
+ */
+ if (ntree->execdata)
+ return ntree->execdata;
+
+ /* ensures only a single output node is enabled */
+ ntreeSetOutput(ntree);
+
+ exec = ntree_exec_begin(ntree);
+
+ for(node= exec->nodetree->nodes.first; node; node= node->next) {
+ /* initialize needed for groups */
+ node->exec= 0;
+
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
+ if(ns && sock->cache) {
+ ns->data= sock->cache;
+ sock->cache= NULL;
+ }
+ }
+ /* cannot initialize them while using in threads */
+ if(ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) {
+ curvemapping_initialize(node->storage);
+ if(node->type==CMP_NODE_CURVE_RGB)
+ curvemapping_premultiply(node->storage, 0);
+ }
+ }
+
+ /* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
+ * which only store the ntree pointer. Should be fixed at some point!
+ */
+ ntree->execdata = exec;
+
+ return exec;
+}
+
+void ntreeCompositEndExecTree(bNodeTreeExec *exec)
+{
+ if(exec) {
+ bNodeTree *ntree= exec->nodetree;
+ bNode *node;
+ bNodeStack *ns;
+
+ for(node= exec->nodetree->nodes.first; node; node= node->next) {
+ bNodeSocket *sock;
+
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ ns = node_get_socket_stack(exec->stack, sock);
+ if(ns && ns->data) {
+ sock->cache= ns->data;
+ ns->data= NULL;
+ }
+ }
+ if(node->type==CMP_NODE_CURVE_RGB)
+ curvemapping_premultiply(node->storage, 1);
+
+ node->need_exec= 0;
+ }
+
+ ntree_exec_end(exec);
+
+ /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
+ ntree->execdata = NULL;
+ }
+}
+
+/* ***************************** threaded version for execute composite nodes ************* */
+/* these are nodes without input, only giving values */
+/* or nodes with only value inputs */
+static int node_only_value(bNode *node)
+{
+ bNodeSocket *sock;
+
+ if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB))
+ return 1;
+
+ /* doing this for all node types goes wrong. memory free errors */
+ if(node->inputs.first && node->type==CMP_NODE_MAP_VALUE) {
+ int retval= 1;
+ for(sock= node->inputs.first; sock; sock= sock->next) {
+ if(sock->link)
+ retval &= node_only_value(sock->link->fromnode);
+ }
+ return retval;
+ }
+ return 0;
+}
+
+/* not changing info, for thread callback */
+typedef struct ThreadData {
+ bNodeStack *stack;
+ RenderData *rd;
+} ThreadData;
+
+static void *exec_composite_node(void *nodeexec_v)
+{
+ bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeExec *nodeexec= nodeexec_v;
+ bNode *node= nodeexec->node;
+ ThreadData *thd= (ThreadData *)node->threaddata;
+
+ node_get_stack(node, thd->stack, nsin, nsout);
+
+ if((node->flag & NODE_MUTED) && (!node_only_value(node))) {
+ /* viewers we execute, for feedback to user */
+ if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
+ else
+ node_compo_pass_on(node, nsin, nsout);
+ }
+ else if(node->typeinfo->execfunc)
+ node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
+ else if (node->typeinfo->newexecfunc)
+ node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
+
+ node->exec |= NODE_READY;
+ return 0;
+}
+
+/* return total of executable nodes, for timecursor */
+static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
+{
+ bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
+ bNode *node;
+ bNodeSocket *sock;
+ int totnode= 0, group_edit= 0;
+
+ /* note; do not add a dependency sort here, the stack was created already */
+
+ /* if we are in group edit, viewer nodes get skipped when group has viewer */
+ for(node= ntree->nodes.first; node; node= node->next)
+ if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+ if(ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
+ group_edit= 1;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ int a;
+
+ node_get_stack(node, thd->stack, nsin, nsout);
+
+ /* test the outputs */
+ /* skip value-only nodes (should be in type!) */
+ if(!node_only_value(node)) {
+ for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if(nsout[a]->data==NULL && nsout[a]->hasoutput) {
+ node->need_exec= 1;
+ break;
+ }
+ }
+ }
+
+ /* test the inputs */
+ for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+ /* skip viewer nodes in bg render or group edit */
+ if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit))
+ node->need_exec= 0;
+ /* is sock in use? */
+ else if(sock->link) {
+ bNodeLink *link= sock->link;
+
+ /* this is the test for a cyclic case */
+ if(link->fromnode==NULL || link->tonode==NULL);
+ else if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
+ if(link->fromnode->need_exec) {
+ node->need_exec= 1;
+ break;
+ }
+ }
+ else {
+ node->need_exec= 0;
+ printf("Node %s skipped, cyclic dependency\n", node->name);
+ }
+ }
+ }
+
+ if(node->need_exec) {
+
+ /* free output buffers */
+ for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if(nsout[a]->data) {
+ free_compbuf(nsout[a]->data);
+ nsout[a]->data= NULL;
+ }
+ }
+ totnode++;
+ /* printf("node needs exec %s\n", node->name); */
+
+ /* tag for getExecutableNode() */
+ node->exec= 0;
+ }
+ else {
+ /* tag for getExecutableNode() */
+ node->exec= NODE_READY|NODE_FINISHED|NODE_SKIPPED;
+
+ }
+ }
+
+ /* last step: set the stack values for only-value nodes */
+ /* just does all now, compared to a full buffer exec this is nothing */
+ if(totnode) {
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->need_exec==0 && node_only_value(node)) {
+ if(node->typeinfo->execfunc) {
+ node_get_stack(node, thd->stack, nsin, nsout);
+ node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
+ }
+ }
+ }
+ }
+
+ return totnode;
+}
+
+/* while executing tree, free buffers from nodes that are not needed anymore */
+static void freeExecutableNode(bNodeTree *ntree, bNodeTreeExec *exec)
+{
+ /* node outputs can be freed when:
+ - not a render result or image node
+ - when node outputs go to nodes all being set NODE_FINISHED
+ */
+ bNode *node;
+ bNodeSocket *sock;
+
+ /* set exec flag for finished nodes that might need freed */
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->type!=CMP_NODE_R_LAYERS)
+ if(node->exec & NODE_FINISHED)
+ node->exec |= NODE_FREEBUFS;
+ }
+ /* clear this flag for input links that are not done yet */
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if((node->exec & NODE_FINISHED)==0) {
+ for(sock= node->inputs.first; sock; sock= sock->next)
+ if(sock->link)
+ sock->link->fromnode->exec &= ~NODE_FREEBUFS;
+ }
+ }
+ /* now we can free buffers */
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->exec & NODE_FREEBUFS) {
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
+ if(ns && ns->data) {
+ free_compbuf(ns->data);
+ ns->data= NULL;
+ // printf("freed buf node %s \n", node->name);
+ }
+ }
+ }
+ }
+}
+
+static bNodeExec *getExecutableNode(bNodeTreeExec *exec)
+{
+ bNodeExec *nodeexec;
+ bNodeSocket *sock;
+ int n;
+
+ for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ if(nodeexec->node->exec==0) {
+ /* input sockets should be ready */
+ for(sock= nodeexec->node->inputs.first; sock; sock= sock->next) {
+ if(sock->link && sock->link->fromnode)
+ if((sock->link->fromnode->exec & NODE_READY)==0)
+ break;
+ }
+ if(sock==NULL)
+ return nodeexec;
+ }
+ }
+ return NULL;
+}
+
+/* check if texture nodes need exec or end */
+static void ntree_composite_texnode(bNodeTree *ntree, int init)
+{
+ bNode *node;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->type==CMP_NODE_TEXTURE && node->id) {
+ Tex *tex= (Tex *)node->id;
+ if(tex->nodetree && tex->use_nodes) {
+ /* has internal flag to detect it only does it once */
+ if(init) {
+ if (!tex->nodetree->execdata)
+ tex->nodetree->execdata = ntreeTexBeginExecTree(tex->nodetree);
+ }
+ else
+ ntreeTexEndExecTree(tex->nodetree->execdata);
+ tex->nodetree->execdata = NULL;
+ }
+ }
+ }
+
+}
+
+/* optimized tree execute test for compositing */
+void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
+{
+ bNodeExec *nodeexec;
+ bNode *node;
+ ListBase threads;
+ ThreadData thdata;
+ int totnode, curnode, rendering= 1, n;
+ bNodeTreeExec *exec= NULL;
+
+ if(ntree==NULL) return;
+
+ if(do_preview)
+ ntreeInitPreview(ntree, 0, 0);
+
+ if (!ntree->execdata)
+ exec = ntreeCompositBeginExecTree(ntree);
+ ntree_composite_texnode(ntree, 1);
+
+ /* prevent unlucky accidents */
+ if(G.background)
+ rd->scemode &= ~R_COMP_CROP;
+
+ /* setup callerdata for thread callback */
+ thdata.rd= rd;
+ thdata.stack= exec->stack;
+
+ /* fixed seed, for example noise texture */
+ BLI_srandom(rd->cfra);
+
+ /* sets need_exec tags in nodes */
+ curnode = totnode= setExecutableNodes(ntree, &thdata);
+
+ BLI_init_threads(&threads, exec_composite_node, rd->threads);
+
+ while(rendering) {
+
+ if(BLI_available_threads(&threads)) {
+ nodeexec= getExecutableNode(exec);
+ if(nodeexec) {
+ node = nodeexec->node;
+ if(ntree->progress && totnode)
+ ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode));
+ if(ntree->stats_draw) {
+ char str[64];
+ sprintf(str, "Compositing %d %s", curnode, node->name);
+ ntree->stats_draw(ntree->sdh, str);
+ }
+ curnode--;
+
+ node->threaddata = &thdata;
+ node->exec= NODE_PROCESSING;
+ BLI_insert_thread(&threads, nodeexec);
+ }
+ else
+ PIL_sleep_ms(50);
+ }
+ else
+ PIL_sleep_ms(50);
+
+ rendering= 0;
+ /* test for ESC */
+ if(ntree->test_break && ntree->test_break(ntree->tbh)) {
+ for(node= ntree->nodes.first; node; node= node->next)
+ node->exec |= NODE_READY;
+ }
+
+ /* check for ready ones, and if we need to continue */
+ for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node;
+ if(node->exec & NODE_READY) {
+ if((node->exec & NODE_FINISHED)==0) {
+ BLI_remove_thread(&threads, nodeexec); /* this waits for running thread to finish btw */
+ node->exec |= NODE_FINISHED;
+
+ /* freeing unused buffers */
+ if(rd->scemode & R_COMP_FREE)
+ freeExecutableNode(ntree, exec);
+ }
+ }
+ else rendering= 1;
+ }
+ }
+
+ BLI_end_threads(&threads);
+
+ ntreeCompositEndExecTree(exec);
+}
+
+/* *********************************************** */
+
+/* clumsy checking... should do dynamic outputs once */
+static void force_hidden_passes(bNode *node, int passflag)
+{
+ bNodeSocket *sock;
+
+ for(sock= node->outputs.first; sock; sock= sock->next)
+ sock->flag &= ~SOCK_UNAVAIL;
+
+ sock= BLI_findlink(&node->outputs, RRES_OUT_Z);
+ if(!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_NORMAL);
+ if(!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_VEC);
+ if(!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_UV);
+ if(!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_RGBA);
+ if(!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF);
+ if(!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_SPEC);
+ if(!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_SHADOW);
+ if(!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_AO);
+ if(!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_REFLECT);
+ if(!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT);
+ if(!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT);
+ if(!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
+ if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA);
+ if(!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_MIST);
+ if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT);
+ if(!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
+ sock= BLI_findlink(&node->outputs, RRES_OUT_ENV);
+ if(!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
+
+}
+
+/* based on rules, force sockets hidden always */
+void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
+{
+ bNode *node;
+
+ if(ntree==NULL) return;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if( node->type==CMP_NODE_R_LAYERS) {
+ Scene *sce= node->id?(Scene *)node->id:curscene;
+ SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
+ if(srl)
+ force_hidden_passes(node, srl->passflag);
+ }
+ else if( node->type==CMP_NODE_IMAGE) {
+ Image *ima= (Image *)node->id;
+ if(ima) {
+ if(ima->rr) {
+ ImageUser *iuser= node->storage;
+ RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
+ if(rl)
+ force_hidden_passes(node, rl->passflag);
+ else
+ force_hidden_passes(node, 0);
+ }
+ else if(ima->type!=IMA_TYPE_MULTILAYER) { /* if ->rr not yet read we keep inputs */
+ force_hidden_passes(node, RRES_OUT_Z);
+ }
+ else
+ force_hidden_passes(node, 0);
+ }
+ else
+ force_hidden_passes(node, 0);
+ }
+ }
+
+}
+
+/* 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 *curscene)
+{
+ Scene *sce;
+
+ for(sce= G.main->scene.first; sce; sce= sce->id.next) {
+ if(sce->nodetree) {
+ bNode *node;
+
+ for(node= sce->nodetree->nodes.first; node; node= node->next) {
+ if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE)
+ NodeTagChanged(sce->nodetree, node);
+ else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
+ NodeTagChanged(sce->nodetree, node);
+ }
+ }
+ }
+}
+
+static int node_animation_properties(bNodeTree *ntree, bNode *node)
+{
+ bNodeSocket *sock;
+ const ListBase *lb;
+ Link *link;
+ PointerRNA ptr;
+ PropertyRNA *prop;
+
+ /* check to see if any of the node's properties have fcurves */
+ RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
+ lb = RNA_struct_type_properties(ptr.type);
+
+ for (link=lb->first; link; link=link->next) {
+ int driven, len=1, index;
+ prop = (PropertyRNA *)link;
+
+ if (RNA_property_array_check(prop))
+ len = RNA_property_array_length(&ptr, prop);
+
+ for (index=0; index<len; index++) {
+ if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) {
+ NodeTagChanged(ntree, node);
+ return 1;
+ }
+ }
+ }
+
+ /* now check node sockets */
+ for (sock = node->inputs.first; sock; sock=sock->next) {
+ int driven, len=1, index;
+
+ RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
+ prop = RNA_struct_find_property(&ptr, "default_value");
+ if (prop) {
+ if (RNA_property_array_check(prop))
+ len = RNA_property_array_length(&ptr, prop);
+
+ for (index=0; index<len; index++) {
+ if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) {
+ NodeTagChanged(ntree, node);
+ return 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* tags nodes that have animation capabilities */
+int ntreeCompositTagAnimated(bNodeTree *ntree)
+{
+ bNode *node;
+ int tagged= 0;
+
+ if(ntree==NULL) return 0;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+
+ tagged = node_animation_properties(ntree, node);
+
+ /* otherwise always tag these node types */
+ if(node->type==CMP_NODE_IMAGE) {
+ Image *ima= (Image *)node->id;
+ if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ NodeTagChanged(ntree, node);
+ tagged= 1;
+ }
+ }
+ else if(node->type==CMP_NODE_TIME) {
+ NodeTagChanged(ntree, node);
+ tagged= 1;
+ }
+ /* here was tag render layer, but this is called after a render, so re-composites fail */
+ else if(node->type==NODE_GROUP) {
+ if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
+ NodeTagChanged(ntree, node);
+ }
+ }
+ }
+
+ return tagged;
+}
+
+
+/* called from image window preview */
+void ntreeCompositTagGenerators(bNodeTree *ntree)
+{
+ bNode *node;
+
+ if(ntree==NULL) return;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
+ NodeTagChanged(ntree, node);
+ }
+}
+
+/* XXX after render animation system gets a refresh, this call allows composite to end clean */
+void ntreeClearTags(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)
+ ntreeClearTags((bNodeTree *)node->id);
+ }
+}
diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/composite/node_composite_util.c
index a763f34a644..f7759775af0 100644
--- a/source/blender/nodes/intern/CMP_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_util.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,12 +27,12 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_util.c
+/** \file blender/nodes/composite/node_composite_util.c
* \ingroup nodes
*/
-#include "CMP_util.h"
+#include "node_composite_util.h"
CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
{
@@ -67,7 +67,7 @@ CompBuf *dupalloc_compbuf(CompBuf *cbuf)
{
CompBuf *dupbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
if(dupbuf) {
- memmove(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
+ memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
dupbuf->xof= cbuf->xof;
dupbuf->yof= cbuf->yof;
@@ -156,7 +156,7 @@ void node_compo_pass_on(bNode *node, bNodeStack **nsin, bNodeStack **nsout)
if(valbuf || colbuf || vecbuf) {
for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
if(nsout[a]->hasoutput) {
- if(sock->type==SOCK_VALUE && valbuf) {
+ if(sock->type==SOCK_FLOAT && valbuf) {
nsout[a]->data= pass_on_compbuf(valbuf);
valbuf= NULL;
}
@@ -1325,7 +1325,7 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy)
if (src->x < 3) xy &= ~(int) 1;
if (src->y < 3) xy &= ~(int) 2;
if (xy < 1) return;
-
+
// see "Recursive Gabor Filtering" by Young/VanVliet
// all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200
if (sigma >= 3.556)
diff --git a/source/blender/nodes/intern/CMP_util.h b/source/blender/nodes/composite/node_composite_util.h
index 3f37eae2af9..e3158b2a286 100644
--- a/source/blender/nodes/intern/CMP_util.h
+++ b/source/blender/nodes/composite/node_composite_util.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_util.h 35562 2011-03-15 20:10:32Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,13 +27,13 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_util.h
+/** \file blender/nodes/composite/node_composite_util.h
* \ingroup nodes
*/
-#ifndef CMP_NODE_UTILS_H_
-#define CMP_NODE_UTILS_H_
+#ifndef NODE_COMPOSITE_UTIL_H_
+#define NODE_COMPOSITE_UTIL_H_
#include <stdlib.h>
#include <string.h>
@@ -70,7 +70,6 @@
#include "BKE_library.h"
#include "BKE_object.h"
-#include "../CMP_node.h"
#include "node_util.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 9dcdfaf21e6..400bdd92b6f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_alphaOver.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
+/** \file blender/nodes/composite/nodes/node_composite_alphaOver.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** ALPHAOVER ******************** */
-static bNodeSocketType cmp_node_alphaover_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_alphaover_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_alphaover_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_alphaover_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -140,7 +140,7 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
}
}
-static void node_alphaover_init(bNode* node)
+static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
}
@@ -149,8 +149,8 @@ void register_node_type_cmp_alphaover(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_ALPHAOVER, "AlphaOver", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_alphaover_in, cmp_node_alphaover_out);
+ node_type_base(&ntype, CMP_NODE_ALPHAOVER, "AlphaOver", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out);
node_type_size(&ntype, 80, 40, 120);
node_type_init(&ntype, node_alphaover_init);
node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index c106b437e17..e7a9ee12ca1 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
+/** \file blender/nodes/composite/nodes/node_composite_bilateralblur.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** BILATERALBLUR ******************** */
-static bNodeSocketType cmp_node_bilateralblur_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Determinator", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_bilateralblur_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_RGBA, 1, "Determinator", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_bilateralblur_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_bilateralblur_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -247,7 +247,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
free_compbuf(new);
}
-static void node_composit_init_bilateralblur(bNode* node)
+static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeBilateralBlurData *nbbd= MEM_callocN(sizeof(NodeBilateralBlurData), "node bilateral blur data");
node->storage= nbbd;
@@ -259,8 +259,8 @@ void register_node_type_cmp_bilateralblur(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- cmp_node_bilateralblur_in, cmp_node_bilateralblur_out);
+ node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out);
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_bilateralblur);
node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index 718578a921b..7b1a9623845 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_blur.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -28,21 +28,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_blur.c
+/** \file blender/nodes/composite/nodes/node_composite_blur.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** BLUR ******************** */
-static bNodeSocketType cmp_node_blur_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Size", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_blur_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Size", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_blur_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_blur_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -713,7 +713,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
generate_preview(data, node, out[0]->data);
}
-static void node_composit_init_blur(bNode* node)
+static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data");
}
@@ -722,8 +722,8 @@ void register_node_type_cmp_blur(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_blur_in, cmp_node_blur_out);
+ node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out);
node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_blur);
node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index 50a8d05b03d..1a5cf956a52 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -1,5 +1,5 @@
/*
-* $Id$
+* $Id: CMP_brightness.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -28,24 +28,24 @@
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_brightness.c
+/** \file blender/nodes/composite/nodes/node_composite_brightness.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Brigh and contrsast ******************** */
-static bNodeSocketType cmp_node_brightcontrast_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Bright", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f},
- { SOCK_VALUE, 1, "Contrast", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f},
+static bNodeSocketTemplate cmp_node_brightcontrast_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Bright", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Contrast", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_brightcontrast_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_brightcontrast_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -100,8 +100,8 @@ void register_node_type_cmp_brightcontrast(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
+ node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_brightcontrast);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index e395716f36d..afdbe82aebc 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_channelMatte.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
+/** \file blender/nodes/composite/nodes/node_composite_channelMatte.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* Channel Matte Node ********************************* */
-static bNodeSocketType cmp_node_channel_matte_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_channel_matte_in[]={
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_channel_matte_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_channel_matte_out[]={
+ {SOCK_RGBA,0,"Image"},
+ {SOCK_FLOAT,0,"Matte"},
{-1,0,""}
};
@@ -187,7 +187,7 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
}
-static void node_composit_init_channel_matte(bNode *node)
+static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage=c;
@@ -206,8 +206,8 @@ void register_node_type_cmp_channel_matte(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_channel_matte_in, cmp_node_channel_matte_out);
+ node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out);
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_channel_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index 03230f2e212..db5e6d93856 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_chromaMatte.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
+/** \file blender/nodes/composite/nodes/node_composite_chromaMatte.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* Chroma Key ********************************************************** */
-static bNodeSocketType cmp_node_chroma_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_chroma_in[]={
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_chroma_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_chroma_out[]={
+ {SOCK_RGBA,0,"Image"},
+ {SOCK_FLOAT,0,"Matte"},
{-1,0,""}
};
@@ -178,7 +178,7 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
}
-static void node_composit_init_chroma_matte(bNode *node)
+static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
@@ -193,8 +193,8 @@ void register_node_type_cmp_chroma_matte(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_chroma_in, cmp_node_chroma_out);
+ node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out);
node_type_size(&ntype, 200, 80, 300);
node_type_init(&ntype, node_composit_init_chroma_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 55d77a902b9..7f687240daf 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_colorMatte.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
+/** \file blender/nodes/composite/nodes/node_composite_colorMatte.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* Color Key ********************************************************** */
-static bNodeSocketType cmp_node_color_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_color_in[]={
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_color_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_color_out[]={
+ {SOCK_RGBA,0,"Image"},
+ {SOCK_FLOAT,0,"Matte"},
{-1,0,""}
};
@@ -114,7 +114,7 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
free_compbuf(cbuf);
}
-static void node_composit_init_color_matte(bNode *node)
+static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node color");
node->storage= c;
@@ -129,8 +129,8 @@ void register_node_type_cmp_color_matte(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_color_in, cmp_node_color_out);
+ node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out);
node_type_size(&ntype, 200, 80, 300);
node_type_init(&ntype, node_composit_init_color_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index 905d97709c3..18b6d806c82 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_colorSpill.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,25 +27,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
+/** \file blender/nodes/composite/nodes/node_composite_colorSpill.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
#define avg(a,b) ((a+b)/2)
/* ******************* Color Spill Supression ********************************* */
-static bNodeSocketType cmp_node_color_spill_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_color_spill_in[]={
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ {SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{-1,0,""}
};
-static bNodeSocketType cmp_node_color_spill_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_color_spill_out[]={
+ {SOCK_RGBA,0,"Image"},
{-1,0,""}
};
@@ -315,7 +315,7 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
free_compbuf(spillmap);
}
-static void node_composit_init_color_spill(bNode *node)
+static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
node->storage=ncs;
@@ -330,8 +330,8 @@ void register_node_type_cmp_color_spill(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS,
- cmp_node_color_spill_in, cmp_node_color_spill_out);
+ node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out);
node_type_size(&ntype, 140, 80, 200);
node_type_init(&ntype, node_composit_init_color_spill);
node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index 4074ea2fa29..7ebceb5c206 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+/** \file blender/nodes/composite/nodes/node_composite_colorbalance.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* Color Balance ********************************* */
-static bNodeSocketType cmp_node_colorbalance_in[]={
- {SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_colorbalance_in[]={
+ {SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_colorbalance_out[]={
- {SOCK_RGBA,0,"Image", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_colorbalance_out[]={
+ {SOCK_RGBA,0,"Image"},
{-1,0,""}
};
@@ -175,7 +175,7 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
}
}
-static void node_composit_init_colorbalance(bNode *node)
+static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeColorBalance *n= node->storage= MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
@@ -188,8 +188,8 @@ void register_node_type_cmp_colorbalance(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_colorbalance_in, cmp_node_colorbalance_out);
+ node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ 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);
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c
new file mode 100644
index 00000000000..ab8cf663ef2
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -0,0 +1,373 @@
+/*
+ * $Id: CMP_blur.c 35562 2011-03-15 20:10:32Z lukastoenne $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
+ * Juho Vepsäläinen
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/nodes/node_composite_common.c
+ * \ingroup cmpnodes
+ */
+
+
+#include "DNA_node_types.h"
+
+#include "BKE_node.h"
+
+#include "node_composite_util.h"
+#include "node_common.h"
+#include "node_exec.h"
+
+#if 0
+static void PRINT_BUFFERS(bNodeTreeExec *exec)
+{
+ bNodeTree *ntree= exec->nodetree;
+ bNode *node;
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int i;
+
+ printf("-------------- DEBUG --------------\n");
+ for (sock=ntree->inputs.first, i=0; sock; sock=sock->next, ++i) {
+ ns = node_get_socket_stack(exec->stack, sock);
+ printf("%d. Tree Input %s", i, sock->name);
+ if (ns->external)
+ printf(" (external)");
+ printf(": data=%p\n", ns->data);
+ }
+ for (sock=ntree->outputs.first, i=0; sock; sock=sock->next, ++i) {
+ ns = node_get_socket_stack(exec->stack, sock);
+ printf("%d. Tree Output %s", i, sock->name);
+ if (ns->external)
+ printf(" (external)");
+ printf(": data=%p\n", ns->data);
+ }
+ for (node=ntree->nodes.first; node; node=node->next) {
+ printf("Node %s:\n", node->name);
+ for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) {
+ ns = node_get_socket_stack(exec->stack, sock);
+ printf("\t%d. Input %s", i, sock->name);
+ if (ns->external)
+ printf(" (external)");
+ printf(": data=%p\n", ns->data);
+ }
+ for (sock=node->outputs.first, i=0; sock; sock=sock->next, ++i) {
+ ns = node_get_socket_stack(exec->stack, sock);
+ printf("\t%d. Output %s", i, sock->name);
+ if (ns->external)
+ printf(" (external)");
+ printf(": data=%p\n", ns->data);
+ }
+ }
+}
+#endif
+
+static void copy_stack(bNodeStack *to, bNodeStack *from)
+{
+ if (to != from) {
+ copy_v4_v4(to->vec, from->vec);
+ to->data = from->data;
+ to->datatype = from->datatype;
+
+ /* tag as copy to prevent freeing */
+ to->is_copy = 1;
+ }
+}
+
+static void move_stack(bNodeStack *to, bNodeStack *from)
+{
+ if (to != from) {
+ copy_v4_v4(to->vec, from->vec);
+ to->data = from->data;
+ to->datatype = from->datatype;
+ to->is_copy = from->is_copy;
+
+ zero_v4(from->vec);
+ from->data = NULL;
+ from->datatype = 0;
+ from->is_copy = 0;
+ }
+}
+
+/**** GROUP ****/
+
+static void *group_initexec(bNode *node)
+{
+ bNodeTree *ngroup= (bNodeTree*)node->id;
+ bNodeTreeExec *exec;
+ bNodeSocket *sock;
+ bNodeStack *ns;
+
+ /* initialize the internal node tree execution */
+ exec = ntreeCompositBeginExecTree(ngroup);
+
+ /* tag group outputs as external to prevent freeing */
+ for (sock=ngroup->outputs.first; sock; sock=sock->next) {
+ if (!(sock->flag & SOCK_INTERNAL)) {
+ ns = node_get_socket_stack(exec->stack, sock);
+ ns->external = 1;
+ }
+ }
+
+ return exec;
+}
+
+static void group_freeexec(bNode *UNUSED(node), void *nodedata)
+{
+ bNodeTreeExec *gexec= (bNodeTreeExec*)nodedata;
+
+ ntreeCompositEndExecTree(gexec);
+}
+
+/* Copy inputs to the internal stack.
+ * This is a shallow copy, no buffers are duplicated here!
+ */
+static void group_copy_inputs(bNode *node, bNodeStack **in, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->inputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ copy_stack(ns, in[a]);
+ }
+ }
+}
+
+/* Copy internal results to the external outputs.
+ */
+static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ move_stack(out[a], ns);
+ }
+ }
+}
+
+/* Free internal buffers */
+static void group_free_internal(bNodeTreeExec *gexec) {
+ bNodeStack *ns;
+ int i;
+
+ for (i=0, ns=gexec->stack; i < gexec->stacksize; ++i, ++ns) {
+ if (!ns->external && !ns->is_copy) {
+ if (ns->data) {
+ free_compbuf(ns->data);
+ ns->data = NULL;
+ }
+ }
+ }
+}
+
+static void group_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ group_copy_inputs(node, in, exec->stack);
+ ntreeExecNodes(exec, data, thread);
+ group_free_internal(exec);
+ group_move_outputs(node, out, exec->stack);
+}
+
+void register_node_type_cmp_group(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_group_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_group_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+
+
+/**** FOR LOOP ****/
+
+#if 0 /* XXX loop nodes don't work nicely with current trees */
+/* Move the results from the previous iteration back to the input sockets. */
+static void loop_iteration_reset(bNodeTree *ngroup, bNodeStack *gstack)
+{
+ bNodeSocket *gin, *gout;
+ bNodeStack *nsin, *nsout;
+
+ gin = ngroup->inputs.first;
+ gout = ngroup->outputs.first;
+
+ while (gin && gout) {
+ /* skip static (non-looping) sockets */
+ while (gin && !(gin->flag & SOCK_DYNAMIC))
+ gin=gin->next;
+ while (gout && !(gout->flag & SOCK_DYNAMIC))
+ gout=gout->next;
+
+ if (gin && gout) {
+ nsin = node_get_socket_stack(gstack, gin);
+ nsout = node_get_socket_stack(gstack, gout);
+
+ move_stack(nsin, nsout);
+
+ gin=gin->next;
+ gout=gout->next;
+ }
+ }
+}
+
+static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ int totiterations= (int)in[0]->vec[0];
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int iteration;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ /* "Iteration" socket */
+ sock = exec->nodetree->inputs.first;
+ ns = node_get_socket_stack(exec->stack, sock);
+
+ group_copy_inputs(node, in, exec->stack);
+ for (iteration=0; iteration < totiterations; ++iteration) {
+ /* first input contains current iteration counter */
+ ns->vec[0] = (float)iteration;
+
+ if (iteration > 0)
+ loop_iteration_reset(exec->nodetree, exec->stack);
+ ntreeExecNodes(exec, data, thread);
+ group_free_internal(exec);
+ }
+ group_move_outputs(node, out, exec->stack);
+}
+
+void register_node_type_cmp_forloop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_forloop_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_forloop_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+#endif
+
+
+/**** WHILE LOOP ****/
+
+#if 0 /* XXX loop nodes don't work nicely with current trees */
+static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ int condition= (in[0]->vec[0] > 0.0f);
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int iteration;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ /* "Condition" socket */
+ sock = exec->nodetree->outputs.first;
+ ns = node_get_socket_stack(exec->stack, sock);
+
+ iteration = 0;
+ group_copy_inputs(node, in, exec->stack);
+ while (condition && iteration < node->custom1) {
+ if (iteration > 0)
+ loop_iteration_reset(exec->nodetree, exec->stack);
+ ntreeExecNodes(exec, data, thread);
+ group_free_internal(exec);
+
+// PRINT_BUFFERS(exec);
+
+ condition = (ns->vec[0] > 0.0f);
+ ++iteration;
+ }
+ group_move_outputs(node, out, exec->stack);
+}
+
+void register_node_type_cmp_whileloop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_whileloop_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_whileloop_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+#endif
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index fb68f56ae64..be6246b42d8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_composite.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,20 +27,20 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_composite.c
+/** \file blender/nodes/composite/nodes/node_composite_composite.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** COMPOSITE ******************** */
-static bNodeSocketType cmp_node_composite_in[]= {
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_composite_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
@@ -103,8 +103,8 @@ void register_node_type_cmp_composite(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW,
- cmp_node_composite_in, NULL);
+ node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
node_type_size(&ntype, 80, 60, 200);
node_type_exec(&ntype, node_composit_exec_composite);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c
index 0331217f0cb..332ecf39616 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_crop.c
+/** \file blender/nodes/composite/nodes/node_composite_crop.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Crop ******************** */
-static bNodeSocketType cmp_node_crop_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_crop_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_crop_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_crop_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -103,7 +103,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
}
}
-static void node_composit_init_crop(bNode* node)
+static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeTwoXYs *nxy= MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
node->storage= nxy;
@@ -117,8 +117,8 @@ void register_node_type_cmp_crop(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_crop_in, cmp_node_crop_out);
+ node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_crop);
node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 921c5e21fea..a830b595321 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_curves.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,19 +27,19 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_curves.c
+/** \file blender/nodes/composite/nodes/node_composite_curves.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** CURVE Time ******************** */
/* custom1 = sfra, custom2 = efra */
-static bNodeSocketType cmp_node_time_out[]= {
- { SOCK_VALUE, 0, "Fac", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_time_out[]= {
+ { SOCK_FLOAT, 0, "Fac"},
{ -1, 0, "" }
};
@@ -57,7 +57,7 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
}
-static void node_composit_init_curves_time(bNode* node)
+static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= 1;
node->custom2= 250;
@@ -68,8 +68,8 @@ void register_node_type_cmp_curve_time(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, cmp_node_time_out);
+ node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS);
+ 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);
@@ -82,13 +82,13 @@ void register_node_type_cmp_curve_time(ListBase *lb)
/* **************** CURVE VEC ******************** */
-static bNodeSocketType cmp_node_curve_vec_in[]= {
- { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_curve_vec_in[]= {
+ { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_curve_vec_out[]= {
- { SOCK_VECTOR, 0, "Vector", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_curve_vec_out[]= {
+ { SOCK_VECTOR, 0, "Vector"},
{ -1, 0, "" }
};
@@ -100,7 +100,7 @@ static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeS
curvemapping_evaluate_premulRGBF(node->storage, out[0]->vec, in[0]->vec);
}
-static void node_composit_init_curve_vec(bNode* node)
+static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
}
@@ -109,8 +109,8 @@ void register_node_type_cmp_curve_vec(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- cmp_node_curve_vec_in, cmp_node_curve_vec_out);
+ node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ 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);
@@ -121,16 +121,16 @@ void register_node_type_cmp_curve_vec(ListBase *lb)
/* **************** CURVE RGB ******************** */
-static bNodeSocketType cmp_node_curve_rgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 1, "Black Level", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 1, "White Level", 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_curve_rgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "Black Level", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "White Level", 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_curve_rgb_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_curve_rgb_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -187,7 +187,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
}
-static void node_composit_init_curve_rgb(bNode* node)
+static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
@@ -196,8 +196,8 @@ void register_node_type_cmp_curve_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_curve_rgb_in, cmp_node_curve_rgb_out);
+ node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ 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);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index f249e2cff6c..a218bfb009d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_defocus.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_defocus.c
+/** \file blender/nodes/composite/nodes/node_composite_defocus.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ************ qdn: Defocus node ****************** */
-static bNodeSocketType cmp_node_defocus_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_defocus_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_defocus_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_defocus_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -857,7 +857,7 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
if (zbuf_use && (zbuf_use != zbuf)) free_compbuf(zbuf_use);
}
-static void node_composit_init_defocus(bNode* node)
+static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
/* qdn: defocus node */
NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data");
@@ -878,8 +878,8 @@ void register_node_type_cmp_defocus(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- cmp_node_defocus_in, cmp_node_defocus_out);
+ node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out);
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_defocus);
node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index 296053298da..a0fff88f5dc 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_diffMatte.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
+/** \file blender/nodes/composite/nodes/node_composite_diffMatte.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* channel Difference Matte ********************************* */
-static bNodeSocketType cmp_node_diff_matte_in[]={
- {SOCK_RGBA,1,"Image 1", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_RGBA,1,"Image 2", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_diff_matte_in[]={
+ {SOCK_RGBA,1,"Image 1", 0.8f, 0.8f, 0.8f, 1.0f},
+ {SOCK_RGBA,1,"Image 2", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_diff_matte_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_diff_matte_out[]={
+ {SOCK_RGBA,0,"Image"},
+ {SOCK_FLOAT,0,"Matte"},
{-1,0,""}
};
@@ -125,7 +125,7 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
free_compbuf(imbuf2);
}
-static void node_composit_init_diff_matte(bNode *node)
+static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
@@ -137,8 +137,8 @@ void register_node_type_cmp_diff_matte(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_diff_matte_in, cmp_node_diff_matte_out);
+ node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out);
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_diff_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index f5d16ff0ab8..ef47fdbfef0 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_dilate.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_dilate.c
+/** \file blender/nodes/composite/nodes/node_composite_dilate.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Dilate/Erode ******************** */
-static bNodeSocketType cmp_node_dilateerode_in[]= {
- { SOCK_VALUE, 1, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_dilateerode_in[]= {
+ { SOCK_FLOAT, 1, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_dilateerode_out[]= {
- { SOCK_VALUE, 0, "Mask", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_dilateerode_out[]= {
+ { SOCK_FLOAT, 0, "Mask"},
{ -1, 0, "" }
};
@@ -152,8 +152,8 @@ void register_node_type_cmp_dilateerode(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- cmp_node_dilateerode_in, cmp_node_dilateerode_out);
+ node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out);
node_type_size(&ntype, 130, 100, 320);
node_type_exec(&ntype, node_composit_exec_dilateerode);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index 2a8bbcc9ad5..3d541120a61 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -26,20 +26,20 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_directionalblur.c
+/** \file blender/nodes/composite/nodes/node_composite_directionalblur.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
-static bNodeSocketType cmp_node_dblur_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.f, 0.f, 1.f},
+static bNodeSocketTemplate cmp_node_dblur_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_dblur_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_dblur_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -122,7 +122,7 @@ static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data= dblur(node, new, ndbd->iter, ndbd->wrap, ndbd->center_x, ndbd->center_y, ndbd->distance, ndbd->angle, ndbd->spin, ndbd->zoom);
}
-static void node_composit_init_dblur(bNode* node)
+static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeDBlurData *ndbd= MEM_callocN(sizeof(NodeDBlurData), "node dblur data");
node->storage= ndbd;
@@ -134,8 +134,8 @@ void register_node_type_cmp_dblur(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- cmp_node_dblur_in, cmp_node_dblur_out);
+ node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out);
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_dblur);
node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index 9139edf8560..4688553d27f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_displace.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,25 +27,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_displace.c
+/** \file blender/nodes/composite/nodes/node_composite_displace.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Displace ******************** */
-static bNodeSocketType cmp_node_displace_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Vector", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "X Scale", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
- { SOCK_VALUE, 1, "Y Scale", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
+static bNodeSocketTemplate cmp_node_displace_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_VECTOR, 1, "Vector", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION},
+ { SOCK_FLOAT, 1, "X Scale", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Y Scale", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_displace_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_displace_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -188,8 +188,8 @@ void register_node_type_cmp_displace(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_displace_in, cmp_node_displace_out);
+ node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_displace);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 5f7613464c1..c895eab391c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_distanceMatte.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c
+/** \file blender/nodes/composite/nodes/node_composite_distanceMatte.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* channel Distance Matte ********************************* */
-static bNodeSocketType cmp_node_distance_matte_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_distance_matte_in[]={
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_distance_matte_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_distance_matte_out[]={
+ {SOCK_RGBA,0,"Image"},
+ {SOCK_FLOAT,0,"Matte"},
{-1,0,""}
};
@@ -122,7 +122,7 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
free_compbuf(inbuf);
}
-static void node_composit_init_distance_matte(bNode *node)
+static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
@@ -134,8 +134,8 @@ void register_node_type_cmp_distance_matte(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_distance_matte_in, cmp_node_distance_matte_out);
+ node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out);
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_distance_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 915cb01d2d4..6beeec49c63 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_filter.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_filter.c
+/** \file blender/nodes/composite/nodes/node_composite_filter.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** FILTER ******************** */
-static bNodeSocketType cmp_node_filter_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_filter_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_filter_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_filter_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -226,8 +226,8 @@ void register_node_type_cmp_filter(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_filter_in, cmp_node_filter_out);
+ node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out);
node_type_size(&ntype, 80, 40, 120);
node_type_label(&ntype, node_filter_label);
node_type_exec(&ntype, node_composit_exec_filter);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index b5fd7b46e03..026130641a3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_flip.c 36333 2011-04-26 09:27:43Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_flip.c
+/** \file blender/nodes/composite/nodes/node_composite_flip.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Flip ******************** */
-static bNodeSocketType cmp_node_flip_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_flip_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_flip_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_flip_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -94,8 +94,8 @@ void register_node_type_cmp_flip(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_flip_in, cmp_node_flip_out);
+ node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_flip);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index 261257d3b5f..d191f649f1f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -1,5 +1,5 @@
/*
-* $Id$
+* $Id: CMP_gamma.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -28,22 +28,22 @@
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_gamma.c
+/** \file blender/nodes/composite/nodes/node_composite_gamma.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Gamma Tools ******************** */
-static bNodeSocketType cmp_node_gamma_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Gamma", 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f},
+static bNodeSocketTemplate cmp_node_gamma_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Gamma", 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_gamma_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_gamma_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -81,8 +81,8 @@ void register_node_type_cmp_gamma(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_gamma_in, cmp_node_gamma_out);
+ node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_gamma);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index 2e0822a4511..0890b9ba24b 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -26,19 +26,19 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_glare.c
+/** \file blender/nodes/composite/nodes/node_composite_glare.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
-static bNodeSocketType cmp_node_glare_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_glare_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_glare_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_glare_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -474,7 +474,7 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data = new;
}
-static void node_composit_init_glare(bNode* node)
+static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeGlare *ndg = MEM_callocN(sizeof(NodeGlare), "node glare data");
ndg->quality = 1;
@@ -494,8 +494,8 @@ void register_node_type_cmp_glare(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- cmp_node_glare_in, cmp_node_glare_out);
+ node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out);
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_glare);
node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index 7b5511c699c..525728ade31 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_hueSatVal.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
+/** \file blender/nodes/composite/nodes/node_composite_hueSatVal.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Hue Saturation ******************** */
-static bNodeSocketType cmp_node_hue_sat_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_hue_sat_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_hue_sat_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_hue_sat_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -95,7 +95,7 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
}
}
-static void node_composit_init_hue_sat(bNode* node)
+static void node_composit_init_hue_sat(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat");
node->storage= nhs;
@@ -108,8 +108,8 @@ void register_node_type_cmp_hue_sat(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_hue_sat_in, cmp_node_hue_sat_out);
+ node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out);
node_type_size(&ntype, 150, 80, 250);
node_type_init(&ntype, node_composit_init_hue_sat);
node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index edf6c454285..edf26aed882 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_huecorrect.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+/** \file blender/nodes/composite/nodes/node_composite_huecorrect.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
-static bNodeSocketType cmp_node_huecorrect_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_huecorrect_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_huecorrect_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_huecorrect_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -137,7 +137,7 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
}
-static void node_composit_init_huecorrect(bNode* node)
+static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
CurveMapping *cumapping = node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
int c;
@@ -157,8 +157,8 @@ void register_node_type_cmp_huecorrect(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_huecorrect_in, cmp_node_huecorrect_out);
+ node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_huecorrect_in, cmp_node_huecorrect_out);
node_type_size(&ntype, 320, 140, 400);
node_type_init(&ntype, node_composit_init_huecorrect);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 72d0de7d15e..97d84997697 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_idMask.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_idMask.c
+/** \file blender/nodes/composite/nodes/node_composite_idMask.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** ID Mask ******************** */
-static bNodeSocketType cmp_node_idmask_in[]= {
- { SOCK_VALUE, 1, "ID value", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_idmask_in[]= {
+ { SOCK_FLOAT, 1, "ID value", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_idmask_out[]= {
- { SOCK_VALUE, 0, "Alpha", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_idmask_out[]= {
+ { SOCK_FLOAT, 0, "Alpha"},
{ -1, 0, "" }
};
@@ -113,8 +113,8 @@ void register_node_type_cmp_idmask(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_idmask_in, cmp_node_idmask_out);
+ node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_idmask);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index a5f256054cd..1278202d5b5 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_image.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,20 +27,20 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_image.c
+/** \file blender/nodes/composite/nodes/node_composite_image.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** IMAGE (and RenderResult, multilayer image) ******************** */
-static bNodeSocketType cmp_node_rlayers_out[]= {
+static bNodeSocketTemplate cmp_node_rlayers_out[]= {
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, "UV", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, "Speed", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
@@ -52,9 +52,9 @@ static bNodeSocketType cmp_node_rlayers_out[]= {
{ SOCK_RGBA, 0, "Reflect", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 0, "Refract", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 0, "Indirect", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "IndexOB", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "IndexMA", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Mist", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "IndexOB", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "IndexMA", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 0, "Mist", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 0, "Emit", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 0, "Environment",0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
@@ -74,7 +74,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
ibuf= BKE_image_get_ibuf(ima, iuser);
if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
- return NULL;
+ return NULL;
}
if (ibuf->rect_float == NULL) {
@@ -213,7 +213,7 @@ static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack *
if(out[RRES_OUT_INDEXOB]->hasoutput)
out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB);
if(out[RRES_OUT_INDEXMA]->hasoutput)
- out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA);
+ out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA);
if(out[RRES_OUT_MIST]->hasoutput)
out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST);
if(out[RRES_OUT_EMIT]->hasoutput)
@@ -295,7 +295,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
}
}
-static void node_composit_init_image(bNode* node)
+static void node_composit_init_image(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
@@ -309,8 +309,8 @@ void register_node_type_cmp_image(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
- NULL, cmp_node_rlayers_out);
+ node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out);
node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, node_composit_init_image);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
@@ -440,8 +440,8 @@ void register_node_type_cmp_rlayers(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
- NULL, cmp_node_rlayers_out);
+ node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out);
node_type_size(&ntype, 150, 100, 300);
node_type_exec(&ntype, node_composit_exec_rlayers);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index 27b0324dfe0..1f7589cae8f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_invert.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_invert.c
+/** \file blender/nodes/composite/nodes/node_composite_invert.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** INVERT ******************** */
-static bNodeSocketType cmp_node_invert_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_invert_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_invert_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_invert_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -114,7 +114,7 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
}
}
-static void node_composit_init_invert(bNode *node)
+static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1 |= CMP_CHAN_RGB;
}
@@ -124,8 +124,8 @@ void register_node_type_cmp_invert(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_invert_in, cmp_node_invert_out);
+ node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out);
node_type_size(&ntype, 120, 120, 140);
node_type_init(&ntype, node_composit_init_invert);
node_type_exec(&ntype, node_composit_exec_invert);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
index 3a005210c6a..85578deecbb 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
@@ -26,21 +26,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_lensdist.c
+/** \file blender/nodes/composite/nodes/node_composite_lensdist.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
-static bNodeSocketType cmp_node_lensdist_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Distort", 0.f, 0.f, 0.f, 0.f, -0.999f, 1.f},
- { SOCK_VALUE, 1, "Dispersion", 0.f, 0.f, 0.f, 0.f, 0.f, 1.f},
+static bNodeSocketTemplate cmp_node_lensdist_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Distort", 0.f, 0.f, 0.f, 0.f, -0.999f, 1.f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Dispersion", 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_lensdist_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_lensdist_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -183,7 +183,7 @@ static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeSt
}
-static void node_composit_init_lensdist(bNode* node)
+static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeLensDist *nld = MEM_callocN(sizeof(NodeLensDist), "node lensdist data");
nld->jit = nld->proj = nld->fit = 0;
@@ -195,8 +195,8 @@ void register_node_type_cmp_lensdist(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_lensdist_in, cmp_node_lensdist_out);
+ node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out);
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_lensdist);
node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index 2c9f7d97f09..673ffe4cbef 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_levels.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_levels.c
+/** \file blender/nodes/composite/nodes/node_composite_levels.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** LEVELS ******************** */
-static bNodeSocketType cmp_node_view_levels_in[]= {
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_view_levels_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_view_levels_out[]={
- {SOCK_VALUE, 0,"Mean",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE, 0,"Std Dev",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_view_levels_out[]={
+ {SOCK_FLOAT, 0,"Mean"},
+ {SOCK_FLOAT, 0,"Std Dev"},
{-1,0,""}
};
@@ -52,7 +52,7 @@ static void rgb_tobw(float r, float g, float b, float* out)
*out= r*0.35f + g*0.45f + b*0.2f;
}
-static void fill_bins(bNode* node, CompBuf* in, int* bins, int colorcor)
+static void fill_bins(bNode* node, CompBuf* in, int* bins)
{
float value[4];
int ivalue=0;
@@ -68,39 +68,29 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins, int colorcor)
if(value[3] > 0.0) { /* don't count transparent pixels */
switch(node->custom1) {
case 1: { /* all colors */
- if(colorcor)
- linearrgb_to_srgb_v3_v3(&value[0],&value[0]);
rgb_tobw(value[0],value[1],value[2], &value[0]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
break;
}
case 2: { /* red channel */
- if(colorcor)
- value[0]=linearrgb_to_srgb(value[0]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
break;
}
case 3: { /* green channel */
- if(colorcor)
- value[1]=linearrgb_to_srgb(value[1]);
value[1]=value[1]*255; /* scale to 0-255 range */
ivalue=(int)value[1];
break;
}
case 4: /*blue channel */
{
- if(colorcor)
- value[2]=linearrgb_to_srgb(value[2]);
value[2]=value[2]*255; /* scale to 0-255 range */
ivalue=(int)value[2];
break;
}
case 5: /* luminence */
{
- if(colorcor)
- linearrgb_to_srgb_v3_v3(&value[0],&value[0]);
rgb_to_yuv(value[0],value[1],value[2], &value[0], &value[1], &value[2]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
@@ -285,7 +275,6 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
{
CompBuf* cbuf;
CompBuf* histogram;
- RenderData *rd=data;
float mean, std_dev;
int bins[256];
int x;
@@ -302,7 +291,7 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
}
/*fill bins */
- fill_bins(node, in[0]->data, bins, rd->color_mgt_flag & R_COLOR_MANAGEMENT);
+ fill_bins(node, in[0]->data, bins);
/* draw the histogram chart */
draw_histogram(node, histogram, bins);
@@ -328,7 +317,7 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
free_compbuf(histogram);
}
-static void node_composit_init_view_levels(bNode* node)
+static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1=1; /*All channels*/
}
@@ -337,8 +326,8 @@ void register_node_type_cmp_view_levels(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW,
- cmp_node_view_levels_in, cmp_node_view_levels_out);
+ node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW);
+ node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_view_levels);
node_type_storage(&ntype, "ImageUser", NULL, NULL);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index 34e58791932..bc7676934fa 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_lummaMatte.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
+/** \file blender/nodes/composite/nodes/node_composite_lummaMatte.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* ******************* Luma Matte Node ********************************* */
-static bNodeSocketType cmp_node_luma_matte_in[]={
- {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_luma_matte_in[]={
+ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f},
{-1,0,""}
};
-static bNodeSocketType cmp_node_luma_matte_out[]={
- {SOCK_RGBA,0,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VALUE,0,"Matte",0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_luma_matte_out[]={
+ {SOCK_RGBA,0,"Image"},
+ {SOCK_FLOAT,0,"Matte"},
{-1,0,""}
};
@@ -100,7 +100,7 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
free_compbuf(cbuf);
}
-static void node_composit_init_luma_matte(bNode *node)
+static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage=c;
@@ -112,8 +112,8 @@ void register_node_type_cmp_luma_matte(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_luma_matte_in, cmp_node_luma_matte_out);
+ node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out);
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_luma_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index 6b2c561b14a..2d92c26b554 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_mapUV.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_mapUV.c
+/** \file blender/nodes/composite/nodes/node_composite_mapUV.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Map UV ******************** */
-static bNodeSocketType cmp_node_mapuv_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "UV", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_mapuv_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_VECTOR, 1, "UV", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_mapuv_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_mapuv_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -168,8 +168,8 @@ void register_node_type_cmp_mapuv(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_mapuv_in, cmp_node_mapuv_out);
+ node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_mapuv);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index f14e0fbd804..0d38aca4ce3 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_mapValue.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,20 +27,20 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_mapValue.c
+/** \file blender/nodes/composite/nodes/node_composite_mapValue.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** MAP VALUE ******************** */
-static bNodeSocketType cmp_node_map_value_in[]= {
- { SOCK_VALUE, 1, "Value", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_map_value_in[]= {
+ { SOCK_FLOAT, 1, "Value", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_map_value_out[]= {
- { SOCK_VALUE, 0, "Value", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_map_value_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -79,7 +79,7 @@ static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeS
}
-static void node_composit_init_map_value(bNode* node)
+static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_mapping();
}
@@ -88,8 +88,8 @@ void register_node_type_cmp_map_value(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- cmp_node_map_value_in, cmp_node_map_value_out);
+ node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out);
node_type_size(&ntype, 100, 60, 150);
node_type_init(&ntype, node_composit_init_map_value);
node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index b7a67f3563b..2489491fdd8 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_math.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_math.c
+/** \file blender/nodes/composite/nodes/node_composite_math.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SCALAR MATH ******************** */
-static bNodeSocketType cmp_node_math_in[]= {
- { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f},
- { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f},
+static bNodeSocketTemplate cmp_node_math_in[]= {
+ { SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_math_out[]= {
- { SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_math_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -145,7 +145,6 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0];
else
out[0]= floorf(in[0] + 0.5f);
-
}
break;
case 15: /* Less Than */
@@ -201,8 +200,8 @@ void register_node_type_cmp_math(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_math_in, cmp_node_math_out);
+ node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out);
node_type_size(&ntype, 120, 110, 160);
node_type_label(&ntype, node_math_label);
node_type_exec(&ntype, node_composit_exec_math);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index d2454b37c29..a5dcfcc44da 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_mixrgb.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
+/** \file blender/nodes/composite/nodes/node_composite_mixrgb.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** MIX RGB ******************** */
-static bNodeSocketType cmp_node_mix_rgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_mix_rgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_mix_rgb_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_mix_rgb_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -88,8 +88,8 @@ void register_node_type_cmp_mix_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
+ node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
node_type_size(&ntype, 110, 60, 120);
node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, node_composit_exec_mix_rgb);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index f53d3041947..5f3c848903c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_normal.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,30 +27,30 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_normal.c
+/** \file blender/nodes/composite/nodes/node_composite_normal.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** NORMAL ******************** */
-static bNodeSocketType cmp_node_normal_in[]= {
- { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_normal_in[]= {
+ { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_normal_out[]= {
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_VALUE, 0, "Dot", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_normal_out[]= {
+ { SOCK_VECTOR, 0, "Normal"},
+ { SOCK_FLOAT, 0, "Dot"},
{ -1, 0, "" }
};
static void do_normal(bNode *node, float *out, float *in)
{
bNodeSocket *sock= node->outputs.first;
- float *nor= sock->ns.vec;
+ float *nor= ((bNodeSocketValueVector*)sock->default_value)->value;
/* render normals point inside... the widget points outside */
out[0]= -INPR(nor, in);
@@ -60,12 +60,13 @@ static void do_normal(bNode *node, float *out, float *in)
static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
+ float *nor= ((bNodeSocketValueVector*)sock->default_value)->value;
/* stack order input: normal */
/* stack order output: normal, value */
/* input no image? then only vector op */
if(in[0]->data==NULL) {
- VECCOPY(out[0]->vec, sock->ns.vec);
+ VECCOPY(out[0]->vec, nor);
/* render normals point inside... the widget points outside */
out[1]->vec[0]= -INPR(out[0]->vec, in[0]->vec);
}
@@ -82,12 +83,23 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac
}
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ bNodeSocket *sock= node->outputs.first;
+ float *nor= ((bNodeSocketValueVector*)sock->default_value)->value;
+
+ nor[0] = 0.0f;
+ nor[1] = 0.0f;
+ nor[2] = 1.0f;
+}
+
void register_node_type_cmp_normal(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- cmp_node_normal_in, cmp_node_normal_out);
+ node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out);
+ node_type_init(&ntype, init);
node_type_size(&ntype, 100, 60, 200);
node_type_exec(&ntype, node_composit_exec_normal);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 22ebd924f09..1c5c3b57b80 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_normalize.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_normalize.c
+/** \file blender/nodes/composite/nodes/node_composite_normalize.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** NORMALIZE single channel, useful for Z buffer ******************** */
-static bNodeSocketType cmp_node_normalize_in[]= {
- { SOCK_VALUE, 1, "Value", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_normalize_in[]= {
+ { SOCK_FLOAT, 1, "Value", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_normalize_out[]= {
- { SOCK_VALUE, 0, "Value", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_normalize_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -107,8 +107,8 @@ void register_node_type_cmp_normalize(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- cmp_node_normalize_in, cmp_node_normalize_out);
+ node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, node_composit_exec_normalize);
node_type_storage(&ntype, "TexMapping", NULL, NULL);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index 1d52e694ea9..13391a4a790 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_outputFile.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,17 +27,17 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+/** \file blender/nodes/composite/nodes/node_composite_outputFile.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** OUTPUT FILE ******************** */
-static bNodeSocketType cmp_node_output_file_in[]= {
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_output_file_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Z", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
@@ -93,7 +93,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
}
}
-static void node_composit_init_output_file(bNode *node)
+static void node_composit_init_output_file(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
Scene *scene= (Scene *)node->id;
NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file");
@@ -113,8 +113,8 @@ void register_node_type_cmp_output_file(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_output_file_in, NULL);
+ node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_output_file_in, NULL);
node_type_size(&ntype, 140, 80, 300);
node_type_init(&ntype, node_composit_init_output_file);
node_type_storage(&ntype, "NodeImageFile", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
index 15d2ac25180..066a8a81891 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -1,5 +1,5 @@
/*
-* $Id$
+* $Id: CMP_premulkey.c 36333 2011-04-26 09:27:43Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -28,21 +28,21 @@
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_premulkey.c
+/** \file blender/nodes/composite/nodes/node_composite_premulkey.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Premul and Key Alpha Convert ******************** */
-static bNodeSocketType cmp_node_premulkey_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_premulkey_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_premulkey_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_premulkey_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -67,8 +67,8 @@ void register_node_type_cmp_premulkey(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_premulkey_in, cmp_node_premulkey_out);
+ node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_premulkey);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c
index 36b7988c4e0..41a13487edd 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_rgb.c 36333 2011-04-26 09:27:43Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,33 +27,46 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_rgb.c
+/** \file blender/nodes/composite/nodes/node_composite_rgb.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** RGB ******************** */
-static bNodeSocketType cmp_node_rgb_out[]= {
- { SOCK_RGBA, 0, "RGBA", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_rgb_out[]= {
+ { SOCK_RGBA, 0, "RGBA", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
+static void node_composit_init_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ bNodeSocket *sock= node->outputs.first;
+ float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
+ /* uses the default value of the output socket, must be initialized here */
+ col[0] = 0.5f;
+ col[1] = 0.5f;
+ col[2] = 0.5f;
+ col[3] = 1.0f;
+}
+
static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
+ float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
- QUATCOPY(out[0]->vec, sock->ns.vec);
+ QUATCOPY(out[0]->vec, col);
}
void register_node_type_cmp_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, cmp_node_rgb_out);
+ node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out);
+ node_type_init(&ntype, node_composit_init_rgb);
node_type_size(&ntype, 140, 80, 140);
node_type_exec(&ntype, node_composit_exec_rgb);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index eccac4f0e6d..4ece562c508 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_rotate.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_rotate.c
+/** \file blender/nodes/composite/nodes/node_composite_rotate.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Rotate ******************** */
-static bNodeSocketType cmp_node_rotate_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Degr", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
+static bNodeSocketTemplate cmp_node_rotate_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Degr", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_rotate_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_rotate_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -122,7 +122,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
}
}
-static void node_composit_init_rotate(bNode *node)
+static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= 1; /* Bilinear Filter*/
}
@@ -131,8 +131,8 @@ void register_node_type_cmp_rotate(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_rotate_in, cmp_node_rotate_out);
+ node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_rotate);
node_type_exec(&ntype, node_composit_exec_rotate);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index b6030cc5a5f..4ba654e82d4 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_scale.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,25 +27,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_scale.c
+/** \file blender/nodes/composite/nodes/node_composite_scale.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Scale ******************** */
#define CMP_SCALE_MAX 12000
-static bNodeSocketType cmp_node_scale_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "X", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX},
- { SOCK_VALUE, 1, "Y", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX},
+static bNodeSocketTemplate cmp_node_scale_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "X", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Y", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_scale_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_scale_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -118,8 +118,8 @@ void register_node_type_cmp_scale(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_scale_in, cmp_node_scale_out);
+ node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_scale);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index 87c4ed1dac0..5460427fd73 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_sepcombHSVA.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
+/** \file blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SEPARATE HSVA ******************** */
-static bNodeSocketType cmp_node_sephsva_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_sephsva_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_sephsva_out[]= {
- { SOCK_VALUE, 0, "H", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "S", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "A", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_sephsva_out[]= {
+ { SOCK_FLOAT, 0, "H"},
+ { SOCK_FLOAT, 0, "S"},
+ { SOCK_FLOAT, 0, "V"},
+ { SOCK_FLOAT, 0, "A"},
{ -1, 0, "" }
};
@@ -105,8 +105,8 @@ void register_node_type_cmp_sephsva(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0,
- cmp_node_sephsva_in, cmp_node_sephsva_out);
+ node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_sephsva);
@@ -115,15 +115,15 @@ void register_node_type_cmp_sephsva(ListBase *lb)
/* **************** COMBINE HSVA ******************** */
-static bNodeSocketType cmp_node_combhsva_in[]= {
- { SOCK_VALUE, 1, "H", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "S", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combhsva_in[]= {
+ { SOCK_FLOAT, 1, "H", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "S", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_combhsva_out[]= {
- { SOCK_RGBA, 0, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combhsva_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -175,8 +175,8 @@ void register_node_type_cmp_combhsva(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_combhsva_in, cmp_node_combhsva_out);
+ node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_combhsva);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 11afd1eaaef..a074d895acb 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_sepcombRGBA.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
+/** \file blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SEPARATE RGBA ******************** */
-static bNodeSocketType cmp_node_seprgba_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_seprgba_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_seprgba_out[]= {
- { SOCK_VALUE, 0, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "A", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_seprgba_out[]= {
+ { SOCK_FLOAT, 0, "R"},
+ { SOCK_FLOAT, 0, "G"},
+ { SOCK_FLOAT, 0, "B"},
+ { SOCK_FLOAT, 0, "A"},
{ -1, 0, "" }
};
@@ -83,8 +83,8 @@ void register_node_type_cmp_seprgba(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0,
- cmp_node_seprgba_in, cmp_node_seprgba_out);
+ node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_seprgba);
@@ -94,15 +94,15 @@ void register_node_type_cmp_seprgba(ListBase *lb)
/* **************** COMBINE RGBA ******************** */
-static bNodeSocketType cmp_node_combrgba_in[]= {
- { SOCK_VALUE, 1, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combrgba_in[]= {
+ { SOCK_FLOAT, 1, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_combrgba_out[]= {
- { SOCK_RGBA, 0, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combrgba_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -151,8 +151,8 @@ void register_node_type_cmp_combrgba(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_combrgba_in, cmp_node_combrgba_out);
+ node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_combrgba);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index 81591602dae..61e88418e59 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_sepcombYCCA.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
+/** \file blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SEPARATE YCCA ******************** */
-static bNodeSocketType cmp_node_sepycca_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_sepycca_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_sepycca_out[]= {
- { SOCK_VALUE, 0, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Cb", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Cr", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "A", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_sepycca_out[]= {
+ { SOCK_FLOAT, 0, "Y"},
+ { SOCK_FLOAT, 0, "Cb"},
+ { SOCK_FLOAT, 0, "Cr"},
+ { SOCK_FLOAT, 0, "A"},
{ -1, 0, "" }
};
@@ -154,8 +154,8 @@ void register_node_type_cmp_sepycca(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_sepycca_in, cmp_node_sepycca_out);
+ node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_sepycca);
@@ -165,15 +165,15 @@ void register_node_type_cmp_sepycca(ListBase *lb)
/* **************** COMBINE YCCA ******************** */
-static bNodeSocketType cmp_node_combycca_in[]= {
- { SOCK_VALUE, 1, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Cb", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Cr", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combycca_in[]= {
+ { SOCK_FLOAT, 1, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Cb", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Cr", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_combycca_out[]= {
- { SOCK_RGBA, 0, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combycca_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -301,8 +301,8 @@ void register_node_type_cmp_combycca(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_combycca_in, cmp_node_combycca_out);
+ node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_combycca);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 8687e307df3..14f086300c0 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_sepcombYUVA.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
+/** \file blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SEPARATE YUVA ******************** */
-static bNodeSocketType cmp_node_sepyuva_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_sepyuva_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_sepyuva_out[]= {
- { SOCK_VALUE, 0, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "U", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "A", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_sepyuva_out[]= {
+ { SOCK_FLOAT, 0, "Y"},
+ { SOCK_FLOAT, 0, "U"},
+ { SOCK_FLOAT, 0, "V"},
+ { SOCK_FLOAT, 0, "A"},
{ -1, 0, "" }
};
@@ -105,8 +105,8 @@ void register_node_type_cmp_sepyuva(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0,
- cmp_node_sepyuva_in, cmp_node_sepyuva_out);
+ node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_sepyuva);
@@ -116,15 +116,15 @@ void register_node_type_cmp_sepyuva(ListBase *lb)
/* **************** COMBINE YUVA ******************** */
-static bNodeSocketType cmp_node_combyuva_in[]= {
- { SOCK_VALUE, 1, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "U", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combyuva_in[]= {
+ { SOCK_FLOAT, 1, "Y", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "U", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "V", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "A", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_combyuva_out[]= {
- { SOCK_RGBA, 0, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_combyuva_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -176,8 +176,8 @@ void register_node_type_cmp_combyuva(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_combyuva_in, cmp_node_combyuva_out);
+ node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_composit_exec_combyuva);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index bb8533a79f6..781d6f11614 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_setalpha.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_setalpha.c
+/** \file blender/nodes/composite/nodes/node_composite_setalpha.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SET ALPHA ******************** */
-static bNodeSocketType cmp_node_setalpha_in[]= {
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_setalpha_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_setalpha_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_setalpha_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -79,8 +79,8 @@ void register_node_type_cmp_setalpha(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_setalpha_in, cmp_node_setalpha_out);
+ node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out);
node_type_size(&ntype, 120, 40, 140);
node_type_exec(&ntype, node_composit_exec_setalpha);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index 13cb3bcfed5..d78faf69e26 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_splitViewer.c 36340 2011-04-26 13:24:20Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,17 +27,17 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
+/** \file blender/nodes/composite/nodes/node_composite_splitViewer.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** SPLIT VIEWER ******************** */
-static bNodeSocketType cmp_node_splitviewer_in[]= {
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_splitviewer_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
@@ -141,7 +141,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
}
}
-static void node_composit_init_splitviewer(bNode* node)
+static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
@@ -155,8 +155,8 @@ void register_node_type_cmp_splitviewer(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "SplitViewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
- cmp_node_splitviewer_in, NULL);
+ node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "SplitViewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_splitviewer_in, NULL);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_splitviewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 46e71b8b8e5..bdeef74c617 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_texture.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_texture.c
+/** \file blender/nodes/composite/nodes/node_composite_texture.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** TEXTURE ******************** */
-static bNodeSocketType cmp_node_texture_in[]= {
- { SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f},
- { SOCK_VECTOR, 1, "Scale", 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f},
+static bNodeSocketTemplate cmp_node_texture_in[]= {
+ { SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION},
+ { SOCK_VECTOR, 1, "Scale", 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_texture_out[]= {
- { SOCK_VALUE, 0, "Value", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA , 0, "Color", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_texture_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
+ { SOCK_RGBA , 0, "Color"},
{ -1, 0, "" }
};
@@ -148,8 +148,8 @@ void register_node_type_cmp_texture(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
- cmp_node_texture_in, cmp_node_texture_out);
+ node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+ node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out);
node_type_size(&ntype, 120, 80, 240);
node_type_exec(&ntype, node_composit_exec_texture);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index f15811ec790..31ffed08c95 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -26,19 +26,19 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_tonemap.c
+/** \file blender/nodes/composite/nodes/node_composite_tonemap.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
-static bNodeSocketType cmp_node_tonemap_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_tonemap_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_tonemap_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_tonemap_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -147,7 +147,7 @@ static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeSta
free_compbuf(img);
}
-static void node_composit_init_tonemap(bNode* node)
+static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeTonemap *ntm = MEM_callocN(sizeof(NodeTonemap), "node tonemap data");
ntm->type = 1;
@@ -167,8 +167,8 @@ void register_node_type_cmp_tonemap(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_tonemap_in, cmp_node_tonemap_out);
+ node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out);
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_tonemap);
node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index eb69523e7a9..a07dfb936ae 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_translate.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_translate.c
+/** \file blender/nodes/composite/nodes/node_composite_translate.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Translate ******************** */
-static bNodeSocketType cmp_node_translate_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "X", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
- { SOCK_VALUE, 1, "Y", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
+static bNodeSocketTemplate cmp_node_translate_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "X", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Y", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_translate_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_translate_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -65,8 +65,8 @@ void register_node_type_cmp_translate(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS,
- cmp_node_translate_in, cmp_node_translate_out);
+ node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, node_composit_exec_translate);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index 1e1c8c61b46..9481d769557 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_valToRgb.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
+/** \file blender/nodes/composite/nodes/node_composite_valToRgb.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** VALTORGB ******************** */
-static bNodeSocketType cmp_node_valtorgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_valtorgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_valtorgb_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_valtorgb_out[]= {
+ { SOCK_RGBA, 0, "Image"},
+ { SOCK_FLOAT, 0, "Alpha"},
{ -1, 0, "" }
};
@@ -80,7 +80,7 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
}
}
-static void node_composit_init_valtorgb(bNode* node)
+static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_colorband(1);
}
@@ -89,8 +89,8 @@ void register_node_type_cmp_valtorgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- cmp_node_valtorgb_in, cmp_node_valtorgb_out);
+ node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_valtorgb_in, cmp_node_valtorgb_out);
node_type_size(&ntype, 240, 200, 300);
node_type_init(&ntype, node_composit_init_valtorgb);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
@@ -102,12 +102,12 @@ void register_node_type_cmp_valtorgb(ListBase *lb)
/* **************** RGBTOBW ******************** */
-static bNodeSocketType cmp_node_rgbtobw_in[]= {
+static bNodeSocketTemplate cmp_node_rgbtobw_in[]= {
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_rgbtobw_out[]= {
- { SOCK_VALUE, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_rgbtobw_out[]= {
+ { SOCK_FLOAT, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
@@ -143,8 +143,8 @@ void register_node_type_cmp_rgbtobw(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0,
- cmp_node_rgbtobw_in, cmp_node_rgbtobw_out);
+ node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out);
node_type_size(&ntype, 80, 40, 120);
node_type_exec(&ntype, node_composit_exec_rgbtobw);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c
index 46762065bb4..e99b665f2ae 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c
+++ b/source/blender/nodes/composite/nodes/node_composite_value.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_value.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,32 +27,42 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_value.c
+/** \file blender/nodes/composite/nodes/node_composite_value.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** VALUE ******************** */
-static bNodeSocketType cmp_node_value_out[]= {
- { SOCK_VALUE, 0, "Value", 0.5f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
+static bNodeSocketTemplate cmp_node_value_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
+static void node_composit_init_value(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ bNodeSocket *sock= node->outputs.first;
+ bNodeSocketValueFloat *dval= (bNodeSocketValueFloat*)sock->default_value;
+ /* uses the default value of the output socket, must be initialized here */
+ dval->value = 0.5f;
+}
+
static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
+ float val= ((bNodeSocketValueFloat*)sock->default_value)->value;
- out[0]->vec[0]= sock->ns.vec[0];
+ out[0]->vec[0]= val;
}
void register_node_type_cmp_value(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, cmp_node_value_out);
+ node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, cmp_node_value_out);
+ node_type_init(&ntype, node_composit_init_value);
node_type_size(&ntype, 80, 40, 120);
node_type_exec(&ntype, node_composit_exec_value);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
index c43bfa2435a..e730728d077 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_vecBlur.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
+/** \file blender/nodes/composite/nodes/node_composite_vecBlur.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** VECTOR BLUR ******************** */
-static bNodeSocketType cmp_node_vecblur_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Speed", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_vecblur_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Z", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_VECTOR, 1, "Speed", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_vecblur_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_vecblur_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -87,7 +87,7 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
free_compbuf(img);
}
-static void node_composit_init_vecblur(bNode* node)
+static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur data");
node->storage= nbd;
@@ -100,8 +100,8 @@ void register_node_type_cmp_vecblur(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS,
- cmp_node_vecblur_in, cmp_node_vecblur_out);
+ node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out);
node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_vecblur);
node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index c4e719efbf9..bcfb45411f1 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_viewer.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,19 +27,19 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_viewer.c
+/** \file blender/nodes/composite/nodes/node_composite_viewer.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** VIEWER ******************** */
-static bNodeSocketType cmp_node_viewer_in[]= {
- { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate cmp_node_viewer_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
@@ -124,7 +124,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
}
}
-static void node_composit_init_viewer(bNode* node)
+static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
@@ -137,8 +137,8 @@ void register_node_type_cmp_viewer(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW,
- cmp_node_viewer_in, NULL);
+ 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_size(&ntype, 80, 60, 200);
node_type_init(&ntype, node_composit_init_viewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
@@ -146,5 +146,3 @@ void register_node_type_cmp_viewer(ListBase *lb)
nodeRegisterType(lb, &ntype);
}
-
-
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index 0fae0fcd4d5..dfed26be343 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: CMP_zcombine.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,26 +27,26 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/CMP_nodes/CMP_zcombine.c
+/** \file blender/nodes/composite/nodes/node_composite_zcombine.c
* \ingroup cmpnodes
*/
-#include "../CMP_util.h"
+#include "node_composite_util.h"
/* **************** Z COMBINE ******************** */
/* lazy coder note: node->custom2 is abused to send signal */
-static bNodeSocketType cmp_node_zcombine_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f},
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f},
+static bNodeSocketTemplate cmp_node_zcombine_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
+ { SOCK_FLOAT, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType cmp_node_zcombine_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f},
+static bNodeSocketTemplate cmp_node_zcombine_out[]= {
+ { SOCK_RGBA, 0, "Image"},
+ { SOCK_FLOAT, 0, "Z"},
{ -1, 0, "" }
};
@@ -228,8 +228,8 @@ void register_node_type_cmp_zcombine(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- cmp_node_zcombine_in, cmp_node_zcombine_out);
+ node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out);
node_type_size(&ntype, 80, 40, 120);
node_type_exec(&ntype, node_composit_exec_zcombine);
diff --git a/source/blender/nodes/intern/SHD_util.c b/source/blender/nodes/intern/SHD_util.c
deleted file mode 100644
index 190f68ce19a..00000000000
--- a/source/blender/nodes/intern/SHD_util.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/nodes/intern/SHD_util.c
- * \ingroup nodes
- */
-
-
-#include "SHD_util.h"
-
-
-
-
-
-/* ****** */
-
-void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
-{
- float *from= ns->vec;
-
- if(type_in==SOCK_VALUE) {
- if(ns->sockettype==SOCK_VALUE)
- *in= *from;
- else
- *in= 0.333333f*(from[0]+from[1]+from[2]);
- }
- else if(type_in==SOCK_VECTOR) {
- if(ns->sockettype==SOCK_VALUE) {
- in[0]= from[0];
- in[1]= from[0];
- in[2]= from[0];
- }
- else {
- VECCOPY(in, from);
- }
- }
- else { /* type_in==SOCK_RGBA */
- if(ns->sockettype==SOCK_RGBA) {
- QUATCOPY(in, from);
- }
- else if(ns->sockettype==SOCK_VALUE) {
- in[0]= from[0];
- in[1]= from[0];
- in[2]= from[0];
- in[3]= 1.0f;
- }
- else {
- VECCOPY(in, from);
- in[3]= 1.0f;
- }
- }
-}
-
-
-/* ******************* execute and parse ************ */
-
-void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
-{
- ShaderCallData scd;
- /*
- @note: preserve material from ShadeInput for material id, nodetree execs change it
- fix for bug "[#28012] Mat ID messy with shader nodes"
- */
- Material *mat = shi->mat;
- /* convert caller data to struct */
- scd.shi= shi;
- scd.shr= shr;
-
- /* each material node has own local shaderesult, with optional copying */
- memset(shr, 0, sizeof(ShadeResult));
-
- ntreeExecTree(ntree, &scd, shi->thread); /* threads */
- // @note: set material back to preserved material
- shi->mat = mat;
- /* better not allow negative for now */
- if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
- if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
- if(shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
-
-}
-
-/* go over all used Geometry and Texture nodes, and return a texco flag */
-/* no group inside needed, this function is called for groups too */
-void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mode)
-{
- bNode *node;
- bNodeSocket *sock;
- int a;
-
- ntreeSocketUseFlags(ntree);
-
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->type==SH_NODE_TEXTURE) {
- if((r_mode & R_OSA) && node->id) {
- Tex *tex= (Tex *)node->id;
- if ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)
- *texco |= TEXCO_OSA|NEED_UV;
- }
- /* usability exception... without input we still give the node orcos */
- sock= node->inputs.first;
- if(sock==NULL || sock->link==NULL)
- *texco |= TEXCO_ORCO|NEED_UV;
- }
- else if(node->type==SH_NODE_GEOMETRY) {
- /* note; sockets always exist for the given type! */
- for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
- if(sock->flag & SOCK_IN_USE) {
- switch(a) {
- case GEOM_OUT_GLOB:
- *texco |= TEXCO_GLOB|NEED_UV; break;
- case GEOM_OUT_VIEW:
- *texco |= TEXCO_VIEW|NEED_UV; break;
- case GEOM_OUT_ORCO:
- *texco |= TEXCO_ORCO|NEED_UV; break;
- case GEOM_OUT_UV:
- *texco |= TEXCO_UV|NEED_UV; break;
- case GEOM_OUT_NORMAL:
- *texco |= TEXCO_NORM|NEED_UV; break;
- case GEOM_OUT_VCOL:
- *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break;
- }
- }
- }
- }
- }
-}
-
-/* nodes that use ID data get synced with local data */
-void nodeShaderSynchronizeID(bNode *node, int copyto)
-{
- if(node->id==NULL) return;
-
- if(ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
- bNodeSocket *sock;
- Material *ma= (Material *)node->id;
- int a;
-
- /* hrmf, case in loop isnt super fast, but we dont edit 100s of material at same time either! */
- for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
- if(!(sock->flag & SOCK_HIDDEN)) {
- if(copyto) {
- switch(a) {
- case MAT_IN_COLOR:
- VECCOPY(&ma->r, sock->ns.vec); break;
- case MAT_IN_SPEC:
- VECCOPY(&ma->specr, sock->ns.vec); break;
- case MAT_IN_REFL:
- ma->ref= sock->ns.vec[0]; break;
- case MAT_IN_MIR:
- VECCOPY(&ma->mirr, sock->ns.vec); break;
- case MAT_IN_AMB:
- ma->amb= sock->ns.vec[0]; break;
- case MAT_IN_EMIT:
- ma->emit= sock->ns.vec[0]; break;
- case MAT_IN_SPECTRA:
- ma->spectra= sock->ns.vec[0]; break;
- case MAT_IN_RAY_MIRROR:
- ma->ray_mirror= sock->ns.vec[0]; break;
- case MAT_IN_ALPHA:
- ma->alpha= sock->ns.vec[0]; break;
- case MAT_IN_TRANSLUCENCY:
- ma->translucency= sock->ns.vec[0]; break;
- }
- }
- else {
- switch(a) {
- case MAT_IN_COLOR:
- VECCOPY(sock->ns.vec, &ma->r); break;
- case MAT_IN_SPEC:
- VECCOPY(sock->ns.vec, &ma->specr); break;
- case MAT_IN_REFL:
- sock->ns.vec[0]= ma->ref; break;
- case MAT_IN_MIR:
- VECCOPY(sock->ns.vec, &ma->mirr); break;
- case MAT_IN_AMB:
- sock->ns.vec[0]= ma->amb; break;
- case MAT_IN_EMIT:
- sock->ns.vec[0]= ma->emit; break;
- case MAT_IN_SPECTRA:
- sock->ns.vec[0]= ma->spectra; break;
- case MAT_IN_RAY_MIRROR:
- sock->ns.vec[0]= ma->ray_mirror; break;
- case MAT_IN_ALPHA:
- sock->ns.vec[0]= ma->alpha; break;
- case MAT_IN_TRANSLUCENCY:
- sock->ns.vec[0]= ma->translucency; break;
- }
- }
- }
- }
- }
-
-}
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
new file mode 100644
index 00000000000..76203c52293
--- /dev/null
+++ b/source/blender/nodes/intern/node_common.c
@@ -0,0 +1,982 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/node_common.c
+ * \ingroup nodes
+ */
+
+
+#include <string.h>
+
+#include "DNA_action_types.h"
+#include "DNA_anim_types.h"
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_action.h"
+#include "BKE_animsys.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BLI_math.h"
+#include "BKE_node.h"
+#include "BKE_utildefines.h"
+
+#include "RNA_access.h"
+#include "RNA_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "node_common.h"
+#include "node_exec.h"
+#include "NOD_socket.h"
+
+/**** Group ****/
+
+bNodeSocket *node_group_find_input(bNode *gnode, bNodeSocket *gsock)
+{
+ bNodeSocket *sock;
+ for (sock=gnode->inputs.first; sock; sock=sock->next)
+ if (sock->groupsock == gsock)
+ return sock;
+ return NULL;
+}
+
+bNodeSocket *node_group_find_output(bNode *gnode, bNodeSocket *gsock)
+{
+ bNodeSocket *sock;
+ for (sock=gnode->outputs.first; sock; sock=sock->next)
+ if (sock->groupsock == gsock)
+ return sock;
+ return NULL;
+}
+
+bNodeSocket *node_group_add_extern_socket(bNodeTree *UNUSED(ntree), ListBase *lb, int in_out, bNodeSocket *gsock)
+{
+ bNodeSocket *sock;
+
+ if (gsock->flag & SOCK_INTERNAL)
+ return NULL;
+
+ sock= MEM_callocN(sizeof(bNodeSocket), "sock");
+
+ /* make a copy of the group socket */
+ *sock = *gsock;
+ sock->link = NULL;
+ sock->next = sock->prev = NULL;
+ sock->new_sock = NULL;
+
+ /* group sockets are dynamically added */
+ sock->flag |= SOCK_DYNAMIC;
+
+ sock->own_index = gsock->own_index;
+ sock->groupsock = gsock;
+ sock->limit = (in_out==SOCK_IN ? 1 : 0xFFF);
+
+ if (gsock->default_value)
+ sock->default_value = MEM_dupallocN(gsock->default_value);
+
+ if(lb)
+ BLI_addtail(lb, sock);
+
+ return sock;
+}
+
+bNode *node_group_make_from_selected(bNodeTree *ntree)
+{
+ bNodeLink *link, *linkn;
+ bNode *node, *gnode, *nextn;
+ bNodeTree *ngroup;
+ bNodeSocket *gsock;
+ ListBase anim_basepaths = {NULL, NULL};
+ float min[2], max[2];
+ int totnode=0;
+ bNodeTemplate ntemp;
+
+ INIT_MINMAX2(min, max);
+
+ /* is there something to group? also do some clearing */
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->flag & NODE_SELECT) {
+ /* no groups in groups */
+ if(node->type==NODE_GROUP)
+ return NULL;
+ DO_MINMAX2( (&node->locx), min, max);
+ totnode++;
+ }
+ node->done= 0;
+ }
+ if(totnode==0) return NULL;
+
+ /* check if all connections are OK, no unselected node has both
+ inputs and outputs to a selection */
+ for(link= ntree->links.first; link; link= link->next) {
+ if(link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT)
+ link->tonode->done |= 1;
+ if(link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT)
+ link->fromnode->done |= 2;
+ }
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if((node->flag & NODE_SELECT)==0)
+ if(node->done==3)
+ break;
+ }
+ if(node)
+ return NULL;
+
+ /* OK! new nodetree */
+ ngroup= ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP);
+
+ /* move nodes over */
+ for(node= ntree->nodes.first; node; node= nextn) {
+ nextn= node->next;
+ if(node->flag & NODE_SELECT) {
+ /* keep track of this node's RNA "base" path (the part of the pat identifying the node)
+ * if the old nodetree has animation data which potentially covers this node
+ */
+ if (ntree->adt) {
+ PointerRNA ptr;
+ char *path;
+
+ RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
+ path = RNA_path_from_ID_to_struct(&ptr);
+
+ if (path)
+ BLI_addtail(&anim_basepaths, BLI_genericNodeN(path));
+ }
+
+ /* change node-collection membership */
+ BLI_remlink(&ntree->nodes, node);
+ BLI_addtail(&ngroup->nodes, node);
+
+ node->locx-= 0.5f*(min[0]+max[0]);
+ node->locy-= 0.5f*(min[1]+max[1]);
+ }
+ }
+
+ /* move animation data over */
+ if (ntree->adt) {
+ LinkData *ld, *ldn=NULL;
+
+ BKE_animdata_separate_by_basepath(&ntree->id, &ngroup->id, &anim_basepaths);
+
+ /* paths + their wrappers need to be freed */
+ for (ld = anim_basepaths.first; ld; ld = ldn) {
+ ldn = ld->next;
+
+ MEM_freeN(ld->data);
+ BLI_freelinkN(&anim_basepaths, ld);
+ }
+ }
+
+ /* make group node */
+ ntemp.type = NODE_GROUP;
+ ntemp.ngroup = ngroup;
+ gnode= nodeAddNode(ntree, &ntemp);
+ gnode->locx= 0.5f*(min[0]+max[0]);
+ gnode->locy= 0.5f*(min[1]+max[1]);
+
+ /* relink external sockets */
+ for(link= ntree->links.first; link; link= linkn) {
+ linkn= link->next;
+
+ if(link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) {
+ BLI_remlink(&ntree->links, link);
+ BLI_addtail(&ngroup->links, link);
+ }
+ else if(link->tonode && (link->tonode->flag & NODE_SELECT)) {
+ gsock = node_group_expose_socket(ngroup, link->tosock, SOCK_IN);
+ link->tosock->link = nodeAddLink(ngroup, NULL, gsock, link->tonode, link->tosock);
+ link->tosock = node_group_add_extern_socket(ntree, &gnode->inputs, SOCK_IN, gsock);
+ link->tonode = gnode;
+ }
+ else if(link->fromnode && (link->fromnode->flag & NODE_SELECT)) {
+ /* search for existing group node socket */
+ for (gsock=ngroup->outputs.first; gsock; gsock=gsock->next)
+ if (gsock->link && gsock->link->fromsock==link->fromsock)
+ break;
+ if (!gsock) {
+ gsock = node_group_expose_socket(ngroup, link->fromsock, SOCK_OUT);
+ gsock->link = nodeAddLink(ngroup, link->fromnode, link->fromsock, NULL, gsock);
+ link->fromsock = node_group_add_extern_socket(ntree, &gnode->outputs, SOCK_OUT, gsock);
+ }
+ else
+ link->fromsock = node_group_find_output(gnode, gsock);
+ link->fromnode = gnode;
+ }
+ }
+
+ ngroup->update |= NTREE_UPDATE;
+ ntreeUpdateTree(ngroup);
+ ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS;
+ ntreeUpdateTree(ntree);
+
+ return gnode;
+}
+
+/* XXX This is a makeshift function to have useful initial group socket values.
+ * In the end this should be implemented by a flexible socket data conversion system,
+ * which is yet to be implemented. The idea is that beside default standard conversions,
+ * such as int-to-float, it should be possible to quickly select a conversion method or
+ * a chain of conversions for each input, whenever there is more than one option.
+ * E.g. a vector-to-float conversion could use either of the x/y/z components or
+ * the vector length.
+ *
+ * In the interface this could be implemented by a pseudo-script textbox on linked inputs,
+ * with quick selection from a predefined list of conversion options. Some Examples:
+ * - vector component 'z' (vector->float): "z"
+ * - greyscale color (float->color): "grey"
+ * - color luminance (color->float): "lum"
+ * - matrix column 2 length (matrix->vector->float): "col[1].len"
+ * - mesh vertex coordinate 'y' (mesh->vertex->vector->float): "vertex.co.y"
+ *
+ * The actual conversion is then done by a series of conversion functions,
+ * which are defined in the socket type structs.
+ */
+static void convert_socket_value(bNodeSocket *from, bNodeSocket *to)
+{
+ /* XXX only one of these pointers is valid! just putting them here for convenience */
+ bNodeSocketValueFloat *fromfloat= (bNodeSocketValueFloat*)from->default_value;
+ bNodeSocketValueInt *fromint= (bNodeSocketValueInt*)from->default_value;
+ bNodeSocketValueBoolean *frombool= (bNodeSocketValueBoolean*)from->default_value;
+ bNodeSocketValueVector *fromvector= (bNodeSocketValueVector*)from->default_value;
+ bNodeSocketValueRGBA *fromrgba= (bNodeSocketValueRGBA*)from->default_value;
+
+ bNodeSocketValueFloat *tofloat= (bNodeSocketValueFloat*)to->default_value;
+ bNodeSocketValueInt *toint= (bNodeSocketValueInt*)to->default_value;
+ bNodeSocketValueBoolean *tobool= (bNodeSocketValueBoolean*)to->default_value;
+ bNodeSocketValueVector *tovector= (bNodeSocketValueVector*)to->default_value;
+ bNodeSocketValueRGBA *torgba= (bNodeSocketValueRGBA*)to->default_value;
+
+ switch (from->type) {
+ case SOCK_FLOAT:
+ switch (to->type) {
+ case SOCK_FLOAT:
+ tofloat->value = fromfloat->value;
+ break;
+ case SOCK_INT:
+ toint->value = (int)fromfloat->value;
+ break;
+ case SOCK_BOOLEAN:
+ tobool->value = (fromfloat->value > 0.0f);
+ break;
+ case SOCK_VECTOR:
+ tovector->value[0] = tovector->value[1] = tovector->value[2] = fromfloat->value;
+ break;
+ case SOCK_RGBA:
+ torgba->value[0] = torgba->value[1] = torgba->value[2] = torgba->value[3] = fromfloat->value;
+ break;
+ }
+ break;
+ case SOCK_INT:
+ switch (to->type) {
+ case SOCK_FLOAT:
+ tofloat->value = (float)fromint->value;
+ break;
+ case SOCK_INT:
+ toint->value = fromint->value;
+ break;
+ case SOCK_BOOLEAN:
+ tobool->value = (fromint->value > 0);
+ break;
+ case SOCK_VECTOR:
+ tovector->value[0] = tovector->value[1] = tovector->value[2] = (float)fromint->value;
+ break;
+ case SOCK_RGBA:
+ torgba->value[0] = torgba->value[1] = torgba->value[2] = torgba->value[3] = (float)fromint->value;
+ break;
+ }
+ break;
+ case SOCK_BOOLEAN:
+ switch (to->type) {
+ case SOCK_FLOAT:
+ tofloat->value = (float)frombool->value;
+ break;
+ case SOCK_INT:
+ toint->value = (int)frombool->value;
+ break;
+ case SOCK_BOOLEAN:
+ tobool->value = frombool->value;
+ break;
+ case SOCK_VECTOR:
+ tovector->value[0] = tovector->value[1] = tovector->value[2] = (float)frombool->value;
+ break;
+ case SOCK_RGBA:
+ torgba->value[0] = torgba->value[1] = torgba->value[2] = torgba->value[3] = (float)frombool->value;
+ break;
+ }
+ break;
+ case SOCK_VECTOR:
+ switch (to->type) {
+ case SOCK_FLOAT:
+ tofloat->value = fromvector->value[0];
+ break;
+ case SOCK_INT:
+ toint->value = (int)fromvector->value[0];
+ break;
+ case SOCK_BOOLEAN:
+ tobool->value = (fromvector->value[0] > 0.0f);
+ break;
+ case SOCK_VECTOR:
+ copy_v3_v3(tovector->value, fromvector->value);
+ break;
+ case SOCK_RGBA:
+ copy_v3_v3(torgba->value, fromvector->value);
+ torgba->value[3] = 1.0f;
+ break;
+ }
+ break;
+ case SOCK_RGBA:
+ switch (to->type) {
+ case SOCK_FLOAT:
+ tofloat->value = fromrgba->value[0];
+ break;
+ case SOCK_INT:
+ toint->value = (int)fromrgba->value[0];
+ break;
+ case SOCK_BOOLEAN:
+ tobool->value = (fromrgba->value[0] > 0.0f);
+ break;
+ case SOCK_VECTOR:
+ copy_v3_v3(tovector->value, fromrgba->value);
+ break;
+ case SOCK_RGBA:
+ copy_v4_v4(torgba->value, fromrgba->value);
+ break;
+ }
+ break;
+ }
+}
+
+static void copy_socket_value(bNodeSocket *from, bNodeSocket *to)
+{
+ /* XXX only one of these pointers is valid! just putting them here for convenience */
+ bNodeSocketValueFloat *fromfloat= (bNodeSocketValueFloat*)from->default_value;
+ bNodeSocketValueInt *fromint= (bNodeSocketValueInt*)from->default_value;
+ bNodeSocketValueBoolean *frombool= (bNodeSocketValueBoolean*)from->default_value;
+ bNodeSocketValueVector *fromvector= (bNodeSocketValueVector*)from->default_value;
+ bNodeSocketValueRGBA *fromrgba= (bNodeSocketValueRGBA*)from->default_value;
+
+ bNodeSocketValueFloat *tofloat= (bNodeSocketValueFloat*)to->default_value;
+ bNodeSocketValueInt *toint= (bNodeSocketValueInt*)to->default_value;
+ bNodeSocketValueBoolean *tobool= (bNodeSocketValueBoolean*)to->default_value;
+ bNodeSocketValueVector *tovector= (bNodeSocketValueVector*)to->default_value;
+ bNodeSocketValueRGBA *torgba= (bNodeSocketValueRGBA*)to->default_value;
+
+ if (from->type != to->type)
+ return;
+
+ switch (from->type) {
+ case SOCK_FLOAT:
+ *tofloat = *fromfloat;
+ break;
+ case SOCK_INT:
+ *toint = *fromint;
+ break;
+ case SOCK_BOOLEAN:
+ *tobool = *frombool;
+ break;
+ case SOCK_VECTOR:
+ *tovector = *fromvector;
+ break;
+ case SOCK_RGBA:
+ *torgba = *fromrgba;
+ break;
+ }
+}
+
+/* returns 1 if its OK */
+int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
+{
+ bNodeLink *link, *linkn;
+ bNode *node, *nextn;
+ bNodeTree *ngroup, *wgroup;
+ ListBase anim_basepaths = {NULL, NULL};
+
+ ngroup= (bNodeTree *)gnode->id;
+ if(ngroup==NULL) return 0;
+
+ /* clear new pointers, set in copytree */
+ for(node= ntree->nodes.first; node; node= node->next)
+ node->new_node= NULL;
+
+ /* wgroup is a temporary copy of the NodeTree we're merging in
+ * - all of wgroup's nodes are transferred across to their new home
+ * - ngroup (i.e. the source NodeTree) is left unscathed
+ */
+ wgroup= ntreeCopyTree(ngroup);
+
+ /* add the nodes into the ntree */
+ for(node= wgroup->nodes.first; node; node= nextn) {
+ nextn= node->next;
+
+ /* keep track of this node's RNA "base" path (the part of the pat identifying the node)
+ * if the old nodetree has animation data which potentially covers this node
+ */
+ if (wgroup->adt) {
+ PointerRNA ptr;
+ char *path;
+
+ RNA_pointer_create(&wgroup->id, &RNA_Node, node, &ptr);
+ path = RNA_path_from_ID_to_struct(&ptr);
+
+ if (path)
+ BLI_addtail(&anim_basepaths, BLI_genericNodeN(path));
+ }
+
+ /* migrate node */
+ BLI_remlink(&wgroup->nodes, node);
+ BLI_addtail(&ntree->nodes, node);
+
+ node->locx+= gnode->locx;
+ node->locy+= gnode->locy;
+
+ node->flag |= NODE_SELECT;
+ }
+
+ /* restore external links to and from the gnode */
+ for(link= ntree->links.first; link; link= link->next) {
+ if (link->fromnode==gnode) {
+ if (link->fromsock->groupsock) {
+ bNodeSocket *gsock= link->fromsock->groupsock;
+ if (gsock->link) {
+ if (gsock->link->fromnode) {
+ /* NB: using the new internal copies here! the groupsock pointer still maps to the old tree */
+ link->fromnode = (gsock->link->fromnode ? gsock->link->fromnode->new_node : NULL);
+ link->fromsock = gsock->link->fromsock->new_sock;
+ }
+ else {
+ /* group output directly maps to group input */
+ bNodeSocket *insock= node_group_find_input(gnode, gsock->link->fromsock);
+ if (insock->link) {
+ link->fromnode = insock->link->fromnode;
+ link->fromsock = insock->link->fromsock;
+ }
+ }
+ }
+ else {
+ /* copy the default input value from the group socket default to the external socket */
+ convert_socket_value(gsock, link->tosock);
+ }
+ }
+ }
+ }
+ /* remove internal output links, these are not used anymore */
+ for(link=wgroup->links.first; link; link= linkn) {
+ linkn = link->next;
+ if (!link->tonode)
+ nodeRemLink(wgroup, link);
+ }
+ /* restore links from internal nodes */
+ for(link= wgroup->links.first; link; link= link->next) {
+ /* indicates link to group input */
+ if (!link->fromnode) {
+ /* NB: can't use find_group_node_input here,
+ * because gnode sockets still point to the old tree!
+ */
+ bNodeSocket *insock;
+ for (insock= gnode->inputs.first; insock; insock= insock->next)
+ if (insock->groupsock->new_sock == link->fromsock)
+ break;
+ if (insock->link) {
+ link->fromnode = insock->link->fromnode;
+ link->fromsock = insock->link->fromsock;
+ }
+ else {
+ /* copy the default input value from the group node socket default to the internal socket */
+ convert_socket_value(insock, link->tosock);
+ nodeRemLink(wgroup, link);
+ }
+ }
+ }
+
+ /* add internal links to the ntree */
+ for(link= wgroup->links.first; link; link= linkn) {
+ linkn= link->next;
+ BLI_remlink(&wgroup->links, link);
+ BLI_addtail(&ntree->links, link);
+ }
+
+ /* and copy across the animation */
+ if (wgroup->adt) {
+ LinkData *ld, *ldn=NULL;
+ bAction *waction;
+
+ /* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
+ waction = wgroup->adt->action = copy_action(wgroup->adt->action);
+
+ /* now perform the moving */
+ BKE_animdata_separate_by_basepath(&wgroup->id, &ntree->id, &anim_basepaths);
+
+ /* paths + their wrappers need to be freed */
+ for (ld = anim_basepaths.first; ld; ld = ldn) {
+ ldn = ld->next;
+
+ MEM_freeN(ld->data);
+ BLI_freelinkN(&anim_basepaths, ld);
+ }
+
+ /* free temp action too */
+ free_libblock(&G.main->action, waction);
+ }
+
+ /* delete the group instance. this also removes old input links! */
+ nodeFreeNode(ntree, gnode);
+
+ /* free the group tree (takes care of user count) */
+ free_libblock(&G.main->nodetree, wgroup);
+
+ ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS;
+ ntreeUpdateTree(ntree);
+
+ return 1;
+}
+
+bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type, int in_out)
+{
+ bNodeSocketType *stype = ntreeGetSocketType(type);
+ bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket");
+
+ strncpy(gsock->name, name, sizeof(gsock->name));
+ gsock->type = type;
+ /* group sockets are dynamically added */
+ gsock->flag |= SOCK_DYNAMIC;
+
+ gsock->next = gsock->prev = NULL;
+ gsock->new_sock = NULL;
+ gsock->link = NULL;
+ /* assign new unique index */
+ gsock->own_index = ngroup->cur_index++;
+ gsock->limit = (in_out==SOCK_IN ? 0xFFF : 1);
+
+ if (stype->value_structsize > 0)
+ gsock->default_value = MEM_callocN(stype->value_structsize, "default socket value");
+
+ BLI_addtail(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock);
+
+ ngroup->update |= (in_out==SOCK_IN ? NTREE_UPDATE_GROUP_IN : NTREE_UPDATE_GROUP_OUT);
+
+ return gsock;
+}
+
+bNodeSocket *node_group_expose_socket(bNodeTree *ngroup, bNodeSocket *sock, int in_out)
+{
+ bNodeSocket *gsock= node_group_add_socket(ngroup, sock->name, sock->type, in_out);
+
+ /* initialize the default value. */
+ copy_socket_value(sock, gsock);
+
+ return gsock;
+}
+
+void node_group_expose_all_sockets(bNodeTree *ngroup)
+{
+ bNode *node;
+ bNodeSocket *sock, *gsock;
+
+ for (node=ngroup->nodes.first; node; node=node->next) {
+ for (sock=node->inputs.first; sock; sock=sock->next) {
+ if (!sock->link && !(sock->flag & SOCK_HIDDEN)) {
+ gsock = node_group_add_socket(ngroup, sock->name, sock->type, SOCK_IN);
+
+ /* initialize the default value. */
+ copy_socket_value(sock, gsock);
+
+ sock->link = nodeAddLink(ngroup, NULL, gsock, node, sock);
+ }
+ }
+ for (sock=node->outputs.first; sock; sock=sock->next) {
+ if (nodeCountSocketLinks(ngroup, sock)==0 && !(sock->flag & SOCK_HIDDEN)) {
+ gsock = node_group_add_socket(ngroup, sock->name, sock->type, SOCK_OUT);
+
+ /* initialize the default value. */
+ copy_socket_value(sock, gsock);
+
+ gsock->link = nodeAddLink(ngroup, node, sock, NULL, gsock);
+ }
+ }
+ }
+}
+
+void node_group_remove_socket(bNodeTree *ngroup, bNodeSocket *gsock, int in_out)
+{
+ nodeRemSocketLinks(ngroup, gsock);
+
+ switch (in_out) {
+ case SOCK_IN:
+ BLI_remlink(&ngroup->inputs, gsock);
+ ngroup->update |= NTREE_UPDATE_GROUP_IN;
+ break;
+ case SOCK_OUT:
+ BLI_remlink(&ngroup->outputs, gsock);
+ ngroup->update |= NTREE_UPDATE_GROUP_OUT;
+ break;
+ }
+
+ if (gsock->default_value)
+ MEM_freeN(gsock->default_value);
+
+ MEM_freeN(gsock);
+}
+
+/* groups display their internal tree name as label */
+const char *node_group_label(bNode *node)
+{
+ return (node->id)? node->id->name+2: "Missing Datablock";
+}
+
+int node_group_valid(bNodeTree *ntree, bNodeTemplate *ntemp)
+{
+ bNodeTemplate childtemp;
+ bNode *node;
+
+ /* regular groups cannot be recursive */
+ if (ntree == ntemp->ngroup)
+ return 0;
+
+ /* make sure all children are valid */
+ for (node=ntemp->ngroup->nodes.first; node; node=node->next) {
+ childtemp = nodeMakeTemplate(node);
+ if (!nodeValid(ntree, &childtemp))
+ return 0;
+ }
+
+ return 1;
+}
+
+bNodeTemplate node_group_template(bNode *node)
+{
+ bNodeTemplate ntemp;
+ ntemp.type = NODE_GROUP;
+ ntemp.ngroup = (bNodeTree*)node->id;
+ return ntemp;
+}
+
+void node_group_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
+{
+ node->id = (ID*)ntemp->ngroup;
+
+ /* NB: group socket input/output roles are inverted internally!
+ * Group "inputs" work as outputs in links and vice versa.
+ */
+ if (ntemp->ngroup) {
+ bNodeSocket *gsock;
+ for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
+ node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
+ for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
+ node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
+ }
+}
+
+static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_out, bNodeSocket *gsock)
+{
+ bNodeSocket *sock;
+
+ /* group sockets tagged as internal are not exposed ever */
+ if (gsock->flag & SOCK_INTERNAL)
+ return NULL;
+
+ for(sock= lb->first; sock; sock= sock->next) {
+ if(sock->own_index==gsock->own_index)
+ break;
+ }
+ if(sock) {
+ sock->groupsock = gsock;
+
+ strcpy(sock->name, gsock->name);
+ sock->type= gsock->type;
+
+ /* XXX hack: group socket input/output roles are inverted internally,
+ * need to change the limit value when making actual node sockets from them.
+ */
+ sock->limit = (in_out==SOCK_IN ? 1 : 0xFFF);
+
+ BLI_remlink(lb, sock);
+
+ return sock;
+ }
+ else {
+ return node_group_add_extern_socket(ntree, NULL, in_out, gsock);
+ }
+}
+
+static void group_verify_socket_list(bNodeTree *ntree, bNode *node, ListBase *lb, int in_out, ListBase *glb)
+{
+ bNodeSocket *sock, *nextsock, *gsock;
+
+ /* step by step compare */
+ for (gsock= glb->first; gsock; gsock=gsock->next) {
+ /* abusing new_sock pointer for verification here! only used inside this function */
+ gsock->new_sock= group_verify_socket(ntree, lb, in_out, gsock);
+ }
+ /* leftovers are removed */
+ for (sock=lb->first; sock; sock=nextsock) {
+ nextsock=sock->next;
+ if (sock->flag & SOCK_DYNAMIC)
+ nodeRemoveSocket(ntree, node, sock);
+ }
+ /* and we put back the verified sockets */
+ for (gsock= glb->first; gsock; gsock=gsock->next) {
+ if (gsock->new_sock) {
+ BLI_addtail(lb, gsock->new_sock);
+ gsock->new_sock = NULL;
+ }
+ }
+}
+
+/* make sure all group node in ntree, which use ngroup, are sync'd */
+void node_group_verify(struct bNodeTree *ntree, struct bNode *node, struct ID *id)
+{
+ /* check inputs and outputs, and remove or insert them */
+ if (node->id==id) {
+ bNodeTree *ngroup= (bNodeTree*)node->id;
+ group_verify_socket_list(ntree, node, &node->inputs, SOCK_IN, &ngroup->inputs);
+ group_verify_socket_list(ntree, node, &node->outputs, SOCK_OUT, &ngroup->outputs);
+ }
+}
+
+struct bNodeTree *node_group_edit_get(bNode *node)
+{
+ if (node->flag & NODE_GROUP_EDIT)
+ return (bNodeTree*)node->id;
+ else
+ return NULL;
+}
+
+struct bNodeTree *node_group_edit_set(bNode *node, int edit)
+{
+ if (edit) {
+ bNodeTree *ngroup= (bNodeTree*)node->id;
+ if (ngroup) {
+ if(ngroup->id.lib)
+ ntreeMakeLocal(ngroup);
+
+ node->flag |= NODE_GROUP_EDIT;
+ }
+ return ngroup;
+ }
+ else {
+ node->flag &= ~NODE_GROUP_EDIT;
+ return NULL;
+ }
+}
+
+void node_group_edit_clear(bNode *node)
+{
+ bNodeTree *ngroup= (bNodeTree*)node->id;
+ bNode *inode;
+
+ node->flag &= ~NODE_GROUP_EDIT;
+
+ if (ngroup)
+ for (inode=ngroup->nodes.first; inode; inode=inode->next)
+ nodeGroupEditClear(inode);
+}
+
+void node_group_link(bNodeTree *ntree, bNodeSocket *sock, int in_out)
+{
+ node_group_expose_socket(ntree, sock, in_out);
+}
+
+/**** For Loop ****/
+
+/* Essentially a group node with slightly different behavior.
+ * The internal tree is executed several times, with each output being re-used
+ * as an input in the next iteration. For this purpose, input and output socket
+ * lists are kept identical!
+ */
+
+bNodeTemplate node_forloop_template(bNode *node)
+{
+ bNodeTemplate ntemp;
+ ntemp.type = NODE_FORLOOP;
+ ntemp.ngroup = (bNodeTree*)node->id;
+ return ntemp;
+}
+
+void node_forloop_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
+{
+ bNodeSocket *sock;
+
+ node->id = (ID*)ntemp->ngroup;
+
+ sock = nodeAddInputFloat(ntree, node, "Iterations", PROP_UNSIGNED, 1, 0, 10000);
+
+ /* NB: group socket input/output roles are inverted internally!
+ * Group "inputs" work as outputs in links and vice versa.
+ */
+ if (ntemp->ngroup) {
+ bNodeSocket *gsock;
+ for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
+ node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
+ for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
+ node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
+ }
+}
+
+void node_forloop_init_tree(bNodeTree *ntree)
+{
+ bNodeSocket *sock;
+ sock = node_group_add_socket(ntree, "Iteration", SOCK_FLOAT, SOCK_IN);
+ sock->flag |= SOCK_INTERNAL;
+}
+
+static void loop_sync(bNodeTree *ntree, int sync_in_out)
+{
+ bNodeSocket *sock, *sync, *nsync, *mirror;
+ ListBase *sync_lb;
+
+ if (sync_in_out==SOCK_IN) {
+ sock = ntree->outputs.first;
+
+ sync = ntree->inputs.first;
+ sync_lb = &ntree->inputs;
+ }
+ else {
+ sock = ntree->inputs.first;
+
+ sync = ntree->outputs.first;
+ sync_lb = &ntree->outputs;
+ }
+
+ /* NB: the sock->storage pointer is used here directly to store the own_index int
+ * out the mirrored socket counterpart!
+ */
+
+ while (sock) {
+ /* skip static and internal sockets on the sync side (preserves socket order!) */
+ while (sync && ((sync->flag & SOCK_INTERNAL) || !(sync->flag & SOCK_DYNAMIC)))
+ sync = sync->next;
+
+ if (!(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) {
+ if (sock->storage==NULL) {
+ /* if mirror index is 0, the sockets is newly added and a new mirror must be created. */
+ mirror = node_group_expose_socket(ntree, sock, sync_in_out);
+ /* store the mirror index */
+ sock->storage = SET_INT_IN_POINTER(mirror->own_index);
+ mirror->storage = SET_INT_IN_POINTER(sock->own_index);
+ /* move mirror to the right place */
+ BLI_remlink(sync_lb, mirror);
+ if (sync)
+ BLI_insertlinkbefore(sync_lb, sync, mirror);
+ else
+ BLI_addtail(sync_lb, mirror);
+ }
+ else {
+ /* look up the mirror socket */
+ for (mirror=sync; mirror; mirror=mirror->next)
+ if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage))
+ break;
+ /* make sure the name is the same (only for identification by user, no deeper meaning) */
+ strcpy(mirror->name, sock->name);
+ /* fix the socket order if necessary */
+ if (mirror != sync) {
+ BLI_remlink(sync_lb, mirror);
+ BLI_insertlinkbefore(sync_lb, sync, mirror);
+ }
+ else
+ sync = sync->next;
+ }
+ }
+
+ sock = sock->next;
+ }
+
+ /* remaining sockets in sync_lb are leftovers from deleted sockets, remove them */
+ while (sync) {
+ nsync = sync->next;
+ if (!(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC))
+ node_group_remove_socket(ntree, sync, sync_in_out);
+ sync = nsync;
+ }
+}
+
+void node_loop_update_tree(bNodeTree *ngroup)
+{
+ /* make sure inputs & outputs are identical */
+ if (ngroup->update & NTREE_UPDATE_GROUP_IN)
+ loop_sync(ngroup, SOCK_OUT);
+ if (ngroup->update & NTREE_UPDATE_GROUP_OUT)
+ loop_sync(ngroup, SOCK_IN);
+}
+
+void node_whileloop_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
+{
+ bNodeSocket *sock;
+
+ node->id = (ID*)ntemp->ngroup;
+
+ sock = nodeAddInputFloat(ntree, node, "Condition", PROP_NONE, 1, 0, 1);
+
+ /* max iterations */
+ node->custom1 = 10000;
+
+ /* NB: group socket input/output roles are inverted internally!
+ * Group "inputs" work as outputs in links and vice versa.
+ */
+ if (ntemp->ngroup) {
+ bNodeSocket *gsock;
+ for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
+ node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
+ for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
+ node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
+ }
+}
+
+void node_whileloop_init_tree(bNodeTree *ntree)
+{
+ bNodeSocket *sock;
+ sock = node_group_add_socket(ntree, "Condition", SOCK_FLOAT, SOCK_OUT);
+ sock->flag |= SOCK_INTERNAL;
+}
+
+bNodeTemplate node_whileloop_template(bNode *node)
+{
+ bNodeTemplate ntemp;
+ ntemp.type = NODE_WHILELOOP;
+ ntemp.ngroup = (bNodeTree*)node->id;
+ return ntemp;
+}
+
+/**** FRAME ****/
+
+void register_node_type_frame(ListBase *lb)
+{
+ /* frame type is used for all tree types, needs dynamic allocation */
+ bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "frame node type");
+
+ node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND);
+ node_type_size(ntype, 150, 100, 0);
+
+ ntype->needs_free = 1;
+ nodeRegisterType(lb, ntype);
+}
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
new file mode 100644
index 00000000000..31a13d8168d
--- /dev/null
+++ b/source/blender/nodes/intern/node_common.h
@@ -0,0 +1,65 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/node_common.h
+ * \ingroup nodes
+ */
+
+
+#ifndef NODE_COMMON_H_
+#define NODE_COMMON_H_
+
+#include "DNA_listBase.h"
+
+struct bNodeTree;
+
+struct bNodeSocket *node_group_add_extern_socket(struct bNodeTree *ntree, ListBase *lb, int in_out, struct bNodeSocket *gsock);
+
+void node_group_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
+void node_forloop_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
+void node_whileloop_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
+
+void node_forloop_init_tree(struct bNodeTree *ntree);
+void node_whileloop_init_tree(struct bNodeTree *ntree);
+
+const char *node_group_label(struct bNode *node);
+
+struct bNodeTemplate node_group_template(struct bNode *node);
+struct bNodeTemplate node_forloop_template(struct bNode *node);
+struct bNodeTemplate node_whileloop_template(struct bNode *node);
+
+int node_group_valid(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
+void node_group_verify(struct bNodeTree *ntree, struct bNode *node, struct ID *id);
+
+struct bNodeTree *node_group_edit_get(struct bNode *node);
+struct bNodeTree *node_group_edit_set(struct bNode *node, int edit);
+void node_group_edit_clear(bNode *node);
+
+void node_loop_update_tree(struct bNodeTree *ngroup);
+
+#endif
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
new file mode 100644
index 00000000000..0d688438cf9
--- /dev/null
+++ b/source/blender/nodes/intern/node_exec.c
@@ -0,0 +1,308 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/node_exec.c
+ * \ingroup nodes
+ */
+
+
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_node.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "node_exec.h"
+
+
+/* for a given socket, find the actual stack entry */
+bNodeStack *node_get_socket_stack(bNodeStack *stack, bNodeSocket *sock)
+{
+ return stack + sock->stack_index;
+}
+
+void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack **out)
+{
+ bNodeSocket *sock;
+
+ /* build pointer stack */
+ if (in) {
+ for(sock= node->inputs.first; sock; sock= sock->next) {
+ *(in++) = node_get_socket_stack(stack, sock);
+ }
+ }
+
+ if (out) {
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ *(out++) = node_get_socket_stack(stack, sock);
+ }
+ }
+}
+
+void node_init_input_index(bNodeSocket *sock, int *index)
+{
+ if (sock->link && sock->link->fromsock) {
+ sock->stack_index = sock->link->fromsock->stack_index;
+ }
+ else {
+ sock->stack_index = (*index)++;
+ }
+}
+
+void node_init_output_index(bNodeSocket *sock, int *index)
+{
+ sock->stack_index = (*index)++;
+}
+
+/* basic preparation of socket stacks */
+static struct bNodeStack *setup_stack(bNodeStack *stack, bNodeSocket *sock)
+{
+ bNodeStack *ns = node_get_socket_stack(stack, sock);
+ float null_value[4]= {0.0f, 0.0f, 0.0f, 0.0f};
+
+ /* don't mess with remote socket stacks, these are initialized by other nodes! */
+ if (sock->link)
+ return ns;
+
+ ns->sockettype = sock->type;
+
+ if (sock->default_value) {
+ switch (sock->type) {
+ case SOCK_FLOAT:
+ ns->vec[0] = ((bNodeSocketValueFloat*)sock->default_value)->value;
+ break;
+ case SOCK_VECTOR:
+ copy_v3_v3(ns->vec, ((bNodeSocketValueVector*)sock->default_value)->value);
+ break;
+ case SOCK_RGBA:
+ copy_v4_v4(ns->vec, ((bNodeSocketValueRGBA*)sock->default_value)->value);
+ break;
+ }
+ }
+ else {
+ switch (sock->type) {
+ case SOCK_FLOAT:
+ ns->vec[0] = 0.0f;
+ break;
+ case SOCK_VECTOR:
+ copy_v3_v3(ns->vec, null_value);
+ break;
+ case SOCK_RGBA:
+ copy_v4_v4(ns->vec, null_value);
+ break;
+ }
+ }
+
+ return ns;
+}
+
+bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
+{
+ bNodeTreeExec *exec;
+ bNode *node;
+ bNodeExec *nodeexec;
+ bNodeSocket *sock, *gsock;
+ bNodeStack *ns;
+ int index= 0;
+ bNode **nodelist;
+ int totnodes, n;
+
+ if((ntree->init & NTREE_TYPE_INIT)==0)
+ ntreeInitTypes(ntree);
+
+ /* get a dependency-sorted list of nodes */
+ ntreeGetDependencyList(ntree, &nodelist, &totnodes);
+
+ /* XXX could let callbacks do this for specialized data */
+ exec = MEM_callocN(sizeof(bNodeTreeExec), "node tree execution data");
+ /* backpointer to node tree */
+ exec->nodetree = ntree;
+
+ /* group inputs essentially work as outputs */
+ for(gsock=ntree->inputs.first; gsock; gsock = gsock->next)
+ node_init_output_index(gsock, &index);
+ /* set stack indexes */
+ for(n=0; n < totnodes; ++n) {
+ node = nodelist[n];
+
+ node->stack_index = index;
+
+ /* init node socket stack indexes */
+ for (sock=node->inputs.first; sock; sock=sock->next)
+ node_init_input_index(sock, &index);
+ for (sock=node->outputs.first; sock; sock=sock->next)
+ node_init_output_index(sock, &index);
+ }
+ /* group outputs essentially work as inputs */
+ for(gsock=ntree->outputs.first; gsock; gsock = gsock->next)
+ node_init_input_index(gsock, &index);
+
+ /* allocated exec data pointers for nodes */
+ exec->totnodes = totnodes;
+ exec->nodeexec = MEM_callocN(exec->totnodes * sizeof(bNodeExec), "node execution data");
+ /* allocate data pointer for node stack */
+ exec->stacksize = index;
+ exec->stack = MEM_callocN(exec->stacksize * sizeof(bNodeStack), "bNodeStack");
+
+ /* prepare group tree inputs */
+ for (sock=ntree->inputs.first; sock; sock=sock->next) {
+ ns = setup_stack(exec->stack, sock);
+ if (ns->hasoutput)
+ ns->hasinput = 1;
+ }
+ /* prepare all internal nodes for execution */
+ for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node = nodelist[n];
+
+ /* tag inputs */
+ for (sock=node->inputs.first; sock; sock=sock->next) {
+ /* disable the node if an input link is invalid */
+ if(sock->link && !(sock->link->flag & NODE_LINK_VALID))
+ node->need_exec= 0;
+
+ ns = setup_stack(exec->stack, sock);
+ if (ns->hasoutput)
+ ns->hasinput = 1;
+ }
+
+ /* tag all outputs */
+ for (sock=node->outputs.first; sock; sock=sock->next) {
+ ns = setup_stack(exec->stack, sock);
+ ns->hasoutput = 1;
+ }
+
+ if(node->typeinfo->initexecfunc)
+ nodeexec->data = node->typeinfo->initexecfunc(node);
+ }
+ /* prepare group tree outputs */
+ for (sock=ntree->outputs.first; sock; sock=sock->next) {
+ ns = setup_stack(exec->stack, sock);
+ ns->hasoutput = 1;
+ }
+
+ if (nodelist)
+ MEM_freeN(nodelist);
+
+ return exec;
+}
+
+void ntree_exec_end(bNodeTreeExec *exec)
+{
+ bNodeExec *nodeexec;
+ int n;
+
+ if (exec->stack)
+ MEM_freeN(exec->stack);
+
+ for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ if (nodeexec->node->typeinfo->freeexecfunc)
+ nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data);
+ }
+
+ if (exec->nodeexec)
+ MEM_freeN(exec->nodeexec);
+
+ MEM_freeN(exec);
+}
+
+/**** Compositor/Material/Texture trees ****/
+
+bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
+{
+ ListBase *lb= &exec->threadstack[thread];
+ bNodeThreadStack *nts;
+
+ for(nts=lb->first; nts; nts=nts->next) {
+ if(!nts->used) {
+ nts->used= 1;
+ break;
+ }
+ }
+
+ if (!nts) {
+ nts= MEM_callocN(sizeof(bNodeThreadStack), "bNodeThreadStack");
+ nts->stack= MEM_dupallocN(exec->stack);
+ nts->used= 1;
+ BLI_addtail(lb, nts);
+ }
+
+ return nts;
+}
+
+void ntreeReleaseThreadStack(bNodeThreadStack *nts)
+{
+ nts->used = 0;
+}
+
+void ntreeExecNodes(bNodeTreeExec *exec, void *callerdata, int thread)
+{
+ bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeExec *nodeexec;
+ bNode *node;
+ int n;
+
+ /* nodes are presorted, so exec is in order of list */
+
+ for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node;
+ if(node->need_exec) {
+ node_get_stack(node, exec->stack, nsin, nsout);
+ if(node->typeinfo->execfunc)
+ node->typeinfo->execfunc(callerdata, node, nsin, nsout);
+ else if (node->typeinfo->newexecfunc)
+ node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
+ }
+ }
+}
+
+void ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *callerdata, int thread)
+{
+ bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeExec *nodeexec;
+ bNode *node;
+ int n;
+
+ /* nodes are presorted, so exec is in order of list */
+
+ for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node;
+ if(node->need_exec) {
+ node_get_stack(node, nts->stack, nsin, nsout);
+ if(node->typeinfo->execfunc)
+ node->typeinfo->execfunc(callerdata, node, nsin, nsout);
+ else if (node->typeinfo->newexecfunc)
+ node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
+ }
+ }
+}
diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h
new file mode 100644
index 00000000000..457e119613b
--- /dev/null
+++ b/source/blender/nodes/intern/node_exec.h
@@ -0,0 +1,89 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/node_exec.h
+ * \ingroup nodes
+ */
+
+
+#ifndef NODE_EXEC_H_
+#define NODE_EXEC_H_
+
+#include "DNA_listBase.h"
+
+#include "BLI_utildefines.h"
+
+#include "BKE_node.h"
+
+#include "RNA_types.h"
+
+struct bNodeTree;
+struct bNode;
+struct bNodeStack;
+
+/* Node execution data */
+typedef struct bNodeExec {
+ struct bNode *node; /* backpointer to node */
+ void *data; /* custom data storage */
+} bNodeExec;
+
+/* Execution Data for each instance of node tree execution */
+typedef struct bNodeTreeExec {
+ struct bNodeTree *nodetree; /* backpointer to node tree */
+
+ int totnodes; /* total node count */
+ struct bNodeExec *nodeexec; /* per-node execution data */
+
+ int stacksize;
+ struct bNodeStack *stack; /* socket data stack */
+ /* only used by material and texture trees to keep one stack for each thread */
+ ListBase *threadstack; /* one instance of the stack for each thread */
+} bNodeTreeExec;
+
+/* stores one stack copy for each thread (material and texture trees) */
+typedef struct bNodeThreadStack {
+ struct bNodeThreadStack *next, *prev;
+ struct bNodeStack *stack;
+ int used;
+} bNodeThreadStack;
+
+struct bNodeStack *node_get_socket_stack(struct bNodeStack *stack, struct bNodeSocket *sock);
+void node_get_stack(struct bNode *node, struct bNodeStack *stack, struct bNodeStack **in, struct bNodeStack **out);
+void node_init_input_index(struct bNodeSocket *sock, int *index);
+void node_init_output_index(struct bNodeSocket *sock, int *index);
+
+struct bNodeTreeExec *ntree_exec_begin(struct bNodeTree *ntree);
+void ntree_exec_end(struct bNodeTreeExec *exec);
+
+void ntreeExecNodes(struct bNodeTreeExec *exec, void *callerdata, int thread);
+
+struct bNodeThreadStack *ntreeGetThreadStack(struct bNodeTreeExec *exec, int thread);
+void ntreeReleaseThreadStack(struct bNodeThreadStack *nts);
+void ntreeExecThreadNodes(struct bNodeTreeExec *exec, struct bNodeThreadStack *nts, void *callerdata, int thread);
+
+#endif
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
new file mode 100644
index 00000000000..ef8b3e797ce
--- /dev/null
+++ b/source/blender/nodes/intern/node_socket.c
@@ -0,0 +1,428 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toennne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/intern/node_socket.c
+ * \ingroup nodes
+ */
+
+
+#include "DNA_node_types.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_node.h"
+
+#include "RNA_access.h"
+#include "RNA_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "NOD_socket.h"
+
+/****************** FLOAT ******************/
+
+static bNodeSocketType node_socket_type_float = {
+ /* type */ SOCK_FLOAT,
+ /* ui_name */ "Float",
+ /* ui_description */ "Floating Point",
+ /* ui_icon */ 0,
+ /* ui_color */ {160,160,160,255},
+
+ /* value_structname */ "bNodeSocketValueFloat",
+ /* value_structsize */ sizeof(bNodeSocketValueFloat),
+
+ /* buttonfunc */ NULL,
+};
+
+/****************** VECTOR ******************/
+
+static bNodeSocketType node_socket_type_vector = {
+ /* type */ SOCK_VECTOR,
+ /* ui_name */ "Vector",
+ /* ui_description */ "3-dimensional floating point vector",
+ /* ui_icon */ 0,
+ /* ui_color */ {100,100,200,255},
+
+ /* value_structname */ "bNodeSocketValueVector",
+ /* value_structsize */ sizeof(bNodeSocketValueVector),
+
+ /* buttonfunc */ NULL,
+};
+
+/****************** RGBA ******************/
+
+static bNodeSocketType node_socket_type_rgba = {
+ /* type */ SOCK_RGBA,
+ /* ui_name */ "RGBA",
+ /* ui_description */ "RGBA color",
+ /* ui_icon */ 0,
+ /* ui_color */ {200,200,40,255},
+
+ /* value_structname */ "bNodeSocketValueRGBA",
+ /* value_structsize */ sizeof(bNodeSocketValueRGBA),
+
+ /* buttonfunc */ NULL,
+};
+
+/****************** INT ******************/
+
+static bNodeSocketType node_socket_type_int = {
+ /* type */ SOCK_INT,
+ /* ui_name */ "Int",
+ /* ui_description */ "Integer",
+ /* ui_icon */ 0,
+ /* ui_color */ {17,133,37,255},
+
+ /* value_structname */ "bNodeSocketValueInt",
+ /* value_structsize */ sizeof(bNodeSocketValueInt),
+
+ /* buttonfunc */ NULL,
+};
+
+/****************** BOOLEAN ******************/
+
+static bNodeSocketType node_socket_type_boolean = {
+ /* type */ SOCK_BOOLEAN,
+ /* ui_name */ "Boolean",
+ /* ui_description */ "Boolean",
+ /* ui_icon */ 0,
+ /* ui_color */ {158,139,63,255},
+
+ /* value_structname */ "bNodeSocketValueBoolean",
+ /* value_structsize */ sizeof(bNodeSocketValueBoolean),
+
+ /* buttonfunc */ NULL,
+};
+
+/****************** MESH ******************/
+
+static bNodeSocketType node_socket_type_mesh = {
+ /* type */ SOCK_MESH,
+ /* ui_name */ "Mesh",
+ /* ui_description */ "Mesh geometry data",
+ /* ui_icon */ 0,
+ /* ui_color */ {255,133,7,255},
+
+ /* value_structname */ NULL,
+ /* value_structsize */ 0,
+
+ /* buttonfunc */ NULL,
+};
+
+
+void node_socket_type_init(bNodeSocketType *types[])
+{
+ #define INIT_TYPE(name) types[node_socket_type_##name.type] = &node_socket_type_##name;
+
+ INIT_TYPE(float);
+ INIT_TYPE(vector);
+ INIT_TYPE(rgba);
+ INIT_TYPE(int);
+ INIT_TYPE(boolean);
+ INIT_TYPE(mesh);
+
+ #undef INIT_TYPE
+}
+
+struct bNodeSocket *nodeAddInputInt(struct bNodeTree *ntree, struct bNode *node, const char *name, PropertySubType subtype,
+ int value, int min, int max)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_INT);
+ bNodeSocketValueInt *dval= (bNodeSocketValueInt*)sock->default_value;
+ dval->subtype = subtype;
+ dval->value = value;
+ dval->min = min;
+ dval->max = max;
+ return sock;
+}
+struct bNodeSocket *nodeAddOutputInt(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_INT);
+ return sock;
+}
+
+struct bNodeSocket *nodeAddInputFloat(struct bNodeTree *ntree, struct bNode *node, const char *name, PropertySubType subtype,
+ float value, float min, float max)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_FLOAT);
+ bNodeSocketValueFloat *dval= (bNodeSocketValueFloat*)sock->default_value;
+ dval->subtype = subtype;
+ dval->value = value;
+ dval->min = min;
+ dval->max = max;
+ return sock;
+}
+struct bNodeSocket *nodeAddOutputFloat(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_FLOAT);
+ return sock;
+}
+
+struct bNodeSocket *nodeAddInputBoolean(struct bNodeTree *ntree, struct bNode *node, const char *name, char value)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_BOOLEAN);
+ bNodeSocketValueBoolean *dval= (bNodeSocketValueBoolean*)sock->default_value;
+ dval->value = value;
+ return sock;
+}
+struct bNodeSocket *nodeAddOutputBoolean(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_BOOLEAN);
+ return sock;
+}
+
+struct bNodeSocket *nodeAddInputVector(struct bNodeTree *ntree, struct bNode *node, const char *name, PropertySubType subtype,
+ float x, float y, float z, float min, float max)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_VECTOR);
+ bNodeSocketValueVector *dval= (bNodeSocketValueVector*)sock->default_value;
+ dval->subtype = subtype;
+ dval->value[0] = x;
+ dval->value[1] = y;
+ dval->value[2] = z;
+ dval->min = min;
+ dval->max = max;
+ return sock;
+}
+struct bNodeSocket *nodeAddOutputVector(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_VECTOR);
+ return sock;
+}
+
+struct bNodeSocket *nodeAddInputRGBA(struct bNodeTree *ntree, struct bNode *node, const char *name,
+ float r, float g, float b, float a)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_RGBA);
+ bNodeSocketValueRGBA *dval= (bNodeSocketValueRGBA*)sock->default_value;
+ dval->value[0] = r;
+ dval->value[1] = g;
+ dval->value[2] = b;
+ dval->value[3] = a;
+ return sock;
+}
+struct bNodeSocket *nodeAddOutputRGBA(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_RGBA);
+ return sock;
+}
+
+struct bNodeSocket *nodeAddInputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_MESH);
+ return sock;
+}
+struct bNodeSocket *nodeAddOutputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name)
+{
+ bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_MESH);
+ return sock;
+}
+
+struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp)
+{
+ bNodeSocket *sock;
+ switch (stemp->type) {
+ case SOCK_INT:
+ sock = nodeAddInputInt(ntree, node, stemp->name, stemp->subtype, (int)stemp->val1, (int)stemp->min, (int)stemp->max);
+ break;
+ case SOCK_FLOAT:
+ sock = nodeAddInputFloat(ntree, node, stemp->name, stemp->subtype, stemp->val1, stemp->min, stemp->max);
+ break;
+ case SOCK_BOOLEAN:
+ sock = nodeAddInputBoolean(ntree, node, stemp->name, (char)stemp->val1);
+ break;
+ case SOCK_VECTOR:
+ sock = nodeAddInputVector(ntree, node, stemp->name, stemp->subtype, stemp->val1, stemp->val2, stemp->val3, stemp->min, stemp->max);
+ break;
+ case SOCK_RGBA:
+ sock = nodeAddInputRGBA(ntree, node, stemp->name, stemp->val1, stemp->val2, stemp->val3, stemp->val4);
+ break;
+ case SOCK_MESH:
+ sock = nodeAddInputMesh(ntree, node, stemp->name);
+ break;
+ default:
+ sock = nodeAddSocket(ntree, node, SOCK_IN, stemp->name, stemp->type);
+ }
+ return sock;
+}
+
+struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp)
+{
+ bNodeSocket *sock;
+ switch (stemp->type) {
+ case SOCK_INT:
+ sock = nodeAddOutputInt(ntree, node, stemp->name);
+ break;
+ case SOCK_FLOAT:
+ sock = nodeAddOutputFloat(ntree, node, stemp->name);
+ break;
+ case SOCK_BOOLEAN:
+ sock = nodeAddOutputBoolean(ntree, node, stemp->name);
+ break;
+ case SOCK_VECTOR:
+ sock = nodeAddOutputVector(ntree, node, stemp->name);
+ break;
+ case SOCK_RGBA:
+ sock = nodeAddOutputRGBA(ntree, node, stemp->name);
+ break;
+ case SOCK_MESH:
+ sock = nodeAddOutputMesh(ntree, node, stemp->name);
+ break;
+ default:
+ sock = nodeAddSocket(ntree, node, SOCK_OUT, stemp->name, stemp->type);
+ }
+ return sock;
+}
+
+static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp)
+{
+ bNodeSocket *sock;
+
+ for(sock= socklist->first; sock; sock= sock->next) {
+ if(!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0)
+ break;
+ }
+ if(sock) {
+ sock->type= stemp->type; /* in future, read this from tydefs! */
+ if(stemp->limit==0) sock->limit= 0xFFF;
+ else sock->limit= stemp->limit;
+
+ /* Copy the property range and subtype parameters in case the template changed.
+ * NOT copying the actual value here, only button behavior changes!
+ */
+ switch (sock->type) {
+ case SOCK_FLOAT:
+ {
+ bNodeSocketValueFloat *dval= sock->default_value;
+ dval->min = stemp->min;
+ dval->max = stemp->max;
+ dval->subtype = stemp->subtype;
+ }
+ break;
+ case SOCK_INT:
+ {
+ bNodeSocketValueInt *dval= sock->default_value;
+ dval->min = stemp->min;
+ dval->max = stemp->max;
+ dval->subtype = stemp->subtype;
+ }
+ break;
+ case SOCK_VECTOR:
+ {
+ bNodeSocketValueVector *dval= sock->default_value;
+ dval->min = stemp->min;
+ dval->max = stemp->max;
+ dval->subtype = stemp->subtype;
+ }
+ break;
+ }
+
+ BLI_remlink(socklist, sock);
+
+ return sock;
+ }
+ else {
+ /* no socket for this template found, make a new one */
+ if (in_out==SOCK_IN)
+ sock = node_add_input_from_template(ntree, node, stemp);
+ else
+ sock = node_add_output_from_template(ntree, node, stemp);
+ /* remove the new socket from the node socket list first,
+ * will be added back after verification.
+ */
+ BLI_remlink(socklist, sock);
+ }
+
+ return sock;
+}
+
+static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp_first)
+{
+ bNodeSocket *sock;
+ bNodeSocketTemplate *stemp;
+
+ /* no inputs anymore? */
+ if(stemp_first==NULL) {
+ while(socklist->first) {
+ sock = (bNodeSocket*)socklist->first;
+ if (!(sock->flag & SOCK_DYNAMIC))
+ nodeRemoveSocket(ntree, node, socklist->first);
+ }
+ }
+ else {
+ /* step by step compare */
+ stemp= stemp_first;
+ while(stemp->type != -1) {
+ stemp->sock= verify_socket_template(ntree, node, in_out, socklist, stemp);
+ stemp++;
+ }
+ /* leftovers are removed */
+ while(socklist->first) {
+ sock = (bNodeSocket*)socklist->first;
+ if (!(sock->flag & SOCK_DYNAMIC))
+ nodeRemoveSocket(ntree, node, socklist->first);
+ }
+
+ /* and we put back the verified sockets */
+ stemp= stemp_first;
+ if (socklist->first) {
+ /* some dynamic sockets left, store the list start
+ * so we can add static sockets infront of it.
+ */
+ sock = socklist->first;
+ while(stemp->type != -1) {
+ /* put static sockets infront of dynamic */
+ BLI_insertlinkbefore(socklist, sock, stemp->sock);
+ stemp++;
+ }
+ }
+ else {
+ while(stemp->type != -1) {
+ BLI_addtail(socklist, stemp->sock);
+ stemp++;
+ }
+ }
+ }
+}
+
+void node_verify_socket_templates(bNodeTree *ntree, bNode *node)
+{
+ bNodeType *ntype= node->typeinfo;
+ if(ntype) {
+ verify_socket_template_list(ntree, node, SOCK_IN, &node->inputs, ntype->inputs);
+ verify_socket_template_list(ntree, node, SOCK_OUT, &node->outputs, ntype->outputs);
+ }
+}
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 1cc8c282179..bdf53df06af 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -32,12 +32,24 @@
*/
-#include "CMP_util.h"
-#include "SHD_util.h"
+#include "DNA_action_types.h"
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_colortools.h"
+#include "BKE_node.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
+#include "MEM_guardedalloc.h"
+
+#include "node_util.h"
+
+/**** Storage Data ****/
+
void node_free_curves(bNode *node)
{
curvemapping_free(node->storage);
@@ -58,6 +70,8 @@ void node_copy_standard_storage(bNode *orig_node, bNode *new_node)
new_node->storage= MEM_dupallocN(orig_node->storage);
}
+/**** Labels ****/
+
const char *node_blend_label(bNode *node)
{
const char *name;
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 5a78fc07883..8d38d57f577 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -35,14 +35,27 @@
#ifndef NODE_UTIL_H_
#define NODE_UTIL_H_
+#include "DNA_listBase.h"
+
+#include "BKE_node.h"
+
#include "MEM_guardedalloc.h"
+#include "NOD_socket.h"
+
+struct bNodeTree;
+struct bNode;
+
+/**** Storage Data ****/
+
extern void node_free_curves(struct bNode *node);
extern void node_free_standard_storage(struct bNode *node);
extern void node_copy_curves(struct bNode *orig_node, struct bNode *new_node);
extern void node_copy_standard_storage(struct bNode *orig_node, struct bNode *new_node);
+/**** Labels ****/
+
const char *node_blend_label(struct bNode *node);
const char *node_math_label(struct bNode *node);
const char *node_vect_math_label(struct bNode *node);
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
new file mode 100644
index 00000000000..620da7553b3
--- /dev/null
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -0,0 +1,212 @@
+/**
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/shader/node_shader_tree.c
+ * \ingroup nodes
+ */
+
+
+#include <string.h>
+
+#include "DNA_material_types.h"
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_threads.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_utildefines.h"
+
+#include "GPU_material.h"
+
+#include "RE_shader_ext.h"
+
+#include "node_exec.h"
+#include "node_util.h"
+#include "node_shader_util.h"
+
+static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
+{
+ Material *ma;
+ for(ma= main->mat.first; ma; ma= ma->id.next) {
+ if(ma->nodetree) {
+ func(calldata, &ma->id, ma->nodetree);
+ }
+ }
+}
+
+static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
+{
+ bNode *lnode;
+
+ /* copy over contents of previews */
+ for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if(ntreeNodeExists(ntree, lnode->new_node)) {
+ bNode *node= lnode->new_node;
+
+ if(node->preview && node->preview->rect) {
+ if(lnode->preview && lnode->preview->rect) {
+ int xsize= node->preview->xsize;
+ int ysize= node->preview->ysize;
+ memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
+ }
+ }
+ }
+ }
+}
+
+bNodeTreeType ntreeType_Shader = {
+ /* type */ NTREE_SHADER,
+ /* id_name */ "NTShader Nodetree",
+
+ /* node_types */ { NULL, NULL },
+
+ /* free_cache */ NULL,
+ /* free_node_cache */ NULL,
+ /* foreach_nodetree */ foreach_nodetree,
+ /* localize */ NULL,
+ /* local_sync */ local_sync,
+ /* local_merge */ NULL,
+ /* update */ NULL,
+ /* update_node */ NULL
+};
+
+/* GPU material from shader nodes */
+
+void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat)
+{
+ bNodeTreeExec *exec;
+
+ if(!ntree->execdata)
+ exec = ntreeShaderBeginExecTree(ntree);
+
+ ntreeExecGPUNodes(exec, mat, 1);
+
+ ntreeShaderEndExecTree(exec);
+}
+
+/* **************** call to switch lamploop for material node ************ */
+
+void (*node_shader_lamp_loop)(struct ShadeInput *, struct ShadeResult *);
+
+void set_node_shader_lamp_loop(void (*lamp_loop_func)(ShadeInput *, ShadeResult *))
+{
+ node_shader_lamp_loop= lamp_loop_func;
+}
+
+
+bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree)
+{
+ bNodeTreeExec *exec;
+ bNode *node;
+
+ /* XXX hack: prevent exec data from being generated twice.
+ * this should be handled by the renderer!
+ */
+ if (ntree->execdata)
+ return ntree->execdata;
+
+ /* ensures only a single output node is enabled */
+ ntreeSetOutput(ntree);
+
+ /* common base initialization */
+ exec = ntree_exec_begin(ntree);
+
+ /* allocate the thread stack listbase array */
+ exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
+
+ for(node= exec->nodetree->nodes.first; node; node= node->next)
+ node->need_exec= 1;
+
+ /* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
+ * which only store the ntree pointer. Should be fixed at some point!
+ */
+ ntree->execdata = exec;
+
+ return exec;
+}
+
+void ntreeShaderEndExecTree(bNodeTreeExec *exec)
+{
+ if(exec) {
+ bNodeTree *ntree= exec->nodetree;
+ bNodeThreadStack *nts;
+ int a;
+
+ if(exec->threadstack) {
+ for(a=0; a<BLENDER_MAX_THREADS; a++) {
+ for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+ if (nts->stack) MEM_freeN(nts->stack);
+ BLI_freelistN(&exec->threadstack[a]);
+ }
+
+ MEM_freeN(exec->threadstack);
+ exec->threadstack= NULL;
+ }
+
+ ntree_exec_end(exec);
+
+ /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
+ ntree->execdata = NULL;
+ }
+}
+
+void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
+{
+ ShaderCallData scd;
+ /*
+ @note: preserve material from ShadeInput for material id, nodetree execs change it
+ fix for bug "[#28012] Mat ID messy with shader nodes"
+ */
+ Material *mat = shi->mat; bNodeThreadStack *nts = NULL;
+ bNodeTreeExec *exec = ntree->execdata;
+
+ /* convert caller data to struct */
+ scd.shi= shi;
+ scd.shr= shr;
+
+ /* each material node has own local shaderesult, with optional copying */
+ memset(shr, 0, sizeof(ShadeResult));
+
+ if (!exec)
+ exec = ntree->execdata = ntreeShaderBeginExecTree(exec->nodetree);
+
+ nts= ntreeGetThreadStack(exec, shi->thread);
+ ntreeExecThreadNodes(exec, nts, &scd, shi->thread);
+ ntreeReleaseThreadStack(nts);
+
+ // @note: set material back to preserved material
+ shi->mat = mat;
+ /* better not allow negative for now */
+ if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
+ if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
+ if(shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
+}
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
new file mode 100644
index 00000000000..cf910ba3f64
--- /dev/null
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -0,0 +1,287 @@
+/*
+ * $Id: SHD_util.c 36549 2011-05-08 14:23:38Z lukastoenne $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/shader/node_shader_util.c
+ * \ingroup nodes
+ */
+
+
+#include "DNA_node_types.h"
+
+#include "node_shader_util.h"
+
+#include "node_exec.h"
+
+/* ****** */
+
+void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
+{
+ float *from= ns->vec;
+
+ if(type_in==SOCK_FLOAT) {
+ if(ns->sockettype==SOCK_FLOAT)
+ *in= *from;
+ else
+ *in= 0.333333f*(from[0]+from[1]+from[2]);
+ }
+ else if(type_in==SOCK_VECTOR) {
+ if(ns->sockettype==SOCK_FLOAT) {
+ in[0]= from[0];
+ in[1]= from[0];
+ in[2]= from[0];
+ }
+ else {
+ VECCOPY(in, from);
+ }
+ }
+ else { /* type_in==SOCK_RGBA */
+ if(ns->sockettype==SOCK_RGBA) {
+ QUATCOPY(in, from);
+ }
+ else if(ns->sockettype==SOCK_FLOAT) {
+ in[0]= from[0];
+ in[1]= from[0];
+ in[2]= from[0];
+ in[3]= 1.0f;
+ }
+ else {
+ VECCOPY(in, from);
+ in[3]= 1.0f;
+ }
+ }
+}
+
+
+/* ******************* execute and parse ************ */
+
+/* go over all used Geometry and Texture nodes, and return a texco flag */
+/* no group inside needed, this function is called for groups too */
+void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mode)
+{
+ bNode *node;
+ bNodeSocket *sock;
+ int a;
+
+ ntreeSocketUseFlags(ntree);
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->type==SH_NODE_TEXTURE) {
+ if((r_mode & R_OSA) && node->id) {
+ Tex *tex= (Tex *)node->id;
+ if ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)
+ *texco |= TEXCO_OSA|NEED_UV;
+ }
+ /* usability exception... without input we still give the node orcos */
+ sock= node->inputs.first;
+ if(sock==NULL || sock->link==NULL)
+ *texco |= TEXCO_ORCO|NEED_UV;
+ }
+ else if(node->type==SH_NODE_GEOMETRY) {
+ /* note; sockets always exist for the given type! */
+ for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+ if(sock->flag & SOCK_IN_USE) {
+ switch(a) {
+ case GEOM_OUT_GLOB:
+ *texco |= TEXCO_GLOB|NEED_UV; break;
+ case GEOM_OUT_VIEW:
+ *texco |= TEXCO_VIEW|NEED_UV; break;
+ case GEOM_OUT_ORCO:
+ *texco |= TEXCO_ORCO|NEED_UV; break;
+ case GEOM_OUT_UV:
+ *texco |= TEXCO_UV|NEED_UV; break;
+ case GEOM_OUT_NORMAL:
+ *texco |= TEXCO_NORM|NEED_UV; break;
+ case GEOM_OUT_VCOL:
+ *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break;
+ }
+ }
+ }
+ }
+ }
+}
+
+/* nodes that use ID data get synced with local data */
+void nodeShaderSynchronizeID(bNode *node, int copyto)
+{
+ if(node->id==NULL) return;
+
+ if(ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+ bNodeSocket *sock;
+ Material *ma= (Material *)node->id;
+ int a;
+
+ /* hrmf, case in loop isnt super fast, but we dont edit 100s of material at same time either! */
+ for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+ if(!(sock->flag & SOCK_HIDDEN)) {
+ if(copyto) {
+ switch(a) {
+ case MAT_IN_COLOR:
+ VECCOPY(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
+ case MAT_IN_SPEC:
+ VECCOPY(&ma->specr, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
+ case MAT_IN_REFL:
+ ma->ref= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ case MAT_IN_MIR:
+ VECCOPY(&ma->mirr, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
+ case MAT_IN_AMB:
+ ma->amb= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ case MAT_IN_EMIT:
+ ma->emit= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ case MAT_IN_SPECTRA:
+ ma->spectra= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ case MAT_IN_RAY_MIRROR:
+ ma->ray_mirror= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ case MAT_IN_ALPHA:
+ ma->alpha= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ case MAT_IN_TRANSLUCENCY:
+ ma->translucency= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
+ }
+ }
+ else {
+ switch(a) {
+ case MAT_IN_COLOR:
+ VECCOPY(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->r); break;
+ case MAT_IN_SPEC:
+ VECCOPY(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->specr); break;
+ case MAT_IN_REFL:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->ref; break;
+ case MAT_IN_MIR:
+ VECCOPY(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->mirr); break;
+ case MAT_IN_AMB:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->amb; break;
+ case MAT_IN_EMIT:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->emit; break;
+ case MAT_IN_SPECTRA:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->spectra; break;
+ case MAT_IN_RAY_MIRROR:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->ray_mirror; break;
+ case MAT_IN_ALPHA:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->alpha; break;
+ case MAT_IN_TRANSLUCENCY:
+ ((bNodeSocketValueFloat*)sock->default_value)->value= ma->translucency; break;
+ }
+ }
+ }
+ }
+ }
+
+}
+
+
+void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
+{
+ memset(gs, 0, sizeof(*gs));
+
+ QUATCOPY(gs->vec, ns->vec);
+ gs->link= ns->data;
+
+ if (type == SOCK_FLOAT)
+ gs->type= GPU_FLOAT;
+ else if (type == SOCK_VECTOR)
+ gs->type= GPU_VEC3;
+ else if (type == SOCK_RGBA)
+ gs->type= GPU_VEC4;
+ else
+ gs->type= GPU_NONE;
+
+ gs->name = "";
+ gs->hasinput= ns->hasinput && ns->data;
+ gs->hasoutput= ns->hasoutput && ns->data;
+ gs->sockettype= ns->sockettype;
+}
+
+void node_data_from_gpu_stack(bNodeStack *ns, GPUNodeStack *gs)
+{
+ ns->data= gs->link;
+ ns->sockettype= gs->sockettype;
+}
+
+static void gpu_stack_from_data_list(GPUNodeStack *gs, ListBase *sockets, bNodeStack **ns)
+{
+ bNodeSocket *sock;
+ int i;
+
+ for (sock=sockets->first, i=0; sock; sock=sock->next, i++)
+ node_gpu_stack_from_data(&gs[i], sock->type, ns[i]);
+
+ gs[i].type= GPU_NONE;
+}
+
+static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNodeStack *gs)
+{
+ bNodeSocket *sock;
+ int i;
+
+ for (sock=sockets->first, i=0; sock; sock=sock->next, i++)
+ node_data_from_gpu_stack(ns[i], &gs[i]);
+}
+
+void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
+{
+ bNodeExec *nodeexec;
+ bNode *node;
+ int n;
+ bNodeStack *stack;
+ bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
+ GPUNodeStack gpuin[MAX_SOCKET+1], gpuout[MAX_SOCKET+1];
+ int doit;
+
+ stack= exec->stack;
+
+ for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node;
+
+ doit = 0;
+ /* for groups, only execute outputs for edited group */
+ if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ if(do_outputs && (node->flag & NODE_DO_OUTPUT))
+ doit = 1;
+ }
+ else
+ doit = 1;
+
+ if (doit) {
+ if(node->typeinfo->gpufunc) {
+ node_get_stack(node, stack, nsin, nsout);
+ gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
+ gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
+ if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
+ data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
+ }
+ else if(node->typeinfo->gpuextfunc) {
+ node_get_stack(node, stack, nsin, nsout);
+ gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
+ gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
+ if(node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
+ data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
+ }
+ }
+ }
+}
diff --git a/source/blender/nodes/intern/SHD_util.h b/source/blender/nodes/shader/node_shader_util.h
index e6b1377067d..1cc04d95d6f 100644
--- a/source/blender/nodes/intern/SHD_util.h
+++ b/source/blender/nodes/shader/node_shader_util.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_util.h 36549 2011-05-08 14:23:38Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,13 +27,13 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_util.h
+/** \file blender/nodes/shader/node_shader_util.h
* \ingroup nodes
*/
-#ifndef SHD_NODE_UTIL_H_
-#define SHD_NODE_UTIL_H_
+#ifndef NODE_SHADER_UTIL_H_
+#define NODE_SHADER_UTIL_H_
#include <math.h>
#include <float.h>
@@ -61,7 +61,7 @@
#include "BKE_library.h"
-#include "../SHD_node.h"
+#include "NOD_shader.h"
#include "node_util.h"
#include "BLI_math.h"
@@ -122,4 +122,9 @@ typedef struct ShaderCallData {
extern void node_ID_title_cb(void *node_v, void *unused_v);
void nodestack_get_vec(float *in, short type_in, bNodeStack *ns);
+void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeStack *ns);
+void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs);
+
+void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs);
+
#endif
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index eea572bf271..ecb7c486dc4 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_camera.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,18 +27,18 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_camera.c
+/** \file blender/nodes/shader/nodes/node_shader_camera.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** CAMERA INFO ******************** */
-static bNodeSocketType sh_node_camera_out[]= {
- { SOCK_VECTOR, 0, "View Vector", 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f}, /* None of these actually */
- { SOCK_VALUE, 0, "View Z Depth", 0.f, 0.0f, 0.0f, 0.0f, 0.0f, 99999999999.0f}, /* have any limits on their */
- { SOCK_VALUE, 0, "View Distance", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 99999999999.0f}, /* values. */
+static bNodeSocketTemplate sh_node_camera_out[]= {
+ { SOCK_VECTOR, 0, "View Vector"},
+ { SOCK_FLOAT, 0, "View Z Depth"},
+ { SOCK_FLOAT, 0, "View Distance"},
{ -1, 0, "" }
};
@@ -63,8 +63,8 @@ void register_node_type_sh_camera(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0,
- NULL, sh_node_camera_out);
+ node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0);
+ node_type_socket_templates(&ntype, NULL, sh_node_camera_out);
node_type_size(&ntype, 95, 95, 120);
node_type_storage(&ntype, "node_camera", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_camera);
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
new file mode 100644
index 00000000000..ab3638436f1
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -0,0 +1,327 @@
+/*
+ * $Id: CMP_blur.c 35562 2011-03-15 20:10:32Z lukastoenne $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
+ * Juho Vepsäläinen
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/shader/nodes/node_shader_common.c
+ * \ingroup shdnodes
+ */
+
+
+#include "DNA_node_types.h"
+
+#include "BKE_node.h"
+
+#include "node_shader_util.h"
+#include "node_common.h"
+#include "node_exec.h"
+
+static void copy_stack(bNodeStack *to, bNodeStack *from)
+{
+ if (to != from) {
+ copy_v4_v4(to->vec, from->vec);
+ to->data = from->data;
+ to->datatype = from->datatype;
+
+ /* tag as copy to prevent freeing */
+ to->is_copy = 1;
+ }
+}
+
+static void move_stack(bNodeStack *to, bNodeStack *from)
+{
+ if (to != from) {
+ copy_v4_v4(to->vec, from->vec);
+ to->data = from->data;
+ to->datatype = from->datatype;
+ to->is_copy = from->is_copy;
+
+ zero_v4(from->vec);
+ from->data = NULL;
+ from->datatype = 0;
+ from->is_copy = 0;
+ }
+}
+
+/**** GROUP ****/
+
+static void *group_initexec(bNode *node)
+{
+ bNodeTree *ngroup= (bNodeTree*)node->id;
+ bNodeTreeExec *exec;
+
+ /* initialize the internal node tree execution */
+ exec = ntreeShaderBeginExecTree(ngroup);
+
+ return exec;
+}
+
+static void group_freeexec(bNode *UNUSED(node), void *nodedata)
+{
+ bNodeTreeExec*gexec= (bNodeTreeExec*)nodedata;
+
+ ntreeShaderEndExecTree(gexec);
+}
+
+/* Copy inputs to the internal stack.
+ */
+static void group_copy_inputs(bNode *node, bNodeStack **in, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->inputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ copy_stack(ns, in[a]);
+ }
+ }
+}
+
+/* Copy internal results to the external outputs.
+ */
+static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ move_stack(out[a], ns);
+ }
+ }
+}
+
+static void group_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ bNodeThreadStack *nts;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ nts = ntreeGetThreadStack(exec, thread);
+
+ group_copy_inputs(node, in, nts->stack);
+ ntreeExecThreadNodes(exec, nts, data, thread);
+ group_move_outputs(node, out, nts->stack);
+
+ ntreeReleaseThreadStack(nts);
+}
+
+static void group_gpu_copy_inputs(bNode *node, GPUNodeStack *in, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->inputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ /* convert the external gpu stack back to internal node stack data */
+ node_data_from_gpu_stack(ns, &in[a]);
+ }
+ }
+}
+
+/* Copy internal results to the external outputs.
+ */
+static void group_gpu_move_outputs(bNode *node, GPUNodeStack *out, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ /* convert the node stack data result back to gpu stack */
+ node_gpu_stack_from_data(&out[a], sock->type, ns);
+ }
+ }
+}
+
+static int gpu_group_execute(GPUMaterial *mat, bNode *node, void *nodedata, GPUNodeStack *in, GPUNodeStack *out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+
+ group_gpu_copy_inputs(node, in, exec->stack);
+ ntreeExecGPUNodes(exec, mat, (node->flag & NODE_GROUP_EDIT));
+ group_gpu_move_outputs(node, out, exec->stack);
+
+ return 1;
+}
+
+void register_node_type_sh_group(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_group_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_group_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute);
+ node_type_gpu_ext(&ntype, gpu_group_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+
+
+/**** FOR LOOP ****/
+
+#if 0 /* XXX loop nodes don't work nicely with current trees */
+static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ bNodeThreadStack *nts;
+ int iterations= (int)in[0]->vec[0];
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int iteration;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ nts = ntreeGetThreadStack(exec, thread);
+
+ /* "Iteration" socket */
+ sock = exec->nodetree->inputs.first;
+ ns = node_get_socket_stack(nts->stack, sock);
+
+// group_copy_inputs(node, in, nts->stack);
+ for (iteration=0; iteration < iterations; ++iteration) {
+ /* first input contains current iteration counter */
+ ns->vec[0] = (float)iteration;
+ ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f;
+
+// if (iteration > 0)
+// loop_init_iteration(exec->nodetree, nts->stack);
+// ntreeExecThreadNodes(exec, nts, data, thread);
+ }
+// loop_copy_outputs(node, in, out, exec->stack);
+
+ ntreeReleaseThreadStack(nts);
+}
+
+void register_node_type_sh_forloop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_forloop_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_forloop_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+#endif
+
+/**** WHILE LOOP ****/
+
+#if 0 /* XXX loop nodes don't work nicely with current trees */
+static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ bNodeThreadStack *nts;
+ int condition= (in[0]->vec[0] > 0.0f);
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int iteration;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ nts = ntreeGetThreadStack(exec, thread);
+
+ /* "Condition" socket */
+ sock = exec->nodetree->outputs.first;
+ ns = node_get_socket_stack(nts->stack, sock);
+
+ iteration = 0;
+// group_copy_inputs(node, in, nts->stack);
+ while (condition && iteration < node->custom1) {
+// if (iteration > 0)
+// loop_init_iteration(exec->nodetree, nts->stack);
+// ntreeExecThreadNodes(exec, nts, data, thread);
+
+ condition = (ns->vec[0] > 0.0f);
+ ++iteration;
+ }
+// loop_copy_outputs(node, in, out, exec->stack);
+
+ ntreeReleaseThreadStack(nts);
+}
+
+void register_node_type_sh_whileloop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_whileloop_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_whileloop_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+#endif
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index a39a639897e..ded867ec441 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_curves.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_curves.c
+/** \file blender/nodes/shader/nodes/node_shader_curves.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** CURVE VEC ******************** */
-static bNodeSocketType sh_node_curve_vec_in[]= {
- { SOCK_VALUE, 0, "Fac", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_curve_vec_in[]= {
+ { SOCK_FLOAT, 0, "Fac", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_curve_vec_out[]= {
- { SOCK_VECTOR, 0, "Vector", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_curve_vec_out[]= {
+ { SOCK_VECTOR, 0, "Vector"},
{ -1, 0, "" }
};
@@ -57,7 +57,7 @@ static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeSta
curvemapping_evaluate3F(node->storage, out[0]->vec, vec);
}
-static void node_shader_init_curve_vec(bNode* node)
+static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
}
@@ -75,8 +75,8 @@ void register_node_type_sh_curve_vec(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- sh_node_curve_vec_in, sh_node_curve_vec_out);
+ node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_curve_vec_in, sh_node_curve_vec_out);
node_type_size(&ntype, 200, 140, 320);
node_type_init(&ntype, node_shader_init_curve_vec);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
@@ -88,14 +88,14 @@ void register_node_type_sh_curve_vec(ListBase *lb)
/* **************** CURVE RGB ******************** */
-static bNodeSocketType sh_node_curve_rgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_curve_rgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_curve_rgb_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_curve_rgb_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -112,7 +112,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta
}
}
-static void node_shader_init_curve_rgb(bNode *node)
+static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
@@ -129,8 +129,8 @@ void register_node_type_sh_curve_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- sh_node_curve_rgb_in, sh_node_curve_rgb_out);
+ node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_curve_rgb_in, sh_node_curve_rgb_out);
node_type_size(&ntype, 200, 140, 320);
node_type_init(&ntype, node_shader_init_curve_rgb);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
index d5e5d5eeb93..6490ee00787 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_dynamic.c 35927 2011-03-31 20:59:55Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,7 +27,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_dynamic.c
+/** \file blender/nodes/shader/nodes/node_shader_dynamic.c
* \ingroup shdnodes
*/
@@ -54,7 +54,7 @@
#endif
#endif
-#include "../SHD_util.h"
+#include "node_shader_util.h"
// XXX
#if 0
@@ -95,7 +95,7 @@ static bNodeType *node_dynamic_find_typeinfo(ListBase *list, ID *id)
static void node_dynamic_free_typeinfo_sockets(bNodeType *tinfo)
{
- bNodeSocketType *sock;
+ bNodeSocketTemplate *sock;
if (!tinfo) return;
@@ -782,7 +782,7 @@ void register_node_type_sh_dynamic(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, 0, NULL, NULL);
+ node_type_base(&ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, 0);
nodeRegisterType(lb, &ntype);
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index 379f54bec57..b88c5979b54 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_geom.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,27 +27,27 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_geom.c
+/** \file blender/nodes/shader/nodes/node_shader_geom.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
#include "DNA_customdata_types.h"
/* **************** GEOMETRY ******************** */
/* output socket type definition */
-static bNodeSocketType sh_node_geom_out[]= {
- { SOCK_VECTOR, 0, "Global", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f}, /* btw; uses no limit */
- { SOCK_VECTOR, 0, "Local", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_VECTOR, 0, "View", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_VECTOR, 0, "Orco", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_VECTOR, 0, "UV", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 0, "Vertex Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Front/Back", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_geom_out[]= {
+ { SOCK_VECTOR, 0, "Global"},
+ { SOCK_VECTOR, 0, "Local"},
+ { SOCK_VECTOR, 0, "View"},
+ { SOCK_VECTOR, 0, "Orco"},
+ { SOCK_VECTOR, 0, "UV"},
+ { SOCK_VECTOR, 0, "Normal"},
+ { SOCK_RGBA, 0, "Vertex Color"},
+ { SOCK_FLOAT, 0, "Front/Back"},
{ -1, 0, "" }
};
@@ -118,7 +118,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
}
}
-static void node_shader_init_geometry(bNode *node)
+static void node_shader_init_geometry(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
}
@@ -140,8 +140,8 @@ void register_node_type_sh_geom(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, sh_node_geom_out);
+ node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, sh_node_geom_out);
node_type_size(&ntype, 120, 80, 160);
node_type_init(&ntype, node_shader_init_geometry);
node_type_storage(&ntype, "NodeGeometry", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index 91fd995dbbe..ef1434b82ca 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -27,25 +27,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
+/** \file blender/nodes/shader/nodes/node_shader_hueSatVal.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** Hue Saturation ******************** */
-static bNodeSocketType sh_node_hue_sat_in[]= {
- { SOCK_VALUE, 1, "Hue", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Saturation", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f},
- { SOCK_VALUE, 1, "Value", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f},
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_hue_sat_in[]= {
+ { SOCK_FLOAT, 1, "Hue", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Saturation", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Value", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_hue_sat_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_hue_sat_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -86,8 +86,8 @@ void register_node_type_sh_hue_sat(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- sh_node_hue_sat_in, sh_node_hue_sat_out);
+ node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out);
node_type_size(&ntype, 150, 80, 250);
node_type_exec(&ntype, node_shader_exec_hue_sat);
node_type_gpu(&ntype, gpu_shader_hue_sat);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c
index f8d6e54859e..bd7e571f073 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_invert.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_invert.c
+/** \file blender/nodes/shader/nodes/node_shader_invert.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** INVERT ******************** */
-static bNodeSocketType sh_node_invert_in[]= {
- { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_invert_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_invert_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_invert_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -78,8 +78,8 @@ void register_node_type_sh_invert(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- sh_node_invert_in, sh_node_invert_out);
+ node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out);
node_type_size(&ntype, 90, 80, 100);
node_type_exec(&ntype, node_shader_exec_invert);
node_type_gpu(&ntype, gpu_shader_invert);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index eb300301ce2..21cea4853ad 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_mapping.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_mapping.c
+/** \file blender/nodes/shader/nodes/node_shader_mapping.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** MAPPING ******************** */
-static bNodeSocketType sh_node_mapping_in[]= {
- { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_mapping_in[]= {
+ { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_mapping_out[]= {
- { SOCK_VECTOR, 0, "Vector", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_mapping_out[]= {
+ { SOCK_VECTOR, 0, "Vector"},
{ -1, 0, "" }
};
@@ -69,7 +69,7 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
}
-static void node_shader_init_mapping(bNode *node)
+static void node_shader_init_mapping(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_mapping();
}
@@ -92,8 +92,8 @@ void register_node_type_sh_mapping(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- sh_node_mapping_in, sh_node_mapping_out);
+ node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out);
node_type_size(&ntype, 240, 160, 320);
node_type_init(&ntype, node_shader_init_mapping);
node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index f78dd9ec727..a0bfd430506 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_material.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,54 +27,54 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_material.c
+/** \file blender/nodes/shader/nodes/node_shader_material.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** MATERIAL ******************** */
-static bNodeSocketType sh_node_material_in[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Spec", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Refl", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_material_in[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "Spec", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Refl", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_material_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_material_out[]= {
+ { SOCK_RGBA, 0, "Color"},
+ { SOCK_FLOAT, 0, "Alpha"},
+ { SOCK_VECTOR, 0, "Normal"},
{ -1, 0, "" }
};
/* **************** EXTENDED MATERIAL ******************** */
-static bNodeSocketType sh_node_material_ext_in[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Spec", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Refl", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 1, "Mirror", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Ambient", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Emit", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "SpecTra", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Ray Mirror", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Alpha", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Translucency", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_material_ext_in[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, "Spec", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Refl", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
+ { SOCK_RGBA, 1, "Mirror", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Ambient", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Emit", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
+ { SOCK_FLOAT, 1, "SpecTra", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Ray Mirror", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, "Alpha", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
+ { SOCK_FLOAT, 1, "Translucency", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_material_ext_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_RGBA, 0, "Diffuse", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 0, "Spec", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 0, "AO", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_material_ext_out[]= {
+ { SOCK_RGBA, 0, "Color"},
+ { SOCK_FLOAT, 0, "Alpha"},
+ { SOCK_VECTOR, 0, "Normal"},
+ { SOCK_RGBA, 0, "Diffuse"},
+ { SOCK_RGBA, 0, "Spec"},
+ { SOCK_RGBA, 0, "AO"},
{ -1, 0, "" }
};
@@ -112,7 +112,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]);
if(hasinput[MAT_IN_REFL])
- nodestack_get_vec(&shi->refl, SOCK_VALUE, in[MAT_IN_REFL]);
+ nodestack_get_vec(&shi->refl, SOCK_FLOAT, in[MAT_IN_REFL]);
/* retrieve normal */
if(hasinput[MAT_IN_NORMAL]) {
@@ -133,17 +133,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
if(hasinput[MAT_IN_MIR])
nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]);
if(hasinput[MAT_IN_AMB])
- nodestack_get_vec(&shi->amb, SOCK_VALUE, in[MAT_IN_AMB]);
+ nodestack_get_vec(&shi->amb, SOCK_FLOAT, in[MAT_IN_AMB]);
if(hasinput[MAT_IN_EMIT])
- nodestack_get_vec(&shi->emit, SOCK_VALUE, in[MAT_IN_EMIT]);
+ nodestack_get_vec(&shi->emit, SOCK_FLOAT, in[MAT_IN_EMIT]);
if(hasinput[MAT_IN_SPECTRA])
- nodestack_get_vec(&shi->spectra, SOCK_VALUE, in[MAT_IN_SPECTRA]);
+ nodestack_get_vec(&shi->spectra, SOCK_FLOAT, in[MAT_IN_SPECTRA]);
if(hasinput[MAT_IN_RAY_MIRROR])
- nodestack_get_vec(&shi->ray_mirror, SOCK_VALUE, in[MAT_IN_RAY_MIRROR]);
+ nodestack_get_vec(&shi->ray_mirror, SOCK_FLOAT, in[MAT_IN_RAY_MIRROR]);
if(hasinput[MAT_IN_ALPHA])
- nodestack_get_vec(&shi->alpha, SOCK_VALUE, in[MAT_IN_ALPHA]);
+ nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]);
if(hasinput[MAT_IN_TRANSLUCENCY])
- nodestack_get_vec(&shi->translucency, SOCK_VALUE, in[MAT_IN_TRANSLUCENCY]);
+ nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]);
}
shi->nodes= 1; /* temp hack to prevent trashadow recursion */
@@ -204,7 +204,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
}
-static void node_shader_init_material(bNode* node)
+static void node_shader_init_material(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= SH_NODE_MAT_DIFF|SH_NODE_MAT_SPEC;
}
@@ -308,8 +308,8 @@ void register_node_type_sh_material(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
- sh_node_material_in, sh_node_material_out);
+ node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+ node_type_socket_templates(&ntype, sh_node_material_in, sh_node_material_out);
node_type_size(&ntype, 120, 80, 240);
node_type_init(&ntype, node_shader_init_material);
node_type_exec(&ntype, node_shader_exec_material);
@@ -323,8 +323,8 @@ void register_node_type_sh_material_ext(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
- sh_node_material_ext_in, sh_node_material_ext_out);
+ node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+ node_type_socket_templates(&ntype, sh_node_material_ext_in, sh_node_material_ext_out);
node_type_size(&ntype, 120, 80, 240);
node_type_init(&ntype, node_shader_init_material);
node_type_exec(&ntype, node_shader_exec_material);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index dd0a564dc4b..0618598379f 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_math.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_math.c
+/** \file blender/nodes/shader/nodes/node_shader_math.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** SCALAR MATH ******************** */
-static bNodeSocketType sh_node_math_in[]= {
- { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
- { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
+static bNodeSocketTemplate sh_node_math_in[]= {
+ { SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_math_out[]= {
- { SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_math_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -242,8 +242,8 @@ void register_node_type_sh_math(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- sh_node_math_in, sh_node_math_out);
+ node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out);
node_type_size(&ntype, 120, 110, 160);
node_type_label(&ntype, node_math_label);
node_type_storage(&ntype, "node_math", NULL, NULL);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
index 8b3033a98ca..a89faa66fc0 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_mixRgb.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
+/** \file blender/nodes/shader/nodes/node_shader_mixRgb.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** MIX RGB ******************** */
-static bNodeSocketType sh_node_mix_rgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA, 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_mix_rgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f},
+ { SOCK_RGBA, 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_mix_rgb_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_mix_rgb_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -54,7 +54,7 @@ static void node_shader_exec_mix_rgb(void *UNUSED(data), bNode *node, bNodeStack
float fac;
float vec[3];
- nodestack_get_vec(&fac, SOCK_VALUE, in[0]);
+ nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
CLAMP(fac, 0.0f, 1.0f);
nodestack_get_vec(col, SOCK_VECTOR, in[1]);
@@ -79,8 +79,8 @@ void register_node_type_sh_mix_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- sh_node_mix_rgb_in, sh_node_mix_rgb_out);
+ node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out);
node_type_size(&ntype, 100, 60, 150);
node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, node_shader_exec_mix_rgb);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index a4e39935cea..099a9bed10d 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_normal.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,25 +27,36 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_normal.c
+/** \file blender/nodes/shader/nodes/node_shader_normal.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** NORMAL ******************** */
-static bNodeSocketType sh_node_normal_in[]= {
- { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_normal_in[]= {
+ { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_normal_out[]= {
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
- { SOCK_VALUE, 0, "Dot", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_normal_out[]= {
+ { SOCK_VECTOR, 0, "Normal"},
+ { SOCK_FLOAT, 0, "Dot"},
{ -1, 0, "" }
};
+static void node_shader_init_normal(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ bNodeSocket *sock= node->outputs.first;
+ bNodeSocketValueVector *dval= (bNodeSocketValueVector*)sock->default_value;
+
+ /* output value is used for normal vector */
+ dval->value[0] = 0.0f;
+ dval->value[1] = 0.0f;
+ dval->value[2] = 1.0f;
+}
+
/* generates normal, does dot product */
static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
@@ -57,7 +68,7 @@ static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
- VECCOPY(out[0]->vec, sock->ns.vec);
+ VECCOPY(out[0]->vec, ((bNodeSocketValueVector*)sock->default_value)->value);
/* render normals point inside... the widget points outside */
out[1]->vec[0]= -INPR(out[0]->vec, vec);
}
@@ -65,7 +76,7 @@ static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack
static int gpu_shader_normal(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
bNodeSocket *sock= node->outputs.first;
- GPUNodeLink *vec = GPU_uniform(sock->ns.vec);
+ GPUNodeLink *vec = GPU_uniform(((bNodeSocketValueVector*)sock->default_value)->value);
return GPU_stack_link(mat, "normal", in, out, vec);
}
@@ -74,8 +85,9 @@ void register_node_type_sh_normal(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
- sh_node_normal_in, sh_node_normal_out);
+ node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_normal_in, sh_node_normal_out);
+ node_type_init(&ntype, node_shader_init_normal);
node_type_exec(&ntype, node_shader_exec_normal);
node_type_gpu(&ntype, gpu_shader_normal);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c
index e42caabff34..638af7d4eb3 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_output.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,17 +27,17 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_output.c
+/** \file blender/nodes/shader/nodes/node_shader_output.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** OUTPUT ******************** */
-static bNodeSocketType sh_node_output_in[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_output_in[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
@@ -49,7 +49,7 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
/* stack order input sockets: col, alpha, normal */
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
- nodestack_get_vec(col+3, SOCK_VALUE, in[1]);
+ nodestack_get_vec(col+3, SOCK_FLOAT, in[1]);
if(shi->do_preview) {
nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
@@ -84,8 +84,8 @@ void register_node_type_sh_output(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW,
- sh_node_output_in, NULL);
+ node_type_base(&ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_socket_templates(&ntype, sh_node_output_in, NULL);
node_type_size(&ntype, 80, 60, 200);
node_type_exec(&ntype, node_shader_exec_output);
node_type_gpu(&ntype, gpu_shader_output);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c
index 3d7f401b055..c9bb78b45dd 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_rgb.c 36481 2011-05-04 11:42:25Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,30 +27,43 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_rgb.c
+/** \file blender/nodes/shader/nodes/node_shader_rgb.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** RGB ******************** */
-static bNodeSocketType sh_node_rgb_out[]= {
- { SOCK_RGBA, 0, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_rgb_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
+static void node_shader_init_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ bNodeSocket *sock= node->outputs.first;
+ bNodeSocketValueRGBA *dval= (bNodeSocketValueRGBA*)sock->default_value;
+ /* uses the default value of the output socket, must be initialized here */
+ dval->value[0] = 0.5f;
+ dval->value[1] = 0.5f;
+ dval->value[2] = 0.5f;
+ dval->value[3] = 1.0f;
+}
+
static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
+ float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
- VECCOPY(out[0]->vec, sock->ns.vec);
+ VECCOPY(out[0]->vec, col);
}
static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
bNodeSocket *sock= node->outputs.first;
- GPUNodeLink *vec = GPU_uniform(sock->ns.vec);
+ float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
+ GPUNodeLink *vec = GPU_uniform(col);
return GPU_stack_link(mat, "set_rgba", in, out, vec);
}
@@ -59,8 +72,9 @@ void register_node_type_sh_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, sh_node_rgb_out);
+ node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, sh_node_rgb_out);
+ node_type_init(&ntype, node_shader_init_rgb);
node_type_size(&ntype, 140, 80, 140);
node_type_exec(&ntype, node_shader_exec_rgb);
node_type_gpu(&ntype, gpu_shader_rgb);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
index e4fa0b02521..9528aca2574 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
@@ -27,22 +27,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
+/** \file blender/nodes/shader/nodes/node_shader_sepcombRGB.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** SEPARATE RGBA ******************** */
-static bNodeSocketType sh_node_seprgb_in[]= {
- { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_seprgb_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_seprgb_out[]= {
- { SOCK_VALUE, 0, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_seprgb_out[]= {
+ { SOCK_FLOAT, 0, "R"},
+ { SOCK_FLOAT, 0, "G"},
+ { SOCK_FLOAT, 0, "B"},
{ -1, 0, "" }
};
@@ -62,8 +62,8 @@ void register_node_type_sh_seprgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0,
- sh_node_seprgb_in, sh_node_seprgb_out);
+ node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_shader_exec_seprgb);
node_type_gpu(&ntype, gpu_shader_seprgb);
@@ -74,14 +74,14 @@ void register_node_type_sh_seprgb(ListBase *lb)
/* **************** COMBINE RGB ******************** */
-static bNodeSocketType sh_node_combrgb_in[]= {
- { SOCK_VALUE, 1, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_combrgb_in[]= {
+ { SOCK_FLOAT, 1, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
+ { SOCK_FLOAT, 1, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
+ { SOCK_FLOAT, 1, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_combrgb_out[]= {
- { SOCK_RGBA, 0, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_combrgb_out[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -101,8 +101,8 @@ void register_node_type_sh_combrgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- sh_node_combrgb_in, sh_node_combrgb_out);
+ node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out);
node_type_size(&ntype, 80, 40, 140);
node_type_exec(&ntype, node_shader_exec_combrgb);
node_type_gpu(&ntype, gpu_shader_combrgb);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
index 80693ff08f0..305639dff21 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
+++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_squeeze.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,23 +27,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_squeeze.c
+/** \file blender/nodes/shader/nodes/node_shader_squeeze.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** VALUE SQUEEZE ******************** */
-static bNodeSocketType sh_node_squeeze_in[]= {
- { SOCK_VALUE, 1, "Value", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f},
- { SOCK_VALUE, 1, "Width", 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f},
- { SOCK_VALUE, 1, "Center", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f},
+static bNodeSocketTemplate sh_node_squeeze_in[]= {
+ { SOCK_FLOAT, 1, "Value", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Width", 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Center", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_squeeze_out[]= {
- { SOCK_VALUE, 0, "Value", 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_squeeze_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -52,9 +52,9 @@ bNodeStack **out)
{
float vec[3];
- nodestack_get_vec(vec, SOCK_VALUE, in[0]);
- nodestack_get_vec(vec+1, SOCK_VALUE, in[1]);
- nodestack_get_vec(vec+2, SOCK_VALUE, in[2]);
+ nodestack_get_vec(vec, SOCK_FLOAT, in[0]);
+ nodestack_get_vec(vec+1, SOCK_FLOAT, in[1]);
+ nodestack_get_vec(vec+2, SOCK_FLOAT, in[2]);
out[0]->vec[0] = 1.0f / (1.0f + pow(2.71828183,-((vec[0]-vec[2])*vec[1]))) ;
}
@@ -68,8 +68,8 @@ void register_node_type_sh_squeeze(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- sh_node_squeeze_in, sh_node_squeeze_out);
+ node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out);
node_type_size(&ntype, 120, 110, 160);
node_type_storage(&ntype, "node_squeeze", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_squeeze);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 249e4eeca5d..a4957d8f683 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_texture.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,24 +27,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_texture.c
+/** \file blender/nodes/shader/nodes/node_shader_texture.c
* \ingroup shdnodes
*/
#include "DNA_texture_types.h"
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** TEXTURE ******************** */
-static bNodeSocketType sh_node_texture_in[]= {
- { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f}, /* no limit */
+static bNodeSocketTemplate sh_node_texture_in[]= {
+ { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, /* no limit */
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_texture_out[]= {
- { SOCK_VALUE, 0, "Value", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_RGBA , 0, "Color", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate sh_node_texture_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
+ { SOCK_RGBA , 0, "Color"},
+ { SOCK_VECTOR, 0, "Normal"},
{ -1, 0, "" }
};
@@ -137,8 +137,8 @@ void register_node_type_sh_texture(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
- sh_node_texture_in, sh_node_texture_out);
+ node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+ node_type_socket_templates(&ntype, sh_node_texture_in, sh_node_texture_out);
node_type_size(&ntype, 120, 80, 240);
node_type_exec(&ntype, node_shader_exec_texture);
node_type_gpu(&ntype, gpu_shader_texture);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index 86f832c12ee..9353143095a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_valToRgb.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
+/** \file blender/nodes/shader/nodes/node_shader_valToRgb.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** VALTORGB ******************** */
-static bNodeSocketType sh_node_valtorgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_valtorgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_valtorgb_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_valtorgb_out[]= {
+ { SOCK_RGBA, 0, "Color"},
+ { SOCK_FLOAT, 0, "Alpha"},
{ -1, 0, "" }
};
@@ -52,14 +52,14 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
if(node->storage) {
float fac;
- nodestack_get_vec(&fac, SOCK_VALUE, in[0]);
+ nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
do_colorband(node->storage, fac, out[0]->vec);
out[1]->vec[0]= out[0]->vec[3];
}
}
-static void node_shader_init_valtorgb(bNode *node)
+static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_colorband(1);
}
@@ -77,8 +77,8 @@ void register_node_type_sh_valtorgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- sh_node_valtorgb_in, sh_node_valtorgb_out);
+ node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_valtorgb_in, sh_node_valtorgb_out);
node_type_size(&ntype, 240, 200, 300);
node_type_init(&ntype, node_shader_init_valtorgb);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
@@ -90,12 +90,12 @@ void register_node_type_sh_valtorgb(ListBase *lb)
/* **************** RGBTOBW ******************** */
-static bNodeSocketType sh_node_rgbtobw_in[]= {
+static bNodeSocketTemplate sh_node_rgbtobw_in[]= {
{ SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_rgbtobw_out[]= {
- { SOCK_VALUE, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_rgbtobw_out[]= {
+ { SOCK_FLOAT, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
@@ -117,8 +117,8 @@ void register_node_type_sh_rgbtobw(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0,
- sh_node_rgbtobw_in, sh_node_rgbtobw_out);
+ node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out);
node_type_size(&ntype, 80, 40, 120);
node_type_exec(&ntype, node_shader_exec_rgbtobw);
node_type_gpu(&ntype, gpu_shader_rgbtobw);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c
index 29a75bbf36d..21ff565306d 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c
+++ b/source/blender/nodes/shader/nodes/node_shader_value.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_value.c 36536 2011-05-07 13:27:27Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,30 +27,40 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_value.c
+/** \file blender/nodes/shader/nodes/node_shader_value.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** VALUE ******************** */
-static bNodeSocketType sh_node_value_out[]= {
- { SOCK_VALUE, 0, "Value", 0.5f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
+static bNodeSocketTemplate sh_node_value_out[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
+static void node_shader_init_value(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ bNodeSocket *sock= node->outputs.first;
+ bNodeSocketValueFloat *dval= (bNodeSocketValueFloat*)sock->default_value;
+ /* uses the default value of the output socket, must be initialized here */
+ dval->value = 0.5f;
+}
+
static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
+ float val= ((bNodeSocketValueFloat*)sock->default_value)->value;
- out[0]->vec[0]= sock->ns.vec[0];
+ out[0]->vec[0]= val;
}
static int gpu_shader_value(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{
bNodeSocket *sock= node->outputs.first;
- GPUNodeLink *vec = GPU_uniform(sock->ns.vec);
+ float *val= &((bNodeSocketValueFloat*)sock->default_value)->value;
+ GPUNodeLink *vec = GPU_uniform(val);
return GPU_stack_link(mat, "set_value", in, out, vec);
}
@@ -59,8 +69,9 @@ void register_node_type_sh_value(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, sh_node_value_out);
+ node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, sh_node_value_out);
+ node_type_init(&ntype, node_shader_init_value);
node_type_size(&ntype, 80, 50, 120);
node_type_exec(&ntype, node_shader_exec_value);
node_type_gpu(&ntype, gpu_shader_value);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 9979e488a71..c6a081431a2 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: SHD_vectMath.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,25 +27,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/SHD_nodes/SHD_vectMath.c
+/** \file blender/nodes/shader/nodes/node_shader_vectMath.c
* \ingroup shdnodes
*/
-#include "../SHD_util.h"
+#include "node_shader_util.h"
/* **************** VECTOR MATH ******************** */
-static bNodeSocketType sh_node_vect_math_in[]= {
- { SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_vect_math_in[]= {
+ { SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f, PROP_NONE},
+ { SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType sh_node_vect_math_out[]= {
- { SOCK_VECTOR, 0, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate sh_node_vect_math_out[]= {
+ { SOCK_VECTOR, 0, "Vector"},
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -136,8 +136,8 @@ void register_node_type_sh_vect_math(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- sh_node_vect_math_in, sh_node_vect_math_out);
+ node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, sh_node_vect_math_in, sh_node_vect_math_out);
node_type_size(&ntype, 80, 75, 140);
node_type_label(&ntype, node_vect_math_label);
node_type_storage(&ntype, "node_vect_math", NULL, NULL);
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
new file mode 100644
index 00000000000..75a57c64f2f
--- /dev/null
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -0,0 +1,237 @@
+/**
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/texture/node_texture_tree.c
+ * \ingroup nodes
+ */
+
+
+#include <string.h>
+
+#include "DNA_texture_types.h"
+#include "DNA_node_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_threads.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
+
+#include "node_exec.h"
+#include "node_util.h"
+#include "NOD_texture.h"
+#include "node_texture_util.h"
+
+#include "RE_pipeline.h"
+#include "RE_shader_ext.h"
+
+
+static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
+{
+ Tex *tx;
+ for(tx= main->tex.first; tx; tx= tx->id.next) {
+ if(tx->nodetree) {
+ func(calldata, &tx->id, tx->nodetree);
+ }
+ }
+}
+
+static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
+{
+ bNode *lnode;
+
+ /* copy over contents of previews */
+ for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+ if(ntreeNodeExists(ntree, lnode->new_node)) {
+ bNode *node= lnode->new_node;
+
+ if(node->preview && node->preview->rect) {
+ if(lnode->preview && lnode->preview->rect) {
+ int xsize= node->preview->xsize;
+ int ysize= node->preview->ysize;
+ memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
+ }
+ }
+ }
+ }
+}
+
+bNodeTreeType ntreeType_Texture = {
+ /* type */ NTREE_TEXTURE,
+ /* id_name */ "NTTexture Nodetree",
+
+ /* node_types */ { NULL, NULL },
+
+ /* free_cache */ NULL,
+ /* free_node_cache */ NULL,
+ /* foreach_nodetree */ foreach_nodetree,
+ /* localize */ NULL,
+ /* local_sync */ local_sync,
+ /* local_merge */ NULL,
+ /* update */ NULL,
+ /* update_node */ NULL
+};
+
+int ntreeTexTagAnimated(bNodeTree *ntree)
+{
+ bNode *node;
+
+ if(ntree==NULL) return 0;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->type==TEX_NODE_CURVE_TIME) {
+ NodeTagChanged(ntree, node);
+ return 1;
+ }
+ else if(node->type==NODE_GROUP) {
+ if( ntreeTexTagAnimated((bNodeTree *)node->id) ) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree)
+{
+ bNodeTreeExec *exec;
+ bNode *node;
+
+ /* XXX hack: prevent exec data from being generated twice.
+ * this should be handled by the renderer!
+ */
+ if (ntree->execdata)
+ return ntree->execdata;
+
+ /* common base initialization */
+ exec = ntree_exec_begin(ntree);
+
+ /* allocate the thread stack listbase array */
+ exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
+
+ for(node= exec->nodetree->nodes.first; node; node= node->next)
+ node->need_exec= 1;
+
+ /* XXX this should not be necessary, but is still used for cmp/sha/tex nodes,
+ * which only store the ntree pointer. Should be fixed at some point!
+ */
+ ntree->execdata = exec;
+
+ return exec;
+}
+
+/* free texture delegates */
+static void tex_free_delegates(bNodeTreeExec *exec)
+{
+ bNodeThreadStack *nts;
+ bNodeStack *ns;
+ int th, a;
+
+ for(th=0; th<BLENDER_MAX_THREADS; th++)
+ for(nts=exec->threadstack[th].first; nts; nts=nts->next)
+ for(ns= nts->stack, a=0; a<exec->stacksize; a++, ns++)
+ if(ns->data && !ns->is_copy)
+ MEM_freeN(ns->data);
+}
+
+void ntreeTexEndExecTree(bNodeTreeExec *exec)
+{
+ if(exec) {
+ bNodeTree *ntree= exec->nodetree;
+ bNodeThreadStack *nts;
+ int a;
+
+ if(exec->threadstack) {
+ tex_free_delegates(exec);
+
+ for(a=0; a<BLENDER_MAX_THREADS; a++) {
+ for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+ if (nts->stack) MEM_freeN(nts->stack);
+ BLI_freelistN(&exec->threadstack[a]);
+ }
+
+ MEM_freeN(exec->threadstack);
+ exec->threadstack= NULL;
+ }
+
+ ntree_exec_end(exec);
+
+ /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
+ ntree->execdata = NULL;
+ }
+}
+
+int ntreeTexExecTree(
+ bNodeTree *nodes,
+ TexResult *texres,
+ float *co,
+ float *dxt, float *dyt,
+ int osatex,
+ short thread,
+ Tex *UNUSED(tex),
+ short which_output,
+ int cfra,
+ int preview,
+ ShadeInput *shi,
+ MTex *mtex
+){
+ TexCallData data;
+ float *nor= texres->nor;
+ int retval = TEX_INT;
+ bNodeThreadStack *nts = NULL;
+ bNodeTreeExec *exec= nodes->execdata;
+
+ data.co = co;
+ data.dxt = dxt;
+ data.dyt = dyt;
+ data.osatex = osatex;
+ data.target = texres;
+ data.do_preview = preview;
+ data.thread = thread;
+ data.which_output = which_output;
+ data.cfra= cfra;
+ data.mtex= mtex;
+ data.shi= shi;
+
+ if (!exec)
+ exec = ntreeTexBeginExecTree(nodes);
+
+ nts= ntreeGetThreadStack(exec, thread);
+ ntreeExecThreadNodes(exec, nts, &data, thread);
+ ntreeReleaseThreadStack(nts);
+
+ if(texres->nor) retval |= TEX_NOR;
+ retval |= TEX_RGB;
+ /* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set
+ however, the texture code checks this for other reasons (namely, a normal is required for material) */
+ texres->nor= nor;
+
+ return retval;
+}
diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/texture/node_texture_util.c
index b5e27ca2ccb..5aedd8681ab 100644
--- a/source/blender/nodes/intern/TEX_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -26,7 +26,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_util.c
+/** \file blender/nodes/texture/node_texture_util.c
* \ingroup nodes
*/
@@ -48,11 +48,11 @@
*/
#include <assert.h>
-#include "TEX_util.h"
+#include "node_texture_util.h"
#define PREV_RES 128 /* default preview resolution */
-void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
+static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
{
if(dg->node->need_exec) {
dg->fn(out, params, dg->node, dg->in, thread);
@@ -68,7 +68,7 @@ static void tex_input(float *out, int sz, bNodeStack *in, TexParams *params, sho
if(dg) {
tex_call_delegate(dg, in->vec, params, thread);
- if(in->hasoutput && in->sockettype == SOCK_VALUE)
+ if(in->hasoutput && in->sockettype == SOCK_FLOAT)
in->vec[1] = in->vec[2] = in->vec[0];
}
memcpy(out, in->vec, sz * sizeof(float));
@@ -83,7 +83,7 @@ void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
{
tex_input(out, 4, in, params, thread);
- if(in->hasoutput && in->sockettype == SOCK_VALUE)
+ if(in->hasoutput && in->sockettype == SOCK_FLOAT)
{
out[1] = out[2] = out[0];
out[3] = 1;
@@ -170,45 +170,3 @@ void ntreeTexCheckCyclics(struct bNodeTree *ntree)
}
}
-
-int ntreeTexExecTree(
- bNodeTree *nodes,
- TexResult *texres,
- float *co,
- float *dxt, float *dyt,
- int osatex,
- short thread,
- Tex *UNUSED(tex),
- short which_output,
- int cfra,
- int preview,
- ShadeInput *shi,
- MTex *mtex
-){
- TexCallData data;
- float *nor= texres->nor;
- int retval = TEX_INT;
-
- data.co = co;
- data.dxt = dxt;
- data.dyt = dyt;
- data.osatex = osatex;
- data.target = texres;
- data.do_preview = preview;
- data.thread = thread;
- data.which_output = which_output;
- data.cfra= cfra;
- data.mtex= mtex;
- data.shi= shi;
-
- ntreeExecTree(nodes, &data, thread);
-
- if(texres->nor) retval |= TEX_NOR;
- retval |= TEX_RGB;
- /* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set
- however, the texture code checks this for other reasons (namely, a normal is required for material) */
- texres->nor= nor;
-
- return retval;
-}
-
diff --git a/source/blender/nodes/intern/TEX_util.h b/source/blender/nodes/texture/node_texture_util.h
index 0875bcd52bf..867b4142052 100644
--- a/source/blender/nodes/intern/TEX_util.h
+++ b/source/blender/nodes/texture/node_texture_util.h
@@ -26,13 +26,13 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_util.h
+/** \file blender/nodes/texture/node_texture_util.h
* \ingroup nodes
*/
-#ifndef TEX_NODE_UTIL_H_
-#define TEX_NODE_UTIL_H_
+#ifndef NODE_TEXTURE_UTIL_H_
+#define NODE_TEXTURE_UTIL_H_
#include <math.h>
#include <string.h>
@@ -60,7 +60,6 @@
#include "BKE_library.h"
-#include "../SHD_node.h"
#include "node_util.h"
#include "BLI_math.h"
@@ -112,8 +111,6 @@ typedef struct TexDelegate {
int type;
} TexDelegate;
-void tex_call_delegate(TexDelegate*, float *out, TexParams *params, short thread);
-
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread);
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread);
float tex_input_value(bNodeStack *in, TexParams *params, short thread);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c
index d5980b786b0..f3275f2bcdf 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c
+++ b/source/blender/nodes/texture/nodes/node_texture_at.c
@@ -26,21 +26,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_at.c
+/** \file blender/nodes/texture/nodes/node_texture_at.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Texture", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_VECTOR, 1, "Coordinates", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Texture", 0.0f, 0.0f, 0.0f, 1.0f },
+ { SOCK_VECTOR, 1, "Coordinates", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Texture", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Texture" },
{ -1, 0, "" }
};
@@ -63,8 +63,8 @@ void register_node_type_tex_at(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index 0eb982496a9..060ed791871 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -26,32 +26,33 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_bricks.c
+/** \file blender/nodes/texture/nodes/node_texture_bricks.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
#include <math.h>
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Bricks 1", 0.596f, 0.282f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_RGBA, 1, "Bricks 2", 0.632f, 0.504f, 0.05f, 1.0f, 0.0f, 1.0f },
- { SOCK_RGBA, 1, "Mortar", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Thickness", 0.02f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Bias", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
- { SOCK_VALUE, 1, "Brick Width", 0.5f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f },
- { SOCK_VALUE, 1, "Row Height", 0.25f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Bricks 1", 0.596f, 0.282f, 0.0f, 1.0f },
+ { SOCK_RGBA, 1, "Bricks 2", 0.632f, 0.504f, 0.05f, 1.0f },
+ { SOCK_RGBA, 1, "Mortar", 0.0f, 0.0f, 0.0f, 1.0f },
+ { SOCK_FLOAT, 1, "Thickness", 0.02f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Bias", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
+ { SOCK_FLOAT, 1, "Brick Width", 0.5f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Row Height", 0.25f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
-static void init(bNode *node) {
+static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+{
node->custom3 = 0.5; /* offset */
node->custom4 = 1.0; /* squash */
}
@@ -123,8 +124,8 @@ void register_node_type_tex_bricks(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 150, 60, 150);
node_type_init(&ntype, init);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c
index c6c25ba1a8a..916ee80d66b 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
+++ b/source/blender/nodes/texture/nodes/node_texture_checker.c
@@ -26,23 +26,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_checker.c
+/** \file blender/nodes/texture/nodes/node_texture_checker.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
#include <math.h>
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color1", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_RGBA, 1, "Color2", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Size", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color1", 1.0f, 0.0f, 0.0f, 1.0f },
+ { SOCK_RGBA, 1, "Color2", 1.0f, 1.0f, 1.0f, 1.0f },
+ { SOCK_FLOAT, 1, "Size", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color" },
{ -1, 0, "" }
};
@@ -74,8 +74,8 @@ void register_node_type_tex_checker(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
new file mode 100644
index 00000000000..cb5102bae4e
--- /dev/null
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -0,0 +1,271 @@
+/*
+ * $Id: CMP_blur.c 35562 2011-03-15 20:10:32Z lukastoenne $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
+ * Juho Vepsäläinen
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/texture/nodes/node_texture_common.c
+ * \ingroup texnodes
+ */
+
+
+#include "DNA_node_types.h"
+
+#include "BKE_node.h"
+
+#include "node_texture_util.h"
+#include "node_common.h"
+#include "node_exec.h"
+
+static void copy_stack(bNodeStack *to, bNodeStack *from)
+{
+ if (to != from) {
+ copy_v4_v4(to->vec, from->vec);
+ to->data = from->data;
+ to->datatype = from->datatype;
+
+ /* tag as copy to prevent freeing */
+ to->is_copy = 1;
+ }
+}
+
+/**** GROUP ****/
+
+static void *group_initexec(bNode *node)
+{
+ bNodeTree *ngroup= (bNodeTree*)node->id;
+ void *exec;
+
+ /* initialize the internal node tree execution */
+ exec = ntreeTexBeginExecTree(ngroup);
+
+ return exec;
+}
+
+static void group_freeexec(bNode *UNUSED(node), void *nodedata)
+{
+ bNodeTreeExec*gexec= (bNodeTreeExec*)nodedata;
+
+ ntreeTexEndExecTree(gexec);
+}
+
+/* Copy inputs to the internal stack.
+ * This is a shallow copy, no buffers are duplicated here!
+ */
+static void group_copy_inputs(bNode *node, bNodeStack **in, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->inputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ copy_stack(ns, in[a]);
+ }
+ }
+}
+
+/* Copy internal results to the external outputs.
+ */
+static void group_copy_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack)
+{
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int a;
+ for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) {
+ if (sock->groupsock) {
+ ns = node_get_socket_stack(gstack, sock->groupsock);
+ copy_stack(out[a], ns);
+ }
+ }
+}
+
+static void group_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ bNodeThreadStack *nts;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ nts = ntreeGetThreadStack(exec, thread);
+
+ group_copy_inputs(node, in, nts->stack);
+ ntreeExecThreadNodes(exec, nts, data, thread);
+ group_copy_outputs(node, out, nts->stack);
+
+ ntreeReleaseThreadStack(nts);
+}
+
+void register_node_type_tex_group(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_group_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_group_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+
+
+/**** FOR LOOP ****/
+
+#if 0 /* XXX loop nodes don't work nicely with current trees */
+static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ bNodeThreadStack *nts;
+ int iterations= (int)in[0]->vec[0];
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int iteration;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ nts = ntreeGetThreadStack(exec, thread);
+
+ /* "Iteration" socket */
+ sock = exec->nodetree->inputs.first;
+ ns = node_get_socket_stack(nts->stack, sock);
+
+// group_copy_inputs(node, in, nts->stack);
+ for (iteration=0; iteration < iterations; ++iteration) {
+ /* first input contains current iteration counter */
+ ns->vec[0] = (float)iteration;
+ ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f;
+
+// if (iteration > 0)
+// loop_init_iteration(exec->nodetree, nts->stack);
+// ntreeExecThreadNodes(exec, nts, data, thread);
+ }
+// loop_copy_outputs(node, in, out, exec->stack);
+
+ ntreeReleaseThreadStack(nts);
+}
+
+void register_node_type_tex_forloop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_forloop_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_forloop_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+#endif
+
+/**** WHILE LOOP ****/
+
+#if 0 /* XXX loop nodes don't work nicely with current trees */
+static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
+{
+ bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
+ bNodeThreadStack *nts;
+ int condition= (in[0]->vec[0] > 0.0f);
+ bNodeSocket *sock;
+ bNodeStack *ns;
+ int iteration;
+
+ /* XXX same behavior as trunk: all nodes inside group are executed.
+ * it's stupid, but just makes it work. compo redesign will do this better.
+ */
+ {
+ bNode *inode;
+ for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
+ inode->need_exec = 1;
+ }
+
+ nts = ntreeGetThreadStack(exec, thread);
+
+ /* "Condition" socket */
+ sock = exec->nodetree->outputs.first;
+ ns = node_get_socket_stack(nts->stack, sock);
+
+ iteration = 0;
+// group_copy_inputs(node, in, nts->stack);
+ while (condition && iteration < node->custom1) {
+// if (iteration > 0)
+// loop_init_iteration(exec->nodetree, nts->stack);
+// ntreeExecThreadNodes(exec, nts, data, thread);
+
+ condition = (ns->vec[0] > 0.0f);
+ ++iteration;
+ }
+// loop_copy_outputs(node, in, out, exec->stack);
+
+ ntreeReleaseThreadStack(nts);
+}
+
+void register_node_type_tex_whileloop(ListBase *lb)
+{
+ static bNodeType ntype;
+
+ node_type_base(&ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, NULL);
+ node_type_size(&ntype, 120, 60, 200);
+ node_type_label(&ntype, node_group_label);
+ node_type_init(&ntype, node_whileloop_init);
+ node_type_valid(&ntype, node_group_valid);
+ node_type_template(&ntype, node_whileloop_template);
+ node_type_update(&ntype, NULL, node_group_verify);
+ node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
+ node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
+ node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
+
+ nodeRegisterType(lb, &ntype);
+}
+#endif
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 6eae78ec3de..a11769173a3 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -26,23 +26,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_compose.c
+/** \file blender/nodes/texture/nodes/node_texture_compose.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_VALUE, 1, "Red", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Green", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Blue", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_FLOAT, 1, "Red", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Green", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Blue", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color" },
{ -1, 0, "" }
};
@@ -62,8 +62,8 @@ void register_node_type_tex_compose(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c
index 3c46971f0d4..b2d9cecc164 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
+++ b/source/blender/nodes/texture/nodes/node_texture_coord.c
@@ -26,16 +26,16 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_coord.c
+/** \file blender/nodes/texture/nodes/node_texture_coord.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType outputs[]= {
- { SOCK_VECTOR, 0, "Coordinates", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_VECTOR, 0, "Coordinates" },
{ -1, 0, "" }
};
@@ -55,8 +55,8 @@ void register_node_type_tex_coord(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, outputs);
+ node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, outputs);
node_type_size(&ntype, 120, 110, 160);
node_type_storage(&ntype, "node_coord", NULL, NULL);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index b7af6c748ff..af6d880cc18 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -26,19 +26,19 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_curves.c
+/** \file blender/nodes/texture/nodes/node_texture_curves.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
/* **************** CURVE Time ******************** */
/* custom1 = sfra, custom2 = efra */
-static bNodeSocketType time_outputs[]= {
- { SOCK_VALUE, 0, "Value", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate time_outputs[]= {
+ { SOCK_FLOAT, 0, "Value" },
{ -1, 0, "" }
};
@@ -60,7 +60,7 @@ static void time_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out
}
-static void time_init(bNode* node)
+static void time_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= 1;
node->custom2= 250;
@@ -71,8 +71,8 @@ void register_node_type_tex_curve_time(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS,
- NULL, time_outputs);
+ node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, time_outputs);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, time_init);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
@@ -82,13 +82,13 @@ void register_node_type_tex_curve_time(ListBase *lb)
}
/* **************** CURVE RGB ******************** */
-static bNodeSocketType rgb_inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate rgb_inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType rgb_outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
+static bNodeSocketTemplate rgb_outputs[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -106,7 +106,7 @@ static void rgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
tex_output(node, in, out[0], &rgb_colorfn, data);
}
-static void rgb_init(bNode *node)
+static void rgb_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
@@ -115,8 +115,8 @@ void register_node_type_tex_curve_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- rgb_inputs, rgb_outputs);
+ node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, rgb_inputs, rgb_outputs);
node_type_size(&ntype, 200, 140, 320);
node_type_init(&ntype, rgb_init);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c
index f27d8c98716..312765f866e 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c
@@ -26,24 +26,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_decompose.c
+/** \file blender/nodes/texture/nodes/node_texture_decompose.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
#include <math.h>
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_VALUE, 0, "Red", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 0, "Green", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 0, "Blue", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_FLOAT, 0, "Red" },
+ { SOCK_FLOAT, 0, "Green" },
+ { SOCK_FLOAT, 0, "Blue" },
+ { SOCK_FLOAT, 0, "Alpha" },
{ -1, 0, "" }
};
@@ -83,8 +83,8 @@ void register_node_type_tex_decompose(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c
index b460844ba4a..fe524baaa96 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
+++ b/source/blender/nodes/texture/nodes/node_texture_distance.c
@@ -26,24 +26,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_distance.c
+/** \file blender/nodes/texture/nodes/node_texture_distance.c
* \ingroup texnodes
*/
#include <math.h>
#include "BLI_math.h"
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_VECTOR, 1, "Coordinate 1", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
- { SOCK_VECTOR, 1, "Coordinate 2", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_VECTOR, 1, "Coordinate 1", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
+ { SOCK_VECTOR, 1, "Coordinate 2", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_FLOAT, 0, "Value" },
{ -1, 0, "" }
};
@@ -66,8 +66,8 @@ void register_node_type_tex_distance(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 120, 110, 160);
node_type_storage(&ntype, "node_distance", NULL, NULL);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index 471d8db2c03..ebc2501cee3 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -26,25 +26,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
+/** \file blender/nodes/texture/nodes/node_texture_hueSatVal.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_VALUE, 1, "Hue", 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f },
- { SOCK_VALUE, 1, "Saturation", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f },
- { SOCK_VALUE, 1, "Value", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f },
- { SOCK_VALUE, 1, "Factor", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_FLOAT, 1, "Hue", 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE },
+ { SOCK_FLOAT, 1, "Saturation", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR },
+ { SOCK_FLOAT, 1, "Value", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR },
+ { SOCK_FLOAT, 1, "Factor", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
+ { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color" },
{ -1, 0, "" }
};
@@ -97,8 +97,8 @@ void register_node_type_tex_hue_sat(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 150, 80, 250);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index a54ca4bb119..1359cf4275f 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: TEX_image.c 36481 2011-05-04 11:42:25Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,16 +27,16 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_image.c
+/** \file blender/nodes/texture/nodes/node_texture_image.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -88,7 +88,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
tex_output(node, in, out[0], &colorfn, data);
}
-static void init(bNode* node)
+static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
@@ -101,8 +101,8 @@ void register_node_type_tex_image(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
- NULL, outputs);
+ node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, NULL, outputs);
node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, init);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c
index e908bdcff07..8ba4f292fec 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c
+++ b/source/blender/nodes/texture/nodes/node_texture_invert.c
@@ -26,22 +26,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_invert.c
+/** \file blender/nodes/texture/nodes/node_texture_invert.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
/* **************** INVERT ******************** */
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -68,8 +68,8 @@ void register_node_type_tex_invert(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 90, 80, 100);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 18468bdd55c..182bc37978f 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -26,24 +26,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_math.c
+/** \file blender/nodes/texture/nodes/node_texture_math.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
/* **************** SCALAR MATH ******************** */
-static bNodeSocketType inputs[]= {
- { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
- { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE},
+ { SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE},
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_FLOAT, 0, "Value"},
{ -1, 0, "" }
};
@@ -189,8 +189,8 @@ void register_node_type_tex_math(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 120, 110, 160);
node_type_label(&ntype, node_math_label);
node_type_storage(&ntype, "node_math", NULL, NULL);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index c7668c27b99..8baac682b18 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -26,23 +26,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
+/** \file blender/nodes/texture/nodes/node_texture_mixRgb.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
/* **************** MIX RGB ******************** */
-static bNodeSocketType inputs[]= {
- { SOCK_VALUE, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
- { SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f },
- { SOCK_RGBA , 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_FLOAT, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
+ { SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f },
+ { SOCK_RGBA , 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color" },
{ -1, 0, "" }
};
@@ -69,8 +69,8 @@ void register_node_type_tex_mix_rgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 046ad724507..c321f5738a1 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -26,18 +26,18 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_output.c
+/** \file blender/nodes/texture/nodes/node_texture_output.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
/* **************** COMPOSITE ******************** */
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION},
{ -1, 0, "" }
};
@@ -141,7 +141,7 @@ static void assign_index(struct bNode *node)
node->custom1 = index;
}
-static void init(bNode *node)
+static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
TexNodeOutput *tno = MEM_callocN(sizeof(TexNodeOutput), "TEX_output");
node->storage= tno;
@@ -162,8 +162,8 @@ void register_node_type_tex_output(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS,
- inputs, NULL);
+ node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, NULL);
node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, init);
node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index 294c1f7322f..8b4c25d85c9 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -26,13 +26,13 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_proc.c
+/** \file blender/nodes/texture/nodes/node_texture_proc.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
#include "RE_shader_ext.h"
@@ -41,21 +41,21 @@
*/
-static bNodeSocketType outputs_both[]= {
- { SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs_both[]= {
+ { SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f },
+ { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION },
{ -1, 0, "" }
};
-static bNodeSocketType outputs_color_only[]= {
- { SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs_color_only[]= {
+ { SOCK_RGBA, 0, "Color" },
{ -1, 0, "" }
};
/* Inputs common to all, #defined because nodes will need their own inputs too */
#define I 2 /* count */
#define COMMON_INPUTS \
- { SOCK_RGBA, 1, "Color 1", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f }, \
- { SOCK_RGBA, 1, "Color 2", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f }
+ { SOCK_RGBA, 1, "Color 1", 0.0f, 0.0f, 0.0f, 1.0f }, \
+ { SOCK_RGBA, 1, "Color 2", 1.0f, 1.0f, 1.0f, 1.0f }
/* Calls multitex and copies the result to the outputs. Called by xxx_exec, which handles inputs. */
static void do_proc(float *result, TexParams *p, float *col1, float *col2, char is_normal, Tex *tex, short thread)
@@ -139,15 +139,15 @@ static int count_outputs(bNode *node)
/* --- VORONOI -- */
-static bNodeSocketType voronoi_inputs[]= {
+static bNodeSocketTemplate voronoi_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "W1", 1.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
- { SOCK_VALUE, 1, "W2", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
- { SOCK_VALUE, 1, "W3", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
- { SOCK_VALUE, 1, "W4", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
+ { SOCK_FLOAT, 1, "W1", 1.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE },
+ { SOCK_FLOAT, 1, "W2", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE },
+ { SOCK_FLOAT, 1, "W3", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE },
+ { SOCK_FLOAT, 1, "W4", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE },
- { SOCK_VALUE, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f, 0.01f, 10.0f },
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 4.0f },
+ { SOCK_FLOAT, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f, 0.01f, 10.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 4.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
@@ -164,7 +164,7 @@ static void voronoi_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short th
ProcDef(voronoi)
/* --- BLEND -- */
-static bNodeSocketType blend_inputs[]= {
+static bNodeSocketTemplate blend_inputs[]= {
COMMON_INPUTS,
{ -1, 0, "" }
};
@@ -172,9 +172,9 @@ ProcNoInputs(blend)
ProcDef(blend)
/* -- MAGIC -- */
-static bNodeSocketType magic_inputs[]= {
+static bNodeSocketTemplate magic_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
+ { SOCK_FLOAT, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void magic_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -184,10 +184,10 @@ static void magic_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thre
ProcDef(magic)
/* --- MARBLE --- */
-static bNodeSocketType marble_inputs[]= {
+static bNodeSocketTemplate marble_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
- { SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void marble_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -198,9 +198,9 @@ static void marble_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thr
ProcDef(marble)
/* --- CLOUDS --- */
-static bNodeSocketType clouds_inputs[]= {
+static bNodeSocketTemplate clouds_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void clouds_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -210,10 +210,10 @@ static void clouds_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thr
ProcDef(clouds)
/* --- DISTORTED NOISE --- */
-static bNodeSocketType distnoise_inputs[]= {
+static bNodeSocketTemplate distnoise_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
- { SOCK_VALUE, 1, "Distortion", 1.00f, 0.0f, 0.0f, 0.0f, 0.0000f, 10.0f },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Distortion", 1.00f, 0.0f, 0.0f, 0.0f, 0.0000f, 10.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void distnoise_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -224,10 +224,10 @@ static void distnoise_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short
ProcDef(distnoise)
/* --- WOOD --- */
-static bNodeSocketType wood_inputs[]= {
+static bNodeSocketTemplate wood_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
- { SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void wood_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -238,14 +238,14 @@ static void wood_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short threa
ProcDef(wood)
/* --- MUSGRAVE --- */
-static bNodeSocketType musgrave_inputs[]= {
+static bNodeSocketTemplate musgrave_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "H", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
- { SOCK_VALUE, 1, "Lacunarity", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6.0f },
- { SOCK_VALUE, 1, "Octaves", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.0f },
+ { SOCK_FLOAT, 1, "H", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Lacunarity", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Octaves", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.0f, PROP_UNSIGNED },
- { SOCK_VALUE, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f },
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
+ { SOCK_FLOAT, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void musgrave_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -259,7 +259,7 @@ static void musgrave_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short t
ProcDef(musgrave)
/* --- NOISE --- */
-static bNodeSocketType noise_inputs[]= {
+static bNodeSocketTemplate noise_inputs[]= {
COMMON_INPUTS,
{ -1, 0, "" }
};
@@ -267,10 +267,10 @@ ProcNoInputs(noise)
ProcDef(noise)
/* --- STUCCI --- */
-static bNodeSocketType stucci_inputs[]= {
+static bNodeSocketTemplate stucci_inputs[]= {
COMMON_INPUTS,
- { SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
- { SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
+ { SOCK_FLOAT, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED },
+ { SOCK_FLOAT, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED },
{ -1, 0, "" }
};
static void stucci_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
@@ -282,7 +282,7 @@ ProcDef(stucci)
/* --- */
-static void init(bNode *node)
+static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
Tex *tex = MEM_callocN(sizeof(Tex), "Tex");
node->storage= tex;
@@ -301,7 +301,8 @@ void register_node_type_tex_proc_##name(ListBase *lb) \
{ \
static bNodeType ntype; \
\
- node_type_base(&ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS, name##_inputs, outputs); \
+ node_type_base(&ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS); \
+ node_type_socket_templates(&ntype, name##_inputs, outputs); \
node_type_size(&ntype, 140, 80, 140); \
node_type_init(&ntype, init); \
node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c
index 1be6152a2b3..a788b9cbbde 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c
@@ -26,25 +26,25 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_rotate.c
+/** \file blender/nodes/texture/nodes/node_texture_rotate.c
* \ingroup texnodes
*/
#include <math.h>
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VALUE, 1, "Turns", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
- { SOCK_VECTOR, 1, "Axis", 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, "Turns", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE },
+ { SOCK_VECTOR, 1, "Axis", 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -100,8 +100,8 @@ void register_node_type_tex_rotate(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 140, 100, 320);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c
index cfffcfda2e5..136dde0d52f 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
+++ b/source/blender/nodes/texture/nodes/node_texture_scale.c
@@ -26,22 +26,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_scale.c
+/** \file blender/nodes/texture/nodes/node_texture_scale.c
* \ingroup texnodes
*/
#include <math.h>
-#include "../TEX_util.h"
+#include "node_texture_util.h"
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_VECTOR, 1, "Scale", 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f },
+ { SOCK_VECTOR, 1, "Scale", 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_FACTOR },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -73,8 +73,8 @@ void register_node_type_tex_scale(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 90, 80, 100);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index c58595866af..10b9b8979f8 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -26,24 +26,24 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_texture.c
+/** \file blender/nodes/texture/nodes/node_texture_texture.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
#include "RE_shader_ext.h"
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color1", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_RGBA, 1, "Color2", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color1", 1.0f, 1.0f, 1.0f, 1.0f },
+ { SOCK_RGBA, 1, "Color2", 0.0f, 0.0f, 0.0f, 1.0f },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color" },
{ -1, 0, "" }
};
@@ -53,7 +53,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
static float red[] = {1,0,0,1};
static float white[] = {1,1,1,1};
float co[3], dxt[3], dyt[3];
-
+
copy_v3_v3(co, p->co);
copy_v3_v3(dxt, p->dxt);
copy_v3_v3(dyt, p->dyt);
@@ -70,7 +70,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
tex_input_rgba(col1, in[0], p, thread);
tex_input_rgba(col2, in[1], p, thread);
-
+
texres.nor = nor;
textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex,
&texres, thread, 0, p->shi, p->mtex);
@@ -94,8 +94,8 @@ void register_node_type_tex_texture(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 120, 80, 240);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c
index 8f7d6d837d7..395404a9411 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_translate.c
@@ -26,23 +26,23 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_translate.c
+/** \file blender/nodes/texture/nodes/node_texture_translate.c
* \ingroup texnodes
*/
#include <math.h>
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_TRANSLATION },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -69,8 +69,8 @@ void register_node_type_tex_translate(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 90, 80, 100);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
index e430c0c9a95..62b457bc862 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
@@ -26,22 +26,22 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_valToNor.c
+/** \file blender/nodes/texture/nodes/node_texture_valToNor.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
-static bNodeSocketType inputs[]= {
- { SOCK_VALUE, 1, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
- { SOCK_VALUE, 1, "Nabla", 0.025f, 0.0f, 0.0f, 0.0f, 0.001f, 0.1f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_FLOAT, 1, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE },
+ { SOCK_FLOAT, 1, "Nabla", 0.025f, 0.0f, 0.0f, 0.0f, 0.001f, 0.1f, PROP_UNSIGNED },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
- { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate outputs[]= {
+ { SOCK_VECTOR, 0, "Normal" },
{ -1, 0, "" }
};
@@ -85,8 +85,8 @@ void register_node_type_tex_valtonor(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 90, 80, 100);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index 8f59828081c..caca6fa97a4 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: TEX_valToRgb.c 36593 2011-05-10 11:19:26Z lukastoenne $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -27,21 +27,21 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
+/** \file blender/nodes/texture/nodes/node_texture_valToRgb.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
/* **************** VALTORGB ******************** */
-static bNodeSocketType valtorgb_in[]= {
- { SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate valtorgb_in[]= {
+ { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ -1, 0, "" }
};
-static bNodeSocketType valtorgb_out[]= {
- { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate valtorgb_out[]= {
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
@@ -59,7 +59,7 @@ static void valtorgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack *
tex_output(node, in, out[0], &valtorgb_colorfn, data);
}
-static void valtorgb_init(bNode *node)
+static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
node->storage = add_colorband(1);
}
@@ -68,8 +68,8 @@ void register_node_type_tex_valtorgb(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
- valtorgb_in, valtorgb_out);
+ node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+ node_type_socket_templates(&ntype, valtorgb_in, valtorgb_out);
node_type_size(&ntype, 240, 200, 300);
node_type_init(&ntype, valtorgb_init);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
@@ -79,12 +79,12 @@ void register_node_type_tex_valtorgb(ListBase *lb)
}
/* **************** RGBTOBW ******************** */
-static bNodeSocketType rgbtobw_in[]= {
+static bNodeSocketTemplate rgbtobw_in[]= {
{ SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketType rgbtobw_out[]= {
- { SOCK_VALUE, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+static bNodeSocketTemplate rgbtobw_out[]= {
+ { SOCK_FLOAT, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
@@ -106,8 +106,8 @@ void register_node_type_tex_rgbtobw(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0,
- rgbtobw_in, rgbtobw_out);
+ node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
+ node_type_socket_templates(&ntype, rgbtobw_in, rgbtobw_out);
node_type_size(&ntype, 80, 40, 120);
node_type_exec(&ntype, rgbtobw_exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c
index e917e525e17..01734f56937 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
+++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c
@@ -26,20 +26,20 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/TEX_nodes/TEX_viewer.c
+/** \file blender/nodes/texture/nodes/node_texture_viewer.c
* \ingroup texnodes
*/
-#include "../TEX_util.h"
-#include "TEX_node.h"
+#include "node_texture_util.h"
+#include "NOD_texture.h"
#include <math.h>
-static bNodeSocketType inputs[]= {
- { SOCK_RGBA, 1, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
+static bNodeSocketTemplate inputs[]= {
+ { SOCK_RGBA, 1, "Color", 1.0f, 0.0f, 0.0f, 1.0f },
{ -1, 0, "" }
};
-static bNodeSocketType outputs[]= {
+static bNodeSocketTemplate outputs[]= {
{ -1, 0, "" }
};
@@ -61,8 +61,8 @@ void register_node_type_tex_viewer(ListBase *lb)
{
static bNodeType ntype;
- node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW,
- inputs, outputs);
+ node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);