diff options
Diffstat (limited to 'source/blender/depsgraph')
7 files changed, 57 insertions, 18 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 8726f51012e..d1837e7a69a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -579,6 +579,7 @@ void DepsgraphNodeBuilder::build_object(int base_index, } /* Create ID node for object and begin init. */ IDDepsNode *id_node = add_id_node(&object->id); + Object *object_cow = get_cow_datablock(object); id_node->linked_state = linked_state; if (object == scene_->camera) { id_node->is_directly_visible = true; @@ -663,6 +664,13 @@ void DepsgraphNodeBuilder::build_object(int base_index, DEG_OPCODE_PLACEHOLDER, "Dupli"); } + /* Syncronization back to original object. */ + add_operation_node(&object->id, + DEG_NODE_TYPE_SYNCHRONIZE, + function_bind(BKE_object_synchronize_to_original, + _1, + object_cow), + DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); } void DepsgraphNodeBuilder::build_object_flags( diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 649bc1a4275..23f1d229d6a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -683,6 +683,12 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) } /* Point caches. */ build_object_pointcache(object); + /* Syncronization back to original object. */ + OperationKey synchronize_key(&object->id, + DEG_NODE_TYPE_SYNCHRONIZE, + DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + add_relation( + final_transform_key, synchronize_key, "Synchronize to Original"); } void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) @@ -697,6 +703,12 @@ void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) DEG_NODE_TYPE_OBJECT_FROM_LAYER, DEG_OPCODE_OBJECT_BASE_FLAGS); add_relation(view_layer_done_key, object_flags_key, "Base flags flush"); + /* Syncronization back to original object. */ + OperationKey synchronize_key(&object->id, + DEG_NODE_TYPE_SYNCHRONIZE, + DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + add_relation( + object_flags_key, synchronize_key, "Synchronize to Original"); } void DepsgraphRelationBuilder::build_object_data(Object *object) @@ -2023,6 +2035,13 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) } } } + /* Syncronization back to original object. */ + ComponentKey final_geometry_jey(&object->id, DEG_NODE_TYPE_GEOMETRY); + OperationKey synchronize_key(&object->id, + DEG_NODE_TYPE_SYNCHRONIZE, + DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL); + add_relation( + final_geometry_jey, synchronize_key, "Synchronize to Original"); } void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index ec1ea1e02b2..55eaf314a0a 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -421,6 +421,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx, case DEG_NODE_TYPE_OBJECT_FROM_LAYER: case DEG_NODE_TYPE_BATCH_CACHE: case DEG_NODE_TYPE_DUPLI: + case DEG_NODE_TYPE_SYNCHRONIZE: { ComponentDepsNode *comp_node = (ComponentDepsNode *)node; if (!comp_node->operations.empty()) { diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc index 3f36b9f7831..d93882a7170 100644 --- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc +++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc @@ -104,6 +104,8 @@ const char *nodeTypeAsString(eDepsNode_Type type) STRINGIFY_TYPE(BATCH_CACHE); /* Duplication. */ STRINGIFY_TYPE(DUPLI); + /* Synchronization. */ + STRINGIFY_TYPE(SYNCHRONIZE); /* Total number of meaningful node types. */ case NUM_DEG_NODE_TYPES: return "SpecialCase"; @@ -180,6 +182,8 @@ const char *operationCodeAsString(eDepsOperation_Code opcode) /* Movie clip. */ STRINGIFY_OPCODE(MOVIECLIP_EVAL); STRINGIFY_OPCODE(MOVIECLIP_SELECT_UPDATE); + /* Synchronization. */ + STRINGIFY_OPCODE(SYNCHRONIZE_TO_ORIGINAL); case DEG_NUM_OPCODES: return "SpecialCase"; #undef STRINGIFY_OPCODE diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h index f8b519cb1aa..61a91c13913 100644 --- a/source/blender/depsgraph/intern/depsgraph_types.h +++ b/source/blender/depsgraph/intern/depsgraph_types.h @@ -157,11 +157,12 @@ typedef enum eDepsNode_Type { DEG_NODE_TYPE_CACHE, /* Batch Cache Component - TODO (dfelinto/sergey) rename to make it more generic. */ DEG_NODE_TYPE_BATCH_CACHE, - /* Duplication system. Used to force duplicated objects visible when * when duplicator is visible. */ DEG_NODE_TYPE_DUPLI, + /* Synchronization back to original datablock. */ + DEG_NODE_TYPE_SYNCHRONIZE, /* Total number of meaningful node types. */ NUM_DEG_NODE_TYPES, @@ -170,7 +171,7 @@ const char *nodeTypeAsString(eDepsNode_Type type); /* Identifiers for common operations (as an enum). */ typedef enum eDepsOperation_Code { - /* Generic Operations. ------------------------------ */ + /* Generic Operations. -------------------------------------------------- */ /* Placeholder for operations which don't need special mention */ DEG_OPCODE_OPERATION = 0, @@ -182,16 +183,16 @@ typedef enum eDepsOperation_Code { // XXX: Placeholder while porting depsgraph code DEG_OPCODE_PLACEHOLDER, - /* Animation, Drivers, etc. ------------------------ */ + /* Animation, Drivers, etc. --------------------------------------------- */ /* NLA + Action */ DEG_OPCODE_ANIMATION, /* Driver */ DEG_OPCODE_DRIVER, - /* Object related. --------------------------------- */ + /* Object related. ------------------------------------------------------ */ DEG_OPCODE_OBJECT_BASE_FLAGS, - /* Transform. -------------------------------------- */ + /* Transform. ----------------------------------------------------------- */ /* Transform entry point - local transforms only */ DEG_OPCODE_TRANSFORM_LOCAL, /* Parenting */ @@ -203,25 +204,25 @@ typedef enum eDepsOperation_Code { /* Handle object-level updates, mainly proxies hacks and recalc flags. */ DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL, - /* Rigid body. -------------------------------------- */ + /* Rigid body. ---------------------------------------------------------- */ /* Perform Simulation */ DEG_OPCODE_RIGIDBODY_REBUILD, DEG_OPCODE_RIGIDBODY_SIM, /* Copy results to object */ DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY, - /* Geometry. ---------------------------------------- */ + /* Geometry. ------------------------------------------------------------ */ /* Evaluate the whole geometry, including modifiers. */ DEG_OPCODE_GEOMETRY_UBEREVAL, /* Evaluation of a shape key. */ DEG_OPCODE_GEOMETRY_SHAPEKEY, - /* Object data. ------------------------------------- */ + /* Object data. --------------------------------------------------------- */ DEG_OPCODE_LIGHT_PROBE_EVAL, DEG_OPCODE_SPEAKER_EVAL, - /* Pose. -------------------------------------------- */ + /* Pose. ---------------------------------------------------------------- */ /* Init pose, clear flags, etc. */ DEG_OPCODE_POSE_INIT, /* Initialize IK solver related pose stuff. */ @@ -234,7 +235,7 @@ typedef enum eDepsOperation_Code { DEG_OPCODE_POSE_IK_SOLVER, DEG_OPCODE_POSE_SPLINE_IK_SOLVER, - /* Bone. -------------------------------------------- */ + /* Bone. ---------------------------------------------------------------- */ /* Bone local transforms - entry point */ DEG_OPCODE_BONE_LOCAL, /* Pose-space conversion (includes parent + restpose, */ @@ -257,37 +258,40 @@ typedef enum eDepsOperation_Code { /* B-Bone segment shape computation (after DONE) */ DEG_OPCODE_BONE_SEGMENTS, - /* Particles. --------------------------------------- */ + /* Particles. ----------------------------------------------------------- */ /* Particle System evaluation. */ DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT, DEG_OPCODE_PARTICLE_SYSTEM_EVAL, DEG_OPCODE_PARTICLE_SETTINGS_EVAL, - /* Point Cache. ------------------------------------- */ + /* Point Cache. --------------------------------------------------------- */ DEG_OPCODE_POINT_CACHE_RESET, - /* Collections. ------------------------------------- */ + /* Collections. --------------------------------------------------------- */ DEG_OPCODE_VIEW_LAYER_EVAL, - /* Copy on Write. ------------------------------------ */ + /* Copy on Write. ------------------------------------------------------- */ DEG_OPCODE_COPY_ON_WRITE, - /* Shading. ------------------------------------------- */ + /* Shading. ------------------------------------------------------------- */ DEG_OPCODE_SHADING, DEG_OPCODE_MATERIAL_UPDATE, DEG_OPCODE_WORLD_UPDATE, - /* Batch caches. -------------------------------------- */ + /* Batch caches. -------------------------------------------------------- */ DEG_OPCODE_GEOMETRY_SELECT_UPDATE, - /* Masks. ------------------------------------------ */ + /* Masks. --------------------------------------------------------------- */ DEG_OPCODE_MASK_ANIMATION, DEG_OPCODE_MASK_EVAL, - /* Movie clips. ------------------------------------ */ + /* Movie clips. --------------------------------------------------------- */ DEG_OPCODE_MOVIECLIP_EVAL, DEG_OPCODE_MOVIECLIP_SELECT_UPDATE, + /* Synchronization clips. ----------------------------------------------- */ + DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL, + DEG_NUM_OPCODES, } eDepsOperation_Code; const char *operationCodeAsString(eDepsOperation_Code opcode); diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc index 4bb9b9d17b3..c1c5899db37 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc +++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc @@ -401,6 +401,7 @@ DEG_COMPONENT_NODE_DEFINE(ShadingParameters, SHADING_PARAMETERS, ID_RECALC_DRAW) DEG_COMPONENT_NODE_DEFINE(Transform, TRANSFORM, ID_RECALC_TRANSFORM); DEG_COMPONENT_NODE_DEFINE(ObjectFromLayer, OBJECT_FROM_LAYER, ID_RECALC); DEG_COMPONENT_NODE_DEFINE(Dupli, DUPLI, 0); +DEG_COMPONENT_NODE_DEFINE(Synchronize, SYNCHRONIZE, 0); /* Node Types Register =================================== */ @@ -424,6 +425,7 @@ void deg_register_component_depsnodes() deg_register_node_typeinfo(&DNTI_TRANSFORM); deg_register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER); deg_register_node_typeinfo(&DNTI_DUPLI); + deg_register_node_typeinfo(&DNTI_SYNCHRONIZE); } } // namespace DEG diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h index e3057e1d3ce..f1ad3208952 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node_component.h +++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h @@ -200,6 +200,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(ShadingParameters); DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform); DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(ObjectFromLayer); DEG_COMPONENT_NODE_DECLARE_GENERIC(Dupli); +DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronize); /* Bone Component */ struct BoneComponentDepsNode : public ComponentDepsNode { |