diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-06-15 08:16:30 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-06-15 08:16:30 +0400 |
commit | 467311ad347d4c89f45e209985f934d1f9077faa (patch) | |
tree | 18db1b14446c5a5cfbbe9ab54bd332eeddb380c6 /source/blender/python/api2_2x/doc/Sys.py | |
parent | 317e067ecb91c2127c12cee3808a5bb2402b82e4 (diff) |
- New script:
Wim Van Hoydonck contributed the famous Knife script (put under Modifiers group) developed by Stefano Selleri and himself (thank to both!)
- Added helper function Blender.sys.makename, updated docs and script ac3d_export to use it (shall update other exporters too):
this function is just a simple helper to format a filename as needed (change extension, strip dirname, it defaults to use G.sce as path).
- Added a test method: Blender.Scene.getScriptlinks(eventName):
just testing, if this path proves useful other functions will be added and made general, for objects, etc.
Diffstat (limited to 'source/blender/python/api2_2x/doc/Sys.py')
-rw-r--r-- | source/blender/python/api2_2x/doc/Sys.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/doc/Sys.py b/source/blender/python/api2_2x/doc/Sys.py index 515bc6e3fee..d969fe545b4 100644 --- a/source/blender/python/api2_2x/doc/Sys.py +++ b/source/blender/python/api2_2x/doc/Sys.py @@ -68,6 +68,35 @@ def splitext (path): @return: (root, ext) """ +def makename (path = "Blender.Get('filename')", ext = "", strip = 0): + """ + Remove extension from 'path', append extension 'ext' (if given) + to the result and return it. If 'strip' is non-zero, also remove + dirname from path. + + Example:: + import Blender + from Blender.sys import * + print makename('/path/to/myfile.txt','.abc', 1) # returns 'myfile.abc' + + print makename('/path/to/myfile.obj', '-01.obj') # '/path/to/myfile-01.obj' + + print makename('/path/to/myfile.txt', strip = 1) # 'myfile' + + # note that: + print makename(ext = '.txt') + # is equivalent to: + print sys.splitext(Blender.Get('filename'))[0]) + '.txt' + + @type path: string + @param path: a path name or Blender.Get('filename'), if not given. + @type ext: string + @param ext: an extension to append. For flexibility, a dot ('.') is + not automatically included. + @rtype: string + @return: the resulting string + """ + def exists(path): """ Tell if the given pathname (file or dir) exists. |