diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-01 02:37:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-01 02:37:36 +0400 |
commit | 4fd4a2e7b92c68c3770fe2d0bbfa4e6a1cef9d77 (patch) | |
tree | 3e9b1bad38c6c9e198f655cbf8f5caa767af85b3 | |
parent | 6f46692e7614b637ecf2c46fff8d24e34450e7cf (diff) |
added note in docs about not beaing able to create new data by calling the class direct.
-rw-r--r-- | doc/python_api/rst/info_quickstart.rst | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/python_api/rst/info_quickstart.rst b/doc/python_api/rst/info_quickstart.rst index b37b7558770..19ec8059aca 100644 --- a/doc/python_api/rst/info_quickstart.rst +++ b/doc/python_api/rst/info_quickstart.rst @@ -123,6 +123,29 @@ Example of a data path that can be quickly found via the console: 1.0 +Data Creation/Removal +^^^^^^^^^^^^^^^^^^^^^ + +Those of you familiar with other python api's may be surprised that new datablocks in the bpy api can't be created by calling the class: + + >>> bpy.types.Mesh() + Traceback (most recent call last): + File "<blender_console>", line 1, in <module> + TypeError: bpy_struct.__new__(type): expected a single argument + + +This is an intentional part of the API design. +The blender/python api can't create blender data that exists outside the main blender database (accessed through bpy.data), because this data is managed by blender (save/load/undo/append... etc). + +Data is added and removed via methods on the collections in bpy.data, eg: + + >>> mesh = bpy.data.meshes.new(name="MyMesh") + >>> print(mesh) + <bpy_struct, Mesh("MyMesh.001")> + + >>> bpy.data.meshes.remove(mesh) + + Custom Properties ^^^^^^^^^^^^^^^^^ |