diff options
Diffstat (limited to 'source/blender/depsgraph/intern/node')
8 files changed, 66 insertions, 17 deletions
diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc index 16089ba27dd..8bc03d8b736 100644 --- a/source/blender/depsgraph/intern/node/deg_node.cc +++ b/source/blender/depsgraph/intern/node/deg_node.cc @@ -94,8 +94,6 @@ const char *nodeTypeAsString(NodeType type) return "PARTICLE_SETTINGS"; case NodeType::SHADING: return "SHADING"; - case NodeType::SHADING_PARAMETERS: - return "SHADING_PARAMETERS"; case NodeType::CACHE: return "CACHE"; case NodeType::POINT_CACHE: @@ -114,6 +112,8 @@ const char *nodeTypeAsString(NodeType type) return "ARMATURE"; case NodeType::GENERIC_DATABLOCK: return "GENERIC_DATABLOCK"; + case NodeType::VISIBILITY: + return "VISIBILITY"; case NodeType::SIMULATION: return "SIMULATION"; @@ -159,7 +159,6 @@ eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type) case NodeType::GENERIC_DATABLOCK: case NodeType::PARTICLE_SYSTEM: case NodeType::PARTICLE_SETTINGS: - case NodeType::SHADING_PARAMETERS: case NodeType::POINT_CACHE: case NodeType::IMAGE_ANIMATION: case NodeType::BATCH_CACHE: @@ -176,6 +175,10 @@ eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type) case NodeType::PROXY: case NodeType::SIMULATION: return DEG_SCENE_COMP_PARAMETERS; + + case NodeType::VISIBILITY: + BLI_assert_msg(0, "Visibility component is supposed to be only used internally."); + return DEG_SCENE_COMP_PARAMETERS; } BLI_assert_msg(0, "Unhandled node type, not supposed to happen."); return DEG_SCENE_COMP_PARAMETERS; @@ -242,7 +245,6 @@ eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type) case NodeType::GENERIC_DATABLOCK: case NodeType::PARTICLE_SYSTEM: case NodeType::PARTICLE_SETTINGS: - case NodeType::SHADING_PARAMETERS: case NodeType::POINT_CACHE: case NodeType::IMAGE_ANIMATION: case NodeType::BATCH_CACHE: @@ -252,6 +254,10 @@ eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type) case NodeType::UNDEFINED: case NodeType::NUM_TYPES: return DEG_OB_COMP_PARAMETERS; + + case NodeType::VISIBILITY: + BLI_assert_msg(0, "Visibility component is supposed to be only used internally."); + return DEG_OB_COMP_PARAMETERS; } BLI_assert_msg(0, "Unhandled node type, not suppsed to happen."); return DEG_OB_COMP_PARAMETERS; @@ -305,7 +311,6 @@ Node::~Node() } } -/* Generic identifier for Depsgraph Nodes. */ string Node::identifier() const { return string(nodeTypeAsString(type)) + " : " + name; diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index e1469b68b0e..7e093ab8765 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -103,6 +103,22 @@ enum class NodeType { * not have very distinctive update procedure. */ GENERIC_DATABLOCK, + /* Component which is used to define visibility relation between IDs, on the ID level. + * + * Consider two ID nodes NodeA and NodeB, with the relation between visibility components going + * as NodeA -> NodeB. If NodeB is considered visible on screen, then the relation will ensure + * that NodeA is also visible. The way how relation is oriented could be seen as a inverted from + * visibility dependency point of view, but it follows the same direction as data dependency + * which simplifies common algorithms which are dealing with relations and visibility. + * + * The fact that the visibility operates on the ID level basically means that all components in + * NodeA will be considered as affecting directly visible when NodeB's visibility is + * affecting directly visible ID. + * + * This is the way to ensure objects needed for visualization without any actual data dependency + * are properly evaluated. Example of this is custom shapes for bones. */ + VISIBILITY, + /* **** Evaluation-Related Outer Types (with Subdata) **** */ /* Pose Component - Owner/Container of Bones Eval */ @@ -114,7 +130,6 @@ enum class NodeType { PARTICLE_SETTINGS, /* Material Shading Component */ SHADING, - SHADING_PARAMETERS, /* Point cache Component */ POINT_CACHE, /* Image Animation Component */ @@ -186,6 +201,7 @@ struct Node { Node(); virtual ~Node(); + /** Generic identifier for Depsgraph Nodes. */ virtual string identifier() const; virtual void init(const ID * /*id*/, const char * /*subdata*/) diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index 0947fad7670..b716877902c 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -43,7 +43,9 @@ namespace blender::deg { /* *********** */ /* Outer Nodes */ -/* Standard Component Methods ============================= */ +/* -------------------------------------------------------------------- */ +/** \name Standard Component Methods + * \{ */ ComponentNode::OperationIDKey::OperationIDKey() : opcode(OperationCode::OPERATION), name(""), name_tag(-1) @@ -86,7 +88,6 @@ ComponentNode::ComponentNode() operations_map = new Map<ComponentNode::OperationIDKey, OperationNode *>(); } -/* Initialize 'component' node - from pointer data given */ void ComponentNode::init(const ID * /*id*/, const char * /*subdata*/) { /* hook up eval context? */ @@ -297,9 +298,12 @@ void ComponentNode::finalize_build(Depsgraph * /*graph*/) operations_map = nullptr; } -/* Bone Component ========================================= */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Bone Component + * \{ */ -/* Initialize 'bone component' node - from pointer data given */ void BoneComponentNode::init(const ID *id, const char *subdata) { /* generic component-node... */ @@ -315,7 +319,11 @@ void BoneComponentNode::init(const ID *id, const char *subdata) this->pchan = BKE_pose_channel_find_name(object->pose, subdata); } -/* Register all components. =============================== */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Register All Components + * \{ */ DEG_COMPONENT_NODE_DEFINE(Animation, ANIMATION, ID_RECALC_ANIMATION); /* TODO(sergey): Is this a correct tag? */ @@ -334,7 +342,6 @@ DEG_COMPONENT_NODE_DEFINE(Pose, EVAL_POSE, ID_RECALC_GEOMETRY); DEG_COMPONENT_NODE_DEFINE(Proxy, PROXY, ID_RECALC_GEOMETRY); DEG_COMPONENT_NODE_DEFINE(Sequencer, SEQUENCER, 0); DEG_COMPONENT_NODE_DEFINE(Shading, SHADING, ID_RECALC_SHADING); -DEG_COMPONENT_NODE_DEFINE(ShadingParameters, SHADING_PARAMETERS, ID_RECALC_SHADING); DEG_COMPONENT_NODE_DEFINE(Transform, TRANSFORM, ID_RECALC_TRANSFORM); DEG_COMPONENT_NODE_DEFINE(ObjectFromLayer, OBJECT_FROM_LAYER, 0); DEG_COMPONENT_NODE_DEFINE(Dupli, DUPLI, 0); @@ -342,9 +349,14 @@ DEG_COMPONENT_NODE_DEFINE(Synchronization, SYNCHRONIZATION, 0); DEG_COMPONENT_NODE_DEFINE(Audio, AUDIO, 0); DEG_COMPONENT_NODE_DEFINE(Armature, ARMATURE, 0); DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0); +DEG_COMPONENT_NODE_DEFINE(Visibility, VISIBILITY, 0); DEG_COMPONENT_NODE_DEFINE(Simulation, SIMULATION, 0); -/* Node Types Register =================================== */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Node Types Register + * \{ */ void deg_register_component_depsnodes() { @@ -364,7 +376,6 @@ void deg_register_component_depsnodes() register_node_typeinfo(&DNTI_EVAL_POSE); register_node_typeinfo(&DNTI_SEQUENCER); register_node_typeinfo(&DNTI_SHADING); - register_node_typeinfo(&DNTI_SHADING_PARAMETERS); register_node_typeinfo(&DNTI_TRANSFORM); register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER); register_node_typeinfo(&DNTI_DUPLI); @@ -372,7 +383,10 @@ void deg_register_component_depsnodes() register_node_typeinfo(&DNTI_AUDIO); register_node_typeinfo(&DNTI_ARMATURE); register_node_typeinfo(&DNTI_GENERIC_DATABLOCK); + register_node_typeinfo(&DNTI_VISIBILITY); register_node_typeinfo(&DNTI_SIMULATION); } +/** \} */ + } // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h index 6e31ef268ed..9f108af8012 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.h +++ b/source/blender/depsgraph/intern/node/deg_node_component.h @@ -67,6 +67,7 @@ struct ComponentNode : public Node { ComponentNode(); ~ComponentNode(); + /** Initialize 'component' node - from pointer data given. */ void init(const ID *id, const char *subdata) override; virtual string identifier() const override; @@ -188,6 +189,15 @@ struct ComponentNode : public Node { } \ } +#define DEG_COMPONENT_NODE_DECLARE_NO_COW(name) \ + struct name##ComponentNode : public ComponentNode { \ + DEG_COMPONENT_NODE_DECLARE; \ + virtual bool depends_on_cow() \ + { \ + return false; \ + } \ + } + DEG_COMPONENT_NODE_DECLARE_GENERIC(Animation); DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(BatchCache); DEG_COMPONENT_NODE_DECLARE_GENERIC(Cache); @@ -210,10 +220,12 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronization); DEG_COMPONENT_NODE_DECLARE_GENERIC(Audio); DEG_COMPONENT_NODE_DECLARE_GENERIC(Armature); DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock); +DEG_COMPONENT_NODE_DECLARE_NO_COW(Visibility); DEG_COMPONENT_NODE_DECLARE_GENERIC(Simulation); /* Bone Component */ struct BoneComponentNode : public ComponentNode { + /** Initialize 'bone component' node - from pointer data given. */ void init(const ID *id, const char *subdata); struct bPoseChannel *pchan; /* the bone that this component represents */ diff --git a/source/blender/depsgraph/intern/node/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc index 2b1ebc663fe..baad8318de2 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.cc +++ b/source/blender/depsgraph/intern/node/deg_node_id.cc @@ -73,7 +73,6 @@ uint64_t IDNode::ComponentIDKey::hash() const BLI_ghashutil_strhash_p(name)); } -/* Initialize 'id' node - from pointer data given. */ void IDNode::init(const ID *id, const char *UNUSED(subdata)) { BLI_assert(id != nullptr); diff --git a/source/blender/depsgraph/intern/node/deg_node_id.h b/source/blender/depsgraph/intern/node/deg_node_id.h index 073469598dc..257e42b8e67 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.h +++ b/source/blender/depsgraph/intern/node/deg_node_id.h @@ -58,6 +58,7 @@ struct IDNode : public Node { const char *name; }; + /** Initialize 'id' node - from pointer data given. */ virtual void init(const ID *id, const char *subdata) override; void init_copy_on_write(ID *id_cow_hint = nullptr); ~IDNode(); diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc index c25dc6fc8d5..eaae5d2d5dc 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.cc +++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc @@ -218,8 +218,6 @@ string OperationNode::identifier() const return string(operationCodeAsString(opcode)) + "(" + name + ")"; } -/* Full node identifier, including owner name. - * used for logging and debug prints. */ string OperationNode::full_identifier() const { string owner_str = owner->owner->name; diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h index a17186da941..31cbb9702ba 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.h +++ b/source/blender/depsgraph/intern/node/deg_node_operation.h @@ -233,6 +233,10 @@ struct OperationNode : public Node { OperationNode(); virtual string identifier() const override; + /** + * Full node identifier, including owner name. + * used for logging and debug prints. + */ string full_identifier() const; virtual void tag_update(Depsgraph *graph, eUpdateSource source) override; |