Commit Graph

13 Commits

Author SHA1 Message Date
Campbell Barton d46da5a09d mathutils support for color arithmetic, also some minor whitespace edits. 2011-06-02 08:29:16 +00:00
Campbell Barton 06fea1a0ff split BLO_library_append_named_part into 2 function, one that adds objects into the scene and another that just links/appends. 2011-05-26 20:45:19 +00:00
Campbell Barton 15289c6048 use PyDoc_STRVAR macro, so its possible to build without docstrings. 2011-05-24 16:05:51 +00:00
Campbell Barton 357ce16958 loading data with bpy.data.libraries.load(), now swaps out the strings in the list to load with the actual datablocks, this is convenient because it saves the script author having to find them after.
also raise warnings rather then errors if the datablock can't be found.
2011-05-24 15:21:14 +00:00
Campbell Barton eabb444106 minor cleanup: make functions static, use NULL for pointer comparisons,
also fixed a possible bug assigning incorrect DPX function types to
imbuf.
2011-05-10 13:11:36 +00:00
Campbell Barton f86565c90e whitespace edits for bpy api, split some really long lines. 2011-04-30 13:58:31 +00:00
Campbell Barton cadc1218c8 C, style changes (mostly white space edits), no functional change. 2011-03-19 11:12:48 +00:00
Campbell Barton fe529d43fe fix for building on some configurations. 2011-03-15 01:48:01 +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 9ec2dfe0df add dir() function for library objects, also was missing call to clear temp flag on exceptions. 2011-03-14 01:00:41 +00:00
Campbell Barton 25a2eb4675 py/library api: raise an error if a requested member isn't found. 2011-03-13 01:15:14 +00:00
gsr b3d 60a2994435 SVN maintenance. 2011-03-13 00:26:46 +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