Commit Graph

158 Commits

Author SHA1 Message Date
Campbell Barton
f4293067c1 py api: sphinx doc corrections, pep8 cleanup and style edits, also added __all__ to some modules which were missing it. 2011-07-31 03:15:37 +00:00
Campbell Barton
2658949752 pep8 cleanup, also print message when attempting to run in animation player mode. 2011-07-29 01:24:03 +00:00
Campbell Barton
5132be21d1 fix [#28075] After the correction of No.38528 is applied, the following phenomenon has been generated.
own fault in recent addition of bpy.path.basename() not supporting byte paths.
2011-07-25 04:00:11 +00:00
Campbell Barton
76e91d7a5f fix [#27922] using preset_paths() with an absolute path returns twice the same thing
raise an error when an invalid subdir is passed to preset_paths()
2011-07-20 15:33:27 +00:00
Campbell Barton
4ad43aaf16 added bpy.path.basename because "//" prefix breaks os.path.basename. 2011-07-20 08:10:01 +00:00
Campbell Barton
f4b6d00926 fix for bpy.path.abspath(), if a path was passed it would get the last directory cut off, broke copying images on export. 2011-07-19 05:05:54 +00:00
Campbell Barton
dbc9e36f72 make python3.3 compatible, __class__ is no longer in the class methods namespace. 2011-07-11 05:50:49 +00:00
Campbell Barton
2c66ab12e9 minor pep8 edits 2011-07-01 12:33:34 +00:00
Campbell Barton
d86d68d4e6 console autocomp import now excludes '_' prefixed variables and the results are sorted. 2011-06-29 10:47:43 +00:00
Campbell Barton
c672b3fb67 [#27439] Console window doesn't hide on startup when presets are used (Windows)
only print preset load messages in when debug is enabled.
2011-05-20 00:21:38 +00:00
Campbell Barton
863b60e1b8 fix [#27432] [2.57/scripts/modules/bpy/path.py:169] can't concat bytes to str 2011-05-19 06:27:39 +00:00
Campbell Barton
b432520799 fix [#27324] WindowManager.invoke_search_popup() crashes blender and does not work
also minor formatting fixes.
2011-05-08 12:51:05 +00:00
Campbell Barton
e26b0c68a4 patch [#27205] Infinite recursion inside resolve_ncase() when passed a driver letter on Windows that does not exist
by Brandon Ehle (azverkan)
2011-05-06 11:27:04 +00:00
Campbell Barton
5a0dca41e5 fix 2 bugs with addon installation
- 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.
2011-05-04 08:44:08 +00:00
Campbell Barton
d8eafe14c6 fix [#27148] *Invalid Path* in all "operator presets" dropdowns 2011-05-02 17:29:30 +00:00
Campbell Barton
f8c09b37d4 api changes needed for for copying old settings to new.
- py: bpy.utils.resource_path('USER', 2, 56)
- C: BLI_get_folder_version(id, major, minor, check);
2011-04-11 13:56:58 +00:00
Campbell Barton
65b13c8089 fix [#26757] Python console: help() doesn't work anymore
also quiet some warnings & add docstrings to bpy module which was shaowing the GPL header in its help() message.
2011-04-03 23:11:00 +00:00
Campbell Barton
c8652b301f pep8 checker, mostly pedantic style changes but also found an error in mesh_utils.mesh_linked_faces() 2011-04-01 02:41:15 +00:00
Campbell Barton
6e5ce953da use 'is None' rather then '== None' as suggested by python docs & mis-spelling. 2011-03-29 04:16:55 +00:00
Campbell Barton
b510019602 fix for incorrect prints with RNA errors (own fault, CONTAINER_RNA_ID was incorrect) & close keymap file after running. 2011-03-25 01:55:00 +00:00
Campbell Barton
2c4999eccb missed committing this before 2011-03-23 15:14:21 +00:00
Campbell Barton
f3686b5885 py/api registration:
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.
2011-03-22 01:38:26 +00:00
Campbell Barton
379f55f54c fix for error printing class register error, remove an unneeded check. 2011-03-21 22:17:01 +00:00
Campbell Barton
2e6a02438e move script directories for internal blender scripts.
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.
2011-03-21 12:35:49 +00:00
Campbell Barton
599bd1cbda patch from Martin, call classes register/unregister functions.
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."
2011-03-21 06:22:09 +00:00
Campbell Barton
e44da6b695 hide addon_utils in bpy.utils & tag/remove unused vars in recent commits. 2011-03-18 20:57:32 +00:00
Campbell Barton
5ef65a0a3b build system now exclude config-*, turtledemo when copying system python.
also remove __pycache__ dirs when cleaning (new in python 3.2)
2011-02-28 05:59:44 +00:00
Campbell Barton
e09189cf50 complete lazy loading of py modules to use to a reduced set of pythons modules, gives ~40% speedup on cold & warm start (without netrender).
- 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.
2011-02-28 04:37:24 +00:00
Campbell Barton
52f92b4cb1 lazy load modules for more scripts. 2011-02-27 14:16:32 +00:00
Campbell Barton
87acf919a5 lazy load pydoc module. move help() replacement into console code rather then on startup since importing pydoc pulls in lots of other modules too. 2011-02-27 14:08:33 +00:00
Campbell Barton
b25db7c8cb pep8 cleanup 2011-02-25 16:06:14 +00:00
Campbell Barton
eee4a62e87 move addon utilities into their own module, these were getting mixed between bpy.utils and space_userpref. 2011-02-21 07:07:44 +00:00
Campbell Barton
812f238494 pep8 cleanup and remove unused vars/imports 2011-02-17 04:35:41 +00:00
Campbell Barton
a6765280f9 py rna api: turn class.is_register into a class property rather then a class method.
eg:

if MySybclass.is_registered:
    ...
2011-02-14 07:26:07 +00:00
Guillermo S. Romero
7b201c7693 SVN maintenance. 2011-02-14 04:47:55 +00:00
Campbell Barton
17efeb310d bpy.utils.register_module() generator could go into eternal loop. 2011-02-11 01:27:00 +00:00
Campbell Barton
2f4f046b6f UI functions added to existing UI classes (operators adding their own menus for eg),
would stop the entire menu from drawing if they raised an exception.

now print the exception and continue.

Also added a verbose argument for bpy.utils.(un)register_module() to help test whats being registered.
2011-02-11 01:12:01 +00:00
Campbell Barton
b1cdf5c344 use weak references for the internal metaclass typemap,
this should help with blender leaking memory with python classes though the bug is still not fixed.
2011-02-11 00:39:07 +00:00
Campbell Barton
fb8c135584 minor python register changes.
- KeyingSetInfo classes are now collected like Panels, Operators etc so bpy.utils.register_module() can be used.
- move bpy.types.register() to bpy.utils.register_class
2011-02-11 00:11:17 +00:00
Campbell Barton
4612034cf4 patch [#25809] Auto-Registration as utility function.
This removes auto-registration, committed by Martin r30961.
Realize this is a contentious topic but Brecht and myself both would rather opt-in registration.

TODO:
- addons need updating.
- class list will be modified to use weakrefs (should have been done for existing system too).
- will move bpy.types.(un)register functions into bpy.utils.(un)register_class, currently including these functions in a type list is internally ugly, scripts which loop over types also need to check for these.
2011-02-10 23:48:22 +00:00
Campbell Barton
0362d19f2d Pythons path functions - os.walk(). os.path.exists(). etc support bytes for paths as well as strings, support this with blender/rna too.
- bpy.data.*.load() functions were only accepting UTF-8 paths.
- rna functions/properties now accept byte values rather then strings for file paths.
- bpy.path.resolve_ncase now supports byte objects.
2011-02-01 04:24:47 +00:00
Campbell Barton
743182106f py api: bpy.path.abspath(), option to return relative to a path other then the current blend file. 2011-01-15 20:35:31 +00:00
Campbell Barton
f66912a335 misc edits, no functional changes
- enabling/disabling no longer prints in the terminal unless in debug mode.
- remove 'header' struct from BLI_storage_types.h, from revision 2 and is not used.
- Add GCC property to guardedalloc to warn if the return value from allocation functions isn't used.
2011-01-15 15:48:46 +00:00
Campbell Barton
dacdfbe6f3 recent change to keyframe menu broke BVH import, now don't use the operator at all, instead assign the action manually.
Also added bpy.path.display_name_from_filepath(), since filepaths are not ensured to be utf8.
same as calling:  os.path.splitext(os.path.basename(name))[0].encode("utf8", "replace").decode("utf8")
2011-01-03 08:28:22 +00:00
Campbell Barton
7f3fe8a2df pep8 cleanup 2011-01-01 07:20:34 +00:00
Campbell Barton
54343b79e6 remove reload() from builtins since python3 no longer uses this.
use imp.reload now.

Should use import hooks but for now replace imp.reload with our own reload as the builtin reload was replaced before.
2010-12-22 21:39:48 +00:00
Campbell Barton
c26cc0afa1 bugfix [#25290] Align on text gives a traceback
[#25284] Traceback error on "System Info" script

- Align was only working on mesh objects, now operate on all objects, missing boundbox's are treated as single points.
- obj.bound_box was returning all nan's for object types with no boundbox.
- ENUM_FLAG type enums were showing no text when displayed in operator redo panel.
2010-12-19 07:05:29 +00:00
Campbell Barton
77c17d332d fix [#25262] Keyboard shortcut presets can't be made because of wrong folder
New create option when getting a user resource for creating paths.
  bpy.utils.user_resource(type, path, create=False)
2010-12-18 07:22:52 +00:00
Campbell Barton
3256d0fc6a allow addons/modules path so extension authors can develop their own shared modules. 2010-12-11 11:52:28 +00:00
Campbell Barton
6f90a38a54 error in own recent commit 2010-11-22 23:41:00 +00:00