Anim: avoid 'unshare' node for custom properties and shapekey values
When creating depsgraph relationships for drivers, avoid creating the 'unshare' depsgraph node for drivers on custom properties and on shapekey `value` properties. This should fix a significant part of the performance regression mentioned in #140706. Pull Request: https://projects.blender.org/blender/blender/pulls/140724
This commit is contained in:
@@ -245,12 +245,26 @@ bool data_path_maybe_shared(const ID &id, const StringRef data_path)
|
||||
/* As it is hard to generally detect implicit sharing, this is implemented as
|
||||
* a 'known to not share' list. */
|
||||
|
||||
/* Allow concurrent writes to custom properties. #140706 shows that this
|
||||
* shouldn't be a problem in practice. */
|
||||
if (data_path.startswith("[\"") && data_path.endswith("\"]")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GS(id.name) == ID_OB) {
|
||||
const Object &ob = *reinterpret_cast<const Object *>(&id);
|
||||
const bool is_thread_safe = (ob.type == OB_ARMATURE && data_path.startswith("pose.bones["));
|
||||
return !is_thread_safe;
|
||||
}
|
||||
|
||||
/* Allow concurrent writes to shapekey values. #140706 shows that this
|
||||
* shouldn't be a problem in practice. */
|
||||
if (GS(id.name) == ID_KE) {
|
||||
const bool is_thread_safe = data_path.startswith("key_blocks[") &&
|
||||
data_path.endswith("].value");
|
||||
return !is_thread_safe;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user