From e2b43a4dbad99ab54f0d1df2b96db4d57e371b74 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Sat, 17 May 2025 08:36:33 +0200 Subject: [PATCH] Cleanup: armature bone display type naming - User visible rename: "Use Armature Setting" -> "Armature Defined" (just added in 8bf73386f26) - Internal code only: rename eArmature_Drawtype enum items to have ARM_DRAW_TYPE_ prefix, instead of just ARM_ (just ARM_ is used in several unrelated enums, leading to confusion) This is re-apply of PR !138982 was backed out in cef7cb45343 due to Win x64 buildbot failure. The error was: ``` view3d_navigate_view_all.cc(321): error C2672: 'blender::bounds::transform_bounds': no matching overloaded function found view3d_navigate_view_all.cc(322): error C2784: 'blender::Bounds> blender::bounds::transform_bounds(const blender::MatBase &,const blender::Bounds> &)': could not deduce template argument for 'const blender::MatBase &' from 'const blender::float4x4' ``` which has nothing whatsoever to do with the PR. But something in the PR (i.e. rename of a completely unrelated enum entries) presumably makes this specific VS2019 compiler version not be able to resolve template argument type. Again, in completely unrelated file with completely unrelated types. So "the fix" is to help VS2019 compiler in that place by explicitly specifying the template types. What exactly in the original change triggers the issue, remains a mystery. "It is known" that VS2019 is quite funky in template argument deduction, maybe this is one of these cases. Pull Request: https://projects.blender.org/blender/blender/pulls/138995 --- .../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 +- .../space_view3d/view3d_navigate_view_all.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 +++++++++++-------- 11 files changed, 41 insertions(+), 37 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_450.cc b/source/blender/blenloader/intern/versioning_450.cc index bec12feb31b..9a76661ce57 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_BONE_DEFAULT; }); + &arm->bonebase, [](Bone *bone) { bone->drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED; }); 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 f7c95a87ec5..690d43dcd46 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_ENVELOPE); + const bool is_envelope_draw = (ctx->drawtype == ARM_DRAW_TYPE_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_OCTA: + case ARM_DRAW_TYPE_OCTA: bone_draw_octa(ctx, bone, boneflag, select_id); break; - case ARM_LINE: + case ARM_DRAW_TYPE_STICK: bone_draw_line(ctx, bone, boneflag, select_id); break; - case ARM_B_BONE: + case ARM_DRAW_TYPE_B_BONE: bone_draw_b_bone(ctx, bone, boneflag, select_id); break; - case ARM_ENVELOPE: + case ARM_DRAW_TYPE_ENVELOPE: bone_draw_envelope(ctx, bone, boneflag, select_id); break; - case ARM_WIRE: + case ARM_DRAW_TYPE_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_B_BONE, ARM_WIRE)) { + else if (ELEM(drawtype, ARM_DRAW_TYPE_B_BONE, ARM_DRAW_TYPE_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_BONE_DEFAULT ? + const eArmature_Drawtype drawtype = eBone->drawtype == ARM_DRAW_TYPE_ARMATURE_DEFINED ? 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_BONE_DEFAULT ? + const eArmature_Drawtype drawtype = bone->drawtype == ARM_DRAW_TYPE_ARMATURE_DEFINED ? 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 27fdc0af4f6..e2cdd4873c5 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_OCTA; + eArmature_Drawtype drawtype = ARM_DRAW_TYPE_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 ef380a8ec0f..02f9ef9202b 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_BONE_DEFAULT; + bone->drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED; 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 6fbb54cb557..b2adae1c534 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_LINE; + arm->drawtype = ARM_DRAW_TYPE_STICK; 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 e61e67ae0ef..a78a2b049c1 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_B_BONE) { + if (arm->drawtype == ARM_DRAW_TYPE_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/space_view3d/view3d_navigate_view_all.cc b/source/blender/editors/space_view3d/view3d_navigate_view_all.cc index 95ead0b980c..8a193a04255 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_view_all.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_view_all.cc @@ -318,7 +318,7 @@ std::optional> view3d_calc_minmax_selected(Depsgraph *de { const std::optional> bounds = BKE_pose_minmax(ob_eval_iter, true); if (bounds) { - const blender::Bounds world_bounds = blender::bounds::transform_bounds( + const blender::Bounds world_bounds = blender::bounds::transform_bounds( ob_eval->object_to_world(), *bounds); minmax_v3v3_v3(min, max, world_bounds.min); minmax_v3v3_v3(min, max, world_bounds.max); diff --git a/source/blender/editors/transform/transform_mode.cc b/source/blender/editors/transform/transform_mode.cc index 4481d1b061a..3cd7acf02e7 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_ENVELOPE) { + if (arm->drawtype == ARM_DRAW_TYPE_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 996190f5bee..ca8813f4eab 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_OCTA, \ + .drawtype = ARM_DRAW_TYPE_OCTA, \ } #define _DNA_DEFAULT_Bone \ { \ - .drawtype = ARM_BONE_DEFAULT, \ + .drawtype = ARM_DRAW_TYPE_ARMATURE_DEFINED, \ } /* clang-format on */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 61815d89523..4445b47cccf 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_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, + 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, } eArmature_Drawtype; /* armature->deformflag */ diff --git a/source/blender/makesrna/intern/rna_armature.cc b/source/blender/makesrna/intern/rna_armature.cc index 7b07513d2f5..c9d6c44ac49 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_BONE_DEFAULT, - "USE_ARMATURE_SETTING", + {ARM_DRAW_TYPE_ARMATURE_DEFINED, + "ARMATURE_DEFINED", 0, - "Use Armature Setting", + "Armature Defined", "Use display mode from armature (default)"}, - {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, + {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, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"}, - {ARM_ENVELOPE, + {ARM_DRAW_TYPE_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"}, - {ARM_WIRE, + {ARM_DRAW_TYPE_WIRE, "WIRE", 0, "Wire", @@ -2158,19 +2158,23 @@ static void rna_def_armature(BlenderRNA *brna) PropertyRNA *parm; static const EnumPropertyItem prop_drawtype_items[] = { - {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, + {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, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"}, - {ARM_ENVELOPE, + {ARM_DRAW_TYPE_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"}, - {ARM_WIRE, + {ARM_DRAW_TYPE_WIRE, "WIRE", 0, "Wire",