Merge branch 'master' into blender2.8

This commit is contained in:
Sergey Sharybin 2017-03-15 14:19:53 +01:00
commit 6b720dffc9
2 changed files with 14 additions and 4 deletions

View File

@ -42,6 +42,7 @@ void BKE_blender_free(void);
void BKE_blender_globals_init(void);
void BKE_blender_globals_clear(void);
void BKE_blender_version_string(char *version_str, size_t maxncpy, short version, short subversion, bool v_prefix, bool include_subversion);
void BKE_blender_userdef_free(void);
void BKE_blender_userdef_refresh(void);

View File

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