Commit Graph

267 Commits

Author SHA1 Message Date
3a58c4679a Fix addon crash when trying listdir a directory we have no permission to. 2014-07-30 15:35:19 +02:00
f94b87bbb8 New python API for units handling.
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
2014-06-17 16:03:40 +02:00
a2489e29f6 Code cleanup: style, unused import 2014-04-28 00:19:15 +10:00
ea610e655c Style cleanup: C & pep8 2014-04-15 13:11:48 +10:00
0c6e74436f Fix T39158: Help > Operator Cheat Sheet causes a python recursive loop.
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.
2014-03-13 17:37:19 +01:00
18f6bb04fa Fix for custom property editor when property id's contained quotes
Adds bpy.utils.escape_identifier()
2014-02-25 16:19:57 +11:00
dea4bcdf67 PyAPI: bpy.ops was showing 'module' in autocomplete output 2014-02-19 13:41:41 +11:00
2a9e33fba5 Keymap: load/save improvements
- 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.
2014-02-19 10:32:23 +11:00
1ea47c9af9 Code Cleanup: style, spelling and pep8 edits 2013-11-20 03:40:10 +11:00
ecf2eeef23 style cleanup 2013-10-16 04:08:20 +00:00
b20c3f97a4 rename presets not to use '+' character, also some typo fixes. 2013-10-05 14:19:39 +00:00
b6631b8be7 fixes for python api docs.
also move foreach_get/set examples into their own py example files (prefer not to have example code built into blenders binary).
2013-09-18 05:20:43 +00:00
4fbe426151 bpy.path.reduce_dirs() - new utility function to de-duplicate and remove nested paths before doing a recursive search. 2013-08-12 07:44:38 +00:00
2085a42e52 pep8 cleanup 2013-06-27 03:05:19 +00:00
c8f30bc7f0 fix [#35574] Export Key Map issue
problem was the keymap failed to import but didnt give any feedback, now it displays error message.
2013-06-11 15:11:55 +00:00
63d523336f freestyle lineset tag attribute was defined but not used, also some code cleanup. 2013-04-07 01:38:03 +00:00
98752a1f30 py api additions needed for fixing [#34864].
- 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.
2013-04-05 00:30:32 +00:00
2c348d003e Big i18n tools update, I/II.
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!
2013-02-24 08:50:55 +00:00
3b8a0f3d67 use import rather then assignment for loading '_' into scripts. 2013-02-10 09:56:05 +00:00
97d62f0183 style cleanup 2013-01-15 23:15:32 +00:00
9dbe85c17e expose common extensions for image/movie/audio types, since python scripts had to do this internally.
- 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 ...
2013-01-04 03:47:37 +00:00
423994bf39 py api: add restrict state context manager (thats python's context not blenders context),
which restricts bpy.context and bpy.data.

enable this for loading scripts in 'startup' too.
2012-12-20 03:56:22 +00:00
ef665b3d18 dissallow access to the context while addons import and register.
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)
2012-12-19 07:27:23 +00:00
7c2e4e28ba bpy.ops module/caller classes incorrectly had __keys__ rather then __slots__.
also added comments about texface drawing when theres no origindex.
2012-12-06 03:09:06 +00:00
7c3db355b1 remove ifdef'd bevel code, current bevel works better then the previous code.
reduce strlen check in texttool_suggest_add()
use 'del list[:]' rather then 'list[:] = []' in python scripts which clear lists.
2012-11-14 09:45:15 +00:00
9fa36b12cc style cleanup: pep8 2012-10-08 08:28:05 +00:00
8a51d235e6 pep8 cleanup 2012-09-26 21:19:51 +00:00
6b1582c012 better handle sizes by default for mask mode, now ignore image width/height 2012-08-25 14:18:54 +00:00
a7ec09aef9 ability to register your own online manual callbacks - useful for 3rd party addon developers, who may want to link to their own URL's. 2012-08-25 14:07:51 +00:00
b0371f053c style cleanup 2012-08-17 18:36:20 +00:00
3270438678 fix for own regression with handling of script paths, however this didnt work quite right before either.
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()
2012-07-29 01:02:25 +00:00
e204d67cc7 Fix [#32135] FRAMERATE: Framerate display is truncated in selection box.
Filename extension was striped twice...
2012-07-18 08:51:19 +00:00
558721ab59 More spell checking. 2012-07-04 15:04:38 +00:00
63810ffcef Style edit (mostly), use """ for docstrings (not ''').
Should also fix the broken py ops tips...
2012-07-03 09:02:41 +00:00
bd21001aaf fix for bug where user scripts path set by an environment variable would write presets there but not show up in the menu. 2012-06-29 08:33:13 +00:00
a09feb7386 option so operators can be executed with undo enabled (and redo). 2012-06-27 21:41:17 +00:00
98e6912480 style cleanup 2012-06-19 22:17:19 +00:00
0d6ffd925d remove duplicate import 2012-06-10 00:22:18 +00:00
9ffb1c1dd8 bpy.utils.time_to_frame() and frame_to_time() utility functions. 2012-05-28 16:06:38 +00:00
5b88712ff9 move debug flag into its own global var (G.debug), split up debug options.
--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.
2012-03-31 00:59:17 +00:00
299025bdfb fix [#30402] modules dir missing from sys.path 2012-03-28 23:53:27 +00:00
b56d2f9766 fix [#30623] user-defined render presets bug
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)
2012-03-21 22:29:49 +00:00
c6c0601d8e py api:
modify bpy.path.display_name_from_filepath() to accept bytes
2012-03-16 04:14:57 +00:00
72889d8935 Code Cleanup: remove unused preset variable. 2012-02-07 06:53:19 +00:00
7f08c71f43 cleanup for redefined vars 2012-01-18 06:55:51 +00:00
032a6f63a7 enable xml preset save/load, replace install/export themes with these. 2012-01-10 16:20:01 +00:00
a8b19260cf check for presets in addons dirs. this way addons can install their own presets too. 2011-12-30 08:39:40 +00:00
b22405fa6f fix for bpy.path.abspath() on windows when the library argument was set and its self a relative path too. 2011-12-11 19:48:56 +00:00
6e28ac2d7b pep8 edits and avoid naming conflicts with python builtins 2011-11-24 19:36:12 +00:00
4d9766aacf minor cleanup
- remove / comment unused python vars
- replace mul_v3_fl(somevec, -1.0f); with negate_v3(somevec);
2011-11-16 16:38:37 +00:00