diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-01-20 07:57:47 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-01-20 07:57:47 +0300 |
commit | 57b91ddce887e097b1f1c7ca5f502c0ec2ffa084 (patch) | |
tree | fea0979d6e5df04c704a8c027a29dc1ec97ac689 /source/blender/python/BPY_interface.c | |
parent | 32fa24339e31c12edfafe72682d8b0705f8a2f97 (diff) |
Scripts in menus:
- now the file .Bpymenus is in ~/.blender/, please delete the old one
- both ~/.blender/scripts/ and (if set) user pref scripts dir are scanned for scripts
- 2 scripts of the same group with the same name, one in each dir: user pref overwrites the other's entry
- fixed the problem with trailing backslash, was my fault (used NULL instead of "/" for relbase in BLI_make_file_string
- slightly changed msgs to be less verbose and parsing to be more forgiving
- if a script registers with a wrong group, 'Misc' is used instead
- 'Blender' tag is now checked, gives a warning (notice) msg if script is newer than Blender program
Blender.NMesh module and doc:
- added vertex.sel var to get/set selection state of vertex.
Diffstat (limited to 'source/blender/python/BPY_interface.c')
-rw-r--r-- | source/blender/python/BPY_interface.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index c2ab8f5319a..e1320bb6b30 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -205,7 +205,7 @@ void init_syspath(void) else printf ("Warning: could not determine argv[0] path\n"); - if (U.pythondir && strcmp(U.pythondir, "")) { + if (U.pythondir && U.pythondir[0] != '\0') { p = Py_BuildValue("s", U.pythondir); syspath_append(p); /* append to module search path */ } @@ -480,6 +480,7 @@ int BPY_menu_do_python(short menutype, int event) FILE *fp = NULL; char *buffer; char filestr[FILE_MAXDIR+FILE_MAXFILE]; + char dirname[FILE_MAXDIR]; Script *script = G.main->script.first; int len; @@ -495,6 +496,10 @@ int BPY_menu_do_python(short menutype, int event) if (!pym) return 0; + if (pym->version > G.version) + notice ("Version mismatch: script was written for Blender %d. " + "It may fail with yours: %d.", pym->version, G.version); + /* if there are submenus, let the user choose one from a pupmenu that we * create here.*/ pysm = pym->submenus; @@ -521,7 +526,13 @@ int BPY_menu_do_python(short menutype, int event) pyarg = Py_None; } - BLI_make_file_string(NULL, filestr, U.pythondir, pym->filename); + if (pym->dir) /* script is in U.pythondir */ + BLI_make_file_string("/", filestr, U.pythondir, pym->filename); + else { /* script is in ~/.blender/scripts/ */ + BLI_make_file_string("/", dirname, BLI_gethome(), ".blender/scripts"); + BLI_make_file_string("/", filestr, dirname, pym->filename); + } + fp = fopen(filestr, "r"); if (!fp) { /* later also support userhome/.blender/scripts/ or whatever */ printf("Error loading script: couldn't open file %s\n", filestr); |