diff options
Diffstat (limited to 'source/blender/nodes')
113 files changed, 2263 insertions, 2529 deletions
diff --git a/source/blender/nodes/CMP_node.h b/source/blender/nodes/CMP_node.h index c2bc4d026ef..4cbb5599797 100644 --- a/source/blender/nodes/CMP_node.h +++ b/source/blender/nodes/CMP_node.h @@ -3,21 +3,21 @@ * * ***** BEGIN GPL LICENSE BLOCK ***** * - * This program is free software; you can redistribute it and/or + * This program is free software(ListBase *lb); 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 + * as published by the Free Software Foundation(ListBase *lb); either version 2 * of the License, or (at your option) any later version. The Blender * Foundation also sells licenses for use in proprietary software under * the Blender License. See http://www.blender.org/BL/ for information * about this. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY(ListBase *lb); 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, + * along with this program(ListBase *lb); 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. @@ -38,76 +38,76 @@ /* ****************** types array for all composite nodes ****************** */ -extern bNodeType cmp_node_rlayers; -extern bNodeType cmp_node_image; -extern bNodeType cmp_node_texture; -extern bNodeType cmp_node_value; -extern bNodeType cmp_node_rgb; -extern bNodeType cmp_node_curve_time; +void register_node_type_cmp_rlayers(ListBase *lb); +void register_node_type_cmp_image(ListBase *lb); +void register_node_type_cmp_texture(ListBase *lb); +void register_node_type_cmp_value(ListBase *lb); +void register_node_type_cmp_rgb(ListBase *lb); +void register_node_type_cmp_curve_time(ListBase *lb); -extern bNodeType cmp_node_composite; -extern bNodeType cmp_node_viewer; -extern bNodeType cmp_node_splitviewer; -extern bNodeType cmp_node_output_file; -extern bNodeType cmp_node_view_levels; +void register_node_type_cmp_composite(ListBase *lb); +void register_node_type_cmp_viewer(ListBase *lb); +void register_node_type_cmp_splitviewer(ListBase *lb); +void register_node_type_cmp_output_file(ListBase *lb); +void register_node_type_cmp_view_levels(ListBase *lb); -extern bNodeType cmp_node_curve_rgb; -extern bNodeType cmp_node_mix_rgb; -extern bNodeType cmp_node_hue_sat; -extern bNodeType cmp_node_brightcontrast; -extern bNodeType cmp_node_gamma; -extern bNodeType cmp_node_invert; -extern bNodeType cmp_node_alphaover; -extern bNodeType cmp_node_zcombine; -extern bNodeType cmp_node_colorbalance; -extern bNodeType cmp_node_huecorrect; +void register_node_type_cmp_curve_rgb(ListBase *lb); +void register_node_type_cmp_mix_rgb(ListBase *lb); +void register_node_type_cmp_hue_sat(ListBase *lb); +void register_node_type_cmp_brightcontrast(ListBase *lb); +void register_node_type_cmp_gamma(ListBase *lb); +void register_node_type_cmp_invert(ListBase *lb); +void register_node_type_cmp_alphaover(ListBase *lb); +void register_node_type_cmp_zcombine(ListBase *lb); +void register_node_type_cmp_colorbalance(ListBase *lb); +void register_node_type_cmp_huecorrect(ListBase *lb); -extern bNodeType cmp_node_normal; -extern bNodeType cmp_node_curve_vec; -extern bNodeType cmp_node_map_value; -extern bNodeType cmp_node_normalize; +void register_node_type_cmp_normal(ListBase *lb); +void register_node_type_cmp_curve_vec(ListBase *lb); +void register_node_type_cmp_map_value(ListBase *lb); +void register_node_type_cmp_normalize(ListBase *lb); -extern bNodeType cmp_node_filter; -extern bNodeType cmp_node_blur; -extern bNodeType cmp_node_dblur; -extern bNodeType cmp_node_bilateralblur; -extern bNodeType cmp_node_vecblur; -extern bNodeType cmp_node_dilateerode; -extern bNodeType cmp_node_defocus; +void register_node_type_cmp_filter(ListBase *lb); +void register_node_type_cmp_blur(ListBase *lb); +void register_node_type_cmp_dblur(ListBase *lb); +void register_node_type_cmp_bilateralblur(ListBase *lb); +void register_node_type_cmp_vecblur(ListBase *lb); +void register_node_type_cmp_dilateerode(ListBase *lb); +void register_node_type_cmp_defocus(ListBase *lb); -extern bNodeType cmp_node_valtorgb; -extern bNodeType cmp_node_rgbtobw; -extern bNodeType cmp_node_setalpha; -extern bNodeType cmp_node_idmask; -extern bNodeType cmp_node_math; -extern bNodeType cmp_node_seprgba; -extern bNodeType cmp_node_combrgba; -extern bNodeType cmp_node_sephsva; -extern bNodeType cmp_node_combhsva; -extern bNodeType cmp_node_sepyuva; -extern bNodeType cmp_node_combyuva; -extern bNodeType cmp_node_sepycca; -extern bNodeType cmp_node_combycca; -extern bNodeType cmp_node_premulkey; +void register_node_type_cmp_valtorgb(ListBase *lb); +void register_node_type_cmp_rgbtobw(ListBase *lb); +void register_node_type_cmp_setalpha(ListBase *lb); +void register_node_type_cmp_idmask(ListBase *lb); +void register_node_type_cmp_math(ListBase *lb); +void register_node_type_cmp_seprgba(ListBase *lb); +void register_node_type_cmp_combrgba(ListBase *lb); +void register_node_type_cmp_sephsva(ListBase *lb); +void register_node_type_cmp_combhsva(ListBase *lb); +void register_node_type_cmp_sepyuva(ListBase *lb); +void register_node_type_cmp_combyuva(ListBase *lb); +void register_node_type_cmp_sepycca(ListBase *lb); +void register_node_type_cmp_combycca(ListBase *lb); +void register_node_type_cmp_premulkey(ListBase *lb); -extern bNodeType cmp_node_diff_matte; -extern bNodeType cmp_node_distance_matte; -extern bNodeType cmp_node_chroma_matte; -extern bNodeType cmp_node_color_matte; -extern bNodeType cmp_node_channel_matte; -extern bNodeType cmp_node_color_spill; -extern bNodeType cmp_node_luma_matte; +void register_node_type_cmp_diff_matte(ListBase *lb); +void register_node_type_cmp_distance_matte(ListBase *lb); +void register_node_type_cmp_chroma_matte(ListBase *lb); +void register_node_type_cmp_color_matte(ListBase *lb); +void register_node_type_cmp_channel_matte(ListBase *lb); +void register_node_type_cmp_color_spill(ListBase *lb); +void register_node_type_cmp_luma_matte(ListBase *lb); -extern bNodeType cmp_node_translate; -extern bNodeType cmp_node_rotate; -extern bNodeType cmp_node_scale; -extern bNodeType cmp_node_flip; -extern bNodeType cmp_node_crop; -extern bNodeType cmp_node_displace; -extern bNodeType cmp_node_mapuv; +void register_node_type_cmp_translate(ListBase *lb); +void register_node_type_cmp_rotate(ListBase *lb); +void register_node_type_cmp_scale(ListBase *lb); +void register_node_type_cmp_flip(ListBase *lb); +void register_node_type_cmp_crop(ListBase *lb); +void register_node_type_cmp_displace(ListBase *lb); +void register_node_type_cmp_mapuv(ListBase *lb); -extern bNodeType cmp_node_glare; -extern bNodeType cmp_node_tonemap; -extern bNodeType cmp_node_lensdist; +void register_node_type_cmp_glare(ListBase *lb); +void register_node_type_cmp_tonemap(ListBase *lb); +void register_node_type_cmp_lensdist(ListBase *lb); #endif diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 8d8423cc19b..09a627b51d4 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -23,9 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c intern/CMP_nodes/*.c intern/SHD_nodes/*.c intern/TEX_nodes/*.c) - -SET(INC +set(INC . ../blenkernel ../blenlib @@ -39,15 +37,121 @@ SET(INC ../../../extern/glew/include ) -IF(WIN32) - LIST(APPEND INC ${PTHREADS_INC}) -ENDIF(WIN32) +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 + intern/node_util.c + + CMP_node.h + SHD_node.h + TEX_node.h + intern/CMP_util.h + intern/SHD_util.h + intern/TEX_util.h + intern/node_util.h +) -IF(WITH_PYTHON) - SET(INC ${INC} ../python ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) +if(WITH_PYTHON) + set(INC ${INC} ../python ${PYTHON_INCLUDE_DIRS}) + add_definitions(-DWITH_PYTHON) +endif() -BLENDERLIB(bf_nodes "${SRC}" "${INC}") +blender_add_lib(bf_nodes "${SRC}" "${INC}") diff --git a/source/blender/nodes/Makefile b/source/blender/nodes/Makefile deleted file mode 100644 index f997e640a17..00000000000 --- a/source/blender/nodes/Makefile +++ /dev/null @@ -1,34 +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) Blender Foundation. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -SOURCEDIR = source/blender/nodes -DIRS = intern intern/CMP_nodes intern/SHD_nodes intern/TEX_nodes - -include nan_subdirs.mk diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index 3e7e0dbe54c..4bed612144c 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -22,10 +22,9 @@ defs = [] if env['WITH_BF_PYTHON']: incs += ' ' + env['BF_PYTHON_INC'] incs += ' ../python' + defs.append('WITH_PYTHON') if env['BF_DEBUG']: defs.append('_DEBUG') -else: - defs.append('DISABLE_PYTHON') if env['OURPLATFORM'] == 'linux2': cflags='-pthread' diff --git a/source/blender/nodes/SHD_node.h b/source/blender/nodes/SHD_node.h index 80cd0c2e73c..20a7aa083ec 100644 --- a/source/blender/nodes/SHD_node.h +++ b/source/blender/nodes/SHD_node.h @@ -39,29 +39,29 @@ /* the type definitions array */ /* ****************** types array for all shaders ****************** */ -extern bNodeType sh_node_output; -extern bNodeType sh_node_material; -extern bNodeType sh_node_camera; -extern bNodeType sh_node_value; -extern bNodeType sh_node_rgb; -extern bNodeType sh_node_mix_rgb; -extern bNodeType sh_node_valtorgb; -extern bNodeType sh_node_rgbtobw; -extern bNodeType sh_node_texture; -extern bNodeType sh_node_normal; -extern bNodeType sh_node_geom; -extern bNodeType sh_node_mapping; -extern bNodeType sh_node_curve_vec; -extern bNodeType sh_node_curve_rgb; -extern bNodeType sh_node_math; -extern bNodeType sh_node_vect_math; -extern bNodeType sh_node_squeeze; -extern bNodeType node_dynamic_typeinfo; -extern bNodeType sh_node_material_ext; -extern bNodeType sh_node_invert; -extern bNodeType sh_node_seprgb; -extern bNodeType sh_node_combrgb; -extern bNodeType sh_node_hue_sat; +void register_node_type_sh_output(ListBase *lb); +void register_node_type_sh_material(ListBase *lb); +void register_node_type_sh_camera(ListBase *lb); +void register_node_type_sh_value(ListBase *lb); +void register_node_type_sh_rgb(ListBase *lb); +void register_node_type_sh_mix_rgb(ListBase *lb); +void register_node_type_sh_valtorgb(ListBase *lb); +void register_node_type_sh_rgbtobw(ListBase *lb); +void register_node_type_sh_texture(ListBase *lb); +void register_node_type_sh_normal(ListBase *lb); +void register_node_type_sh_geom(ListBase *lb); +void register_node_type_sh_mapping(ListBase *lb); +void register_node_type_sh_curve_vec(ListBase *lb); +void register_node_type_sh_curve_rgb(ListBase *lb); +void register_node_type_sh_math(ListBase *lb); +void register_node_type_sh_vect_math(ListBase *lb); +void register_node_type_sh_squeeze(ListBase *lb); +void register_node_type_sh_dynamic(ListBase *lb); +void register_node_type_sh_material_ext(ListBase *lb); +void register_node_type_sh_invert(ListBase *lb); +void register_node_type_sh_seprgb(ListBase *lb); +void register_node_type_sh_combrgb(ListBase *lb); +void register_node_type_sh_hue_sat(ListBase *lb); #endif diff --git a/source/blender/nodes/TEX_node.h b/source/blender/nodes/TEX_node.h index 1bbca09ac8f..b741c654b15 100644 --- a/source/blender/nodes/TEX_node.h +++ b/source/blender/nodes/TEX_node.h @@ -38,41 +38,41 @@ /* ****************** types array for all texture nodes ****************** */ -extern bNodeType tex_node_math; -extern bNodeType tex_node_mix_rgb; -extern bNodeType tex_node_valtorgb; -extern bNodeType tex_node_valtonor; -extern bNodeType tex_node_rgbtobw; -extern bNodeType tex_node_output; -extern bNodeType tex_node_viewer; -extern bNodeType tex_node_checker; -extern bNodeType tex_node_texture; -extern bNodeType tex_node_bricks; -extern bNodeType tex_node_image; -extern bNodeType tex_node_curve_rgb; -extern bNodeType tex_node_curve_time; -extern bNodeType tex_node_invert; -extern bNodeType tex_node_hue_sat; -extern bNodeType tex_node_coord; -extern bNodeType tex_node_distance; +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); +void register_node_type_tex_valtonor(ListBase *lb); +void register_node_type_tex_rgbtobw(ListBase *lb); +void register_node_type_tex_output(ListBase *lb); +void register_node_type_tex_viewer(ListBase *lb); +void register_node_type_tex_checker(ListBase *lb); +void register_node_type_tex_texture(ListBase *lb); +void register_node_type_tex_bricks(ListBase *lb); +void register_node_type_tex_image(ListBase *lb); +void register_node_type_tex_curve_rgb(ListBase *lb); +void register_node_type_tex_curve_time(ListBase *lb); +void register_node_type_tex_invert(ListBase *lb); +void register_node_type_tex_hue_sat(ListBase *lb); +void register_node_type_tex_coord(ListBase *lb); +void register_node_type_tex_distance(ListBase *lb); -extern bNodeType tex_node_rotate; -extern bNodeType tex_node_translate; -extern bNodeType tex_node_scale; -extern bNodeType tex_node_at; +void register_node_type_tex_rotate(ListBase *lb); +void register_node_type_tex_translate(ListBase *lb); +void register_node_type_tex_scale(ListBase *lb); +void register_node_type_tex_at(ListBase *lb); -extern bNodeType tex_node_compose; -extern bNodeType tex_node_decompose; +void register_node_type_tex_compose(ListBase *lb); +void register_node_type_tex_decompose(ListBase *lb); -extern bNodeType tex_node_proc_voronoi; -extern bNodeType tex_node_proc_blend; -extern bNodeType tex_node_proc_magic; -extern bNodeType tex_node_proc_marble; -extern bNodeType tex_node_proc_clouds; -extern bNodeType tex_node_proc_wood; -extern bNodeType tex_node_proc_musgrave; -extern bNodeType tex_node_proc_noise; -extern bNodeType tex_node_proc_stucci; -extern bNodeType tex_node_proc_distnoise; +void register_node_type_tex_proc_voronoi(ListBase *lb); +void register_node_type_tex_proc_blend(ListBase *lb); +void register_node_type_tex_proc_magic(ListBase *lb); +void register_node_type_tex_proc_marble(ListBase *lb); +void register_node_type_tex_proc_clouds(ListBase *lb); +void register_node_type_tex_proc_wood(ListBase *lb); +void register_node_type_tex_proc_musgrave(ListBase *lb); +void register_node_type_tex_proc_noise(ListBase *lb); +void register_node_type_tex_proc_stucci(ListBase *lb); +void register_node_type_tex_proc_distnoise(ListBase *lb); #endif diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c index 37061dd7eae..e8cfc8533d1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c @@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_alphaover_out[]= { { -1, 0, "" } }; -static void do_alphaover_premul(bNode *node, float *out, float *src, float *over, float *fac) +static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { if(over[3]<=0.0f) { @@ -61,7 +61,7 @@ static void do_alphaover_premul(bNode *node, float *out, float *src, float *over } /* result will be still premul, but the over part is premulled */ -static void do_alphaover_key(bNode *node, float *out, float *src, float *over, float *fac) +static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { if(over[3]<=0.0f) { @@ -107,7 +107,7 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, -static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: col col */ /* stack order out: col */ @@ -140,22 +140,19 @@ static void node_alphaover_init(bNode* node) node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); } -bNodeType cmp_node_alphaover= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ALPHAOVER, - /* name */ "AlphaOver", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_alphaover_in, - /* output sock */ cmp_node_alphaover_out, - /* storage */ "NodeTwoFloats", - /* execfunc */ node_composit_exec_alphaover, - /* butfunc */ NULL, - /* initfunc */ node_alphaover_init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_alphaover); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c index 97577fa6b5e..efa044158a2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c @@ -81,7 +81,7 @@ static bNodeSocketType cmp_node_bilateralblur_out[]= { /* code of this node was heavily inspired by the smooth function of opencv library. The main change is an optional image input */ -static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeBilateralBlurData *nbbd= node->storage; CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data; @@ -250,20 +250,17 @@ static void node_composit_init_bilateralblur(bNode* node) nbbd->sigma_space= 5.0; } -bNodeType cmp_node_bilateralblur= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_BILATERALBLUR, - /* name */ "Bilateral Blur", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_bilateralblur_in, - /* output sock */ cmp_node_bilateralblur_out, - /* storage */ "NodeBilateralBlurData", - /* execfunc */ node_composit_exec_bilateralblur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_bilateralblur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_bilateralblur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index eb8b079f341..75aca3e0428 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -93,109 +93,119 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca int x, y, pix= img->type; int i, bigstep; float *src, *dest; - + /* helper image */ work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */ - - /* horizontal */ - rad = scale*(float)nbd->sizex; - if(rad>imgx/2) - rad= imgx/2; - else if(rad<1) - rad= 1; - gausstab= make_gausstab(nbd->filtertype, rad); - gausstabcent= gausstab+rad; - - for (y = 0; y < imgy; y++) { - float *srcd= img->rect + pix*(y*img->x); + /* horizontal */ + if(nbd->sizex == 0) { + memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy); + } + else { + rad = scale*(float)nbd->sizex; + if(rad>imgx/2) + rad= imgx/2; + else if(rad<1) + rad= 1; - dest = work->rect + pix*(y * img->x); + gausstab= make_gausstab(nbd->filtertype, rad); + gausstabcent= gausstab+rad; - for (x = 0; x < imgx ; x++) { - int minr= x-rad<0?-x:-rad; - int maxr= x+rad>imgx?imgx-x:rad; + for (y = 0; y < imgy; y++) { + float *srcd= img->rect + pix*(y*img->x); - src= srcd + pix*(x+minr); + dest = work->rect + pix*(y * img->x); - sum= gval = rval= bval= aval= 0.0f; - for (i= minr; i < maxr; i++) { - val= gausstabcent[i]; - sum+= val; - rval += val * (*src++); + for (x = 0; x < imgx ; x++) { + int minr= x-rad<0?-x:-rad; + int maxr= x+rad>imgx?imgx-x:rad; + + src= srcd + pix*(x+minr); + + sum= gval = rval= bval= aval= 0.0f; + for (i= minr; i < maxr; i++) { + val= gausstabcent[i]; + sum+= val; + rval += val * (*src++); + if(pix==4) { + gval += val * (*src++); + bval += val * (*src++); + aval += val * (*src++); + } + } + sum= 1.0f/sum; + *dest++ = rval*sum; if(pix==4) { - gval += val * (*src++); - bval += val * (*src++); - aval += val * (*src++); + *dest++ = gval*sum; + *dest++ = bval*sum; + *dest++ = aval*sum; } } - sum= 1.0f/sum; - *dest++ = rval*sum; - if(pix==4) { - *dest++ = gval*sum; - *dest++ = bval*sum; - *dest++ = aval*sum; - } + if(node->exec & NODE_BREAK) + break; } - if(node->exec & NODE_BREAK) - break; + + /* vertical */ + MEM_freeN(gausstab); } - /* vertical */ - MEM_freeN(gausstab); - - rad = scale*(float)nbd->sizey; - if(rad>imgy/2) - rad= imgy/2; - else if(rad<1) - rad= 1; - - gausstab= make_gausstab(nbd->filtertype, rad); - gausstabcent= gausstab+rad; - - bigstep = pix*imgx; - for (x = 0; x < imgx; x++) { - float *srcd= work->rect + pix*x; - - dest = new->rect + pix*x; + if(nbd->sizey == 0) { + memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy); + } + else { + rad = scale*(float)nbd->sizey; + if(rad>imgy/2) + rad= imgy/2; + else if(rad<1) + rad= 1; + + gausstab= make_gausstab(nbd->filtertype, rad); + gausstabcent= gausstab+rad; - for (y = 0; y < imgy ; y++) { - int minr= y-rad<0?-y:-rad; - int maxr= y+rad>imgy?imgy-y:rad; + bigstep = pix*imgx; + for (x = 0; x < imgx; x++) { + float *srcd= work->rect + pix*x; - src= srcd + bigstep*(y+minr); + dest = new->rect + pix*x; - sum= gval = rval= bval= aval= 0.0f; - for (i= minr; i < maxr; i++) { - val= gausstabcent[i]; - sum+= val; - rval += val * src[0]; + for (y = 0; y < imgy ; y++) { + int minr= y-rad<0?-y:-rad; + int maxr= y+rad>imgy?imgy-y:rad; + + src= srcd + bigstep*(y+minr); + + sum= gval = rval= bval= aval= 0.0f; + for (i= minr; i < maxr; i++) { + val= gausstabcent[i]; + sum+= val; + rval += val * src[0]; + if(pix==4) { + gval += val * src[1]; + bval += val * src[2]; + aval += val * src[3]; + } + src += bigstep; + } + sum= 1.0f/sum; + dest[0] = rval*sum; if(pix==4) { - gval += val * src[1]; - bval += val * src[2]; - aval += val * src[3]; + dest[1] = gval*sum; + dest[2] = bval*sum; + dest[3] = aval*sum; } - src += bigstep; + dest+= bigstep; } - sum= 1.0f/sum; - dest[0] = rval*sum; - if(pix==4) { - dest[1] = gval*sum; - dest[2] = bval*sum; - dest[3] = aval*sum; - } - dest+= bigstep; + if(node->exec & NODE_BREAK) + break; } - if(node->exec & NODE_BREAK) - break; + MEM_freeN(gausstab); } - + free_compbuf(work); - MEM_freeN(gausstab); } /* reference has to be mapped 0-1, and equal in size */ -static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float fac, NodeBlurData *nbd) +static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref), float UNUSED(fac), NodeBlurData *nbd) { CompBuf *wbuf; register float val; @@ -568,11 +578,25 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN if(out[0]->hasoutput==0) return; if(nbd->relative) { - nbd->sizex= (int)(nbd->percentx*nbd->image_in_width); - nbd->sizey= (int)(nbd->percenty*nbd->image_in_height); + if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) { + nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width); + nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height); + } + else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_Y) { + nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width); + nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_width); + } + else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_X) { + nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_height); + nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height); + } } - if (((NodeBlurData *)node->storage)->filtertype == R_FILTER_FAST_GAUSS) { + if (nbd->sizex==0 && nbd->sizey==0) { + new= pass_on_compbuf(img); + out[0]->data= new; + } + else if (nbd->filtertype == R_FILTER_FAST_GAUSS) { CompBuf *new, *img = in[0]->data; /*from eeshlo's original patch, removed to fit in with the existing blur node */ /*const float sx = in[1]->vec[0], sy = in[2]->vec[0];*/ @@ -612,6 +636,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN /* if fac input, we do it different */ if(in[1]->data) { + CompBuf *gammabuf; /* make output size of input image */ new= alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */ @@ -620,7 +645,18 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new->xof = img->xof; new->yof = img->yof; - blur_with_reference(node, new, img, in[1]->data); + if(nbd->gamma) { + gammabuf= dupalloc_compbuf(img); + gamma_correct_compbuf(gammabuf, 0); + } + else gammabuf= img; + + blur_with_reference(node, new, gammabuf, in[1]->data); + + if(nbd->gamma) { + gamma_correct_compbuf(new, 1); + free_compbuf(gammabuf); + } if(node->exec & NODE_BREAK) { free_compbuf(new); new= NULL; @@ -633,7 +669,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new= pass_on_compbuf(img); } else { - NodeBlurData *nbd= node->storage; CompBuf *gammabuf; /* make output size of input image */ @@ -679,21 +714,19 @@ static void node_composit_init_blur(bNode* node) node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data"); } -bNodeType cmp_node_blur= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_BLUR, - /* name */ "Blur", - /* width+range */ 120, 80, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_blur_in, - /* output sock */ cmp_node_blur_out, - /* storage */ "NodeBlurData", - /* execfunc */ node_composit_exec_blur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_blur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_blur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c index 03eed59a4c4..f2f7636e96b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c @@ -44,15 +44,14 @@ static bNodeSocketType cmp_node_brightcontrast_out[]= { { -1, 0, "" } }; -static void do_brightnesscontrast(bNode *node, float *out, float *in) +static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, float *in_brightness, float *in_contrast) { float i; int c; - float a, b, contrast, brightness, delta, v; - contrast = node->custom2; - brightness = (float)(node->custom1); - brightness = (brightness) / 100.0f; - delta = contrast / 200.0f; + float a, b, v; + float brightness = (*in_brightness) / 100.0f; + float contrast = *in_contrast; + float delta = contrast / 200.0f; a = 1.0f - delta * 2.0f; /* * The algorithm is by Werner D. Streidt @@ -77,37 +76,30 @@ static void do_brightnesscontrast(bNode *node, float *out, float *in) } } -static void node_composit_exec_brightcontrast(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; if(in[0]->data) { CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); - node->custom1 = in[1]->vec[0]; - node->custom2 = in[2]->vec[0]; stackbuf= dupalloc_compbuf(cbuf); - composit1_pixel_processor(node, stackbuf, cbuf, in[0]->vec, do_brightnesscontrast, CB_RGBA); + composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, do_brightnesscontrast, CB_RGBA, CB_VAL, CB_VAL); out[0]->data = stackbuf; if(cbuf != in[0]->data) free_compbuf(cbuf); } } -bNodeType cmp_node_brightcontrast= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_BRIGHTCONTRAST, - /* name */ "Bright/Contrast", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_brightcontrast_in, - /* output sock */ cmp_node_brightcontrast_out, - /* storage */ "", - /* execfunc */ node_composit_exec_brightcontrast, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copysotragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_brightcontrast); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index ca7c19cc778..044ed6d069b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_channel_matte_out[]={ {-1,0,""} }; -static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in) +static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in) { /*normalize to the range 0.0 to 1.0) */ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); @@ -52,7 +52,7 @@ static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in) out[3]=in[3]; } -static void do_normalized_ycca_to_rgba2(bNode *node, float *out, float *in) +static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ in[0]=in[0]*255.0; @@ -197,19 +197,17 @@ static void node_composit_init_channel_matte(bNode *node) node->custom2= 2; /* Green Channel */ } -bNodeType cmp_node_channel_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CHANNEL_MATTE, - /* name */ "Channel Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_channel_matte_in, - /* output sock */ cmp_node_channel_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_channel_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_channel_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_channel_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index e502129c3d3..eba2d55187e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_chroma_out[]={ {-1,0,""} }; -static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) +static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in) { rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); @@ -62,7 +62,7 @@ static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) out[3]=in[3]; } -static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in) +static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ in[0]=(in[0]+1.0)/2.0; @@ -184,21 +184,19 @@ static void node_composit_init_chroma_matte(bNode *node) c->fstrength= 1.0f; }; -bNodeType cmp_node_chroma_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CHROMA_MATTE, - /* name */ "Chroma Key", - /* width+range */ 200, 80, 300, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_chroma_in, - /* output sock */ cmp_node_chroma_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_chroma_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_chroma_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_chroma_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c index 8d5f4688657..57063465ac2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c @@ -112,21 +112,19 @@ static void node_composit_init_color_matte(bNode *node) c->fstrength= 1.0f; }; -bNodeType cmp_node_color_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COLOR_MATTE, - /* name */ "Color Key", - /* width+range */ 200, 80, 300, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_color_in, - /* output sock */ cmp_node_color_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_color_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_color_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_color_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c index 3191ad757a0..e4b9ead504b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c @@ -182,7 +182,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma } } -static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* Originally based on the information from the book "The Art and Science of Digital Composition" and @@ -322,19 +322,16 @@ static void node_composit_init_color_spill(bNode *node) ncs->unspill=0; /* do not use unspill */ } -bNodeType cmp_node_color_spill={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COLOR_SPILL, - /* name */ "Color Spill", - /* width+range */ 140, 80, 200, - /* class+opts */ NODE_CLASS_MATTE, NODE_OPTIONS, - /* input sock */ cmp_node_color_spill_in, - /* output sock */ cmp_node_color_spill_out, - /* storage */ "NodeColorspill", - /* execfunc */ node_composit_exec_color_spill, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_color_spill, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, -}; - +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_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); + node_type_exec(&ntype, node_composit_exec_color_spill); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index 33f5680eaa9..2596037065f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -120,7 +120,7 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f out[3] = in[3]; } -static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf= in[1]->data; CompBuf *stackbuf; @@ -179,20 +179,18 @@ static void node_composit_init_colorbalance(bNode *node) n->gain[0] = n->gain[1] = n->gain[2] = 1.0f; } -bNodeType cmp_node_colorbalance={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COLORBALANCE, - /* name */ "Color Balance", - /* width+range */ 400, 200, 400, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_colorbalance_in, - /* output sock */ cmp_node_colorbalance_out, - /* storage */ "NodeColorBalance", - /* execfunc */ node_composit_exec_colorbalance, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_colorbalance, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_colorbalance); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index 7510a2d11d4..1bbcb0f7527 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_composite_in[]= { }; /* applies to render pipeline */ -static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha, z */ @@ -94,19 +94,15 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i generate_preview(data, node, in[0]->data); } -bNodeType cmp_node_composite= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMPOSITE, - /* name */ "Composite", - /* width+range */ 80, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ cmp_node_composite_in, - /* output sock */ NULL, - /* storage */ "", - /* execfunc */ node_composit_exec_composite, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 60, 200); + node_type_exec(&ntype, node_composit_exec_composite); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c index dd5ce88bd36..b8d24fc1b14 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_crop_out[]= { { -1, 0, "" } }; -static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { NodeTwoXYs *ntxy= node->storage; @@ -108,19 +108,17 @@ static void node_composit_init_crop(bNode* node) nxy->y2= 0; } -bNodeType cmp_node_crop= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CROP, - /* name */ "Crop", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_crop_in, - /* output sock */ cmp_node_crop_out, - /* storage */ "NodeTwoXYs", - /* execfunc */ node_composit_exec_crop, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_crop, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_crop); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index e4afa1922bb..2252bc2d181 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -38,7 +38,7 @@ static bNodeSocketType cmp_node_time_out[]= { { -1, 0, "" } }; -static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { RenderData *rd= data; /* stack order output: fac */ @@ -59,22 +59,20 @@ static void node_composit_init_curves_time(bNode* node) node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -bNodeType cmp_node_curve_time= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TIME, - /* name */ "Time", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_time_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_curves_time, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_curves_time, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_curves_time); + + nodeRegisterType(lb, &ntype); +} + @@ -89,7 +87,7 @@ static bNodeSocketType cmp_node_curve_vec_out[]= { { -1, 0, "" } }; -static void node_composit_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: vec */ /* stack order output: vec */ @@ -102,23 +100,20 @@ static void node_composit_init_curve_vec(bNode* node) node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); }; -bNodeType cmp_node_curve_vec= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CURVE_VEC, - /* name */ "Vector Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_curve_vec_in, - /* output sock */ cmp_node_curve_vec_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_curve_vec, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_curve_vec, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_curve_vec); + + nodeRegisterType(lb, &ntype); +} + /* **************** CURVE RGB ******************** */ static bNodeSocketType cmp_node_curve_rgb_in[]= { @@ -158,7 +153,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac) out[3]= in[3]; } -static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: fac, image, black level, white level */ /* stack order output: image */ @@ -192,20 +187,18 @@ static void node_composit_init_curve_rgb(bNode* node) node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); }; -bNodeType cmp_node_curve_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CURVE_RGB, - /* name */ "RGB Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_curve_rgb_in, - /* output sock */ cmp_node_curve_rgb_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_curve_rgb, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_curve_rgb, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_curve_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index a93a5760842..7f5d5df9d6f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -378,7 +378,13 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, //------------------------------------------------------------------ // main loop +#ifndef __APPLE__ /* can crash on Mac, see bug #22856, disabled for now */ +#ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */ + #pragma omp parallel for private(y) if(!nqd->preview) schedule(guided) +#else #pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided) +#endif +#endif for (y=0; y<img->y; y++) { unsigned int p, p4, zp, cp, cp4; float *ctcol, u, v, ct_crad, cR2=0; @@ -791,7 +797,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } -static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data; NodeDefocus *nqd = node->storage; @@ -863,21 +869,19 @@ static void node_composit_init_defocus(bNode* node) node->storage = nbd; } -bNodeType cmp_node_defocus = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DEFOCUS, - /* name */ "Defocus", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_defocus_in, - /* output sock */ cmp_node_defocus_out, - /* storage */ "NodeDefocus", - /* execfunc */ node_composit_exec_defocus, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_defocus, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_defocus); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c index 0735a369d12..73046d70011 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c @@ -128,21 +128,19 @@ static void node_composit_init_diff_matte(bNode *node) c->t2= 0.1f; } -bNodeType cmp_node_diff_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DIFF_MATTE, - /* name */ "Difference Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_diff_matte_in, - /* output sock */ cmp_node_diff_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_diff_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_diff_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_diff_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c index 6c67413ea1f..3ceaecfed43 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c @@ -110,7 +110,7 @@ static void morpho_erode(CompBuf *cbuf) } -static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: mask */ /* stack order out: mask */ @@ -143,21 +143,16 @@ static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack * } } -bNodeType cmp_node_dilateerode= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DILATEERODE, - /* name */ "Dilate/Erode", - /* width+range */ 130, 100, 320, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_dilateerode_in, - /* output sock */ cmp_node_dilateerode_out, - /* storage */ "", - /* execfunc */ node_composit_exec_dilateerode, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 130, 100, 320); + node_type_exec(&ntype, node_composit_exec_dilateerode); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c index b0cf5559772..533a8b1324b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c @@ -102,7 +102,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, return img; } -static void node_composit_exec_dblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeDBlurData *ndbd= node->storage; CompBuf *new, *img= in[0]->data; @@ -125,19 +125,17 @@ static void node_composit_init_dblur(bNode* node) ndbd->center_y= 0.5; } -bNodeType cmp_node_dblur = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DBLUR, - /* name */ "Directional Blur", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_dblur_in, - /* output sock */ cmp_node_dblur_out, - /* storage */ "NodeDBlurData", - /* execfunc */ node_composit_exec_dblur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_dblur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_dblur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c index aa7fac81c2c..7871efc30b7 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c @@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= { * in order to take effect */ #define DISPLACE_EPSILON 0.01 -static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) +static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) { ImBuf *ibuf; int x, y; @@ -60,7 +60,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float float vec[3], vecdx[3], vecdy[3]; float col[3]; - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; for(y=0; y < stackbuf->y; y++) { @@ -140,7 +140,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float } -static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; @@ -171,20 +171,16 @@ static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in } } -bNodeType cmp_node_displace= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DISPLACE, - /* name */ "Displace", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_displace_in, - /* output sock */ cmp_node_displace_out, - /* storage */ "", - /* execfunc */ node_composit_exec_displace, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_displace); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c index e0e595fc8f6..406f9e829c1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c @@ -125,21 +125,19 @@ static void node_composit_init_distance_matte(bNode *node) c->t2= 0.1f; } -bNodeType cmp_node_distance_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DIST_MATTE, - /* name */ "Distance Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_distance_matte_in, - /* output sock */ cmp_node_distance_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_distance_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_distance_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_distance_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c index 8f9a988c4c2..52b0fb008aa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c @@ -217,22 +217,18 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, } -bNodeType cmp_node_filter= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_FILTER, - /* name */ "Filter", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_filter_in, - /* output sock */ cmp_node_filter_out, - /* storage */ "", - /* execfunc */ node_composit_exec_filter, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 80, 40, 120); + node_type_label(&ntype, node_filter_label); + node_type_exec(&ntype, node_composit_exec_filter); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c index fbc570c4028..b0058765136 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_flip_out[]= { { -1, 0, "" } }; -static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { CompBuf *cbuf= in[0]->data; @@ -85,21 +85,17 @@ static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bN } } -bNodeType cmp_node_flip= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_FLIP, - /* name */ "Flip", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_flip_in, - /* output sock */ cmp_node_flip_out, - /* storage */ "", - /* execfunc */ node_composit_exec_flip, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_flip); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c index c0e524a3ae9..98af5bff2ec 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_gamma_out[]= { { -1, 0, "" } }; -static void do_gamma(bNode *node, float *out, float *in, float *fac) +static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) { int i=0; for(i=0; i<3; i++) { @@ -51,7 +51,7 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac) } out[3] = in[3]; } -static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: Fac, Image */ /* stack order out: Image */ @@ -72,21 +72,14 @@ static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, b } } -bNodeType cmp_node_gamma= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_GAMMA, - /* name */ "Gamma", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_gamma_in, - /* output sock */ cmp_node_gamma_out, - /* storage */ "", - /* execfunc */ node_composit_exec_gamma, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copysotragefunc */ NULL, - /* id */ NULL -}; - - +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_gamma); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index 1d50acfdc26..1d7471680d0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -422,7 +422,7 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src) //-------------------------------------------------------------------------------------------- -static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *src, *img = in[0]->data; NodeGlare* ndg = node->storage; @@ -484,19 +484,17 @@ static void node_composit_init_glare(bNode* node) node->storage = ndg; } -bNodeType cmp_node_glare = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_GLARE, - /* name */ "Glare", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_glare_in, - /* output sock */ cmp_node_glare_out, - /* storage */ "NodeGlare", - /* execfunc */ node_composit_exec_glare, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_glare, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_glare); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c index c274c580771..412ed5e6fa5 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c @@ -65,7 +65,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) } } -static void node_composit_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: Fac, Image */ /* stack order out: Image */ @@ -99,22 +99,19 @@ static void node_composit_init_hue_sat(bNode* node) nhs->val= 1.0f; } -bNodeType cmp_node_hue_sat= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_HUE_SAT, - /* name */ "Hue Saturation Value", - /* width+range */ 150, 80, 250, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_hue_sat_in, - /* output sock */ cmp_node_hue_sat_out, - /* storage */ "NodeHueSat", - /* execfunc */ node_composit_exec_hue_sat, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_hue_sat, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_hue_sat); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c index 9eb79bb8c36..54503d23550 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c @@ -98,7 +98,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac) out[3]= in[3]; } -static void node_composit_exec_huecorrect(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf= in[1]->data; CompBuf *stackbuf; @@ -148,20 +148,18 @@ static void node_composit_init_huecorrect(bNode* node) cumapping->cur = 1; } -bNodeType cmp_node_huecorrect= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_HUECORRECT, - /* name */ "Hue Correct", - /* width+range */ 320, 140, 400, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_huecorrect_in, - /* output sock */ cmp_node_huecorrect_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_huecorrect, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_huecorrect, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +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_size(&ntype, 320, 140, 400); + node_type_init(&ntype, node_composit_init_huecorrect); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_composit_exec_huecorrect); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c index 9b088cb3f55..8b422012cec 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c @@ -104,21 +104,17 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, } -bNodeType cmp_node_idmask= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ID_MASK, - /* name */ "ID Mask", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_idmask_in, - /* output sock */ cmp_node_idmask_out, - /* storage */ "", - /* execfunc */ node_composit_exec_idmask, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_idmask); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index 9309d2939db..a0ac8d90bfa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -77,25 +77,31 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i /* now we need a float buffer from the image * with matching color management */ - if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { - if(ibuf->profile != IB_PROFILE_NONE) { - rect= ibuf->rect_float; + if(ibuf->channels == 4) { + if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { + if(ibuf->profile != IB_PROFILE_NONE) { + rect= ibuf->rect_float; + } + else { + rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); + srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); + alloc= TRUE; + } } else { - rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); - srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); - alloc= TRUE; + if(ibuf->profile == IB_PROFILE_NONE) { + rect= ibuf->rect_float; + } + else { + rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); + linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); + alloc= TRUE; + } } } else { - if(ibuf->profile == IB_PROFILE_NONE) { - rect= ibuf->rect_float; - } - else { - rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); - linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); - alloc= TRUE; - } + /* non-rgba passes can't use color profiles */ + rect= ibuf->rect_float; } /* done coercing into the correct color management */ @@ -209,7 +215,7 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I }; -static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { /* image assigned to output */ @@ -291,22 +297,20 @@ static void node_composit_init_image(bNode* node) iuser->ok= 1; } -bNodeType cmp_node_image= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_IMAGE, - /* name */ "Image", - /* width+range */ 120, 80, 300, - /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_rlayers_out, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_image, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_image, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_image); + + nodeRegisterType(lb, &ntype); +} + /* **************** RENDER RESULT ******************** */ @@ -372,7 +376,7 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); }; -static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { Scene *sce= (Scene *)node->id; Render *re= (sce)? RE_GetRender(sce->id.name): NULL; @@ -422,22 +426,17 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, }; -bNodeType cmp_node_rlayers= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_R_LAYERS, - /* name */ "Render Layers", - /* width+range */ 150, 100, 300, - /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_rlayers_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rlayers, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 150, 100, 300); + node_type_exec(&ntype, node_composit_exec_rlayers); + + nodeRegisterType(lb, &ntype); +} -}; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c index 08ae51975b9..a60edd5ac7d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c @@ -75,7 +75,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) QUATCOPY(out, col); } -static void node_composit_exec_invert(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac, Image, Image */ /* stack order out: Image */ @@ -115,20 +115,16 @@ static void node_composit_init_invert(bNode *node) } /* custom1 = mix type */ -bNodeType cmp_node_invert= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_INVERT, - /* name */ "Invert", - /* width+range */ 120, 120, 140, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_invert_in, - /* output sock */ cmp_node_invert_out, - /* storage */ "", - /* execfunc */ node_composit_exec_invert, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_invert, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 120, 120, 140); + node_type_init(&ntype, node_composit_init_invert); + node_type_exec(&ntype, node_composit_exec_invert); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c index fc9045caafd..159bc859450 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c @@ -147,7 +147,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb } -static void node_composit_exec_lensdist(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *img = in[0]->data; NodeLensDist* nld = node->storage; @@ -174,19 +174,17 @@ static void node_composit_init_lensdist(bNode* node) } -bNodeType cmp_node_lensdist = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_LENSDIST, - /* name */ "Lens Distortion", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_lensdist_in, - /* output sock */ cmp_node_lensdist_out, - /* storage */ "NodeLensDist", - /* execfunc */ node_composit_exec_lensdist, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_lensdist, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_lensdist); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c index f4934b4b57b..71170d1633e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c @@ -328,21 +328,18 @@ static void node_composit_init_view_levels(bNode* node) node->custom1=1; /*All channels*/ } -bNodeType cmp_node_view_levels= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VIEW_LEVELS, - /* name */ "Levels", - /* widthrange */ 140, 100, 320, - /* classopts */ NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ cmp_node_view_levels_in, - /* output sock */ cmp_node_view_levels_out, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_view_levels, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_view_levels, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_view_levels); + node_type_storage(&ntype, "ImageUser", NULL, NULL); + node_type_exec(&ntype, node_composit_exec_view_levels); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c index af198fba699..91edb48415b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c @@ -103,20 +103,18 @@ static void node_composit_init_luma_matte(bNode *node) c->t2= 0.0f; }; -bNodeType cmp_node_luma_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_LUMA_MATTE, - /* name */ "Luminance Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_luma_matte_in, - /* output sock */ cmp_node_luma_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_luma_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_luma_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_luma_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c index 91d1aa148b2..f0e0aec37b9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c @@ -51,7 +51,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr int x, y, sx, sy, row= 3*stackbuf->x; /* ibuf needed for sampling */ - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; /* vars for efficient looping */ @@ -134,7 +134,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr } -static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; @@ -159,21 +159,17 @@ static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, b } } -bNodeType cmp_node_mapuv= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MAP_UV, - /* name */ "Map UV", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_mapuv_in, - /* output sock */ cmp_node_mapuv_out, - /* storage */ "", - /* execfunc */ node_composit_exec_mapuv, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_mapuv); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c index 357218ea937..550e4a2e870 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c @@ -52,7 +52,7 @@ static void do_map_value(bNode *node, float *out, float *src) out[0]= texmap->max[0]; } -static void node_composit_exec_map_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: valbuf */ /* stack order out: valbuf */ @@ -79,23 +79,20 @@ static void node_composit_init_map_value(bNode* node) node->storage= add_mapping(); } -bNodeType cmp_node_map_value= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MAP_VALUE, - /* name */ "Map Value", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_map_value_in, - /* output sock */ cmp_node_map_value_out, - /* storage */ "TexMapping", - /* execfunc */ node_composit_exec_map_value, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_map_value, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_map_value); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index f663dc76b5c..7a8dadafb86 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -29,7 +29,6 @@ #include "../CMP_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}, @@ -151,7 +150,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) } } -static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf=in[0]->data; CompBuf *cbuf2=in[1]->data; @@ -181,22 +180,19 @@ static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bN out[0]->data= stackbuf; } -bNodeType cmp_node_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MATH, - /* name */ "Math", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_math_in, - /* output sock */ cmp_node_math_out, - /* storage */ "", - /* execfunc */ node_composit_exec_math, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 120, 110, 160); + node_type_label(&ntype, node_math_label); + node_type_exec(&ntype, node_composit_exec_math); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c index 34d6713d9e3..91b8eb8b752 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c @@ -79,20 +79,16 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, } /* custom1 = mix type */ -bNodeType cmp_node_mix_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MIX_RGB, - /* name */ "Mix", - /* width+range */ 110, 60, 120, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_mix_rgb_in, - /* output sock */ cmp_node_mix_rgb_out, - /* storage */ "", - /* execfunc */ node_composit_exec_mix_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 110, 60, 120); + node_type_label(&ntype, node_blend_label); + node_type_exec(&ntype, node_composit_exec_mix_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c index c57caf180ad..5b218f4d486 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c @@ -52,7 +52,7 @@ static void do_normal(bNode *node, float *out, float *in) } /* generates normal, does dot product */ -static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { bNodeSocket *sock= node->outputs.first; /* stack order input: normal */ @@ -77,21 +77,16 @@ static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, } -bNodeType cmp_node_normal= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_NORMAL, - /* name */ "Normal", - /* width+range */ 100, 60, 200, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_normal_in, - /* output sock */ cmp_node_normal_out, - /* storage */ "", - /* execfunc */ node_composit_exec_normal, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 100, 60, 200); + node_type_exec(&ntype, node_composit_exec_normal); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c index 64855ba5cf3..1c92eb6519e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_normalize_out[]= { { -1, 0, "" } }; -static void do_normalize(bNode *node, float *out, float *src, float *min, float *mult) +static void do_normalize(bNode *UNUSED(node), float *out, float *src, float *min, float *mult) { float res; res = (src[0] - min[0]) * mult[0]; @@ -58,7 +58,7 @@ static void do_normalize(bNode *node, float *out, float *src, float *min, float /* The code below assumes all data is inside range +- this, and that input buffer is single channel */ #define BLENDER_ZMAX 10000.0f -static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: valbuf */ /* stack order out: valbuf */ @@ -98,19 +98,15 @@ static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **i } } -bNodeType cmp_node_normalize= { - /* *next, *prev*/ NULL, NULL, - /* type code */ CMP_NODE_NORMALIZE, - /* name */ "Normalize", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_normalize_in, - /* output sock */ cmp_node_normalize_out, - /* storage */ "TexMapping", - /* execfunc */ node_composit_exec_normalize, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, node_composit_exec_normalize); + node_type_storage(&ntype, "TexMapping", NULL, NULL); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c index 6f29548fcc3..701a3910be9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_output_file_in[]= { { -1, 0, "" } }; -static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha */ @@ -54,7 +54,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * return; } else { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); - ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); char string[256]; ibuf->rect_float= cbuf->rect; @@ -71,7 +71,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * } } - BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION)); + BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE); if(0 == BKE_write_ibuf((Scene *)node->id, ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality)) printf("Cannot save Node File Output to %s\n", string); @@ -104,22 +104,19 @@ static void node_composit_init_output_file(bNode *node) } } -bNodeType cmp_node_output_file= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_OUTPUT_FILE, - /* name */ "File Output", - /* width+range */ 140, 80, 300, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_output_file_in, - /* output sock */ NULL, - /* storage */ "NodeImageFile", - /* execfunc */ node_composit_exec_output_file, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_output_file, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_output_file); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c index 5058fa51c11..d64a2cee453 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c @@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_premulkey_out[]= { { -1, 0, "" } }; -static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; @@ -58,20 +58,16 @@ static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **i } } -bNodeType cmp_node_premulkey= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_PREMULKEY, - /* name */ "Alpha Convert", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_premulkey_in, - /* output sock */ cmp_node_premulkey_out, - /* storage */ "", - /* execfunc */ node_composit_exec_premulkey, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copysotragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_premulkey); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c index 3b9b993d5f8..975d9cae219 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c @@ -36,29 +36,24 @@ static bNodeSocketType cmp_node_rgb_out[]= { { -1, 0, "" } }; -static void node_composit_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; VECCOPY(out[0]->vec, sock->ns.vec); } -bNodeType cmp_node_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_RGB, - /* name */ "RGB", - /* width+range */ 140, 80, 140, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_rgb_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 140, 80, 140); + node_type_exec(&ntype, node_composit_exec_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index ccb1d8abfd9..ff8a2460efc 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_rotate_out[]= { }; /* only supports RGBA nodes now */ -static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) @@ -68,8 +68,8 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, maxy= -centy + (float)cbuf->y; - ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); - obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0); + ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); + obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); if(ibuf && obuf){ ibuf->rect_float=cbuf->rect; @@ -120,19 +120,16 @@ static void node_composit_init_rotate(bNode *node) node->custom1= 1; /* Bilinear Filter*/ } -bNodeType cmp_node_rotate= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ROTATE, - /* name */ "Rotate", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_rotate_in, - /* output sock */ cmp_node_rotate_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rotate, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_rotate, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_rotate); + node_type_exec(&ntype, node_composit_exec_rotate); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index 9779875b01a..a524f4cb29b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -75,7 +75,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b newx= MIN2(newx, CMP_SCALE_MAX); newy= MIN2(newy, CMP_SCALE_MAX); - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); if(ibuf) { ibuf->rect_float= cbuf->rect; IMB_scaleImBuf(ibuf, newx, newy); @@ -109,22 +109,18 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b } }; -bNodeType cmp_node_scale= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SCALE, - /* name */ "Scale", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_scale_in, - /* output sock */ cmp_node_scale_out, - /* storage */ "", - /* execfunc */ node_composit_exec_scale, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_scale); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c index 0ac47c58ab3..040a88bc37b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sephsva_out[]= { { -1, 0, "" } }; -static void do_sephsva(bNode *node, float *out, float *in) +static void do_sephsva(bNode *UNUSED(node), float *out, float *in) { float h, s, v; @@ -55,7 +55,7 @@ static void do_sephsva(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -96,23 +96,18 @@ static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in, } } -bNodeType cmp_node_sephsva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPHSVA, - /* name */ "Separate HSVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_sephsva_in, - /* output sock */ cmp_node_sephsva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_sephsva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_sephsva); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE HSVA ******************** */ static bNodeSocketType cmp_node_combhsva_in[]= { @@ -127,7 +122,7 @@ static bNodeSocketType cmp_node_combhsva_out[]= { { -1, 0, "" } }; -static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b); @@ -138,7 +133,7 @@ static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ @@ -171,21 +166,17 @@ static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in } } -bNodeType cmp_node_combhsva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBHSVA, - /* name */ "Combine HSVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combhsva_in, - /* output sock */ cmp_node_combhsva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combhsva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combhsva); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c index c5a57f8a175..1062344db39 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_seprgba_out[]= { { -1, 0, "" } }; -static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -74,23 +74,18 @@ static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in, } } -bNodeType cmp_node_seprgba= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPRGBA, - /* name */ "Separate RGBA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_seprgba_in, - /* output sock */ cmp_node_seprgba_out, - /* storage */ "", - /* execfunc */ node_composit_exec_seprgba, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_seprgba); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE RGBA ******************** */ @@ -106,7 +101,7 @@ static bNodeSocketType cmp_node_combrgba_out[]= { { -1, 0, "" } }; -static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_combrgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { out[0] = in1[0]; out[1] = in2[0]; @@ -114,7 +109,7 @@ static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float * out[3] = in4[0]; } -static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ @@ -147,21 +142,16 @@ static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in } } -bNodeType cmp_node_combrgba= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBRGBA, - /* name */ "Combine RGBA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combrgba_in, - /* output sock */ cmp_node_combrgba_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combrgba, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combrgba); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c index 7b3dfccab50..364457fc5fa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepycca_out[]= { { -1, 0, "" } }; -static void do_sepycca(bNode *node, float *out, float *in) +static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in) { float y, cb, cr; @@ -56,13 +56,51 @@ static void do_sepycca(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void do_sepycca_709(bNode *UNUSED(node), float *out, float *in) +{ + float y, cb, cr; + + rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_ITU_BT709); + + /*divided by 255 to normalize for viewing in */ + out[0]= y/255.0; + out[1]= cb/255.0; + out[2]= cr/255.0; + out[3]= in[3]; +} + +static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in) +{ + float y, cb, cr; + + rgb_to_ycc(in[0], in[1], in[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255); + + /*divided by 255 to normalize for viewing in */ + out[0]= y/255.0; + out[1]= cb/255.0; + out[2]= cr/255.0; + out[3]= in[3]; +} + +static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* input no image? then only color operation */ if(in[0]->data==NULL) { float y, cb, cr; - rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT601); + switch(node->custom1) + { + case 1: + rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT709); + break; + case 2: + rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_JFIF_0_255); + break; + case 0: + default: + rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT601); + break; + } /*divided by 255 to normalize for viewing in */ out[0]->vec[0] = y/255.0; @@ -76,7 +114,19 @@ static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, CompBuf *cbuf2=typecheck_compbuf(cbuf, CB_RGBA); /* convert the RGB stackbuf to an HSV representation */ - composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca, CB_RGBA); + switch(node->custom1) + { + case 1: + composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_709, CB_RGBA); + break; + case 2: + composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_jfif, CB_RGBA); + break; + case 0: + default: + composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_601, CB_RGBA); + break; + } /* separate each of those channels */ if(out[0]->hasoutput) @@ -95,29 +145,25 @@ static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, } } -bNodeType cmp_node_sepycca= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPYCCA, - /* name */ "Separate YCbCrA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_sepycca_in, - /* output sock */ cmp_node_sepycca_out, - /* storage */ "", - /* execfunc */ node_composit_exec_sepycca, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_sepycca); + + nodeRegisterType(lb, &ntype); +} + /* **************** 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.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { SOCK_VALUE, 1, "Cr", 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}, { -1, 0, "" } }; @@ -126,7 +172,7 @@ static bNodeSocketType cmp_node_combycca_out[]= { { -1, 0, "" } }; -static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_ycca_601(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; float y, cb, cr; @@ -144,16 +190,67 @@ static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void do_comb_ycca_709(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) +{ + float r,g,b; + float y, cb, cr; + + /*need to un-normalize the data*/ + y=in1[0]*255; + cb=in2[0]*255; + cr=in3[0]*255; + + ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_ITU_BT709); + + out[0] = r; + out[1] = g; + out[2] = b; + out[3] = in4[0]; +} + +static void do_comb_ycca_jfif(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) +{ + float r,g,b; + float y, cb, cr; + + /*need to un-normalize the data*/ + y=in1[0]*255; + cb=in2[0]*255; + cr=in3[0]*255; + + ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_JFIF_0_255); + + out[0] = r; + out[1] = g; + out[2] = b; + out[3] = in4[0]; +} + +static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 ycca channels */ /* stack order in: 4 value channels */ /* input no image? then only color operation */ if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) { - out[0]->vec[0] = in[0]->vec[0]; - out[0]->vec[1] = in[1]->vec[0]; - out[0]->vec[2] = in[2]->vec[0]; + float y = in[0]->vec[0] * 255; + float cb = in[1]->vec[0] * 255; + float cr = in[2]->vec[0] * 255; + + switch(node->custom1) + { + case 1: + ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT709); + break; + case 2: + ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_JFIF_0_255); + break; + case 0: + default: + ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT601); + break; + } + out[0]->vec[3] = in[3]->vec[0]; } else { @@ -169,29 +266,43 @@ static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */ - composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, - in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, - do_comb_ycca, CB_VAL, CB_VAL, CB_VAL, CB_VAL); + + switch(node->custom1) + { + case 1: + composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, + in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, + do_comb_ycca_709, CB_VAL, CB_VAL, CB_VAL, CB_VAL); + break; + + case 2: + composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, + in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, + do_comb_ycca_jfif, CB_VAL, CB_VAL, CB_VAL, CB_VAL); + break; + case 0: + default: + composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, + in[2]->data, in[2]->vec, in[3]->data, in[3]->vec, + do_comb_ycca_601, CB_VAL, CB_VAL, CB_VAL, CB_VAL); + break; + } out[0]->data= stackbuf; } } -bNodeType cmp_node_combycca= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBYCCA, - /* name */ "Combine YCbCrA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combycca_in, - /* output sock */ cmp_node_combycca_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combycca, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combycca); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c index 13b71026054..99a625042df 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepyuva_out[]= { { -1, 0, "" } }; -static void do_sepyuva(bNode *node, float *out, float *in) +static void do_sepyuva(bNode *UNUSED(node), float *out, float *in) { float y, u, v; @@ -55,7 +55,7 @@ static void do_sepyuva(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -96,22 +96,18 @@ static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, } } -bNodeType cmp_node_sepyuva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPYUVA, - /* name */ "Separate YUVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_sepyuva_in, - /* output sock */ cmp_node_sepyuva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_sepyuva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_sepyuva); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE YUVA ******************** */ @@ -127,7 +123,7 @@ static bNodeSocketType cmp_node_combyuva_out[]= { { -1, 0, "" } }; -static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; yuv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b); @@ -138,7 +134,7 @@ static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ @@ -171,20 +167,16 @@ static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in } } -bNodeType cmp_node_combyuva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBYUVA, - /* name */ "Combine YUVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combyuva_in, - /* output sock */ cmp_node_combyuva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combyuva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combyuva); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c index a7d10017c1f..106203ded7a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_setalpha_out[]= { { -1, 0, "" } }; -static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: RGBA image */ /* stack order in: col, alpha */ @@ -70,20 +70,15 @@ static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in } } -bNodeType cmp_node_setalpha= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SETALPHA, - /* name */ "Set Alpha", - /* width+range */ 120, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_setalpha_in, - /* output sock */ cmp_node_setalpha_out, - /* storage */ "", - /* execfunc */ node_composit_exec_setalpha, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 120, 40, 140); + node_type_exec(&ntype, node_composit_exec_setalpha); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c index 98bda1bd7fa..1bb0cdfcd10 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_splitviewer_in[]= { { -1, 0, "" } }; -static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, float *fac) +static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac) { if(*fac==0.0f) { QUATCOPY(out, in1); @@ -46,7 +46,7 @@ static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, } } -static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: image image */ @@ -146,22 +146,20 @@ static void node_composit_init_splitviewer(bNode* node) node->custom1= 50; /* default 50% split */ } -bNodeType cmp_node_splitviewer= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SPLITVIEWER, - /* name */ "SplitViewer", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_splitviewer_in, - /* output sock */ NULL, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_splitviewer, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_splitviewer, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_splitviewer); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index f990fa452cb..63a43352b2a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -79,7 +79,7 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco) else { VECCOPY(col, nor); } - + typecheck_compbuf_color(out, col, cbuf->type, cbuf->procedural_type); } @@ -96,19 +96,20 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, /* first make the preview image */ CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */ - /* Also take care about the render size! */ - sizex = (rd->size*rd->xsch)/100; - sizey = (rd->size*rd->ysch)/100; - prevbuf->rect_procedural= texture_procedural; prevbuf->node= node; VECCOPY(prevbuf->procedural_offset, in[0]->vec); VECCOPY(prevbuf->procedural_size, in[1]->vec); prevbuf->procedural_type= CB_RGBA; composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA); + generate_preview(data, node, prevbuf); free_compbuf(prevbuf); + /* texture procedural buffer type doesnt work well, we now render a buffer in scene size */ + sizex = (rd->size*rd->xsch)/100; + sizey = (rd->size*rd->ysch)/100; + if(out[0]->hasoutput) { CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */ @@ -117,6 +118,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, VECCOPY(stackbuf->procedural_offset, in[0]->vec); VECCOPY(stackbuf->procedural_size, in[1]->vec); stackbuf->procedural_type= CB_VAL; + composit1_pixel_processor(node, stackbuf, stackbuf, out[0]->vec, do_copy_value, CB_VAL); + stackbuf->rect_procedural= NULL; out[0]->data= stackbuf; } @@ -128,28 +131,25 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, VECCOPY(stackbuf->procedural_offset, in[0]->vec); VECCOPY(stackbuf->procedural_size, in[1]->vec); stackbuf->procedural_type= CB_RGBA; + composit1_pixel_processor(node, stackbuf, stackbuf, out[0]->vec, do_copy_rgba, CB_RGBA); + stackbuf->rect_procedural= NULL; out[1]->data= stackbuf; } } } -bNodeType cmp_node_texture= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TEXTURE, - /* name */ "Texture", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ cmp_node_texture_in, - /* output sock */ cmp_node_texture_out, - /* storage */ "", - /* execfunc */ node_composit_exec_texture, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 120, 80, 240); + node_type_exec(&ntype, node_composit_exec_texture); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c index 12f0c171f94..d58f0e827c2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c @@ -123,7 +123,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) } -static void node_composit_exec_tonemap(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *img = in[0]->data; @@ -158,19 +158,17 @@ static void node_composit_init_tonemap(bNode* node) node->storage = ntm; } -bNodeType cmp_node_tonemap = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TONEMAP, - /* name */ "Tonemap", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_tonemap_in, - /* output sock */ cmp_node_tonemap_out, - /* storage */ "NodeTonemap", - /* execfunc */ node_composit_exec_tonemap, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_tonemap, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_tonemap); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c index ca359d436f6..cad4d79b75c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_translate_out[]= { { -1, 0, "" } }; -static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { if(in[0]->data) { CompBuf *cbuf= in[0]->data; @@ -56,20 +56,16 @@ static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **i } } -bNodeType cmp_node_translate= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TRANSLATE, - /* name */ "Translate", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_translate_in, - /* output sock */ cmp_node_translate_out, - /* storage */ "", - /* execfunc */ node_composit_exec_translate, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_translate); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c index 6ce03f38cdb..2000e411f8c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c @@ -46,7 +46,7 @@ static void do_colorband_composit(bNode *node, float *out, float *in) do_colorband(node->storage, in[0], out); } -static void node_composit_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac */ /* stack order out: col, alpha */ @@ -80,23 +80,20 @@ static void node_composit_init_valtorgb(bNode* node) node->storage= add_colorband(1); } -bNodeType cmp_node_valtorgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VALTORGB, - /* name */ "ColorRamp", - /* width+range */ 240, 200, 300, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_valtorgb_in, - /* output sock */ cmp_node_valtorgb_out, - /* storage */ "ColorBand", - /* execfunc */ node_composit_exec_valtorgb, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_valtorgb, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_valtorgb); + + nodeRegisterType(lb, &ntype); +} + /* **************** RGBTOBW ******************** */ @@ -109,12 +106,12 @@ static bNodeSocketType cmp_node_rgbtobw_out[]= { { -1, 0, "" } }; -static void do_rgbtobw(bNode *node, float *out, float *in) +static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in) { out[0]= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f; } -static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw */ /* stack order in: col */ @@ -137,21 +134,14 @@ static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, } } -bNodeType cmp_node_rgbtobw= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_RGBTOBW, - /* name */ "RGB to BW", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_rgbtobw_in, - /* output sock */ cmp_node_rgbtobw_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rgbtobw, - /* butfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_composit_exec_rgbtobw); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c index 14a3b6fe15c..787c9135898 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c @@ -35,27 +35,23 @@ static bNodeSocketType cmp_node_value_out[]= { { -1, 0, "" } }; -static void node_composit_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; out[0]->vec[0]= sock->ns.vec[0]; } -bNodeType cmp_node_value= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VALUE, - /* name */ "Value", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_value_out, - /* storage */ "", - /* execfunc */ node_composit_exec_value, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_composit_exec_value); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c index eaeeadd02af..71c8c48db7a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c @@ -44,7 +44,7 @@ static bNodeSocketType cmp_node_vecblur_out[]= { -static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeBlurData *nbd= node->storage; CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data; @@ -91,20 +91,18 @@ static void node_composit_init_vecblur(bNode* node) }; /* custom1: itterations, custom2: maxspeed (0 = nolimit) */ -bNodeType cmp_node_vecblur= { - /* next, prev */ NULL, NULL, - /* type code */ CMP_NODE_VECBLUR, - /* name */ "Vector Blur", - /* width+range */ 120, 80, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_vecblur_in, - /* output sock */ cmp_node_vecblur_out, - /* storage */ "NodeBlurData", - /* execfunc */ node_composit_exec_vecblur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_vecblur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +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_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); + node_type_exec(&ntype, node_composit_exec_vecblur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c index 80200ad9ce6..f23a82e1dc2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c @@ -39,7 +39,7 @@ static bNodeSocketType cmp_node_viewer_in[]= { }; -static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha, z */ @@ -128,21 +128,18 @@ static void node_composit_init_viewer(bNode* node) iuser->ok= 1; } -bNodeType cmp_node_viewer= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VIEWER, - /* name */ "Viewer", - /* width+range */ 80, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ cmp_node_viewer_in, - /* output sock */ NULL, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_viewer, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_viewer, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +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_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); + node_type_exec(&ntype, node_composit_exec_viewer); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c index 7be9f34f00b..675eae74a53 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c @@ -31,7 +31,7 @@ /* **************** Z COMBINE ******************** */ - /* lazy coder note: node->custom1 is abused to send signal */ + /* 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}, @@ -47,13 +47,40 @@ static bNodeSocketType cmp_node_zcombine_out[]= { static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2) { + float alpha; + float malpha; + if(*z1 <= *z2) { - QUATCOPY(out, src1); + if (node->custom1) { + // use alpha in combine operation + alpha= src1[3]; + malpha= 1.0f - alpha; + out[0]= malpha*src2[0] + alpha*src1[0]; + out[1]= malpha*src2[1] + alpha*src1[1]; + out[2]= malpha*src2[2] + alpha*src1[2]; + out[3]= malpha*src2[3] + alpha*src1[3]; + } + else { + // do combination based solely on z value + QUATCOPY(out, src1); + } } else { - QUATCOPY(out, src2); + if (node->custom1) { + // use alpha in combine operation + alpha= src2[3]; + malpha= 1.0f - alpha; + out[0]= malpha*src1[0] + alpha*src2[0]; + out[1]= malpha*src1[1] + alpha*src2[1]; + out[2]= malpha*src1[2] + alpha*src2[2]; + out[3]= malpha*src1[3] + alpha*src2[3]; + } + else { + // do combination based solely on z value + QUATCOPY(out, src1); + } - if(node->custom1) + if(node->custom2) *z1= *z2; } } @@ -62,20 +89,49 @@ static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2) { if(*z1 > *z2) { *out= 1.0f; - if(node->custom1) + if(node->custom2) *z1= *z2; } } static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol) { - float alpha= *acol; - float malpha= 1.0f - alpha; - - out[0]= malpha*col1[0] + alpha*col2[0]; - out[1]= malpha*col1[1] + alpha*col2[1]; - out[2]= malpha*col1[2] + alpha*col2[2]; - out[3]= malpha*col1[3] + alpha*col2[3]; + float alpha; + float malpha; + + if (node->custom1) { + // use alpha in combine operation, antialiased mask in used here just as hint for the z value + if (*acol>0.0f) { + alpha= col2[3]; + malpha= 1.0f - alpha; + + + out[0]= malpha*col1[0] + alpha*col2[0]; + out[1]= malpha*col1[1] + alpha*col2[1]; + out[2]= malpha*col1[2] + alpha*col2[2]; + out[3]= malpha*col1[3] + alpha*col2[3]; + } + else { + alpha= col1[3]; + malpha= 1.0f - alpha; + + + out[0]= malpha*col2[0] + alpha*col1[0]; + out[1]= malpha*col2[1] + alpha*col1[1]; + out[2]= malpha*col2[2] + alpha*col1[2]; + out[3]= malpha*col2[3] + alpha*col1[3]; + } + } + else { + // do combination based solely on z value but with antialiased mask + alpha = *acol; + malpha= 1.0f - alpha; + + out[0]= malpha*col1[0] + alpha*col2[0]; + out[1]= malpha*col1[1] + alpha*col2[1]; + out[2]= malpha*col1[2] + alpha*col2[2]; + out[3]= malpha*col1[3] + alpha*col2[3]; + } } static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in, bNodeStack **out) @@ -107,11 +163,11 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in *zval= in[1]->vec[0]; } /* lazy coder hack */ - node->custom1= 1; + node->custom2= 1; out[1]->data= zbuf; } else { - node->custom1= 0; + node->custom2= 0; zbuf= in[1]->data; } @@ -163,20 +219,15 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in } -bNodeType cmp_node_zcombine= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ZCOMBINE, - /* name */ "Z Combine", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_zcombine_in, - /* output sock */ cmp_node_zcombine_out, - /* storage */ "", - /* execfunc */ node_composit_exec_zcombine, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_composit_exec_zcombine); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/Makefile b/source/blender/nodes/intern/CMP_nodes/Makefile deleted file mode 100644 index 5e97864fb95..00000000000 --- a/source/blender/nodes/intern/CMP_nodes/Makefile +++ /dev/null @@ -1,47 +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) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = nodes_cmp -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -CFLAGS += $(LEVEL_1_C_WARNINGS) - -CPPFLAGS += -I../../../blenkernel -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../../../makesdna -CPPFLAGS += -I../../../makesrna -CPPFLAGS += -I../../../blenlib -CPPFLAGS += -I../../../editors/include -CPPFLAGS += -I../../../imbuf -CPPFLAGS += -I../../../render/extern/include -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index 9edcc8b0eec..9e2fed1877e 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -414,12 +414,12 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) return inbuf; } -float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, int yrad) +static float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad) { if(cbuf) { if(cbuf->rect_procedural) { - cbuf->rect_procedural(cbuf, rectf, (float)x/(float)xrad, (float)y/(float)yrad); - return rectf; + cbuf->rect_procedural(cbuf, use, (float)x/(float)xrad, (float)y/(float)yrad); + return use; } else { static float col[4]= {0.0f, 0.0f, 0.0f, 0.0f}; @@ -434,7 +434,7 @@ float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, in return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) ); } } - else return rectf; + else return defcol; } /* **************************************************** */ @@ -446,6 +446,7 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa { CompBuf *src_use; float *outfp=out->rect, *srcfp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src_use= typecheck_compbuf(src_buf, src_type); @@ -455,7 +456,7 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - srcfp= compbuf_get_pixel(src_use, src_col, x, y, xrad, yrad); + srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad); func(node, outfp, srcfp); } } @@ -471,6 +472,7 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa { CompBuf *src_use, *fac_use; float *outfp=out->rect, *srcfp, *facfp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src_use= typecheck_compbuf(src_buf, src_type); @@ -481,8 +483,8 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - srcfp= compbuf_get_pixel(src_use, src_col, x, y, xrad, yrad); - facfp= compbuf_get_pixel(fac_use, fac, x, y, xrad, yrad); + srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad); + facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad); func(node, outfp, srcfp, facfp); } @@ -500,6 +502,7 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo { CompBuf *src1_use, *src2_use, *fac_use; float *outfp=out->rect, *src1fp, *src2fp, *facfp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src1_use= typecheck_compbuf(src1_buf, src1_type); @@ -511,9 +514,9 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - src1fp= compbuf_get_pixel(src1_use, src1_col, x, y, xrad, yrad); - src2fp= compbuf_get_pixel(src2_use, src2_col, x, y, xrad, yrad); - facfp= compbuf_get_pixel(fac_use, fac, x, y, xrad, yrad); + src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad); + src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad); + facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad); func(node, outfp, src1fp, src2fp, facfp); } @@ -535,6 +538,7 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo { CompBuf *src1_use, *src2_use, *fac1_use, *fac2_use; float *outfp=out->rect, *src1fp, *src2fp, *fac1fp, *fac2fp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src1_use= typecheck_compbuf(src1_buf, src1_type); @@ -547,10 +551,10 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - src1fp= compbuf_get_pixel(src1_use, src1_col, x, y, xrad, yrad); - src2fp= compbuf_get_pixel(src2_use, src2_col, x, y, xrad, yrad); - fac1fp= compbuf_get_pixel(fac1_use, fac1, x, y, xrad, yrad); - fac2fp= compbuf_get_pixel(fac2_use, fac2, x, y, xrad, yrad); + src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad); + src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad); + fac1fp= compbuf_get_pixel(fac1_use, fac1, color, x, y, xrad, yrad); + fac2fp= compbuf_get_pixel(fac2_use, fac2, color, x, y, xrad, yrad); func(node, outfp, src1fp, fac1fp, src2fp, fac2fp); } @@ -662,59 +666,59 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) } } -void do_rgba_to_yuva(bNode *node, float *out, float *in) +void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in) { rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_rgba_to_hsva(bNode *node, float *out, float *in) +void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in) { rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_rgba_to_ycca(bNode *node, float *out, float *in) +void do_rgba_to_ycca(bNode *UNUSED(node), float *out, float *in) { rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } -void do_yuva_to_rgba(bNode *node, float *out, float *in) +void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in) { yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_hsva_to_rgba(bNode *node, float *out, float *in) +void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in) { hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_ycca_to_rgba(bNode *node, float *out, float *in) +void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in) { ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } -void do_copy_rgba(bNode *node, float *out, float *in) +void do_copy_rgba(bNode *UNUSED(node), float *out, float *in) { QUATCOPY(out, in); } -void do_copy_rgb(bNode *node, float *out, float *in) +void do_copy_rgb(bNode *UNUSED(node), float *out, float *in) { VECCOPY(out, in); out[3]= 1.0f; } -void do_copy_value(bNode *node, float *out, float *in) +void do_copy_value(bNode *UNUSED(node), float *out, float *in) { out[0]= in[0]; } -void do_copy_a_rgba(bNode *node, float *out, float *in, float *fac) +void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac) { VECCOPY(out, in); out[3]= *fac; @@ -1303,7 +1307,7 @@ CompBuf* qd_downScaledCopy(CompBuf* src, int scale) void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) { double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; - float *X, *Y, *W; + double *X, *Y, *W; int i, x, y, sz; // <0.5 not valid, though can have a possibly useful sort of sharpening effect @@ -1367,9 +1371,9 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) // intermediate buffers sz = MAX2(src->x, src->y); - X = MEM_callocN(sz*sizeof(float), "IIR_gauss X buf"); - Y = MEM_callocN(sz*sizeof(float), "IIR_gauss Y buf"); - W = MEM_callocN(sz*sizeof(float), "IIR_gauss W buf"); + X = MEM_callocN(sz*sizeof(double), "IIR_gauss X buf"); + Y = MEM_callocN(sz*sizeof(double), "IIR_gauss Y buf"); + W = MEM_callocN(sz*sizeof(double), "IIR_gauss W buf"); if (xy & 1) { // H for (y=0; y<src->y; ++y) { const int yx = y*src->x; diff --git a/source/blender/nodes/intern/CMP_util.h b/source/blender/nodes/intern/CMP_util.h index 9dfea6abf54..efb711ab416 100644 --- a/source/blender/nodes/intern/CMP_util.h +++ b/source/blender/nodes/intern/CMP_util.h @@ -46,25 +46,28 @@ #include "DNA_scene_types.h" #include "DNA_texture_types.h" +#include "BLI_math.h" +#include "BLI_blenlib.h" +#include "BLI_rand.h" +#include "BLI_threads.h" +#include "BLI_utildefines.h" +#include "BLI_utildefines.h" + #include "BKE_blender.h" #include "BKE_colortools.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" + #include "BKE_library.h" #include "BKE_object.h" #include "../CMP_node.h" #include "node_util.h" -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_rand.h" -#include "BLI_threads.h" - #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -117,7 +120,6 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy); CompBuf *typecheck_compbuf(CompBuf *inbuf, int type); void typecheck_compbuf_color(float *out, float *in, int outtype, int intype); -float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, int yrad); /* **************************************************** */ @@ -163,7 +165,7 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2); extern void node_ID_title_cb(void *node_v, void *unused_v); -/* utility functions used by glare, tonemap and lense distortion */ +/* utility functions used by glare, tonemap and lens distortion */ /* soms macros for color handling */ typedef float fRGB[4]; /* clear color */ diff --git a/source/blender/nodes/intern/Makefile b/source/blender/nodes/intern/Makefile deleted file mode 100644 index 1ffc09bce2c..00000000000 --- a/source/blender/nodes/intern/Makefile +++ /dev/null @@ -1,51 +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) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = nodes -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -CFLAGS += $(LEVEL_1_C_WARNINGS) - -CPPFLAGS += -I../../blenkernel -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../../makesdna -CPPFLAGS += -I../../makesrna -CPPFLAGS += -I../../blenlib -CPPFLAGS += -I../../editors/include -CPPFLAGS += -I../../imbuf -CPPFLAGS += -I../../render/extern/include -CPPFLAGS += -I../../gpu -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) - -DIRS = SHD_nodes CMP_nodes TEX_nodes -include nan_subdirs.mk diff --git a/source/blender/nodes/intern/SHD_nodes/Makefile b/source/blender/nodes/intern/SHD_nodes/Makefile deleted file mode 100644 index 666ffd4a7d3..00000000000 --- a/source/blender/nodes/intern/SHD_nodes/Makefile +++ /dev/null @@ -1,50 +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) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = nodes_shd -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -CFLAGS += $(LEVEL_1_C_WARNINGS) - -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += -I../../../python -CPPFLAGS += -I../../../blenkernel -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../../../makesdna -CPPFLAGS += -I../../../makesrna -CPPFLAGS += -I../../../blenlib -CPPFLAGS += -I../../../editors/include -CPPFLAGS += -I../../../imbuf -CPPFLAGS += -I../../../render/extern/include -CPPFLAGS += -I../../../gpu -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c index d89099955aa..82c060ed1d6 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c @@ -38,7 +38,7 @@ static bNodeSocketType sh_node_camera_out[]= { }; -static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */ @@ -49,26 +49,23 @@ static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bN } } -static int gpu_shader_camera(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION)); } -bNodeType sh_node_camera= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_CAMERA, - /* name */ "Camera Data", - /* width+range */ 95, 95, 120, - /* class+opts */ NODE_CLASS_INPUT, 0, - /* input sock */ NULL, - /* output sock */ sh_node_camera_out, - /* storage */ "node_camera", - /* execfunc */ node_shader_exec_camera, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_camera -}; +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_size(&ntype, 95, 95, 120); + node_type_storage(&ntype, "node_camera", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_camera); + node_type_gpu(&ntype, gpu_shader_camera); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c index 4e47e75993d..405c455501c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_curve_vec_out[]= { { -1, 0, "" } }; -static void node_shader_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -66,24 +66,21 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array)); } -bNodeType sh_node_curve_vec= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_CURVE_VEC, - /* name */ "Vector Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ sh_node_curve_vec_in, - /* output sock */ sh_node_curve_vec_out, - /* storage */ "CurveMapping", - /* execfunc */ node_shader_exec_curve_vec, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_curve_vec, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_curve_vec - -}; +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_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); + node_type_exec(&ntype, node_shader_exec_curve_vec); + node_type_gpu(&ntype, gpu_shader_curve_vec); + + nodeRegisterType(lb, &ntype); +} + /* **************** CURVE RGB ******************** */ static bNodeSocketType sh_node_curve_rgb_in[]= { @@ -97,7 +94,7 @@ static bNodeSocketType sh_node_curve_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -123,21 +120,18 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array)); } -bNodeType sh_node_curve_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_CURVE_RGB, - /* name */ "RGB Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_curve_rgb_in, - /* output sock */ sh_node_curve_rgb_out, - /* storage */ "CurveMapping", - /* execfunc */ node_shader_exec_curve_rgb, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_curve_rgb, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_curve_rgb -}; +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_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); + node_type_exec(&ntype, node_shader_exec_curve_rgb); + node_type_gpu(&ntype, gpu_shader_curve_rgb); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c index 5e391e02feb..315655d68bf 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c @@ -27,22 +27,22 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifndef DISABLE_PYTHON +/* TODO, support python3.x */ +#undef WITH_PYTHON + +#ifdef WITH_PYTHON #include <Python.h> #include <compile.h> #include <eval.h> #endif -/* TODO, support python3.x */ -#define DISABLE_PYTHON 1 - #include "DNA_text_types.h" #include "BKE_text.h" -#include "BKE_utildefines.h" + // XXX #if 0 -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON #include "api2_2x/Node.h" #include "api2_2x/gen_utils.h" #include "BPY_extern.h" @@ -57,7 +57,7 @@ static void node_dynamic_setup(bNode *node); static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNodeStack **out); static void node_dynamic_free_storage_cb(bNode *node); -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON static PyObject *init_dynamicdict(void) { PyObject *newscriptdict, *item; PyGILState_STATE gilstate = PyGILState_Ensure(); @@ -156,7 +156,7 @@ static void node_dynamic_update_socket_links(bNode *node, bNodeTree *ntree) static void node_dynamic_free_storage_cb(bNode *node) { -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON NodeScriptDict *nsd; PyObject *pydict; BPy_Node *pynode; @@ -186,7 +186,7 @@ static void node_dynamic_disable(bNode *node) /* Disable all pynodes using the given text (script) id */ static void node_dynamic_disable_all_by_id(ID *id) { -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON Material *ma; /* XXX hardcoded for shaders */ for (ma= G.main->mat.first; ma; ma= ma->id.next) { @@ -346,7 +346,7 @@ int nodeDynamicUnlinkText(ID *txtid) { static void node_dynamic_pyerror_print(bNode *node) { -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON PyGILState_STATE gilstate = PyGILState_Ensure(); fprintf(stderr, "\nError in dynamic node script \"%s\":\n", node->name); @@ -373,7 +373,7 @@ static void node_dynamic_register_type(bNode *node) node->typeinfo->name = BLI_strdup(node->name); } -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON /* node_dynamic_get_pynode: * Find the pynode definition from the script */ static PyObject *node_dynamic_get_pynode(PyObject *dict) @@ -415,11 +415,11 @@ static PyObject *node_dynamic_get_pynode(PyObject *dict) "no PyNode definition found in the script!"); return NULL; } -#endif /* DISABLE_PYTHON */ +#endif /* WITH_PYTHON */ static int node_dynamic_parse(struct bNode *node) { -#ifdef DISABLE_PYTHON +#ifndef WITH_PYTHON return -1; #else PyObject *dict= NULL; @@ -516,7 +516,7 @@ static int node_dynamic_parse(struct bNode *node) * pynodes already linked to a script (node->id != NULL). */ static void node_dynamic_setup(bNode *node) { -#ifndef DISABLE_PYTHON +#ifdef WITH_PYTHON NodeScriptDict *nsd = NULL; bNodeTree *nodetree = NULL; bNodeType *ntype = NULL; @@ -640,7 +640,7 @@ static void node_dynamic_setup(bNode *node) node->custom1 = BSET(node->custom1, NODE_DYNAMIC_READY); PyGILState_Release(gilstate); -#endif /* DISABLE_PYTHON */ +#endif /* WITH_PYTHON */ return; } @@ -673,7 +673,7 @@ static void node_dynamic_init_cb(bNode *node) { /* node_dynamic_copy_cb: pynode copy callback */ static void node_dynamic_copy_cb(bNode *orig_node, bNode *new_node) { -#ifdef DISABLE_PYTHON +#ifndef WITH_PYTHON return; #else NodeScriptDict *nsd; @@ -698,7 +698,7 @@ static void node_dynamic_copy_cb(bNode *orig_node, bNode *new_node) /* node_dynamic_exec_cb: the execution callback called per pixel * during rendering. */ static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { -#ifdef DISABLE_PYTHON +#ifndef WITH_PYTHON return; #else BPy_Node *mynode = NULL; @@ -758,26 +758,29 @@ static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNode #endif } -bNodeType node_dynamic_typeinfo = { - /* next, prev */ NULL, NULL, - /* type code */ NODE_DYNAMIC, - /* name */ "Dynamic", - /* width+range */ 150, 60, 300, - /* class+opts */ NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ NULL, - /* storage */ "NodeScriptDict", - /* execfunc */ node_dynamic_exec_cb, - /* butfunc */ NULL, - /* initfunc */ node_dynamic_init_cb, - /* freefunc */ node_dynamic_free_storage_cb, - /* copyfunc */ node_dynamic_copy_cb, - /* id */ NULL -}; +void register_node_type_sh_dynamic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, NULL, NULL); + node_type_size(&ntype, 150, 60, 300); + node_type_init(&ntype, node_dynamic_init_cb); + node_type_storage(&ntype, "NodeScriptDict", node_dynamic_free_storage_cb, node_dynamic_copy_cb); + node_type_exec(&ntype, node_dynamic_exec_cb); + + nodeRegisterType(lb, &ntype); +} #else -bNodeType node_dynamic_typeinfo = {NULL}; +void register_node_type_sh_dynamic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, 0, "", 0, 0, NULL, NULL); + + nodeRegisterType(lb, &ntype); +} #endif diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c index aefe7d104b5..32fe457c2d8 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c @@ -47,7 +47,7 @@ static bNodeSocketType sh_node_geom_out[]= { }; /* node execute callback */ -static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; @@ -131,21 +131,18 @@ static int gpu_shader_geom(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN } /* node type definition */ -bNodeType sh_node_geom= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_GEOMETRY, - /* name */ "Geometry", - /* width+range */ 120, 80, 160, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ sh_node_geom_out, - /* storage */ "NodeGeometry", - /* execfunc */ node_shader_exec_geom, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_geometry, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_geom - -}; +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_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); + node_type_exec(&ntype, node_shader_exec_geom); + node_type_gpu(&ntype, gpu_shader_geom); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c index 4f319f8937c..6fd8ece8ec9 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c @@ -45,7 +45,7 @@ static bNodeSocketType sh_node_hue_sat_out[]= { }; /* note: it would be possible to use CMP version for both nodes */ -static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, float *val, float *in, float *fac) +static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac) { if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0 || *val!=1.0)) { float col[3], hsv[3], mfac= 1.0f - *fac; @@ -66,34 +66,29 @@ static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, floa } } -static void node_shader_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { do_hue_sat_fac(node, out[0]->vec, in[0]->vec, in[1]->vec, in[2]->vec, in[4]->vec, in[3]->vec); } -static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "hue_sat", in, out); } -bNodeType sh_node_hue_sat= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_HUE_SAT, - /* name */ "Hue Saturation Value", - /* width+range */ 150, 80, 250, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_hue_sat_in, - /* output sock */ sh_node_hue_sat_out, - /* storage */ "", - /* execfunc */ node_shader_exec_hue_sat, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_hue_sat - -}; +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_size(&ntype, 150, 80, 250); + node_type_exec(&ntype, node_shader_exec_hue_sat); + node_type_gpu(&ntype, gpu_shader_hue_sat); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c index 08666f4dd52..9929afd0bc1 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c @@ -43,7 +43,7 @@ static bNodeSocketType sh_node_invert_out[]= { { -1, 0, "" } }; -static void node_shader_exec_invert(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_invert(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { float col[3], facm; @@ -64,26 +64,22 @@ bNodeStack **out) VECCOPY(out[0]->vec, col); } -static int gpu_shader_invert(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "invert", in, out); } -bNodeType sh_node_invert= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_INVERT, - /* name */ "Invert", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_invert_in, - /* output sock */ sh_node_invert_out, - /* storage */ "", - /* execfunc */ node_shader_exec_invert, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_invert -}; +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_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, node_shader_exec_invert); + node_type_gpu(&ntype, gpu_shader_invert); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c index 49778625446..f11200cfc7e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c @@ -41,7 +41,7 @@ static bNodeSocketType sh_node_mapping_out[]= { }; /* do the regular mapping options for blender textures */ -static void node_shader_exec_mapping(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { TexMapping *texmap= node->storage; float *vec= out[0]->vec; @@ -83,22 +83,17 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G return GPU_stack_link(mat, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax); } -bNodeType sh_node_mapping= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MAPPING, - /* name */ "Mapping", - /* width+range */ 240, 160, 320, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ sh_node_mapping_in, - /* output sock */ sh_node_mapping_out, - /* storage */ "TexMapping", - /* execfunc */ node_shader_exec_mapping, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_mapping, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_mapping +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_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); + node_type_exec(&ntype, node_shader_exec_mapping); + node_type_gpu(&ntype, gpu_shader_mapping); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c index 4395eef0a5f..4984a1ca821 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c @@ -235,10 +235,12 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, /* write to outputs */ if(node->custom1 & SH_NODE_MAT_DIFF) { - if(node->custom1 & SH_NODE_MAT_SPEC) - out[MAT_OUT_COLOR].link= shr.combined; - else - out[MAT_OUT_COLOR].link= shr.diff; + out[MAT_OUT_COLOR].link= shr.combined; + + if(!(node->custom1 & SH_NODE_MAT_SPEC)) { + GPUNodeLink *link; + GPU_link(mat, "vec_math_sub", shr.combined, shr.spec, &out[MAT_OUT_COLOR].link, &link); + } } else if(node->custom1 & SH_NODE_MAT_SPEC) { out[MAT_OUT_COLOR].link= shr.spec; @@ -265,39 +267,33 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return 0; } -bNodeType sh_node_material= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MATERIAL, - /* name */ "Material", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ sh_node_material_in, - /* output sock */ sh_node_material_out, - /* storage */ "", - /* execfunc */ node_shader_exec_material, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_material, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_material -}; +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_size(&ntype, 120, 80, 240); + node_type_init(&ntype, node_shader_init_material); + node_type_exec(&ntype, node_shader_exec_material); + node_type_gpu(&ntype, gpu_shader_material); + + nodeRegisterType(lb, &ntype); +} + + +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_size(&ntype, 120, 80, 240); + node_type_init(&ntype, node_shader_init_material); + node_type_exec(&ntype, node_shader_exec_material); + node_type_gpu(&ntype, gpu_shader_material); + + nodeRegisterType(lb, &ntype); +} -bNodeType sh_node_material_ext= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MATERIAL_EXT, - /* name */ "Extended Material", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ sh_node_material_ext_in, - /* output sock */ sh_node_material_ext_out, - /* storage */ "", - /* execfunc */ node_shader_exec_material, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_material, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_material -}; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c index 7429c084ab3..ba2ee6d066a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c @@ -30,7 +30,6 @@ #include "../SHD_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}, @@ -43,7 +42,7 @@ static bNodeSocketType sh_node_math_out[]= { { -1, 0, "" } }; -static void node_shader_exec_math(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { switch(node->custom1){ @@ -196,7 +195,7 @@ bNodeStack **out) static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - static char *names[] = {"math_add", "math_subtract", "math_multiply", + static const char *names[] = {"math_add", "math_subtract", "math_multiply", "math_divide", "math_sine", "math_cosine", "math_tangent", "math_asin", "math_acos", "math_atan", "math_pow", "math_log", "math_min", "math_max", "math_round", "math_less_than", "math_greater_than"}; @@ -234,21 +233,19 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN return 1; } -bNodeType sh_node_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MATH, - /* name */ "Math", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_math_in, - /* output sock */ sh_node_math_out, - /* storage */ "node_math", - /* execfunc */ node_shader_exec_math, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_math -}; +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_size(&ntype, 120, 110, 160); + node_type_label(&ntype, node_math_label); + node_type_storage(&ntype, "node_math", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_math); + node_type_gpu(&ntype, gpu_shader_math); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c index bc4342e11e3..eac3c60655a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c @@ -29,7 +29,6 @@ #include "../SHD_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}, @@ -42,7 +41,7 @@ static bNodeSocketType sh_node_mix_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_mix_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac, col1, col2 */ /* stack order out: col */ @@ -62,7 +61,7 @@ static void node_shader_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, b static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - static char *names[] = {"mix_blend", "mix_add", "mix_mult", "mix_sub", + static const char *names[] = {"mix_blend", "mix_add", "mix_mult", "mix_sub", "mix_screen", "mix_div", "mix_diff", "mix_dark", "mix_light", "mix_overlay", "mix_dodge", "mix_burn", "mix_hue", "mix_sat", "mix_val", "mix_color", "mix_soft", "mix_linear"}; @@ -71,21 +70,17 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G } -bNodeType sh_node_mix_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MIX_RGB, - /* name */ "Mix", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_mix_rgb_in, - /* output sock */ sh_node_mix_rgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_mix_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_mix_rgb - -}; +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_size(&ntype, 100, 60, 150); + node_type_label(&ntype, node_blend_label); + node_type_exec(&ntype, node_shader_exec_mix_rgb); + node_type_gpu(&ntype, gpu_shader_mix_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c index eb3786286ae..ccbf80edeb7 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_normal_out[]= { }; /* generates normal, does dot product */ -static void node_shader_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { bNodeSocket *sock= node->outputs.first; float vec[3]; @@ -65,21 +65,14 @@ static int gpu_shader_normal(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GP return GPU_stack_link(mat, "normal", in, out, vec); } -bNodeType sh_node_normal= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_NORMAL, - /* name */ "Normal", - /* width+range */ 100, 60, 200, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ sh_node_normal_in, - /* output sock */ sh_node_normal_out, - /* storage */ "", - /* execfunc */ node_shader_exec_normal, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_normal -}; - +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_exec(&ntype, node_shader_exec_normal); + node_type_gpu(&ntype, gpu_shader_normal); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/intern/SHD_nodes/SHD_output.c index 740639b6ab4..d61e9def144 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_output.c @@ -36,7 +36,7 @@ static bNodeSocketType sh_node_output_in[]= { { -1, 0, "" } }; -static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; @@ -62,7 +62,7 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN } } -static int gpu_shader_output(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *outlink; @@ -75,22 +75,17 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GP return 1; } -bNodeType sh_node_output= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_OUTPUT, - /* name */ "Output", - /* width+range */ 80, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ sh_node_output_in, - /* output sock */ NULL, - /* storage */ "", - /* execfunc */ node_shader_exec_output, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_output - -}; +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_size(&ntype, 80, 60, 200); + node_type_exec(&ntype, node_shader_exec_output); + node_type_gpu(&ntype, gpu_shader_output); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c index 71af58beb67..109147c7d45 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c @@ -35,7 +35,7 @@ static bNodeSocketType sh_node_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; @@ -50,21 +50,16 @@ static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNo return GPU_stack_link(mat, "set_rgba", in, out, vec); } -bNodeType sh_node_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_RGB, - /* name */ "RGB", - /* width+range */ 140, 80, 140, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ sh_node_rgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_rgb - -}; +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_size(&ntype, 140, 80, 140); + node_type_exec(&ntype, node_shader_exec_rgb); + node_type_gpu(&ntype, gpu_shader_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c index 883cd4d3bf4..da4c7f70022 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c @@ -41,36 +41,31 @@ static bNodeSocketType sh_node_seprgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_seprgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_seprgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { out[0]->vec[0] = in[0]->vec[0]; out[1]->vec[0] = in[0]->vec[1]; out[2]->vec[0] = in[0]->vec[2]; } -static int gpu_shader_seprgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "separate_rgb", in, out); } -bNodeType sh_node_seprgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_SEPRGB, - /* name */ "Separate RGB", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ sh_node_seprgb_in, - /* output sock */ sh_node_seprgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_seprgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_seprgb - -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_shader_exec_seprgb); + node_type_gpu(&ntype, gpu_shader_seprgb); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE RGB ******************** */ @@ -85,33 +80,28 @@ static bNodeSocketType sh_node_combrgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_combrgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_combrgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { out[0]->vec[0] = in[0]->vec[0]; out[0]->vec[1] = in[1]->vec[0]; out[0]->vec[2] = in[2]->vec[0]; } -static int gpu_shader_combrgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "combine_rgb", in, out); } -bNodeType sh_node_combrgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_COMBRGB, - /* name */ "Combine RGB", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_combrgb_in, - /* output sock */ sh_node_combrgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_combrgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_combrgb - -}; +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_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_shader_exec_combrgb); + node_type_gpu(&ntype, gpu_shader_combrgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c index 926dcd0f046..ff6e3913d19 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_squeeze_out[]= { { -1, 0, "" } }; -static void node_shader_exec_squeeze(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_squeeze(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -54,26 +54,23 @@ bNodeStack **out) out[0]->vec[0] = 1.0f / (1.0f + pow(2.71828183,-((vec[0]-vec[2])*vec[1]))) ; } -static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "squeeze", in, out); } -bNodeType sh_node_squeeze= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_SQUEEZE, - /* name */ "Squeeze Value", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_squeeze_in, - /* output sock */ sh_node_squeeze_out, - /* storage */ "node_squeeze", - /* execfunc */ node_shader_exec_squeeze, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_squeeze -}; +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_size(&ntype, 120, 110, 160); + node_type_storage(&ntype, "node_squeeze", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_squeeze); + node_type_gpu(&ntype, gpu_shader_squeeze); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c index b2fb3b2261c..ec36dd8043e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c @@ -58,6 +58,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b /* we should find out if a normal as output is needed, for now we do all */ texres.nor= nor; + texres.tr= texres.tg= texres.tb= 0.0f; if(in[0]->hasinput) { nodestack_get_vec(vec, SOCK_VECTOR, in[0]); @@ -127,22 +128,17 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G return 0; } -bNodeType sh_node_texture= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_TEXTURE, - /* name */ "Texture", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ sh_node_texture_in, - /* output sock */ sh_node_texture_out, - /* storage */ "", - /* execfunc */ node_shader_exec_texture, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_texture - -}; +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_size(&ntype, 120, 80, 240); + node_type_exec(&ntype, node_shader_exec_texture); + node_type_gpu(&ntype, gpu_shader_texture); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c index e2260461152..8603ec018d6 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c @@ -40,7 +40,7 @@ static bNodeSocketType sh_node_valtorgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac */ /* stack order out: col, alpha */ @@ -68,24 +68,21 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "valtorgb", in, out, GPU_texture(size, array)); } -bNodeType sh_node_valtorgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_VALTORGB, - /* name */ "ColorRamp", - /* width+range */ 240, 200, 300, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_valtorgb_in, - /* output sock */ sh_node_valtorgb_out, - /* storage */ "ColorBand", - /* execfunc */ node_shader_exec_valtorgb, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_valtorgb, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_valtorgb - -}; +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_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); + node_type_exec(&ntype, node_shader_exec_valtorgb); + node_type_gpu(&ntype, gpu_shader_valtorgb); + + nodeRegisterType(lb, &ntype); +} + /* **************** RGBTOBW ******************** */ static bNodeSocketType sh_node_rgbtobw_in[]= { @@ -98,7 +95,7 @@ static bNodeSocketType sh_node_rgbtobw_out[]= { }; -static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_rgbtobw(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { /* stack order out: bw */ /* stack order in: col */ @@ -106,27 +103,22 @@ static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, b out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f; } -static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "rgbtobw", in, out); } -bNodeType sh_node_rgbtobw= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_RGBTOBW, - /* name */ "RGB to BW", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ sh_node_rgbtobw_in, - /* output sock */ sh_node_rgbtobw_out, - /* storage */ "", - /* execfunc */ node_shader_exec_rgbtobw, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_rgbtobw +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_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_shader_exec_rgbtobw); + node_type_gpu(&ntype, gpu_shader_rgbtobw); + + nodeRegisterType(lb, &ntype); +} -}; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/intern/SHD_nodes/SHD_value.c index 1663ea352aa..21c58419d9b 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_value.c @@ -35,7 +35,7 @@ static bNodeSocketType sh_node_value_out[]= { { -1, 0, "" } }; -static void node_shader_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; @@ -50,22 +50,17 @@ static int gpu_shader_value(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPU return GPU_stack_link(mat, "set_value", in, out, vec); } -bNodeType sh_node_value= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_VALUE, - /* name */ "Value", - /* width+range */ 80, 50, 120, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ sh_node_value_out, - /* storage */ "", - /* execfunc */ node_shader_exec_value, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_value - -}; +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_size(&ntype, 80, 50, 120); + node_type_exec(&ntype, node_shader_exec_value); + node_type_gpu(&ntype, gpu_shader_value); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c index 062c6402fb6..a85022cffab 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c @@ -44,7 +44,7 @@ static bNodeSocketType sh_node_vect_math_out[]= { { -1, 0, "" } }; -static void node_shader_exec_vect_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec1[3], vec2[3]; @@ -101,7 +101,7 @@ static void node_shader_exec_vect_math(void *data, bNode *node, bNodeStack **in, static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) { - static char *names[] = {"vec_math_add", "vec_math_sub", + static const char *names[] = {"vec_math_add", "vec_math_sub", "vec_math_average", "vec_math_dot", "vec_math_cross", "vec_math_normalize"}; @@ -127,21 +127,19 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return 1; } -bNodeType sh_node_vect_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_VECT_MATH, - /* name */ "Vector Math", - /* width+range */ 80, 75, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_vect_math_in, - /* output sock */ sh_node_vect_math_out, - /* storage */ "node_vect_math", - /* execfunc */ node_shader_exec_vect_math, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_vect_math -}; +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_size(&ntype, 80, 75, 140); + node_type_label(&ntype, node_vect_math_label); + node_type_storage(&ntype, "node_vect_math", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_vect_math); + node_type_gpu(&ntype, gpu_shader_vect_math); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_util.h b/source/blender/nodes/intern/SHD_util.h index ea3a100ca05..4134c160f16 100644 --- a/source/blender/nodes/intern/SHD_util.h +++ b/source/blender/nodes/intern/SHD_util.h @@ -51,8 +51,9 @@ #include "BKE_image.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" + #include "BKE_library.h" #include "../SHD_node.h" @@ -62,6 +63,7 @@ #include "BLI_blenlib.h" #include "BLI_rand.h" #include "BLI_threads.h" +#include "BLI_utildefines.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" diff --git a/source/blender/nodes/intern/TEX_nodes/Makefile b/source/blender/nodes/intern/TEX_nodes/Makefile deleted file mode 100644 index 74eabe7932a..00000000000 --- a/source/blender/nodes/intern/TEX_nodes/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL 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. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# 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) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# -# - -LIBNAME = nodes_tex -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -CFLAGS += $(LEVEL_1_C_WARNINGS) - -CPPFLAGS += -I../../../blenkernel -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../../../makesdna -CPPFLAGS += -I../../../makesrna -CPPFLAGS += -I../../../blenlib -CPPFLAGS += -I../../../include -CPPFLAGS += -I../../../imbuf -CPPFLAGS += -I../../../render/extern/include -CPPFLAGS += -I$(OPENGL_HEADERS) diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/intern/TEX_nodes/TEX_at.c index 08c1c65792d..75fa1e4378d 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_at.c @@ -38,7 +38,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { TexParams np = *p; float new_co[3]; @@ -53,20 +53,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_at = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_AT, - /* name */ "At", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_DISTORT, 0, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c index 9d26621e08c..7a32b6342aa 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c @@ -112,20 +112,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_bricks= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_BRICKS, - /* name */ "Bricks", - /* width+range */ 150, 60, 150, - /* class+opts */ NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ init, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 150, 60, 150); + node_type_init(&ntype, init); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c index 4155cec4d7f..25cfd4412f5 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float x = p->co[0]; float y = p->co[1]; @@ -64,20 +64,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_checker= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_CHECKER, - /* name */ "Checker", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c index 7319a50b7d9..3b933927c5e 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { int i; for(i = 0; i < 4; i++) @@ -52,20 +52,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_compose= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_COMPOSE, - /* name */ "Compose RGBA", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, 0, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c index 68e892ce77c..5311dbc2360 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c @@ -33,7 +33,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void vectorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **UNUSED(in), short UNUSED(thread)) { out[0] = p->co[0]; out[1] = p->co[1]; @@ -45,20 +45,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &vectorfn, data); } -bNodeType tex_node_coord= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_COORD, - /* name */ "Coordinates", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ outputs, - /* storage */ "node_coord", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +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_size(&ntype, 120, 110, 160); + node_type_storage(&ntype, "node_coord", NULL, NULL); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c index 49a1ef35fbb..e4ea39b8591 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c @@ -36,7 +36,7 @@ static bNodeSocketType time_outputs[]= { { -1, 0, "" } }; -static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) { /* stack order output: fac */ float fac= 0.0f; @@ -61,22 +61,19 @@ static void time_init(bNode* node) node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -bNodeType tex_node_curve_time= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_CURVE_TIME, - /* name */ "Time", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ time_outputs, - /* storage */ "CurveMapping", - /* execfunc */ time_exec, - /* butfunc */ NULL, - /* initfunc */ time_init, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +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_size(&ntype, 140, 100, 320); + node_type_init(&ntype, time_init); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, time_exec); + + nodeRegisterType(lb, &ntype); +} /* **************** CURVE RGB ******************** */ static bNodeSocketType rgb_inputs[]= { @@ -108,20 +105,17 @@ static void rgb_init(bNode *node) node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); } -bNodeType tex_node_curve_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_CURVE_RGB, - /* name */ "RGB Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ rgb_inputs, - /* output sock */ rgb_outputs, - /* storage */ "CurveMapping", - /* execfunc */ rgb_exec, - /* butfunc */ NULL, - /* initfunc */ rgb_init, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +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_size(&ntype, 200, 140, 320); + node_type_init(&ntype, rgb_init); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, rgb_exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c index f031091e08d..c66e26321b6 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c @@ -41,25 +41,25 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void valuefn_r(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_r(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[0]; } -static void valuefn_g(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_g(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[1]; } -static void valuefn_b(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_b(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[2]; } -static void valuefn_a(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_a(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[3]; @@ -73,20 +73,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[3], &valuefn_a, data); } -bNodeType tex_node_decompose= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_DECOMPOSE, - /* name */ "Decompose RGBA", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, 0, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c index e0fee3e3153..887fbd1be90 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c @@ -41,7 +41,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float co1[3], co2[3]; @@ -56,21 +56,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &valuefn, data); } -bNodeType tex_node_distance= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_DISTANCE, - /* name */ "Distance", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "node_distance", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - - +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_size(&ntype, 120, 110, 160); + node_type_storage(&ntype, "node_distance", NULL, NULL); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c index 367ea7b9e5f..66a98b70fd4 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c @@ -42,7 +42,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void do_hue_sat_fac(bNode *node, float *out, float hue, float sat, float val, float *in, float fac) +static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac) { if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) { float col[3], hsv[3], mfac= 1.0f - fac; @@ -87,22 +87,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_hue_sat= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_HUE_SAT, - /* name */ "Hue Saturation Value", - /* width+range */ 150, 80, 250, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 150, 80, 250); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c index 628d9026db1..a870d1d31fe 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c @@ -34,7 +34,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) { float x = p->co[0]; float y = p->co[1]; @@ -58,7 +58,13 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor py = (int)( (y-yoff) * ysize ); if( (!xsize) || (!ysize) ) return; - if( !ibuf->rect_float ) IMB_float_from_rect(ibuf); + + if( !ibuf->rect_float ) { + BLI_lock_thread(LOCK_IMAGE); + if( !ibuf->rect_float ) + IMB_float_from_rect(ibuf); + BLI_unlock_thread(LOCK_IMAGE); + } while( px < 0 ) px += ibuf->x; while( py < 0 ) py += ibuf->y; @@ -85,20 +91,16 @@ static void init(bNode* node) iuser->ok= 1; } -bNodeType tex_node_image= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_IMAGE, - /* name */ "Image", - /* width+range */ 120, 80, 300, - /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ outputs, - /* storage */ "ImageUser", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; - +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_size(&ntype, 120, 80, 300); + node_type_init(&ntype, init); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c index 1619ed73023..d6d66abd863 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c @@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float col[4]; @@ -58,20 +58,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_invert= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_INVERT, - /* name */ "Invert", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c index a17c295eb7f..7e1c54b6e47 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c @@ -174,20 +174,17 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &valuefn, data); } -bNodeType tex_node_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_MATH, - /* name */ "Math", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "node_math", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +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_size(&ntype, 120, 110, 160); + node_type_label(&ntype, node_math_label); + node_type_storage(&ntype, "node_math", NULL, NULL); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c index c709d58b8ba..152288fcac8 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c @@ -28,7 +28,6 @@ #include "../TEX_util.h" - /* **************** MIX RGB ******************** */ static bNodeSocketType inputs[]= { { SOCK_VALUE, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }, @@ -60,20 +59,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_mix_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_MIX_RGB, - /* name */ "Mix", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 100, 60, 150); + node_type_label(&ntype, node_blend_label); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c index 09bc893cc1f..b10cfa543a1 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c @@ -36,7 +36,7 @@ static bNodeSocketType inputs[]= { }; /* applies to render pipeline */ -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; TexResult *target = cdata->target; @@ -45,7 +45,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) TexParams params; params_from_cdata(¶ms, cdata); - if(in[1]->hasinput && !in[0]->hasinput) + if(in[1] && in[1]->hasinput && !in[0]->hasinput) tex_input_rgba(&target->tr, in[1], ¶ms, cdata->thread); else tex_input_rgba(&target->tr, in[0], ¶ms, cdata->thread); @@ -63,7 +63,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) target->talpha = 1.0f; if(target->nor) { - if(in[1]->hasinput) + if(in[1] && in[1]->hasinput) tex_input_vec(target->nor, in[1], ¶ms, cdata->thread); else target->nor = 0; @@ -152,20 +152,16 @@ static void copy(bNode *orig, bNode *new) assign_index(new); } -bNodeType tex_node_output= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_OUTPUT, - /* name */ "Output", - /* width+range */ 150, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW | NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ NULL, - /* storage */ "TexNodeOutput", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ copy, - /* id */ NULL -}; - +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_size(&ntype, 150, 60, 200); + node_type_init(&ntype, init); + node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c index 3e7ef0e94fe..bba25ea7bd2 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c @@ -111,7 +111,7 @@ static int count_outputs(bNode *node) /* Boilerplate generators */ #define ProcNoInputs(name) \ - static void name##_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread) \ + static void name##_map_inputs(Tex *UNUSED(tex), bNodeStack **UNUSED(in), TexParams *UNUSED(p), short UNUSED(thread)) \ {} #define ProcDef(name) \ @@ -290,21 +290,29 @@ static void init(bNode *node) /* Node type definitions */ #define TexDef(TEXTYPE, outputs, name, Name) \ - { NULL, NULL, TEX_NODE_PROC+TEXTYPE, Name, 140,80,140, NODE_CLASS_TEXTURE, \ - NODE_OPTIONS | NODE_PREVIEW, name##_inputs, outputs, "Tex", name##_exec, NULL, init, \ - node_free_standard_storage, node_copy_standard_storage, NULL } +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_size(&ntype, 140, 80, 140); \ + node_type_init(&ntype, init); \ + node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \ + node_type_exec(&ntype, name##_exec); \ + \ + nodeRegisterType(lb, &ntype); \ +} #define C outputs_color_only #define CV outputs_both -bNodeType tex_node_proc_voronoi = TexDef(TEX_VORONOI, CV, voronoi, "Voronoi" ); -bNodeType tex_node_proc_blend = TexDef(TEX_BLEND, C, blend, "Blend" ); -bNodeType tex_node_proc_magic = TexDef(TEX_MAGIC, C, magic, "Magic" ); -bNodeType tex_node_proc_marble = TexDef(TEX_MARBLE, CV, marble, "Marble" ); -bNodeType tex_node_proc_clouds = TexDef(TEX_CLOUDS, CV, clouds, "Clouds" ); -bNodeType tex_node_proc_wood = TexDef(TEX_WOOD, CV, wood, "Wood" ); -bNodeType tex_node_proc_musgrave = TexDef(TEX_MUSGRAVE, CV, musgrave, "Musgrave" ); -bNodeType tex_node_proc_noise = TexDef(TEX_NOISE, C, noise, "Noise" ); -bNodeType tex_node_proc_stucci = TexDef(TEX_STUCCI, CV, stucci, "Stucci" ); -bNodeType tex_node_proc_distnoise = TexDef(TEX_DISTNOISE, CV, distnoise, "Distorted Noise" ); - +TexDef(TEX_VORONOI, CV, voronoi, "Voronoi" ); +TexDef(TEX_BLEND, C, blend, "Blend" ); +TexDef(TEX_MAGIC, C, magic, "Magic" ); +TexDef(TEX_MARBLE, CV, marble, "Marble" ); +TexDef(TEX_CLOUDS, CV, clouds, "Clouds" ); +TexDef(TEX_WOOD, CV, wood, "Wood" ); +TexDef(TEX_MUSGRAVE, CV, musgrave, "Musgrave" ); +TexDef(TEX_NOISE, C, noise, "Noise" ); +TexDef(TEX_STUCCI, CV, stucci, "Stucci" ); +TexDef(TEX_DISTNOISE, CV, distnoise, "Distorted Noise" ); diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c index 9a855938eef..92a9fa26311 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c @@ -64,7 +64,7 @@ static void rotate(float new_co[3], float a, float ax[3], float co[3]) new_co[2] = para[2] + perp[2] + cp[2]; } -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3], new_dxt[3], new_dyt[3], a, ax[3]; @@ -90,20 +90,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_rotate= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_ROTATE, - /* name */ "Rotate", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +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_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c index 721c322c540..65ae744531b 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float scale[3], new_co[3], new_dxt[3], new_dyt[3]; TexParams np = *p; @@ -64,20 +64,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_scale = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_SCALE, - /* name */ "Scale", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +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_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c index c01caa022e5..2bbd08a4c1f 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c @@ -83,21 +83,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_texture= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_TEXTURE, - /* name */ "Texture", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 120, 80, 240); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c index a823338faf9..a570386bcda 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float offset[3], new_co[3]; TexParams np = *p; @@ -59,20 +59,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_translate = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_TRANSLATE, - /* name */ "Translate", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +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_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c index 46aefe5ad47..67fb068870c 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c @@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void normalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3]; float *co = p->co; @@ -75,20 +75,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &normalfn, data); } -bNodeType tex_node_valtonor = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_VALTONOR, - /* name */ "Value to Normal", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +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_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c index 3810167a58a..f23baffb0ee 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c @@ -58,23 +58,19 @@ static void valtorgb_init(bNode *node) node->storage = add_colorband(1); } -bNodeType tex_node_valtorgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_VALTORGB, - /* name */ "ColorRamp", - /* width+range */ 240, 200, 300, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ valtorgb_in, - /* output sock */ valtorgb_out, - /* storage */ "ColorBand", - /* execfunc */ valtorgb_exec, - /* butfunc */ NULL, - /* initfunc */ valtorgb_init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL +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_size(&ntype, 240, 200, 300); + node_type_init(&ntype, valtorgb_init); + node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, valtorgb_exec); + + nodeRegisterType(lb, &ntype); +} /* **************** RGBTOBW ******************** */ static bNodeSocketType rgbtobw_in[]= { @@ -87,7 +83,7 @@ static bNodeSocketType rgbtobw_out[]= { }; -static void rgbtobw_valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float cin[4]; tex_input_rgba(cin, in[0], p, thread); @@ -100,21 +96,15 @@ static void rgbtobw_exec(void *data, bNode *node, bNodeStack **in, bNodeStack ** tex_output(node, in, out[0], &rgbtobw_valuefn, data); } -bNodeType tex_node_rgbtobw= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_RGBTOBW, - /* name */ "RGB to BW", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ rgbtobw_in, - /* output sock */ rgbtobw_out, - /* storage */ "", - /* execfunc */ rgbtobw_exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +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_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, rgbtobw_exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c index 698c894a8d8..5dbfc2561b5 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c @@ -37,7 +37,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; @@ -51,20 +51,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) } } -bNodeType tex_node_viewer = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_VIEWER, - /* name */ "Viewer", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +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_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c index dc31685827f..d288b13a66c 100644 --- a/source/blender/nodes/intern/TEX_util.c +++ b/source/blender/nodes/intern/TEX_util.c @@ -29,11 +29,11 @@ /* HOW TEXTURE NODES WORK - In contrast to Shader nodes, which place a colour into the output + In contrast to Shader nodes, which place a color into the output stack when executed, Texture nodes place a TexDelegate* there. To - obtain a colour value from this, a node further up the chain reads + obtain a color value from this, a node further up the chain reads the TexDelegate* from its input stack, and uses tex_call_delegate to - retrieve the colour from the delegate. + retrieve the color from the delegate. comments: (ton) @@ -173,7 +173,7 @@ int ntreeTexExecTree( float *dxt, float *dyt, int osatex, short thread, - Tex *tex, + Tex *UNUSED(tex), short which_output, int cfra, int preview, @@ -181,6 +181,7 @@ int ntreeTexExecTree( MTex *mtex ){ TexCallData data; + float *nor= texres->nor; int retval = TEX_INT; data.co = co; @@ -199,6 +200,9 @@ int ntreeTexExecTree( 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/intern/TEX_util.h index a9465e17623..4caee223a1e 100644 --- a/source/blender/nodes/intern/TEX_util.h +++ b/source/blender/nodes/intern/TEX_util.h @@ -50,8 +50,9 @@ #include "BKE_image.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" + #include "BKE_library.h" #include "../SHD_node.h" @@ -61,6 +62,7 @@ #include "BLI_blenlib.h" #include "BLI_rand.h" #include "BLI_threads.h" +#include "BLI_utildefines.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index 746b8a37f5b..baf0fc17bf7 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -30,6 +30,9 @@ #include "CMP_util.h" #include "SHD_util.h" +#include "RNA_access.h" +#include "RNA_enum_types.h" + void node_free_curves(bNode *node) { curvemapping_free(node->storage); @@ -50,3 +53,30 @@ void node_copy_standard_storage(bNode *orig_node, bNode *new_node) new_node->storage= MEM_dupallocN(orig_node->storage); } +const char *node_blend_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_blend_type_items, node->custom1, &name); + return name; +} + +const char *node_math_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_math_items, node->custom1, &name); + return name; +} + +const char *node_vect_math_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_vec_math_items, node->custom1, &name); + return name; +} + +const char *node_filter_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_filter_items, node->custom1, &name); + return name; +} diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index 0326459ac68..c41ce3025ba 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -38,6 +38,11 @@ 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); +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); +const char *node_filter_label(struct bNode *node); + #endif // this is needed for inlining behaviour |