diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-11-29 14:12:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-01-03 17:30:14 +0300 |
commit | a230445caec6cae4eda9dbf8ea758322310fc7eb (patch) | |
tree | 9d806bbd391aa6044296dec46bc4c71660ef92fd /source | |
parent | a3e634d4d7a3f2ae12d9a6e1709e790dfa6f27c5 (diff) |
Depsgraph: Remove object-level visibility from geometry builders
Continuation of the D13404 which finished the design of not having
geometry-level nodes dependent on object-level.
Differential Revision: https://developer.blender.org/D13405
Diffstat (limited to 'source')
4 files changed, 31 insertions, 55 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index f8562e16746..ecbe89b1e7f 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -199,9 +199,7 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) nullptr, OperationCode::OPERATION, "", -1); /* Pin the node so that it and its relations are preserved by the unused nodes/relations * deletion. This is mainly to make it easier to debug visibility. */ - /* NOTE: Keep un-pinned for the 3.0 release. This way we are more sure that side effects of the - * change is minimal outside of the dependency graph area. */ - // visibility_operation->flag |= OperationFlag::DEPSOP_FLAG_PINNED; + visibility_operation->flag |= OperationFlag::DEPSOP_FLAG_PINNED; graph_->operations.append(visibility_operation); } return id_node; @@ -589,11 +587,7 @@ void DepsgraphNodeBuilder::build_id(ID *id) case ID_HA: case ID_PT: case ID_VO: - /* TODO(sergey): Get visibility from a "parent" somehow. - * - * NOTE: Similarly to above, we don't want false-positives on - * visibility. */ - build_object_data_geometry_datablock(id, false); + build_object_data_geometry_datablock(id); break; case ID_SPK: build_speaker((Speaker *)id); @@ -769,32 +763,28 @@ void DepsgraphNodeBuilder::build_object(int base_index, if (object->modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_modifiers_foreach_ID_link(object, modifier_walk, &data); } /* Grease Pencil Modifiers. */ if (object->greasepencil_modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_gpencil_modifiers_foreach_ID_link(object, modifier_walk, &data); } /* Shader FX. */ if (object->shader_fx.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_shaderfx_foreach_ID_link(object, modifier_walk, &data); } /* Constraints. */ if (object->constraints.first != nullptr) { BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_visible; BKE_constraints_id_loop(&object->constraints, constraint_walk, &data); } /* Object data. */ - build_object_data(object, is_visible); + build_object_data(object); /* Parameters, used by both drivers/animation and also to inform dependency * from object's data. */ build_parameters(&object->id); @@ -897,7 +887,7 @@ void DepsgraphNodeBuilder::build_object_instance_collection(Object *object, bool is_parent_collection_visible_ = is_current_parent_collection_visible; } -void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_object_data(Object *object) { if (object->data == nullptr) { return; @@ -914,14 +904,14 @@ void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visi case OB_HAIR: case OB_POINTCLOUD: case OB_VOLUME: - build_object_data_geometry(object, is_object_visible); + build_object_data_geometry(object); break; case OB_ARMATURE: if (ID_IS_LINKED(object) && object->proxy_from != nullptr) { - build_proxy_rig(object, is_object_visible); + build_proxy_rig(object); } else { - build_rig(object, is_object_visible); + build_rig(object); } break; case OB_LAMP: @@ -1472,7 +1462,7 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) /* ObData Geometry Evaluation */ /* XXX: what happens if the datablock is shared! */ -void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_object_data_geometry(Object *object) { OperationNode *op_node; Scene *scene_cow = get_cow_datablock(scene_); @@ -1494,7 +1484,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob /* Point caches. */ build_object_pointcache(object); /* Geometry. */ - build_object_data_geometry_datablock((ID *)object->data, is_object_visible); + build_object_data_geometry_datablock((ID *)object->data); build_dimensions(object); /* Batch cache. */ add_operation_node( @@ -1504,7 +1494,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob [object_cow](::Depsgraph *depsgraph) { BKE_object_select_update(depsgraph, object_cow); }); } -void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool is_object_visible) +void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata) { if (built_map_.checkIsBuiltAndTag(obdata)) { return; @@ -1548,17 +1538,15 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool BKE_curve_eval_geometry(depsgraph, (Curve *)obdata_cow); }); op_node->set_as_entry(); - /* Make sure objects used for bevel.taper are in the graph. - * NOTE: This objects might be not linked to the scene. */ Curve *cu = (Curve *)obdata; if (cu->bevobj != nullptr) { - build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, false); } if (cu->taperobj != nullptr) { - build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, false); } if (cu->textoncurve != nullptr) { - build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, false); } break; } @@ -2121,10 +2109,7 @@ void DepsgraphNodeBuilder::modifier_walk(void *user_data, } switch (GS(id->name)) { case ID_OB: - /* Special case for object, so we take owner visibility into - * account. */ - data->builder->build_object( - -1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, data->is_parent_visible); + data->builder->build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false); break; default: data->builder->build_id(id); @@ -2144,10 +2129,7 @@ void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/, } switch (GS(id->name)) { case ID_OB: - /* Special case for object, so we take owner visibility into - * account. */ - data->builder->build_object( - -1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, data->is_parent_visible); + data->builder->build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false); break; default: data->builder->build_id(id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 2d24dc49802..83bc33b6a4e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -186,20 +186,17 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void build_object_flags(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state); - virtual void build_object_data(Object *object, bool is_object_visible); + virtual void build_object_data(Object *object); virtual void build_object_data_camera(Object *object); - virtual void build_object_data_geometry(Object *object, bool is_object_visible); - virtual void build_object_data_geometry_datablock(ID *obdata, bool is_object_visible); + virtual void build_object_data_geometry(Object *object); + virtual void build_object_data_geometry_datablock(ID *obdata); virtual void build_object_data_light(Object *object); virtual void build_object_data_lightprobe(Object *object); virtual void build_object_data_speaker(Object *object); virtual void build_object_transform(Object *object); virtual void build_object_constraints(Object *object); virtual void build_object_pointcache(Object *object); - virtual void build_pose_constraints(Object *object, - bPoseChannel *pchan, - int pchan_index, - bool is_object_visible); + virtual void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index); virtual void build_rigidbody(Scene *scene); virtual void build_particle_systems(Object *object, bool is_object_visible); virtual void build_particle_settings(ParticleSettings *part); @@ -227,8 +224,8 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void build_dimensions(Object *object); virtual void build_ik_pose(Object *object, bPoseChannel *pchan, bConstraint *con); virtual void build_splineik_pose(Object *object, bPoseChannel *pchan, bConstraint *con); - virtual void build_rig(Object *object, bool is_object_visible); - virtual void build_proxy_rig(Object *object, bool is_object_visible); + virtual void build_rig(Object *object); + virtual void build_proxy_rig(Object *object); virtual void build_armature(bArmature *armature); virtual void build_armature_bones(ListBase *bones); virtual void build_shapekeys(Key *key); @@ -284,8 +281,6 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { struct BuilderWalkUserData { DepsgraphNodeBuilder *builder; - /* Denotes whether object the walk is invoked from is visible. */ - bool is_parent_visible; }; static void modifier_walk(void *user_data, struct Object *object, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 00c78b8edce..e8dda7b8de4 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -58,13 +58,11 @@ namespace blender::deg { void DepsgraphNodeBuilder::build_pose_constraints(Object *object, bPoseChannel *pchan, - int pchan_index, - bool is_object_visible) + int pchan_index) { /* Pull indirect dependencies via constraints. */ BuilderWalkUserData data; data.builder = this; - data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); /* Create node for constraint stack. */ @@ -147,7 +145,7 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, } /* Pose/Armature Bones Graph */ -void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_rig(Object *object) { bArmature *armature = (bArmature *)object->data; Scene *scene_cow = get_cow_datablock(scene_); @@ -272,7 +270,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) } /* Build constraints. */ if (pchan->constraints.first != nullptr) { - build_pose_constraints(object, pchan, pchan_index, is_object_visible); + build_pose_constraints(object, pchan, pchan_index); } /** * IK Solvers. @@ -301,14 +299,14 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) } /* Custom shape. */ if (pchan->custom != nullptr) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + /* NOTE: The relation builder will ensure visibility of the custom shape object. */ + build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, false); } pchan_index++; } } -void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visible) +void DepsgraphNodeBuilder::build_proxy_rig(Object *object) { bArmature *armature = (bArmature *)object->data; OperationNode *op_node; @@ -356,7 +354,8 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl /* Custom shape. */ if (pchan->custom != nullptr) { - build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); + /* NOTE: The relation builder will ensure visibility of the custom shape object. */ + build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, false); } pchan_index++; diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index ef58a35afb2..6cb5e31303f 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -112,11 +112,11 @@ enum class NodeType { * 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 + * the 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. */ + * properly evaluated. Example of this is custom shapes for bones. */ VISIBILITY, /* **** Evaluation-Related Outer Types (with Subdata) **** */ |