Fix #115434: custom bone colors invisible in stick mode #115477

4 changed files with 66 additions and 13 deletions

View File

@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 8
#define BLENDER_FILE_SUBVERSION 9
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@ -2578,6 +2578,12 @@ static int rebuild_pose_bone(
pchan->bone = bone;
pchan->parent = parchan;
/* Prevent custom bone colors from having alpha zero.
* Part of the fix for issue #115434. */
pchan->color.custom.solid[3] = 255;
pchan->color.custom.select[3] = 255;
pchan->color.custom.active[3] = 255;
/* We ensure the current pchan is immediately after the one we just generated/updated in the
* previous call to `rebuild_pose_bone`.
*

View File

@ -1759,6 +1759,16 @@ static void versioning_grease_pencil_stroke_radii_scaling(GreasePencil *grease_p
}
}
static void version_ensure_opaque_bone_colors_recursive(Bone *bone)
{
bone->color.custom.solid[3] = 255;
bone->color.custom.select[3] = 255;
bone->color.custom.active[3] = 255;
LISTBASE_FOREACH (Bone *, child_bone, &bone->childbase) {
version_ensure_opaque_bone_colors_recursive(child_bone);
}
}
void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
{
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 1)) {
@ -2485,18 +2495,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
versioning_nodes_dynamic_sockets(*ntree);
}
}
/**
* Versioning code until next subversion bump goes here.
*
* \note Be sure to check when bumping the version:
* - #do_versions_after_linking_400 in this file.
* - `versioning_userdef.cc`, #blo_do_versions_userdef
* - `versioning_userdef.cc`, #do_versions_theme
*
* \note Keep this message at the bottom of the function.
*/
{
/* Keep this block, even when empty. */
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 9)) {
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
if (ntree->type == NTREE_GEOMETRY) {
version_geometry_nodes_use_rotation_socket(*ntree);
@ -2528,5 +2528,44 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
material->displacement_method = displacement_method;
}
}
/* Prevent custom bone colors from having alpha zero.
* Part of the fix for issue #115434. */
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
LISTBASE_FOREACH (Bone *, bone, &arm->bonebase) {
version_ensure_opaque_bone_colors_recursive(bone);
}
if (arm->edbo) {
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
ebone->color.custom.solid[3] = 255;
ebone->color.custom.select[3] = 255;
ebone->color.custom.active[3] = 255;
}
}
}
LISTBASE_FOREACH (Object *, obj, &bmain->objects) {
if (obj->pose == nullptr) {
continue;
}
LISTBASE_FOREACH (bPoseChannel *, pchan, &obj->pose->chanbase) {
pchan->color.custom.solid[3] = 255;
pchan->color.custom.select[3] = 255;
pchan->color.custom.active[3] = 255;
}
}
}
/**
* Versioning code until next subversion bump goes here.
*
* \note Be sure to check when bumping the version:
* - #do_versions_after_linking_400 in this file.
* - `versioning_userdef.cc`, #blo_do_versions_userdef
* - `versioning_userdef.cc`, #do_versions_theme
*
* \note Keep this message at the bottom of the function.
*/
{
/* Keep this block, even when empty. */
}
}

View File

@ -83,6 +83,12 @@ EditBone *ED_armature_ebone_add(bArmature *arm, const char *name)
bone->ease1 = 1.0f;
bone->ease2 = 1.0f;
/* Prevent custom bone colors from having alpha zero.
* Part of the fix for issue #115434. */
bone->color.custom.solid[3] = 255;
bone->color.custom.select[3] = 255;
bone->color.custom.active[3] = 255;
copy_v3_fl(bone->scale_in, 1.0f);
copy_v3_fl(bone->scale_out, 1.0f);
@ -1522,6 +1528,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
}
}
newbone->color = ebone->color;
newbone->weight = ebone->weight;
newbone->dist = ebone->dist;
newbone->xwidth = ebone->xwidth;