diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2012-11-14 23:53:46 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2012-11-14 23:53:46 +0400 |
commit | 7cfb79256e5cd21405528887b8d3b6b405ebba62 (patch) | |
tree | d9673a353431d25a27251233c32cd406f4ce81a5 /source/blender/nodes | |
parent | 71389d4d74fd1e632ff0e23416d33ca5e63c609d (diff) |
Map Range Node (tiles)
this node allows for more control for normalization of the mapped input range.
Made during BlenderPRO 2012 - Brasilia, Brazil :)
Idea and testing: Daniel Salazar
Implementation: yours truly
Reviewed by Lukas Toenne and Sergey Sharybin
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/nodes/NOD_composite.h | 1 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_mapRange.c | 58 |
3 files changed, 60 insertions, 0 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 7dca4d07b24..9e412785467 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -84,6 +84,7 @@ set(SRC composite/nodes/node_composite_lummaMatte.c composite/nodes/node_composite_mapUV.c composite/nodes/node_composite_mapValue.c + composite/nodes/node_composite_mapRange.c composite/nodes/node_composite_math.c composite/nodes/node_composite_mask.c composite/nodes/node_composite_mixrgb.c diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index ee67ac88085..eecc1e46827 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -72,6 +72,7 @@ void register_node_type_cmp_huecorrect(struct bNodeTreeType *ttype); void register_node_type_cmp_normal(struct bNodeTreeType *ttype); void register_node_type_cmp_curve_vec(struct bNodeTreeType *ttype); void register_node_type_cmp_map_value(struct bNodeTreeType *ttype); +void register_node_type_cmp_map_range(struct bNodeTreeType *ttype); void register_node_type_cmp_normalize(struct bNodeTreeType *ttype); void register_node_type_cmp_filter(struct bNodeTreeType *ttype); diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c new file mode 100644 index 00000000000..f96e133b19f --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.c @@ -0,0 +1,58 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/nodes/composite/nodes/node_composite_mapRange.c + * \ingroup cmpnodes + */ + + +#include "node_composite_util.h" + +/* **************** MAP VALUE ******************** */ +static bNodeSocketTemplate cmp_node_map_range_in[] = { + { SOCK_FLOAT, 1, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("From Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("From Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("To Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("To Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, + { -1, 0, "" } +}; +static bNodeSocketTemplate cmp_node_map_range_out[] = { + { SOCK_FLOAT, 0, N_("Value")}, + { -1, 0, "" } +}; + +void register_node_type_cmp_map_range(bNodeTreeType *ttype) +{ + static bNodeType ntype; + + node_type_base(ttype, &ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, NODE_OPTIONS); + node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out); + node_type_size(&ntype, 120, 60, 150); + + nodeRegisterType(ttype, &ntype); +} |