Partial versioning code, very much WIP

Just committing to transfer to another computer.
This commit is contained in:
demeterdzadik@gmail.com
2023-10-10 16:23:05 +02:00
committed by Demeter Dzadik
parent 229a84ef90
commit 43f8efbf82
2 changed files with 31 additions and 1 deletions

View File

@@ -1183,6 +1183,30 @@ static void enable_geometry_nodes_is_modifier(Main &bmain)
}
}
static void version_bone_color_theme(Main &bmain)
{
auto version_bone_color = [&](animrig::BoneColor &color) {
// do stuff.
};
/* Version pose bone colors. */
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
if (ob->type != OB_ARMATURE || !ob->pose) {
continue;
}
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
version_bone_color(pchan->color);
}
}
/* Version armature bone colors. */
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
blender::animrig::ANIM_armature_foreach_bone(
&arm->bonebase, [&](Bone *bone) { version_bone_color(bone->color); });
}
}
void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
{
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 1)) {

View File

@@ -66,6 +66,12 @@
/* For versioning we only ever want to manipulate preferences passed in. */
#define U BLI_STATIC_ASSERT(false, "Global 'U' not allowed, only use arguments passed in!")
static void version_bone_color_theme(bTheme *btheme)
{
/* Reset the bone colors to the new default values. */
memcpy(btheme->tarm, &U_theme_default.tarm, sizeof(*btheme->tarm) * 20);
}
static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
{
@@ -380,7 +386,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
*/
{
/* Keep this block, even when empty. */
memcpy(btheme->tarm, &U_theme_default.tarm, sizeof(*btheme->tarm) * 20);
version_bone_color_theme(btheme);
}
#undef FROM_DEFAULT_V4_UCHAR