=ID Properties Python Doc Update=

The epydocs are now updated to have idproperties;
all the modules that have bindings for ID properties
now has docs for them.  E.g Materials have a .properties
members, Image, Texture, Scene, Object, NMEsh, and Mesh.

I realized that .properties was already taken in
Objects, so I renamed it to .idproperties.  There was
also a nasty little problem with an example inside
Object.getType; the entire example was being pasted inside
the return field.  I fixed it by just moving the return
definition to after the example, like it should be.
This commit is contained in:
Joseph Eagar
2006-11-20 11:07:56 +00:00
parent a5a83ecd10
commit 19a4f41172
9 changed files with 66 additions and 17 deletions

View File

@@ -4995,7 +4995,7 @@ static PyGetSetDef BPy_Object_getseters[] = {
(getter)Object_getType, (setter)NULL, (getter)Object_getType, (setter)NULL,
"String describing Object type", "String describing Object type",
NULL}, NULL},
{"properties", (getter)Object_GetProperties, (setter)NULL, {"idproperties", (getter)Object_GetProperties, (setter)NULL,
"Get the ID properties associated with this object"}, "Get the ID properties associated with this object"},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */ {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
}; };

View File

@@ -1,16 +1,25 @@
class IDProperty: class IDProperty:
""" """
The IDProperty wrapper type The IDProperty Type
=========================== ===================
@ivar name: the name of the property @ivar name: The name of the property
@ivar type: the property type (is read-only) @type name: string
@ivar data: the property's data. @ivar type: The property type (is read-only)
@type type: int
@ivar data: The property's data. This data can be of several forms, depending on the
ID property type:
1. For arrays, data implements the [] and allows editing of the array.
2. For groups, data allows iteration through the group, and access using the []
operator (but note that you can access a group that way through the parent IDProperty too).
See L{IDGroup<IDGroup>}.
3. For strings/ints/floats, data just holds the value and can be freely modified.
""" """
class IDGroup: class IDGroup:
""" """
The IDGroup wrapper type The IDGroup Type
======================== ================
This type supports both iteration and the [] This type supports both iteration and the []
operator to get child ID properties. operator to get child ID properties.
@@ -20,12 +29,14 @@ class IDGroup:
group['a float!'] = 0.0 group['a float!'] = 0.0
group['an int!'] = 0 group['an int!'] = 0
group['a string!'] = "hi!" group['a string!'] = "hi!"
group['an array!'] = [0, 0, 1.0, 0] #note that any floats in the list group['an array!'] = [0, 0, 1.0, 0]
#makes the whole list a float array.
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2], \ group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2], \
"another subgroup": {"a": 0.0, "str": "bleh"}} "another subgroup": {"a": 0.0, "str": "bleh"}}
you also do del group['item'] Note that for arrays, the array type defaults to int unless a float is found
while scanning the template list; if any floats are found, then the whole
array is float.
""" """
def newProperty(type, name, array_type="Float", val=""): def newProperty(type, name, array_type="Float", val=""):
@@ -48,8 +59,8 @@ class IDGroup:
class IDArray: class IDArray:
""" """
The IDArray wrapper type The IDArray Type
======================== ================
@ivar type: returns the type of the array, can be either IDP_Int or IDP_Float @ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
""" """

View File

@@ -65,11 +65,16 @@ def GetCurrent ():
@return: The Current Blender Image, If there is no current image it returns None. @return: The Current Blender Image, If there is no current image it returns None.
""" """
from IDProp import IDProperty, IDGroup, IDArray
class Image: class Image:
""" """
The Image object The Image object
================ ================
This object gives access to Images in Blender. This object gives access to Images in Blender.
@ivar properties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this image's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@ivar name: The name of this Image object. @ivar name: The name of this Image object.
@ivar filename: The filename (path) to the image file loaded into this Image @ivar filename: The filename (path) to the image file loaded into this Image
object. object.

View File

@@ -1,3 +1,5 @@
from IDProp import IDProperty, IDGroup, IDArray
# Blender.Material module and the Material PyObject # Blender.Material module and the Material PyObject
""" """
@@ -105,6 +107,10 @@ class Material:
The Material object The Material object
=================== ===================
This object gives access to Materials in Blender. This object gives access to Materials in Blender.
@ivar properties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this material's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@ivar B: Diffuse color (L{rgbCol}) blue component. @ivar B: Diffuse color (L{rgbCol}) blue component.
Value is clamped to the range [0.0,1.0]. Value is clamped to the range [0.0,1.0].
@type B: float @type B: float

View File

