diff options
Diffstat (limited to 'source/blender/depsgraph/intern/node')
10 files changed, 27 insertions, 25 deletions
diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc index 7a515424e06..6303b22cac3 100644 --- a/source/blender/depsgraph/intern/node/deg_node.cc +++ b/source/blender/depsgraph/intern/node/deg_node.cc @@ -100,6 +100,8 @@ const char *nodeTypeAsString(NodeType type) return "SIMULATION"; case NodeType::NTREE_OUTPUT: return "NTREE_OUTPUT"; + case NodeType::NTREE_GEOMETRY_PREPROCESS: + return "NTREE_GEOMETRY_PREPROCESS"; /* Total number of meaningful node types. */ case NodeType::NUM_TYPES: @@ -158,6 +160,7 @@ eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type) case NodeType::CACHE: case NodeType::SIMULATION: case NodeType::NTREE_OUTPUT: + case NodeType::NTREE_GEOMETRY_PREPROCESS: return DEG_SCENE_COMP_PARAMETERS; case NodeType::VISIBILITY: @@ -232,6 +235,7 @@ eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type) case NodeType::SYNCHRONIZATION: case NodeType::SIMULATION: case NodeType::NTREE_OUTPUT: + case NodeType::NTREE_GEOMETRY_PREPROCESS: case NodeType::UNDEFINED: case NodeType::NUM_TYPES: return DEG_OB_COMP_PARAMETERS; diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index db912ee3a82..e31c1769a2a 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -130,6 +130,8 @@ enum class NodeType { SIMULATION, /* Node tree output component. */ NTREE_OUTPUT, + /* Preprocessing for geometry node trees before they can be evaluated. */ + NTREE_GEOMETRY_PREPROCESS, /* Total number of meaningful node types. */ NUM_TYPES, diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index f2d82e80fa6..718097b4ef8 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -48,18 +48,18 @@ ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode, const char * string ComponentNode::OperationIDKey::identifier() const { - const string codebuf = to_string(static_cast<int>(opcode)); + const string codebuf = to_string(int(opcode)); return "OperationIDKey(" + codebuf + ", " + name + ")"; } bool ComponentNode::OperationIDKey::operator==(const OperationIDKey &other) const { - return (opcode == other.opcode) && (STREQ(name, other.name)) && (name_tag == other.name_tag); + return (opcode == other.opcode) && STREQ(name, other.name) && (name_tag == other.name_tag); } uint64_t ComponentNode::OperationIDKey::hash() const { - const int opcode_as_int = static_cast<int>(opcode); + const int opcode_as_int = int(opcode); return BLI_ghashutil_combine_hash( name_tag, BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int), @@ -90,10 +90,11 @@ ComponentNode::~ComponentNode() string ComponentNode::identifier() const { - const string idname = this->owner->name; - const string typebuf = "" + to_string(static_cast<int>(type)) + ")"; - return typebuf + name + " : " + idname + - "( affects_visible_id: " + (affects_visible_id ? "true" : "false") + ")"; + const string type_name = type_get_factory(type)->type_name(); + const string name_part = name[0] ? (string(" '") + name + "'") : ""; + + return "[" + type_name + "]" + name_part + " : " + + "(affects_visible_id: " + (affects_visible_id ? "true" : "false") + ")"; } OperationNode *ComponentNode::find_operation(OperationIDKey key) const @@ -337,6 +338,7 @@ DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0); DEG_COMPONENT_NODE_DEFINE(Visibility, VISIBILITY, 0); DEG_COMPONENT_NODE_DEFINE(Simulation, SIMULATION, 0); DEG_COMPONENT_NODE_DEFINE(NTreeOutput, NTREE_OUTPUT, ID_RECALC_NTREE_OUTPUT); +DEG_COMPONENT_NODE_DEFINE(NTreeGeometryPreprocess, NTREE_GEOMETRY_PREPROCESS, 0); /** \} */ @@ -371,6 +373,7 @@ void deg_register_component_depsnodes() register_node_typeinfo(&DNTI_VISIBILITY); register_node_typeinfo(&DNTI_SIMULATION); register_node_typeinfo(&DNTI_NTREE_OUTPUT); + register_node_typeinfo(&DNTI_NTREE_GEOMETRY_PREPROCESS); } /** \} */ diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h index f7f38b88854..44c63822ca3 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.h +++ b/source/blender/depsgraph/intern/node/deg_node_component.h @@ -208,6 +208,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock); DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(Visibility); DEG_COMPONENT_NODE_DECLARE_GENERIC(Simulation); DEG_COMPONENT_NODE_DECLARE_GENERIC(NTreeOutput); +DEG_COMPONENT_NODE_DECLARE_GENERIC(NTreeGeometryPreprocess); /* Bone Component */ struct BoneComponentNode : public ComponentNode { diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.cc b/source/blender/depsgraph/intern/node/deg_node_factory.cc index bcdfdbec604..4c08d4ee7bb 100644 --- a/source/blender/depsgraph/intern/node/deg_node_factory.cc +++ b/source/blender/depsgraph/intern/node/deg_node_factory.cc @@ -10,19 +10,19 @@ namespace blender::deg { /* Global type registry */ -static DepsNodeFactory *node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {nullptr}; +static DepsNodeFactory *node_typeinfo_registry[int(NodeType::NUM_TYPES)] = {nullptr}; void register_node_typeinfo(DepsNodeFactory *factory) { BLI_assert(factory != nullptr); - const int type_as_int = static_cast<int>(factory->type()); + const int type_as_int = int(factory->type()); node_typeinfo_registry[type_as_int] = factory; } DepsNodeFactory *type_get_factory(const NodeType type) { /* Look up type - at worst, it doesn't exist in table yet, and we fail. */ - const int type_as_int = static_cast<int>(type); + const int type_as_int = int(type); return node_typeinfo_registry[type_as_int]; } diff --git a/source/blender/depsgraph/intern/node/deg_node_factory_impl.h b/source/blender/depsgraph/intern/node/deg_node_factory_impl.h index d9d0a1c1e3e..5059368120e 100644 --- a/source/blender/depsgraph/intern/node/deg_node_factory_impl.h +++ b/source/blender/depsgraph/intern/node/deg_node_factory_impl.h @@ -34,15 +34,8 @@ Node *DepsNodeFactoryImpl<ModeObjectType>::create_node(const ID *id, const char *name) const { Node *node = new ModeObjectType(); - /* Populate base node settings. */ node->type = type(); - /* Set name if provided, or use default type name. */ - if (name[0] != '\0') { - node->name = name; - } - else { - node->name = type_name(); - } + node->name = name; node->init(id, subdata); return node; } diff --git a/source/blender/depsgraph/intern/node/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc index 9a7d27808be..a37feb7b95d 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.cc +++ b/source/blender/depsgraph/intern/node/deg_node_id.cc @@ -52,12 +52,12 @@ bool IDNode::ComponentIDKey::operator==(const ComponentIDKey &other) const uint64_t IDNode::ComponentIDKey::hash() const { - const int type_as_int = static_cast<int>(type); + const int type_as_int = int(type); return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(type_as_int), BLI_ghashutil_strhash_p(name)); } -void IDNode::init(const ID *id, const char *UNUSED(subdata)) +void IDNode::init(const ID *id, const char * /*subdata*/) { BLI_assert(id != nullptr); /* Store ID-pointer. */ @@ -75,7 +75,6 @@ void IDNode::init(const ID *id, const char *UNUSED(subdata)) has_base = false; is_user_modified = false; id_cow_recalc_backup = 0; - id_invisible_recalc = 0; visible_components_mask = 0; previously_visible_components_mask = 0; @@ -191,7 +190,7 @@ IDComponentsMask IDNode::get_visible_components_mask() const IDComponentsMask result = 0; for (ComponentNode *comp_node : components.values()) { if (comp_node->possibly_affects_visible_id) { - const int component_type_as_int = static_cast<int>(comp_node->type); + const int component_type_as_int = int(comp_node->type); BLI_assert(component_type_as_int < 64); result |= (1ULL << component_type_as_int); } diff --git a/source/blender/depsgraph/intern/node/deg_node_id.h b/source/blender/depsgraph/intern/node/deg_node_id.h index e9bbc816907..7f0a656cb8d 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.h +++ b/source/blender/depsgraph/intern/node/deg_node_id.h @@ -123,9 +123,6 @@ struct IDNode : public Node { /* Accumulate recalc flags from multiple update passes. */ int id_cow_recalc_backup; - /* Flags which components were not evaluated due to ID being invisible. */ - int id_invisible_recalc; - IDComponentsMask visible_components_mask; IDComponentsMask previously_visible_components_mask; diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc index 016af735fcf..d5401a6b0d1 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.cc +++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc @@ -173,6 +173,8 @@ const char *operationCodeAsString(OperationCode opcode) /* Node Tree. */ case OperationCode::NTREE_OUTPUT: return "NTREE_OUTPUT"; + case OperationCode::NTREE_GEOMETRY_PREPROCESS: + return "NTREE_GEOMETRY_PREPROCESS"; /* Movie clip. */ case OperationCode::MOVIECLIP_EVAL: return "MOVIECLIP_EVAL"; diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h index cb3beb56556..b0685ac0351 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.h +++ b/source/blender/depsgraph/intern/node/deg_node_operation.h @@ -165,6 +165,7 @@ enum class OperationCode { /* Node Tree. ----------------------------------------------------------- */ NTREE_OUTPUT, + NTREE_GEOMETRY_PREPROCESS, /* Batch caches. -------------------------------------------------------- */ GEOMETRY_SELECT_UPDATE, |