Cleanup: armature bone display type naming

- User visible rename: "Use Armature Setting" -> "Armature Defined"
  (just added in 8bf73386f2)
- 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 cef7cb4534 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::VecBase<T,3>> blender::bounds::transform_bounds(const blender::MatBase<T,Size,Size,NumCol*NumRow%4==0?4:1*sizeof(T)> &,const blender::Bounds<blender::VecBase<T,3>> &)': could not deduce template argument for 'const blender::MatBase<T,Size,Size,NumCol*NumRow%4==0?4:1*sizeof(T)> &' 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
This commit is contained in:
Aras Pranckevicius
2025-05-17 08:36:33 +02:00
committed by Aras Pranckevicius
parent eaedc88c48
commit e2b43a4dba
11 changed files with 41 additions and 37 deletions

View File

@@ -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");
}
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -2805,7 +2805,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain,
bArmature *arm = static_cast<bArmature *>(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<ListBase>("edbo armature");
MVertSkin *mvert_skin = static_cast<MVertSkin *>(

View File

@@ -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<const bArmature *>(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;

View File

@@ -318,7 +318,7 @@ std::optional<blender::Bounds<float3>> view3d_calc_minmax_selected(Depsgraph *de
{
const std::optional<blender::Bounds<float3>> bounds = BKE_pose_minmax(ob_eval_iter, true);
if (bounds) {
const blender::Bounds<float3> world_bounds = blender::bounds::transform_bounds(
const blender::Bounds<float3> world_bounds = blender::bounds::transform_bounds<float, 4>(
ob_eval->object_to_world(), *bounds);
minmax_v3v3_v3(min, max, world_bounds.min);
minmax_v3v3_v3(min, max, world_bounds.max);

View File

@@ -45,7 +45,7 @@ eTfmMode transform_mode_really_used(bContext *C, eTfmMode mode)
return TFM_RESIZE;
}
bArmature *arm = static_cast<bArmature *>(ob->data);
if (arm->drawtype == ARM_ENVELOPE) {
if (arm->drawtype == ARM_DRAW_TYPE_ENVELOPE) {
return TFM_BONE_ENVELOPE_DIST;
}
}

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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",