@@ -669,15 +669,21 @@ class MFaceSeq:
@rtype: list of ints @rtype: list of ints
""" """
from IDProp import IDProperty, IDGroup, IDArray
class Mesh: class Mesh:
""" """
The Mesh Data object The Mesh Data object
==================== ====================
This object gives access to mesh data in Blender. This object gives access to mesh data in Blender.
@note: the verts, edges and faces attributes are implemented as sequences. @note: the verts, edges and faces attributes are implemented as sequences.
The operator[] and len() are defined for these sequences. You cannot The operator[] and len() are defined for these sequences. You cannot
assign to an item in the sequence, but you can assign to most of the assign to an item in the sequence, but you can assign to most of the
attributes of individual items. attributes of individual items.
@ivar properties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this mesh's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@ivar edges: The mesh's edges. @ivar edges: The mesh's edges.
@type edges: sequence of MEdges @type edges: sequence of MEdges
@ivar faces: The mesh's faces. @ivar faces: The mesh's faces.

View File

@@ -337,12 +337,17 @@ class NMFace:
@param vertex: An NMVert object. @param vertex: An NMVert object.
""" """
from IDProp import IDProperty, IDGroup, IDArray
class NMesh: class NMesh:
""" """
The NMesh Data object The NMesh Data object
===================== =====================
This object gives access to mesh data in Blender. We refer to mesh as the This object gives access to mesh data in Blender. We refer to mesh as the
object in Blender and NMesh as its Python counterpart. object in Blender and NMesh as its Python counterpart.
@ivar properties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this mesh's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@ivar name: The NMesh name. It's common to use this field to store extra @ivar name: The NMesh name. It's common to use this field to store extra
data about the mesh (to be exported to another program, for example). data about the mesh (to be exported to another program, for example).
@ivar materials: The list of materials used by this NMesh. See @ivar materials: The list of materials used by this NMesh. See

View File

@@ -232,6 +232,7 @@ def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=
Blender.Redraw() Blender.Redraw()
""" """
from IDProp import IDProperty, IDGroup, IDArray
class Object: class Object:
""" """
The Object object The Object object
@@ -245,6 +246,10 @@ class Object:
To get these values in worldspace (taking into account vertex parents, constraints etc) To get these values in worldspace (taking into account vertex parents, constraints etc)
pass the argument 'worldspace' to these functions. pass the argument 'worldspace' to these functions.
@ivar idproperties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this object's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@ivar LocX: The X location coordinate of the object. @ivar LocX: The X location coordinate of the object.
@type LocX: float @type LocX: float
@ivar LocY: The Y location coordinate of the object. @ivar LocY: The Y location coordinate of the object.
@@ -841,8 +846,6 @@ class Object:
""" """
Returns the type of the object in 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice', Returns the type of the object in 'Armature', 'Camera', 'Curve', 'Lamp', 'Lattice',
'Mball', 'Mesh', 'Surf', 'Empty', 'Wave' (deprecated) or 'unknown' in exceptional cases. 'Mball', 'Mesh', 'Surf', 'Empty', 'Wave' (deprecated) or 'unknown' in exceptional cases.
@return: The type of object.
@rtype: String
I{B{Example:}} I{B{Example:}}
@@ -861,6 +864,9 @@ class Object:
obj.RotZ = 3.141592 - obj.RotZ obj.RotZ = 3.141592 - obj.RotZ
Blender.Redraw() Blender.Redraw()
@return: The type of object.
@rtype: String
""" """
def insertIpoKey(keytype): def insertIpoKey(keytype):

View File

@@ -73,12 +73,17 @@ def Unlink(scene):
@type scene: Blender Scene @type scene: Blender Scene
@param scene: The Scene to be unlinked. @param scene: The Scene to be unlinked.
""" """
from IDProp import IDProperty, IDGroup, IDArray
class Scene: class Scene:
""" """
The Scene object The Scene object
================ ================
This object gives access to Scene data in Blender. This object gives access to Scene data in Blender.
@ivar properties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this scene's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@type name: string @type name: string
@ivar name: The Scene name. @ivar name: The Scene name.
@type Layers: integer (bitmask) @type Layers: integer (bitmask)

View File

@@ -241,6 +241,7 @@ def Get (name = None):
- (): A list with all Texture objects in the current scene. - (): A list with all Texture objects in the current scene.
""" """
from IDProp import IDProperty, IDGroup, IDArray
class Texture: class Texture:
""" """
The Texture object The Texture object
@@ -250,6 +251,10 @@ class Texture:
Note that many of the attributes of this object are only relevant for Note that many of the attributes of this object are only relevant for
specific texture types. specific texture types.
@ivar properties: Returns an L{IDProperty<IDProperty>} reference of type L{IDGroup<IDGroup>} to
this textures's ID Properties. Note that dict access is available for groups on the parent
L{IDProperty<IDProperty>} object, but for everything else you need to get the L{IDGroup<IDGroup>}
object from the L{IDProperty<IDProperty>}'s data member.
@ivar animFrames: Number of frames of a movie to use. @ivar animFrames: Number of frames of a movie to use.
Value is clamped to the range [0,30000]. Value is clamped to the range [0,30000].
@type animFrames: int @type animFrames: int