From 27da305a404f72a75a37892e1ac080c6531d059b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 24 Jun 2021 19:13:52 +1000 Subject: Depsgraph: support flushing parameters without a full COW update Avoid computationally expensive copying operations when only some settings have been modified. This is done by adding support for updating parameters without tagging for copy-on-write. Currently only mesh data blocks are supported, other data-blocks can be added individually. This prepares for changing values such as edit-mesh auto-smooth angle in edit-mode without duplicating all mesh-data. The benefit will only be seen when the user interface no longer tags all ID's for copy on write updates. ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations where non edit-mode geometry is modified in edit-mode. While this isn't something user are likely to do, Python scripts may change the underlying mesh. Reviewed By: sergey Ref D11377 --- .../blender/depsgraph/intern/builder/deg_builder_nodes.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source/blender/depsgraph/intern/builder') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 20169f0a961..56168739fae 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1215,7 +1215,19 @@ void DepsgraphNodeBuilder::build_parameters(ID *id) op_node = add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY); op_node->set_as_entry(); /* Generic evaluation node. */ - add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); + + if (ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(GS(id->name))) { + ID *id_cow = get_cow_id(id); + add_operation_node( + id, + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL, + [id_cow, id](::Depsgraph * /*depsgraph*/) { BKE_id_eval_properties_copy(id_cow, id); }); + } + else { + add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); + } + /* Explicit exit operation. */ op_node = add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT); op_node->set_as_exit(); -- cgit v1.2.3