Exposes all supported unit systems & types, and to_value()/to_string() functions.
Reviewed and enhanced by CampbellBarton, many thanks!
Differential Revision: https://developer.blender.org/D416
- 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.
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!
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.
- installing an addon which creates a new script directory didn't add this to the sys.path.
- installing the addon was meant to set the search string to the addon name but was broken.
move calls to the classes register/unregister function into register_class() / unregister_class() and add docs.
also other minor changes:
- remove face sorting keybinding, was Ctrl+Alt+F, this is quite and obscure feature and face order normally doesn't matter, so access from Face menu is enough.
- add commented out call to mesh.validate() in addon template since its useful to correct incomplete meshes during development.
ui/ --> startup/bl_ui
op/ --> startup/bl_operators
scripts/startup/ is now the only auto-loading script dir which gives some speedup for blender loading too.
~/.blender/2.56/scripts/startup works for auto-loading scripts too.
Modified to only do one lookup.
from Martin:
"Basically, what it does is allow you to add register and unregister class methods to rna types, this way you don't have to rely on module register/unregister methods to setup your types properly (and it makes them easier to move around when reorganizing code and easier to understand what a type does when reading code). This is especially nice for PropertyGroup classes that are added as properties to existing types, you can easily see in their register methods where they are added and removed in their unregister method. Obviously, those two methods are optional, so current code still works fine."
- use own OrderedDictMini class, pythons collections.OrderedDict is overkill, 179 sloc. replaced with own, 11 lines.
- remove code which stored the class file & line per RNA subclass, this was useful but would raise its own exception every time to generate a stack trace to get the class info so we could use of the class failed to register. the class stores its module & name which can be enough to find where it was defined.