Fix #145190: Armature Symmetrize not symmetrizing Viewport Display
If the mirror bone was already existing, it was not copying over `Display As` (which was reported) but also `Bone Color` was not transferred. Since the second does not suit _all_ workflows, this was made optional (defaulting to OFF). Pull Request: https://projects.blender.org/blender/blender/pulls/145221
This commit is contained in:
committed by
Philipp Oeser
parent
c249a11922
commit
7f94b86038
@@ -1286,6 +1286,7 @@ static wmOperatorStatus armature_symmetrize_exec(bContext *C, wmOperator *op)
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
const int direction = RNA_enum_get(op->ptr, "direction");
|
||||
const bool copy_bone_colors = RNA_boolean_get(op->ptr, "copy_bone_colors");
|
||||
const int axis = 0;
|
||||
|
||||
/* cancel if nothing selected */
|
||||
@@ -1425,6 +1426,16 @@ static wmOperatorStatus armature_symmetrize_exec(bContext *C, wmOperator *op)
|
||||
/* Copy flags in case bone is pre-existing data. */
|
||||
ebone->flag = (ebone->flag & ~flag_copy) | (ebone_iter->flag & flag_copy);
|
||||
|
||||
/* Copy Viewport Display. */
|
||||
ebone->drawtype = ebone_iter->drawtype;
|
||||
if (copy_bone_colors) {
|
||||
ebone->color.palette_index = ebone_iter->color.palette_index;
|
||||
copy_v4_v4_uchar(ebone->color.custom.active, ebone_iter->color.custom.active);
|
||||
copy_v4_v4_uchar(ebone->color.custom.select, ebone_iter->color.custom.select);
|
||||
copy_v4_v4_uchar(ebone->color.custom.solid, ebone_iter->color.custom.solid);
|
||||
ebone->color.custom.flag = ebone_iter->color.custom.flag;
|
||||
}
|
||||
|
||||
if (ebone_iter->parent == nullptr) {
|
||||
/* If this bone has no parent,
|
||||
* Set the duplicate->parent to nullptr
|
||||
@@ -1547,6 +1558,8 @@ void ARMATURE_OT_symmetrize(wmOperatorType *ot)
|
||||
-1,
|
||||
"Direction",
|
||||
"Which sides to copy from and to (when both are selected)");
|
||||
ot->prop = RNA_def_boolean(
|
||||
ot->srna, "copy_bone_colors", false, "Bone Colors", "Copy colors to existing bones");
|
||||
}
|
||||
|
||||
/* ------------------------------------------ */
|
||||
|
||||
Reference in New Issue
Block a user