From 04d0261c37ccd28e8466312f5a2d8260c5a4c9e9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 2 Jan 2010 23:14:01 +0000 Subject: 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() ?) --- source/blender/python/intern/bpy_interface.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/python/intern/bpy_interface.c') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 5ac3a233e11..2fcb36f6d5b 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -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 */ -- cgit v1.2.3