diff options
Diffstat (limited to 'source/blender/blenkernel/intern/blender.c')
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index afd60102453..4e62ddd8888 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -100,6 +100,18 @@ void BKE_blender_free(void) free_nodesystem(); } +void BKE_blender_version_string(char *version_str, size_t maxncpy, short version, short subversion, bool v_prefix, bool include_subversion) +{ + const char *prefix = v_prefix ? "v" : ""; + + if (include_subversion && subversion > 0) { + BLI_snprintf(version_str, maxncpy, "%s%d.%02d.%d", prefix, version / 100, subversion % 100, subversion); + } + else { + BLI_snprintf(version_str, maxncpy, "%s%d.%02d", prefix, version / 100, version % 100); + } +} + void BKE_blender_globals_init(void) { memset(&G, 0, sizeof(Global)); @@ -110,10 +122,7 @@ void BKE_blender_globals_init(void) strcpy(G.ima, "//"); - if (BLENDER_SUBVERSION) - BLI_snprintf(versionstr, sizeof(versionstr), "v%d.%02d.%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION); - else - BLI_snprintf(versionstr, sizeof(versionstr), "v%d.%02d", BLENDER_VERSION / 100, BLENDER_VERSION % 100); + BKE_blender_version_string(versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true); #ifndef WITH_PYTHON_SECURITY /* default */ G.f |= G_SCRIPT_AUTOEXEC; |