diff options
-rw-r--r-- | release/scripts/startup/nodeitems_builtins.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 25 | ||||
-rw-r--r-- | source/blender/nodes/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/nodes/NOD_function.h | 4 | ||||
-rw-r--r-- | source/blender/nodes/NOD_static_types.h | 4 | ||||
-rw-r--r-- | source/blender/nodes/function/nodes/node_fn_combine_strings.cc | 46 | ||||
-rw-r--r-- | source/blender/nodes/function/nodes/node_fn_group_instance_id.cc | 46 | ||||
-rw-r--r-- | source/blender/nodes/function/nodes/node_fn_object_transforms.cc | 95 | ||||
-rw-r--r-- | source/blender/nodes/function/nodes/node_fn_switch.cc | 86 |
11 files changed, 0 insertions, 320 deletions
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index 6e1397ff971..d9c107bef63 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -562,8 +562,6 @@ geometry_node_categories = [ NodeItem("NodeFrame"), NodeItem("NodeReroute"), ]), - # NodeItem("FunctionNodeCombineStrings"), - # NodeItem("FunctionNodeGroupInstanceID"), ] diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 013c90197b2..71f188a2de1 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1402,11 +1402,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree, * \{ */ #define FN_NODE_BOOLEAN_MATH 1200 -#define FN_NODE_SWITCH 1201 #define FN_NODE_FLOAT_COMPARE 1202 -#define FN_NODE_GROUP_INSTANCE_ID 1203 -#define FN_NODE_COMBINE_STRINGS 1204 -#define FN_NODE_OBJECT_TRANSFORMS 1205 #define FN_NODE_RANDOM_FLOAT 1206 #define FN_NODE_INPUT_VECTOR 1207 #define FN_NODE_INPUT_STRING 1208 diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 5041f914ef9..ea8d0b5415c 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4947,14 +4947,10 @@ static void registerGeometryNodes() static void registerFunctionNodes() { register_node_type_fn_boolean_math(); - register_node_type_fn_combine_strings(); register_node_type_fn_float_compare(); - register_node_type_fn_group_instance_id(); register_node_type_fn_input_string(); register_node_type_fn_input_vector(); - register_node_type_fn_object_transforms(); register_node_type_fn_random_float(); - register_node_type_fn_switch(); } void BKE_node_system_init(void) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index fc1f692a8bf..a46c9a6fe40 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -91,20 +91,6 @@ static const EnumPropertyItem node_socket_type_items[] = { {0, NULL, 0, NULL, NULL}, }; -static const EnumPropertyItem node_socket_data_type_items[] = { - {SOCK_FLOAT, "FLOAT", 0, "Float", ""}, - {SOCK_INT, "INT", 0, "Int", ""}, - {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""}, - {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, - {SOCK_STRING, "STRING", 0, "String", ""}, - {SOCK_RGBA, "RGBA", 0, "Color", ""}, - {SOCK_OBJECT, "OBJECT", 0, "Object", ""}, - {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, - {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""}, - {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""}, - {0, NULL, 0, NULL, NULL}, -}; - static const EnumPropertyItem node_quality_items[] = { {NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"}, {NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"}, @@ -4601,17 +4587,6 @@ static void def_float_compare(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } -static void def_fn_switch(StructRNA *srna) -{ - PropertyRNA *prop; - - prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, node_socket_data_type_items); - RNA_def_property_ui_text(prop, "Data Type", "Data type for inputs and outputs"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); -} - static void def_vector_math(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 366cac48a40..271f4e5c5e4 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -132,14 +132,10 @@ set(SRC composite/node_composite_util.c function/nodes/node_fn_boolean_math.cc - function/nodes/node_fn_combine_strings.cc function/nodes/node_fn_float_compare.cc - function/nodes/node_fn_group_instance_id.cc function/nodes/node_fn_input_string.cc function/nodes/node_fn_input_vector.cc - function/nodes/node_fn_object_transforms.cc function/nodes/node_fn_random_float.cc - function/nodes/node_fn_switch.cc function/node_function_util.cc geometry/nodes/node_geo_align_rotation_to_vector.cc diff --git a/source/blender/nodes/NOD_function.h b/source/blender/nodes/NOD_function.h index 6b184f04af7..b31b5326d66 100644 --- a/source/blender/nodes/NOD_function.h +++ b/source/blender/nodes/NOD_function.h @@ -21,14 +21,10 @@ extern "C" { #endif void register_node_type_fn_boolean_math(void); -void register_node_type_fn_combine_strings(void); void register_node_type_fn_float_compare(void); -void register_node_type_fn_group_instance_id(void); void register_node_type_fn_input_string(void); void register_node_type_fn_input_vector(void); -void register_node_type_fn_object_transforms(void); void register_node_type_fn_random_float(void); -void register_node_type_fn_switch(void); #ifdef __cplusplus } diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index abb467961b1..ec687ae6b70 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -262,10 +262,6 @@ DefNode(TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DI DefNode(FunctionNode, FN_NODE_BOOLEAN_MATH, def_boolean_math, "BOOLEAN_MATH", BooleanMath, "Boolean Math", "") DefNode(FunctionNode, FN_NODE_FLOAT_COMPARE, def_float_compare, "FLOAT_COMPARE", FloatCompare, "Float Compare", "") -DefNode(FunctionNode, FN_NODE_SWITCH, def_fn_switch, "SWITCH", Switch, "Switch", "") -DefNode(FunctionNode, FN_NODE_GROUP_INSTANCE_ID, 0, "GROUP_INSTANCE_ID", GroupInstanceID, "Group Instance ID", "") -DefNode(FunctionNode, FN_NODE_COMBINE_STRINGS, 0, "COMBINE_STRINGS", CombineStrings, "Combine Strings", "") -DefNode(FunctionNode, FN_NODE_OBJECT_TRANSFORMS, 0, "OBJECT_TRANSFORMS", ObjectTransforms, "Object Transforms", "") DefNode(FunctionNode, FN_NODE_RANDOM_FLOAT, 0, "RANDOM_FLOAT", RandomFloat, "Random Float", "") DefNode(FunctionNode, FN_NODE_INPUT_VECTOR, def_fn_input_vector, "INPUT_VECTOR", InputVector, "Vector", "") DefNode(FunctionNode, FN_NODE_INPUT_STRING, def_fn_input_string, "INPUT_STRING", InputString, "String", "") diff --git a/source/blender/nodes/function/nodes/node_fn_combine_strings.cc b/source/blender/nodes/function/nodes/node_fn_combine_strings.cc deleted file mode 100644 index a545c4f0749..00000000000 --- a/source/blender/nodes/function/nodes/node_fn_combine_strings.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "node_function_util.hh" - -static bNodeSocketTemplate fn_node_combine_strings_in[] = { - {SOCK_STRING, N_("A")}, - {SOCK_STRING, N_("B")}, - {-1, ""}, -}; - -static bNodeSocketTemplate fn_node_combine_strings_out[] = { - {SOCK_STRING, N_("Result")}, - {-1, ""}, -}; - -static void fn_node_combine_strings_expand_in_mf_network( - blender::nodes::NodeMFNetworkBuilder &builder) -{ - static blender::fn::CustomMF_SI_SI_SO<std::string, std::string, std::string> combine_fn{ - "Combine Strings", [](const std::string &a, const std::string &b) { return a + b; }}; - builder.set_matching_fn(combine_fn); -} - -void register_node_type_fn_combine_strings() -{ - static bNodeType ntype; - - fn_node_type_base(&ntype, FN_NODE_COMBINE_STRINGS, "Combine Strings", 0, 0); - node_type_socket_templates(&ntype, fn_node_combine_strings_in, fn_node_combine_strings_out); - ntype.expand_in_mf_network = fn_node_combine_strings_expand_in_mf_network; - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/function/nodes/node_fn_group_instance_id.cc b/source/blender/nodes/function/nodes/node_fn_group_instance_id.cc deleted file mode 100644 index 3d0ea201239..00000000000 --- a/source/blender/nodes/function/nodes/node_fn_group_instance_id.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "node_function_util.hh" - -static bNodeSocketTemplate fn_node_group_instance_id_out[] = { - {SOCK_STRING, N_("Identifier")}, - {-1, ""}, -}; - -static void fn_node_group_instance_id_expand_in_mf_network( - blender::nodes::NodeMFNetworkBuilder &builder) -{ - const blender::nodes::DNode &node = builder.dnode(); - std::string id = "/"; - for (const blender::nodes::DTreeContext *context = node.context(); - context->parent_node() != nullptr; - context = context->parent_context()) { - id = "/" + context->parent_node()->name() + id; - } - builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<std::string>>( - std::move(id)); -} - -void register_node_type_fn_group_instance_id() -{ - static bNodeType ntype; - - fn_node_type_base(&ntype, FN_NODE_GROUP_INSTANCE_ID, "Group Instance ID", 0, 0); - node_type_socket_templates(&ntype, nullptr, fn_node_group_instance_id_out); - ntype.expand_in_mf_network = fn_node_group_instance_id_expand_in_mf_network; - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/function/nodes/node_fn_object_transforms.cc b/source/blender/nodes/function/nodes/node_fn_object_transforms.cc deleted file mode 100644 index a73049776e5..00000000000 --- a/source/blender/nodes/function/nodes/node_fn_object_transforms.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "node_function_util.hh" - -#include "BKE_persistent_data_handle.hh" - -static bNodeSocketTemplate fn_node_object_transforms_in[] = { - {SOCK_OBJECT, N_("Object")}, - {-1, ""}, -}; - -static bNodeSocketTemplate fn_node_object_transforms_out[] = { - {SOCK_VECTOR, N_("Location")}, - {-1, ""}, -}; - -class ObjectTransformsFunction : public blender::fn::MultiFunction { - public: - ObjectTransformsFunction() - { - static blender::fn::MFSignature signature = create_signature(); - this->set_signature(&signature); - } - - static blender::fn::MFSignature create_signature() - { - blender::fn::MFSignatureBuilder signature{"Object Transforms"}; - signature.depends_on_context(); - signature.single_input<blender::bke::PersistentObjectHandle>("Object"); - signature.single_output<blender::float3>("Location"); - return signature.build(); - } - - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext context) const override - { - const blender::VArray<blender::bke::PersistentObjectHandle> &handles = - params.readonly_single_input<blender::bke::PersistentObjectHandle>(0, "Object"); - blender::MutableSpan locations = params.uninitialized_single_output<blender::float3>( - 1, "Location"); - - const blender::bke::PersistentDataHandleMap *handle_map = - context.get_global_context<blender::bke::PersistentDataHandleMap>( - "PersistentDataHandleMap"); - if (handle_map == nullptr) { - locations.fill_indices(mask, {0, 0, 0}); - return; - } - - for (int64_t i : mask) { - blender::bke::PersistentObjectHandle handle = handles[i]; - const Object *object = handle_map->lookup(handle); - blender::float3 location; - if (object == nullptr) { - location = {0, 0, 0}; - } - else { - location = object->loc; - } - locations[i] = location; - } - } -}; - -static void fn_node_object_transforms_expand_in_mf_network( - blender::nodes::NodeMFNetworkBuilder &builder) -{ - static ObjectTransformsFunction fn; - builder.set_matching_fn(fn); -} - -void register_node_type_fn_object_transforms() -{ - static bNodeType ntype; - - fn_node_type_base(&ntype, FN_NODE_OBJECT_TRANSFORMS, "Object Transforms", 0, 0); - node_type_socket_templates(&ntype, fn_node_object_transforms_in, fn_node_object_transforms_out); - ntype.expand_in_mf_network = fn_node_object_transforms_expand_in_mf_network; - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/function/nodes/node_fn_switch.cc b/source/blender/nodes/function/nodes/node_fn_switch.cc deleted file mode 100644 index 5187decbbe5..00000000000 --- a/source/blender/nodes/function/nodes/node_fn_switch.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "BLI_listbase.h" - -#include "UI_interface.h" -#include "UI_resources.h" - -#include "node_function_util.hh" - -static void fn_node_switch_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE); -} - -static bNodeSocketTemplate fn_node_switch_in[] = { - {SOCK_BOOLEAN, N_("Switch")}, - - {SOCK_FLOAT, N_("If False"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_INT, N_("If False"), 0, 0, 0, 0, -10000, 10000}, - {SOCK_BOOLEAN, N_("If False")}, - {SOCK_VECTOR, N_("If False"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_STRING, N_("If False")}, - {SOCK_RGBA, N_("If False"), 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_OBJECT, N_("If False")}, - {SOCK_IMAGE, N_("If False")}, - - {SOCK_FLOAT, N_("If True"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_INT, N_("If True"), 0, 0, 0, 0, -10000, 10000}, - {SOCK_BOOLEAN, N_("If True")}, - {SOCK_VECTOR, N_("If True"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_STRING, N_("If True")}, - {SOCK_RGBA, N_("If True"), 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_OBJECT, N_("If True")}, - {SOCK_IMAGE, N_("If True")}, - - {-1, ""}, -}; - -static bNodeSocketTemplate fn_node_switch_out[] = { - {SOCK_FLOAT, N_("Result")}, - {SOCK_INT, N_("Result")}, - {SOCK_BOOLEAN, N_("Result")}, - {SOCK_VECTOR, N_("Result")}, - {SOCK_STRING, N_("Result")}, - {SOCK_RGBA, N_("Result")}, - {SOCK_OBJECT, N_("Result")}, - {SOCK_IMAGE, N_("Result")}, - {-1, ""}, -}; - -static void fn_node_switch_update(bNodeTree *UNUSED(ntree), bNode *node) -{ - int index = 0; - LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { - nodeSetSocketAvailability(sock, index == 0 || sock->type == node->custom1); - index++; - } - LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { - nodeSetSocketAvailability(sock, sock->type == node->custom1); - } -} - -void register_node_type_fn_switch() -{ - static bNodeType ntype; - - fn_node_type_base(&ntype, FN_NODE_SWITCH, "Switch", 0, 0); - node_type_socket_templates(&ntype, fn_node_switch_in, fn_node_switch_out); - node_type_update(&ntype, fn_node_switch_update); - ntype.draw_buttons = fn_node_switch_layout; - nodeRegisterType(&ntype); -} |