Core issue exists since ages - the thing you get from bpy.types.YOUR_OT_operator is fuzzy, and may change,
due to the fact that both Operator and OperatorProperties share the same name...
Would be cool to get rid of this issue one day, but for now it's safer to use rna acessor...
This commit is to be backported to 2.70.
- avoid passing redundant operator name to keymap property set function.
- avoid double attr lookups when setting each property.
- handle exceptions on value type mismatch.
- avoid resource warning on failed load.
- add rna property 'as_bytes' method so you can get a string property as python bytes (bypass encoding).
- make bpy.path.abspath/relpath compatible with bytes.
- add 'relpath' option to bpy_extras.image_utils.load_image(), so you can load an image relative to a path.
Notes:
* Everything is still a bit raw and sometimes hackish.
* Not every feature implemented yet.
* A bunch of cleanup is still needed.
* Doc needs to be updated too!
- bpy.path.extensions_image
- bpy.path.extensions_movie
- bpy.path.extensions_audio
eg:
if os.path.splitext(filename)[1].lower() in bpy.path.extensions_image:
... we have an image ...
Since the window manager is needed for keymaps this is kept as an exception.
some addons will need updating, but in every case I've seen addons should not be accessing the context while registering.
(bad stuff! - declaring the scene as a global variable - which crashes when the users loads a new file, manipulating the active object or scene... tsk tsk)
Handle these 2 kinds of script paths
* user script path: ~/.blender/scripts OR $BLENDER_USER_SCRIPTS
* pref script path: always bpy.context.user_preferences.filepaths.script_directory
now both are returned by bpy.utils.script_paths()
--debug
--debug-ffmpeg
--debug-python
--debug-events
--debug-wm
This makes debug output easier to read - event debug prints would flood output too much before.
For convenience:
--debug-all turns all debug flags on (works as --debug did before).
also removed some redundant whitespace in debug prints and prefix some prints with __func__ to give some context.
this report exposed multiple bugs in blender when using a non utf8 compatible home directory.
- bpy.utils.script_paths() would crash when homedir wasn't utf8 (reported bug)
- PyC_DefaultNameSpace() - would raise an error when running when __file__ was non utf8.
- preset filepath property was not set to accept non utf8.
- bpy.paths.display_name would raise an error on non utf8 paths, (used for preset draw)