diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-17 14:43:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-17 14:43:55 +0400 |
commit | 2dc6ca49b32ef2a8d73855b1f10a841792b94216 (patch) | |
tree | 6d2f23ca19e3162f1c0e1f706d1617643b70add0 /doc/python_api/rst/info_gotcha.rst | |
parent | 3335cf41f66c01e6fe710de695595a5aaddc3e41 (diff) |
py docs:
added python doc section on script performance and a note on relative file paths in the gotcha's page.
also added script for spell checking py comments.
Diffstat (limited to 'doc/python_api/rst/info_gotcha.rst')
-rw-r--r-- | doc/python_api/rst/info_gotcha.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index e7903dcf96a..b17debbb15c 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -223,6 +223,26 @@ While writing scripts that deal with armatures you may find you have to switch b This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode. +Relative File Paths +=================== + +Blenders relative file paths are not compatible with standard python modules such as ``sys`` and ``os``. + +Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path. + +A common case where you would run into this problem is when exporting a material with assosiated image paths. + +>>> bpy.path.abspath(image.filepath) + + +When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the `bpy.types.ID`. + +>>> bpy.path.abspath(image.filepath, library=image.library) + + +These returns the absolute path which can be used with native python modules. + + Unicode Problems ================ |