new python submodule. eg.

from bpy.app import binary_path, version, version_string, home

can add constant variables from blender here as needed (maybe functions too... bpy.app.memory_usage() ?)
This commit is contained in:
2010-01-02 23:14:01 +00:00
parent e7d863cee5
commit 04d0261c37
7 changed files with 34 additions and 9 deletions

View File

@@ -223,12 +223,15 @@ static void bpy_init_modules( void )
/* blender info that wont change at runtime, add into _bpy */
{
extern char bprogname[]; /* argv[0] from creator.c */
PyObject *mod_dict= PyModule_GetDict(mod);
char tmpstr[256];
PyModule_AddStringConstant(mod, "_HOME", BLI_gethome());
PyDict_SetItemString(mod_dict, "_VERSION", Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
sprintf(tmpstr, "%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
PyModule_AddStringConstant(mod, "_VERSION_STR", tmpstr);
PyModule_AddStringConstant(mod, "_BINPATH", bprogname);
}
/* add our own modules dir, this is a python package */