[Bf-blender-cvs] [d56df9d1352] tmp-COW_InsertKeyframe_Fix: Add back temporary exception for pose bones in DEG_get_evaluated_rna_pointer()
Joshua Leung
noreply at git.blender.org
Sat May 19 19:42:46 CEST 2018
Commit: d56df9d1352070b4ab7e4faa7bebc01f384c67a5
Author: Joshua Leung
Date: Sat May 19 19:42:36 2018 +0200
Branches: tmp-COW_InsertKeyframe_Fix
https://developer.blender.org/rBd56df9d1352070b4ab7e4faa7bebc01f384c67a5
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.
===================================================================
M source/blender/depsgraph/intern/depsgraph_query.cc
===================================================================
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;
More information about the Bf-blender-cvs
mailing list