Skip to content

Commit

Permalink
UPBGE: Add upbge version info to stats (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
lordloki authored Jul 30, 2018
1 parent 59d33db commit 727c1fb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions source/blender/blenkernel/BKE_blender.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ 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_upbge_version_string(
char *version_str, size_t maxncpy,
short version, short subversion, bool v_prefix, bool include_subversion);


void BKE_blender_userdef_data_swap(struct UserDef *userdef_dst, struct UserDef *userdef_src);
void BKE_blender_userdef_data_set(struct UserDef *userdef);
Expand Down
1 change: 1 addition & 0 deletions source/blender/blenkernel/BKE_blender_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
#define BLENDER_VERSION_CYCLE alpha

extern char versionstr[]; /* from blender.c */
extern char upbge_versionstr[]; /* from blender.c */

#endif /* __BKE_BLENDER_VERSION_H__ */
14 changes: 14 additions & 0 deletions source/blender/blenkernel/intern/blender.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Global G;
UserDef U;

char versionstr[48] = "";
char upbge_versionstr[48] = "";

/* ********** free ********** */

Expand Down Expand Up @@ -117,6 +118,18 @@ void BKE_blender_version_string(char *version_str, size_t maxncpy, short version
}
}

void BKE_upbge_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) {
BLI_snprintf(version_str, maxncpy, "%s0.%d.%d", prefix, version, subversion);
}
else {
BLI_snprintf(version_str, maxncpy, "%s0.%d", prefix, version);
}
}

void BKE_blender_globals_init(void)
{
memset(&G, 0, sizeof(Global));
Expand All @@ -128,6 +141,7 @@ void BKE_blender_globals_init(void)
strcpy(G.ima, "//");

BKE_blender_version_string(versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true);
BKE_upbge_version_string(upbge_versionstr, sizeof(versionstr), UPBGE_VERSION, UPBGE_SUBVERSION, true, true);

#ifndef WITH_PYTHON_SECURITY /* default */
G.f |= G_SCRIPT_AUTOEXEC;
Expand Down
2 changes: 1 addition & 1 deletion source/blender/editors/space_info/info_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static void stats_string(Scene *scene)
s = stats->infostr;
ofs = 0;

ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", versionstr);
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s (based on Blender %s) | ", upbge_versionstr, versionstr);

if (scene->obedit) {
if (BKE_keyblock_from_object(scene->obedit))
Expand Down

0 comments on commit 727c1fb

Please sign in to comment.