From 4dc639ac9965f3d0e8b2304363c62d888cdd1dc9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Nov 2018 15:42:37 +0100 Subject: Speedup rigs with multiple objects deformed by bbones Previously each of the objects which has armature modifier will request deformation matricies from bbones. Thing is, all those deformations are the same and do not depend on object which is being modified. What's even worse is that this calculation is not cheap. This change makes it so bbones deformation is calculated once and stored in the armature object. After this armature modifiers simply use it. With a rigs we've got here dependency graph evaluation time goes down from 0.02 sec to 0.012 sec. Possible further optimization is to make bbone deformation calculated at the time when bone is calculated. This will avoid an extra threaded loop over all bones. --- source/blender/makesdna/DNA_object_types.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/makesdna/DNA_object_types.h') diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index ffc798317ce..22b878ebac6 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -127,6 +127,11 @@ typedef struct ObjectDisplay { int flag; } ObjectDisplay; +/* Forward declaration for cache bbone deformation information. + * + * TODO(sergey): Consider moving it to more appropriate place. */ +struct ObjectBBoneDeform; + /* Not saved in file! */ typedef struct Object_Runtime { /* Original mesh pointer, before object->data was changed to point @@ -149,6 +154,8 @@ typedef struct Object_Runtime { /* Runtime grease pencil drawing data */ struct GpencilBatchCache *gpencil_cache; + + struct ObjectBBoneDeform *cached_bbone_deformation; } Object_Runtime; typedef struct Object { -- cgit v1.2.3