diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-02-10 18:59:57 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-02-10 18:59:57 +0300 |
commit | a7ae33202fa94a52235fbe595873d81e482d5f58 (patch) | |
tree | c075afc26803edd25de9021d3190d2d9613f741d /source/blender/editors/armature/armature_add.c | |
parent | a5cddaefd344a4ab8c1d5d1be39edf6e6dc456e0 (diff) | |
parent | ad77b52abcbd0daf0d1a3ad395983cb90beeb72a (diff) |
Merge branch 'master' into greasepencil-objectgreasepencil-object
Conflicts:
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenkernel/BKE_gpencil.h
source/blender/blenkernel/BKE_gpencil_update_cache.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/gpencil.c
source/blender/blenkernel/intern/gpencil_update_cache.c
source/blender/blenlib/BLI_listbase.h
source/blender/blenlib/intern/DLRB_tree.c
source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_gpencil.cc
source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_gpencil.h
source/blender/makesdna/DNA_gpencil_types.h
source/blender/makesrna/intern/rna_gpencil.c
Diffstat (limited to 'source/blender/editors/armature/armature_add.c')
-rw-r--r-- | source/blender/editors/armature/armature_add.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 4a327904ddd..e1d4b5fec73 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -15,11 +15,11 @@ * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. - * Operators and API's for creating bones */ /** \file * \ingroup edarmature + * Operators and API's for creating bones. */ #include "DNA_anim_types.h" @@ -859,14 +859,28 @@ static void updateDuplicateCustomBoneShapes(bContext *C, EditBone *dup_bone, Obj Main *bmain = CTX_data_main(C); char name_flip[MAX_ID_NAME - 2]; + /* Invert the X location */ + pchan->custom_translation[0] *= -1; + /* Invert the Y rotation */ + pchan->custom_rotation_euler[1] *= -1; + /* Invert the Z rotation */ + pchan->custom_rotation_euler[2] *= -1; + /* Skip the first two chars in the object name as those are used to store object type */ BLI_string_flip_side_name(name_flip, pchan->custom->id.name + 2, false, sizeof(name_flip)); Object *shape_ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, name_flip); + /* If name_flip doesn't exist, BKE_libblock_find_name() returns pchan->custom (best match) */ + shape_ob = shape_ob == pchan->custom ? NULL : shape_ob; + if (shape_ob != NULL) { /* A flipped shape object exists, use it! */ pchan->custom = shape_ob; } + else { + /* Flip shape */ + pchan->custom_scale_xyz[0] *= -1; + } } } |