WIP: Closures and deferred evaluation for geometry nodes #107842

Draft
Lukas Tönne wants to merge 35 commits from LukasTonne/blender:geometry-nodes-closures into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 22 additions and 0 deletions
Showing only changes of commit 59846f3955 - Show all commits

View File

@ -1634,6 +1634,11 @@ typedef struct bNodeFunctionSignature {
int _pad;
} bNodeFunctionSignature;
typedef struct NodeFunctionEvaluate {
/* Expected signature of the function. */
bNodeFunctionSignature signature;
} NodeFunctionEvaluate;
/* script node mode */
#define NODE_SCRIPT_INTERNAL 0
#define NODE_SCRIPT_EXTERNAL 1

View File

@ -5544,6 +5544,14 @@ static void rna_def_node_function_signature(BlenderRNA *brna)
static void def_fn_evaluate(StructRNA *srna)
{
PropertyRNA *prop;
RNA_def_struct_sdna_from(srna, "NodeFunctionEvaluate", "storage");
prop = RNA_def_property(srna, "signature", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "signature");
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Signature", "Expected signature of the function");
}
/* -- Shader Nodes ---------------------------------------------------------- */

View File

@ -18,6 +18,12 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Function>(N_("Function"));
}
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeFunctionEvaluate *data = MEM_cnew<NodeFunctionEvaluate>(__func__);
node->storage = data;
}
static void node_update(bNodeTree *ntree, bNode *node)
{
}
@ -37,6 +43,9 @@ void register_node_type_fn_evaluate()
fn_node_type_base(&ntype, FN_NODE_EVALUATE, "Evaluate", NODE_CLASS_GROUP);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.initfunc = file_ns::node_init;
ntype.updatefunc = file_ns::node_update;
node_type_storage(
&ntype, "NodeFunctionEvaluate", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(&ntype);
}