From cef7cb453431156257eefc505bf83bf4f4b1124b Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 16 May 2025 21:01:41 +0200 Subject: [PATCH] Revert "Cleanup: armature bone display type naming" This reverts commit 2149f462d46cfa (broke Windows x64 compilation on CI). Pull Request: https://projects.blender.org/blender/blender/pulls/138994 --- .../blenloader/intern/versioning_450.cc | 2 +- .../draw/engines/overlay/overlay_armature.cc | 18 +++++------ .../draw/engines/overlay/overlay_armature.hh | 2 +- .../blender/editors/armature/armature_add.cc | 2 +- .../blender/editors/object/object_modifier.cc | 2 +- .../space_view3d/view3d_gizmo_armature.cc | 2 +- .../editors/transform/transform_mode.cc | 2 +- .../blender/makesdna/DNA_armature_defaults.h | 4 +-- source/blender/makesdna/DNA_armature_types.h | 12 ++++---- .../blender/makesrna/intern/rna_armature.cc | 30 ++++++++----------- 10 files changed, 36 insertions(+), 40 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_450.cc b/source/blender/blenloader/intern/versioning_450.cc index 9a76661ce57..bec12feb31b 100644 --- a/source/blender/blenloader/intern/versioning_450.cc +++ b/source/blender/blenloader/intern/versioning_450.cc @@ -4343,7 +4343,7 @@ static void version_set_default_bone_drawtype(Main *bmain) { LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) { blender::animrig::ANIM_armature_foreach_bone( - &arm->bonebase, [](Bone *bone) { bone->drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED; }); + &arm->bonebase, [](Bone *bone) { bone->drawtype = ARM_BONE_DEFAULT; }); BLI_assert_msg(!arm->edbo, "Armatures should not be saved in edit mode"); } } diff --git a/source/blender/draw/engines/overlay/overlay_armature.cc b/source/blender/draw/engines/overlay/overlay_armature.cc index 690d43dcd46..f7c95a87ec5 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.cc +++ b/source/blender/draw/engines/overlay/overlay_armature.cc @@ -1246,7 +1246,7 @@ static void draw_points(const Armatures::DrawContext *ctx, copy_v4_v4(col_wire_root, (ctx->const_color) ? ctx->const_color : &theme.colors.vert.x); copy_v4_v4(col_wire_tail, (ctx->const_color) ? ctx->const_color : &theme.colors.vert.x); - const bool is_envelope_draw = (ctx->drawtype == ARM_DRAW_TYPE_ENVELOPE); + const bool is_envelope_draw = (ctx->drawtype == ARM_ENVELOPE); const float envelope_ignore = -1.0f; col_wire_tail[3] = col_wire_root[3] = get_bone_wire_thickness(ctx, boneflag); @@ -1574,19 +1574,19 @@ static void bone_draw(const eArmature_Drawtype drawtype, } switch (drawtype) { - case ARM_DRAW_TYPE_OCTA: + case ARM_OCTA: bone_draw_octa(ctx, bone, boneflag, select_id); break; - case ARM_DRAW_TYPE_STICK: + case ARM_LINE: bone_draw_line(ctx, bone, boneflag, select_id); break; - case ARM_DRAW_TYPE_B_BONE: + case ARM_B_BONE: bone_draw_b_bone(ctx, bone, boneflag, select_id); break; - case ARM_DRAW_TYPE_ENVELOPE: + case ARM_ENVELOPE: bone_draw_envelope(ctx, bone, boneflag, select_id); break; - case ARM_DRAW_TYPE_WIRE: + case ARM_WIRE: bone_draw_wire(ctx, bone, boneflag, select_id); break; default: @@ -1865,7 +1865,7 @@ static void bone_draw_update_display_matrix(const eArmature_Drawtype drawtype, if (use_custom_shape) { draw_bone_update_disp_matrix_custom_shape(bone); } - else if (ELEM(drawtype, ARM_DRAW_TYPE_B_BONE, ARM_DRAW_TYPE_WIRE)) { + else if (ELEM(drawtype, ARM_B_BONE, ARM_WIRE)) { draw_bone_update_disp_matrix_bbone(bone); } else { @@ -1926,7 +1926,7 @@ void Armatures::draw_armature_edit(Armatures::DrawContext *ctx) draw_bone_relations(ctx, bone, boneflag); } - const eArmature_Drawtype drawtype = eBone->drawtype == ARM_DRAW_TYPE_ARMATURE_DEFINED ? + const eArmature_Drawtype drawtype = eBone->drawtype == ARM_BONE_DEFAULT ? arm_drawtype : eArmature_Drawtype(eBone->drawtype); bone_draw_update_display_matrix(drawtype, false, bone); @@ -2060,7 +2060,7 @@ void Armatures::draw_armature_pose(Armatures::DrawContext *ctx) draw_bone_relations(ctx, bone_ptr, boneflag); } - const eArmature_Drawtype drawtype = bone->drawtype == ARM_DRAW_TYPE_ARMATURE_DEFINED ? + const eArmature_Drawtype drawtype = bone->drawtype == ARM_BONE_DEFAULT ? arm_drawtype : eArmature_Drawtype(bone->drawtype); bone_draw_update_display_matrix(drawtype, use_custom_shape, bone_ptr); diff --git a/source/blender/draw/engines/overlay/overlay_armature.hh b/source/blender/draw/engines/overlay/overlay_armature.hh index e2cdd4873c5..27fdc0af4f6 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.hh +++ b/source/blender/draw/engines/overlay/overlay_armature.hh @@ -478,7 +478,7 @@ class Armatures : Overlay { /* Note: can be mutated inside `draw_armature_pose()`. */ eArmatureDrawMode draw_mode = ARM_DRAW_MODE_OBJECT; - eArmature_Drawtype drawtype = ARM_DRAW_TYPE_OCTA; + eArmature_Drawtype drawtype = ARM_OCTA; Armatures::BoneBuffers *bone_buf = nullptr; Resources *res = nullptr; diff --git a/source/blender/editors/armature/armature_add.cc b/source/blender/editors/armature/armature_add.cc index f97061974c5..cbe6e750271 100644 --- a/source/blender/editors/armature/armature_add.cc +++ b/source/blender/editors/armature/armature_add.cc @@ -70,7 +70,7 @@ EditBone *ED_armature_ebone_add(bArmature *arm, const char *name) BLI_addtail(arm->edbo, bone); bone->flag |= BONE_TIPSEL; - bone->drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED; + bone->drawtype = ARM_BONE_DEFAULT; bone->weight = 1.0f; bone->dist = 0.25f; bone->xwidth = 0.1f; diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc index c4ae61c9267..0d7bb5b5c80 100644 --- a/source/blender/editors/object/object_modifier.cc +++ b/source/blender/editors/object/object_modifier.cc @@ -2805,7 +2805,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain, bArmature *arm = static_cast(arm_ob->data); ANIM_armature_bonecoll_show_all(arm); arm_ob->dtx |= OB_DRAW_IN_FRONT; - arm->drawtype = ARM_DRAW_TYPE_STICK; + arm->drawtype = ARM_LINE; arm->edbo = MEM_callocN("edbo armature"); MVertSkin *mvert_skin = static_cast( diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.cc b/source/blender/editors/space_view3d/view3d_gizmo_armature.cc index a78a2b049c1..e61e67ae0ef 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_armature.cc +++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.cc @@ -117,7 +117,7 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType Object *ob = BKE_object_pose_armature_get(base->object); if (ob) { const bArmature *arm = static_cast(ob->data); - if (arm->drawtype == ARM_DRAW_TYPE_B_BONE) { + if (arm->drawtype == ARM_B_BONE) { bPoseChannel *pchan = BKE_pose_channel_active_if_bonecoll_visible(ob); if (pchan && pchan->bone->segments > 1) { return true; diff --git a/source/blender/editors/transform/transform_mode.cc b/source/blender/editors/transform/transform_mode.cc index 3cd7acf02e7..4481d1b061a 100644 --- a/source/blender/editors/transform/transform_mode.cc +++ b/source/blender/editors/transform/transform_mode.cc @@ -45,7 +45,7 @@ eTfmMode transform_mode_really_used(bContext *C, eTfmMode mode) return TFM_RESIZE; } bArmature *arm = static_cast(ob->data); - if (arm->drawtype == ARM_DRAW_TYPE_ENVELOPE) { + if (arm->drawtype == ARM_ENVELOPE) { return TFM_BONE_ENVELOPE_DIST; } } diff --git a/source/blender/makesdna/DNA_armature_defaults.h b/source/blender/makesdna/DNA_armature_defaults.h index ca8813f4eab..996190f5bee 100644 --- a/source/blender/makesdna/DNA_armature_defaults.h +++ b/source/blender/makesdna/DNA_armature_defaults.h @@ -15,12 +15,12 @@ .deformflag = ARM_DEF_VGROUP | ARM_DEF_ENVELOPE, \ .flag = ARM_COL_CUSTOM, /* custom bone-group colors */ \ .layer = 1, \ - .drawtype = ARM_DRAW_TYPE_OCTA, \ + .drawtype = ARM_OCTA, \ } #define _DNA_DEFAULT_Bone \ { \ - .drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED, \ + .drawtype = ARM_BONE_DEFAULT, \ } /* clang-format on */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 4445b47cccf..61815d89523 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -374,12 +374,12 @@ typedef enum eArmature_Flag { /* armature->drawtype */ typedef enum eArmature_Drawtype { - ARM_DRAW_TYPE_ARMATURE_DEFINED = -1, /* Use draw type from Armature (only used on Bones). */ - ARM_DRAW_TYPE_OCTA = 0, - ARM_DRAW_TYPE_STICK = 1, - ARM_DRAW_TYPE_B_BONE = 2, - ARM_DRAW_TYPE_ENVELOPE = 3, - ARM_DRAW_TYPE_WIRE = 4, + ARM_BONE_DEFAULT = -1, /* Use draw type from Armature (only used on Bones). */ + ARM_OCTA = 0, + ARM_LINE = 1, + ARM_B_BONE = 2, + ARM_ENVELOPE = 3, + ARM_WIRE = 4, } eArmature_Drawtype; /* armature->deformflag */ diff --git a/source/blender/makesrna/intern/rna_armature.cc b/source/blender/makesrna/intern/rna_armature.cc index c9d6c44ac49..7b07513d2f5 100644 --- a/source/blender/makesrna/intern/rna_armature.cc +++ b/source/blender/makesrna/intern/rna_armature.cc @@ -1364,24 +1364,24 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) }; static const EnumPropertyItem prop_drawtype_items[] = { - {ARM_DRAW_TYPE_ARMATURE_DEFINED, - "ARMATURE_DEFINED", + {ARM_BONE_DEFAULT, + "USE_ARMATURE_SETTING", 0, - "Armature Defined", + "Use Armature Setting", "Use display mode from armature (default)"}, - {ARM_DRAW_TYPE_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape"}, - {ARM_DRAW_TYPE_STICK, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"}, - {ARM_DRAW_TYPE_B_BONE, + {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape"}, + {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"}, + {ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"}, - {ARM_DRAW_TYPE_ENVELOPE, + {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"}, - {ARM_DRAW_TYPE_WIRE, + {ARM_WIRE, "WIRE", 0, "Wire", @@ -2158,23 +2158,19 @@ static void rna_def_armature(BlenderRNA *brna) PropertyRNA *parm; static const EnumPropertyItem prop_drawtype_items[] = { - {ARM_DRAW_TYPE_OCTA, - "OCTAHEDRAL", - 0, - "Octahedral", - "Display bones as octahedral shape (default)"}, - {ARM_DRAW_TYPE_STICK, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"}, - {ARM_DRAW_TYPE_B_BONE, + {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"}, + {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"}, + {ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"}, - {ARM_DRAW_TYPE_ENVELOPE, + {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"}, - {ARM_DRAW_TYPE_WIRE, + {ARM_WIRE, "WIRE", 0, "Wire",