UI: Adding LTS to Title Bar and other Version Changes
This tries to keep to the spirit of task of #124511. Title bar shows a more detailed version string, while status bar shows more compactly. "LTS" is included in the long form when defined. Patch version shown in both detailed and long form but only if non-zero. "Alpha", "Beta", "Release Candidate" included in long form, but uses " a", " b", " RC" for short form. Pull Request: https://projects.blender.org/blender/blender/pulls/125332
This commit is contained in:
committed by
Harley Acheson
parent
a78e56d465
commit
7374077610
@@ -26,6 +26,8 @@ extern "C" {
|
||||
#define BLENDER_VERSION_PATCH 0
|
||||
/** Blender release cycle stage: alpha/beta/rc/release. */
|
||||
#define BLENDER_VERSION_CYCLE alpha
|
||||
/** Blender release type suffix. LTS or blank. */
|
||||
#define BLENDER_VERSION_SUFFIX
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
@@ -50,6 +52,9 @@ const char *BKE_blender_version_string_compact(void);
|
||||
/** Returns true when version cycle is alpha, otherwise (beta, rc) returns false. */
|
||||
bool BKE_blender_version_is_alpha(void);
|
||||
|
||||
/** Returns true when version suffix is LTS, otherwise returns false. */
|
||||
bool BKE_blender_version_is_lts(void);
|
||||
|
||||
/**
|
||||
* Fill in given string buffer with user-readable formatted file version and subversion (if
|
||||
* provided).
|
||||
|
||||
@@ -97,34 +97,48 @@ static char blender_version_string_compact[48] = "";
|
||||
static void blender_version_init()
|
||||
{
|
||||
const char *version_cycle = "";
|
||||
const char *version_cycle_compact = "";
|
||||
if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) {
|
||||
version_cycle = " Alpha";
|
||||
version_cycle_compact = " a";
|
||||
}
|
||||
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) {
|
||||
version_cycle = " Beta";
|
||||
version_cycle_compact = " b";
|
||||
}
|
||||
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) {
|
||||
version_cycle = " Release Candidate";
|
||||
version_cycle_compact = " RC";
|
||||
}
|
||||
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
|
||||
version_cycle = "";
|
||||
version_cycle_compact = "";
|
||||
}
|
||||
else {
|
||||
BLI_assert_msg(0, "Invalid Blender version cycle");
|
||||
}
|
||||
|
||||
const char *version_patch = "";
|
||||
if (!STREQ(STRINGIFY(BLENDER_VERSION_PATCH), "0")) {
|
||||
version_patch = "." STRINGIFY(BLENDER_VERSION_PATCH);
|
||||
}
|
||||
|
||||
const char *version_suffix = BKE_blender_version_is_lts() ? " LTS" : "";
|
||||
|
||||
SNPRINTF(blender_version_string,
|
||||
"%d.%01d.%d%s",
|
||||
"%d.%01d%s%s%s",
|
||||
BLENDER_VERSION / 100,
|
||||
BLENDER_VERSION % 100,
|
||||
BLENDER_VERSION_PATCH,
|
||||
version_patch,
|
||||
version_suffix,
|
||||
version_cycle);
|
||||
|
||||
SNPRINTF(blender_version_string_compact,
|
||||
"%d.%01d%s",
|
||||
"%d.%01d%s%s",
|
||||
BLENDER_VERSION / 100,
|
||||
BLENDER_VERSION % 100,
|
||||
version_cycle);
|
||||
version_patch,
|
||||
version_cycle_compact);
|
||||
}
|
||||
|
||||
const char *BKE_blender_version_string()
|
||||
@@ -163,6 +177,11 @@ bool BKE_blender_version_is_alpha()
|
||||
return is_alpha;
|
||||
}
|
||||
|
||||
bool BKE_blender_version_is_lts()
|
||||
{
|
||||
return STREQ(STRINGIFY(BLENDER_VERSION_SUFFIX), "LTS");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -716,7 +716,8 @@ const char *ED_info_statusbar_string_ex(Main *bmain,
|
||||
if (info[0]) {
|
||||
ofs += BLI_snprintf_rlen(info + ofs, len - ofs, " | ");
|
||||
}
|
||||
ofs += BLI_snprintf_rlen(info + ofs, len - ofs, IFACE_("%s"), BKE_blender_version_string());
|
||||
ofs += BLI_snprintf_rlen(
|
||||
info + ofs, len - ofs, IFACE_("%s"), BKE_blender_version_string_compact());
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
@@ -539,7 +539,7 @@ void WM_window_title(wmWindowManager *wm, wmWindow *win, const char *title)
|
||||
}
|
||||
|
||||
str += " - Blender ";
|
||||
str += BKE_blender_version_string_compact();
|
||||
str += BKE_blender_version_string();
|
||||
|
||||
GHOST_SetTitle(handle, str.c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user