diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-05-19 20:42:36 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-05-19 20:54:47 +0300 |
commit | aca892832afb84ec9adfd98a3134a3bc536999c1 (patch) | |
tree | e3fbaa294c43faf69db4af970fa5a1d8ff703dfa /source/blender/depsgraph | |
parent | 006b8e6092fe18572339987a73c714a644a2cd1d (diff) |
Add back temporary exception for pose bones in DEG_get_evaluated_rna_pointer()
Without the exception, adding new poses to pose libraries took several seconds
with only <= 4 bones selected. While we may still need this for other cases too,
since bones are such a common use case, it makes sense to provide some level
of optimisation for them.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index 5857342a9df..734b0ef931a 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -172,11 +172,26 @@ void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr, r_ptr_eval->data = (void *)cow_id; r_ptr_eval->type = ptr->type; } + else if (ptr->type == &RNA_PoseBone) { + /* HACK: Since bone keyframing is quite commonly used, + * speed things up for this case by doing a special lookup + * for bones + */ + const Object *ob_eval = (Object *)cow_id; + bPoseChannel *pchan = (bPoseChannel *)ptr->data; + const bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name); + r_ptr_eval->id.data = (void *)cow_id; + r_ptr_eval->data = (void *)pchan_eval; + r_ptr_eval->type = ptr->type; + } else { /* For everything else, try to get RNA Path of the BMain-pointer, * then use that to look up what the COW-domain one should be * given the COW ID pointer as the new lookup point */ + /* TODO: Find a faster alternative, or implement support for other + * common types too above (e.g. modifiers) + */ char *path = RNA_path_from_ID_to_struct(ptr); if (path) { PointerRNA cow_id_ptr; |