PyAPI: expose the file version via bpy.app.version_file

This exposes the version saved to the file,
compatible with `bpy.data.version`.

This is needed to write out version information into key-maps.
This commit is contained in:
Campbell Barton 2020-10-22 12:29:38 +11:00
parent e9ae8148ae
commit b9c8eb3b0c
1 changed files with 3 additions and 0 deletions

View File

@ -82,6 +82,7 @@ static PyTypeObject BlenderAppType;
static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 83, 1)"},
{"version_file", "The blend file version, compatible with ``bpy.data.version``"},
{"version_string", "The Blender version formatted as a string"},
{"version_cycle", "The release status of this build alpha/beta/rc/release"},
{"version_char", "Deprecated, always an empty string"},
@ -151,6 +152,8 @@ static PyObject *make_app_info(void)
SetObjItem(
PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH));
SetObjItem(PyC_Tuple_Pack_I32(
BLENDER_FILE_VERSION / 100, BLENDER_FILE_VERSION % 100, BLENDER_FILE_SUBVERSION));
SetStrItem(BKE_blender_version_string());
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));