Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2018-05-19 20:42:36 +0300
committerJoshua Leung <aligorith@gmail.com>2018-05-19 20:42:36 +0300
commitd56df9d1352070b4ab7e4faa7bebc01f384c67a5 (patch)
tree02294325998cc097cc84fc2cab8fb8d136ae98bb
parentb8e44cc194d2ec1a8388485e11da163793816a9a (diff)
Add back temporary exception for pose bones in DEG_get_evaluated_rna_pointer()tmp-COW_InsertKeyframe_Fix
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.
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc15
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;