Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/node.cc
| Show First 20 Lines • Show All 1,372 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void nodeRegisterType(bNodeType *nt) | void nodeRegisterType(bNodeType *nt) | ||||
| { | { | ||||
| /* debug only: basic verification of registered types */ | /* debug only: basic verification of registered types */ | ||||
| BLI_assert(nt->idname[0] != '\0'); | BLI_assert(nt->idname[0] != '\0'); | ||||
| BLI_assert(nt->poll != nullptr); | BLI_assert(nt->poll != nullptr); | ||||
| if (nt->declare && !nt->declaration_is_dynamic) { | if (nt->declare && !nt->declare_dynamic) { | ||||
| if (nt->fixed_declaration == nullptr) { | if (nt->fixed_declaration == nullptr) { | ||||
| nt->fixed_declaration = new blender::nodes::NodeDeclaration(); | nt->fixed_declaration = new blender::nodes::NodeDeclaration(); | ||||
| blender::nodes::build_node_declaration(*nt, *nt->fixed_declaration); | blender::nodes::build_node_declaration(*nt, *nt->fixed_declaration); | ||||
| } | } | ||||
| } | } | ||||
| BLI_ghash_insert(nodetypes_hash, nt->idname, nt); | BLI_ghash_insert(nodetypes_hash, nt->idname, nt); | ||||
| /* XXX pass Main to register function? */ | /* XXX pass Main to register function? */ | ||||
| ▲ Show 20 Lines • Show All 1,595 Lines • ▼ Show 20 Lines | void node_free_node(bNodeTree *ntree, bNode *node) | ||||
| } | } | ||||
| if (node->prop) { | if (node->prop) { | ||||
| /* Remember, no ID user refcount management here! */ | /* Remember, no ID user refcount management here! */ | ||||
| IDP_FreePropertyContent_ex(node->prop, false); | IDP_FreePropertyContent_ex(node->prop, false); | ||||
| MEM_freeN(node->prop); | MEM_freeN(node->prop); | ||||
| } | } | ||||
| if (node->typeinfo->declaration_is_dynamic) { | if (node->typeinfo->declare_dynamic) { | ||||
| delete node->runtime->declaration; | delete node->runtime->declaration; | ||||
| } | } | ||||
| MEM_delete(node->runtime); | MEM_delete(node->runtime); | ||||
| MEM_freeN(node); | MEM_freeN(node); | ||||
| if (ntree) { | if (ntree) { | ||||
| BKE_ntree_update_tag_node_removed(ntree); | BKE_ntree_update_tag_node_removed(ntree); | ||||
| ▲ Show 20 Lines • Show All 595 Lines • ▼ Show 20 Lines | |||||
| bool nodeDeclarationEnsureOnOutdatedNode(bNodeTree * /*ntree*/, bNode *node) | bool nodeDeclarationEnsureOnOutdatedNode(bNodeTree * /*ntree*/, bNode *node) | ||||
| { | { | ||||
| if (node->runtime->declaration != nullptr) { | if (node->runtime->declaration != nullptr) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (node->typeinfo->declare == nullptr) { | if (node->typeinfo->declare == nullptr) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (node->typeinfo->declaration_is_dynamic) { | if (node->typeinfo->declare_dynamic) { | ||||
| node->runtime->declaration = new blender::nodes::NodeDeclaration(); | node->runtime->declaration = new blender::nodes::NodeDeclaration(); | ||||
| blender::nodes::build_node_declaration(*node->typeinfo, *node->runtime->declaration); | blender::nodes::build_node_declaration(*node->typeinfo, *node->runtime->declaration); | ||||
| } | } | ||||
| else { | else { | ||||
| /* Declaration should have been created in #nodeRegisterType. */ | /* Declaration should have been created in #nodeRegisterType. */ | ||||
| BLI_assert(node->typeinfo->fixed_declaration != nullptr); | BLI_assert(node->typeinfo->fixed_declaration != nullptr); | ||||
| node->runtime->declaration = node->typeinfo->fixed_declaration; | node->runtime->declaration = node->typeinfo->fixed_declaration; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 570 Lines • Show Last 20 Lines | |||||