Commit Graph

476 Commits

Author SHA1 Message Date
Campbell Barton
68dbfe6ac9 move generic bpy helper modules into bpy_extras. 2011-05-16 07:51:02 +00:00
Campbell Barton
6c8317ae8f new empty package to move bpy utility modules into. 2011-05-16 07:48:43 +00:00
Campbell Barton
2f08309ffe window_to_3d_vector was incorrect but dolly view operator was accounting for it. fixed so result isnt negated and mouse coords dont need to be adjusted. 2011-05-12 06:52:24 +00:00
Campbell Barton
a131ce066a python utility module for converting between 2d/3d region/world coordinates. 2011-05-12 06:32:21 +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
e239085f70 io_utils.axis_conversion(...) utility function to easily convert the forward & up axis between different apps on import/export. 2011-05-07 11:25:59 +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
f02b9b37f2 api to support different kinds of relative paths on export, including copying the files to a subdir. 2011-04-14 08:47:47 +00:00
Campbell Barton
ba03e5023e less alarming warnings about the python api not being stable in online docs and remove from interactive console. 2011-04-12 12:09:38 +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
d5d9c56cb5 minor edits to keyingsets script. 2011-04-05 12:31:55 +00:00
Joshua Leung
b2753f6af9 "Bugfix" (i.e. feature request in disguise!) [#26772] Delta Scaling,
Rotation and Location don't have Keying Sets

Added Keying Sets for Delta Loc/Rot/Scale settings (aka dLoc/dRot).
These settings could already be found in the Object properties, under
the collapsed "Delta Transforms" panel.

I've added these to the end of the Keying Sets list, since adding any
earlier will end up breaking active Keying Set setting in older files.
Besides, these settings aren't that frequently used either...
2011-04-05 11:49: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
Martin Poirier
3598882f0e Proper traceback when addons fails AST parsing setp 2011-03-27 20:52:50 +00:00
Campbell Barton
50a06eccff pep8 cleanup 2011-03-27 05:23:14 +00:00
Campbell Barton
7ccfec1ff3 fix (own bug) [#26628] "FCurve/Driver Version Fix" Incorrectly Clobbers Array Indexing
also escape strings properly now.
2011-03-27 03:14:14 +00:00
Joshua Leung
7beca3d142 Bugfixes due to recent RNA renaming:
* Driver F-Curves were not getting fixed by the "FCurve/Driver Version
Fix" tool. This was causing problems such as shapekey drivers from
older (2.56 compatible rigs) failing to run. As well as renaming the
paths for these Driver F-Curves, the "disabled" flags also get cleared
from these drivers so that they can be run again

* "Revive Disabled F-Curves"  operator in Animation Editors can now be
used to revive disabled drivers too.
2011-03-26 23:42:51 +00:00
Campbell Barton
0c03fa78c1 fix [#26601] Python error when use of autocomplete
Was a naming collision with 'keys' python method, reserve keys/items/values/get for python.
Updated animsys_update.py for shapekey data paths.

renamed:
  Particle.hair --> hair_keys
  Particle.keys --> particle_keys
  Key.keys --> key_blocks
  EnumProperty.items --> enum_items
  KeyMap.items --> keymap_items 

noted:
  http://wiki.blender.org/index.php/Dev:2.5/Py/API/Updates#Since_2.56a
2011-03-25 02:12:44 +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
a2acecc9d2 allow system info operator in background mode. 2011-03-22 11:44:46 +00:00
Campbell Barton
1b80538fea fix [#25688] undocumted functions in pyapi
expose collection function docs.
2011-03-22 04:28:51 +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
82783cd0cd pep8 edits and remove commented code from last commit. 2011-03-14 23:17:52 +00:00
Campbell Barton
2d1ef275f2 bpy.types.libraries.load sphinx doc & examples (doc system needed some updates).
http://www.blender.org/documentation/blender_python_api_2_56_3/bpy.types.BlendDataLibraries.html#bpy.types.BlendDataLibraries.load
2011-03-14 10:31:50 +00:00
Campbell Barton
bd1c5d48f2 RNA API Rename
'create' was used as prefix and suffix, change dupli list functions to use as suffix, this matches obj.animation_data_create() & obj.animation_data_clear().
 obj.create_dupli_list() --> obj.dupli_list_create()
 obj.free_dupli_list() --> obj.dupli_list_clear()

Don't use 'create' for object to mesh function since other uses of this are for createing data which stays attached, instead use mathutils style naming convention.
  obj.create_mesh() --> obj.to_mesh()
2011-03-14 01:37:18 +00:00
Campbell Barton
8c526e79e3 library loading api.
this is not well suited to RNA so this is a native python api.

This uses:
  bpy.data.libraries.load(filepath, link=False, relative=False)

however the return value needs to use pythons context manager, this means the library loading is confined to a block of code and python cant leave a half loaded library state.


eg, load a single scene we know the name of:
  with bpy.data.libraries.load(filepath) as (data_from, data_to):
      data_to.scenes = ["Scene"]


eg, load all scenes:
  with bpy.data.libraries.load(filepath) as (data_from, data_to):
      data_to.scenes = data_from.scenes


eg, load all objects starting with 'A'
  with bpy.data.libraries.load(filepath) as (data_from, data_to):
      data_to.objects = [name for name in data_from.objects if name.startswith("A")]

As you can see gives 2 objects like 'bpy.data', but containing lists of strings which can be moved from one into another.
2011-03-12 16:06:37 +00:00
Campbell Barton
897c2ede13 py/ui: ensure extensions which add draw functions for menus/headers/panels always get the default operator context, not the one that was last set. 2011-03-09 10:57:56 +00:00
Campbell Barton
c544d3ffb8 Py/Operators: FBX Exporter setting order was still randomized.
Some lines removed recently I thought were are needed were there so classes that use mix-ins keep the argument order.
2011-03-07 08:57:35 +00:00
Campbell Barton
db066592b7 PyAPI: allow subclasses of io_utils.ExportHelper to set when the extension is enforced. 2011-03-07 08:01:38 +00:00
Campbell Barton
2f741e4dde fix for own error [#26310] "Randomize Transform" operator has widgets jumbled
the correct order was being overwritten.
2011-03-03 13:23:40 +00:00
Campbell Barton
21067886aa update for changed exception type 2011-03-02 04:16:57 +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
fc0c016940 replace import *'s with named imports (using * is convenient for some scripts but considered bad practice by python devs) 2011-02-27 15:25: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
91e6fd1828 port of function from 2.4x's BPyMesh.py thanks to 'merlin_' on IRC. 2011-02-26 16:13:14 +00:00
Campbell Barton
b25db7c8cb pep8 cleanup 2011-02-25 16:06:14 +00:00
Campbell Barton
2fd60d9719 error in own recent moving addons functions into its own module. addon_utils.reset_all failed. 2011-02-22 22:24:50 +00:00
Campbell Barton
4b859e91cb bugfix/workaround [#25629] Add torus with autmatic edit mode duplicates mesh after >Aling to View.
adding meshes in C does:
 Add Empty Mesh -> Enter Editmode -> Create Mesh

while python does:
 Add Generated Mesh -> Enter Editmode


problem with this is there is no empty undo state for undo-redo to use so it always gave a duplicate mesh on redo-ing.
workaround by adding an empty mesh, do an undo push, and join the generated mesh into the empty one.

this would be fixed if undo stack spanned modes.
2011-02-22 02:47:59 +00:00
Nathan Vegdahl
ea20a27240 Editbone length was still using "normalize()" instead of "normalized()"
for setting length, which was thus failing and erroring out.
2011-02-21 20:26:37 +00:00