Depsgraph: remove redundant mesh data duplication in edit-mode
This resolves a bottleneck where every update while transforming copied the entire mesh data-block, which isn't needed as the edit-mesh is the source of the data being edited. Testing shows a significant overall speedup when transforming: - ~1.5x with a subdivided cube 1.5 million vertices. - ~3.0x with the spring mesh (edit-mode with modifiers disabled, duplicated 10x to drop performance). Reviewed By: sergey Ref D11337
This commit is contained in:
parent
27da305a40
commit
51568030e9
Notes:
blender-bot
2023-02-14 07:17:43 +01:00
Referenced by issue #101995, Regressoin: Bisect: Unstable display when UV editor is open Referenced by issue #95165, Regression: Custom Normals tools dont update immediately (when started with Auto Smooth OFF) Referenced by issue #93963, Inconsistent displaying object data in a Viewport between scenes Referenced by issue #91996, Linked Instances Across Scenes have unreliable updates when editing their common mesh data. Referenced by issue #88550, Mesh Optimization Project Progress
|
@ -31,6 +31,10 @@
|
|||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
struct ID;
|
||||
struct bPoseChannel;
|
||||
|
||||
|
@ -158,6 +162,23 @@ struct ComponentNode : public Node {
|
|||
DEG_COMPONENT_NODE_DECLARE; \
|
||||
}
|
||||
|
||||
/* When updating object data in edit-mode, don't request COW update since this will duplicate
|
||||
* all object data which is unnecessary when the edit-mode data is used for calculating modifiers.
|
||||
*
|
||||
* TODO: Investigate modes besides edit-mode. */
|
||||
#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_OBDATA_IN_EDIT_MODE(name) \
|
||||
struct name##ComponentNode : public ComponentNode { \
|
||||
DEG_COMPONENT_NODE_DECLARE; \
|
||||
virtual bool need_tag_cow_before_update() override \
|
||||
{ \
|
||||
if (OB_DATA_SUPPORT_EDITMODE(owner->id_type) && \
|
||||
BKE_object_data_is_in_editmode(owner->id_orig)) { \
|
||||
return false; \
|
||||
} \
|
||||
return true; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \
|
||||
struct name##ComponentNode : public ComponentNode { \
|
||||
DEG_COMPONENT_NODE_DECLARE; \
|
||||
|
@ -171,7 +192,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Animation);
|
|||
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(BatchCache);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Cache);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(CopyOnWrite);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Geometry);
|
||||
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_OBDATA_IN_EDIT_MODE(Geometry);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(ImageAnimation);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(LayerCollections);
|
||||
DEG_COMPONENT_NODE_DECLARE_GENERIC(Particles);
|
||||
|
|
Loading…
Reference in New Issue