diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-01-23 22:24:45 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-01-23 22:24:45 +0300 |
commit | 23a3a51e16c72d347f15790ed9e4d7bdc2d4f44a (patch) | |
tree | dd3279b095031344d2bc4bb19eee263d5b1ef6bc /source/blender/python/BPY_interface.c | |
parent | 5aad4bfceb454974e0800bfab08271c8b3baaff3 (diff) |
Blender's debug mode only worked on startup:
- G.f's G_DEBUG flag was being erased in blenkernel/intern/blender.c's
setup_app_data:
G.f= bfd->globalf
// added a line above it to fix this:
if (G.f & G_DEBUG) bfd->globalf |=G_DEBUG;
G.f= bfd->globalf;
BPython:
- debug info now only shown if Blender is started with '-d' option
- added ~/.blender/scripts to modules sys.path
- added two new functions to Blender.sys: basename and splitext
- added doc for Blender.sys, updated other docs
Diffstat (limited to 'source/blender/python/BPY_interface.c')
-rw-r--r-- | source/blender/python/BPY_interface.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 3a1fd5c26a0..225821dd8c5 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -146,12 +146,14 @@ void BPY_end_python(void) return; } -void syspath_append(PyObject *dir) +void syspath_append(char *dirname) { - PyObject *mod_sys, *dict, *path; + PyObject *mod_sys, *dict, *path, *dir; PyErr_Clear(); + dir = Py_BuildValue("s", dirname); + mod_sys = PyImport_ImportModule("sys"); /* new ref */ dict = PyModule_GetDict(mod_sys); /* borrowed ref */ path = PyDict_GetItemString(dict, "path"); /* borrowed ref */ @@ -198,19 +200,13 @@ void init_syspath(void) if (execdir[n-1] == '.') n--; /*fix for when run as ./blender */ execdir[n] = '\0'; - p = Py_BuildValue("s", execdir); - syspath_append(p); /* append to module search path */ + syspath_append(execdir); /* append to module search path */ /* set Blender.sys.progname */ } else printf ("Warning: could not determine argv[0] path\n"); - if (U.pythondir && U.pythondir[0] != '\0') { - p = Py_BuildValue("s", U.pythondir); - syspath_append(p); /* append to module search path */ - } - /* * bring in the site module so we can add * site-package dirs to sys.path @@ -236,7 +232,7 @@ void init_syspath(void) for (index = 0; index < size; index++) { item = PySequence_GetItem (p, index); /* new ref */ if( item ) - syspath_append (item); + syspath_append (PyString_AsString(item)); } } Py_DECREF(mod); @@ -273,7 +269,9 @@ void init_syspath(void) /*****************************************************************************/ void BPY_post_start_python(void) { - syspath_append(Py_BuildValue("s", U.pythondir)); + if (U.pythondir && U.pythondir[0] != '\0') + syspath_append(U.pythondir); /* append to module search path */ + BPyMenu_Init(0); /* get dynamic menus (registered scripts) data */ } |