[Bf-blender-cvs] [de6a8ad569d] simulation-tree: cleanup
Jacques Lucke
noreply at git.blender.org
Wed Feb 19 16:12:37 CET 2020
Commit: de6a8ad569d5652914683663df0e923010945980
Author: Jacques Lucke
Date: Wed Feb 19 14:14:04 2020 +0100
Branches: simulation-tree
https://developer.blender.org/rBde6a8ad569d5652914683663df0e923010945980
cleanup
===================================================================
M source/blender/simulations/nodes/my_test_node.cc
===================================================================
diff --git a/source/blender/simulations/nodes/my_test_node.cc b/source/blender/simulations/nodes/my_test_node.cc
index 4c5e393d8df..df1af6223b7 100644
--- a/source/blender/simulations/nodes/my_test_node.cc
+++ b/source/blender/simulations/nodes/my_test_node.cc
@@ -360,10 +360,7 @@ class NodeTypeDefinition {
NodeTypeCallbacks *m_callbacks;
public:
- NodeTypeDefinition(StringRef idname,
- StringRef ui_name,
- StringRef ui_description,
- DeclareNodeFunc declare_fn)
+ NodeTypeDefinition(StringRef idname, StringRef ui_name, StringRef ui_description)
{
bNodeType *ntype = &m_ntype;
@@ -384,7 +381,7 @@ class NodeTypeDefinition {
ntype->userdata = (void *)m_callbacks;
ntype->free_userdata = [](void *userdata) { delete (NodeTypeCallbacks *)userdata; };
- m_callbacks->m_declare_node = declare_fn;
+ m_callbacks->m_declare_node = [](NodeBuilder &UNUSED(builder)) {};
m_callbacks->m_init_storage = []() { return nullptr; };
m_callbacks->m_copy_storage = [](void *storage) {
BLI_assert(storage == nullptr);
@@ -419,6 +416,11 @@ class NodeTypeDefinition {
ntype->draw_buttons_ex = nullptr;
}
+ void add_declaration(DeclareNodeFunc declare_fn)
+ {
+ m_callbacks->m_declare_node = declare_fn;
+ }
+
void add_dna_storage(StringRef struct_name,
InitStorageFunc init_storage_fn,
CopyStorageFunc copy_storage_fn,
@@ -477,8 +479,8 @@ class NodeTypeDefinition {
void register_node_type_my_test_node()
{
{
- static NodeTypeDefinition ntype(
- "MyTestNode", "My Test Node", "My Description", declare_test_node);
+ static NodeTypeDefinition ntype("MyTestNode", "My Test Node", "My Description");
+ ntype.add_declaration(declare_test_node);
ntype.add_dna_storage<MyTestNodeStorage>("MyTestNodeStorage",
[](MyTestNodeStorage *storage) { storage->x = 3; });
ntype.add_copy_behavior<MyTestNodeStorage>(
@@ -517,12 +519,12 @@ void register_node_type_my_test_node()
ntype.register_type();
}
{
- static NodeTypeDefinition ntype(
- "MyTestNode2", "Node 2", "Description", [](NodeBuilder &node_builder) {
- node_builder.fixed_input("a", "A", *data_socket_float);
- node_builder.fixed_input("b", "B", *data_socket_float);
- node_builder.fixed_output("result", "Result", *data_socket_float);
- });
+ static NodeTypeDefinition ntype("MyTestNode2", "Node 2", "Description");
+ ntype.add_declaration([](NodeBuilder &node_builder) {
+ node_builder.fixed_input("a", "A", *data_socket_float);
+ node_builder.fixed_input("b", "B", *data_socket_float);
+ node_builder.fixed_output("result", "Result", *data_socket_float);
+ });
ntype.register_type();
}
}
More information about the Bf-blender-cvs
mailing list