=IDProperties Python update=
Updated epydocs for next-to-latest id properties commit.
This commit is contained in:
@@ -1,21 +1,3 @@
|
||||
class IDProperty:
|
||||
"""
|
||||
The IDProperty Type
|
||||
===================
|
||||
@ivar name: The name of the property
|
||||
@type name: string
|
||||
@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:
|
||||
"""
|
||||
The IDGroup Type
|
||||
@@ -24,15 +6,15 @@ class IDGroup:
|
||||
operator to get child ID properties.
|
||||
|
||||
You can also add new properties using the [] operator.
|
||||
For example:
|
||||
For example::
|
||||
|
||||
group['a float!'] = 0.0
|
||||
group['an int!'] = 0
|
||||
group['a string!'] = "hi!"
|
||||
group['an array!'] = [0, 0, 1.0, 0]
|
||||
|
||||
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2], \
|
||||
"another subgroup": {"a": 0.0, "str": "bleh"}}
|
||||
group['a float!'] = 0.0
|
||||
group['an int!'] = 0
|
||||
group['a string!'] = "hi!"
|
||||
group['an array!'] = [0, 0, 1.0, 0]
|
||||
|
||||
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
|
||||
"another subgroup": {"a": 0.0, "str": "bleh"}}
|
||||
|
||||
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
|
||||
@@ -41,24 +23,80 @@ class IDGroup:
|
||||
You can also delete properties with the del operator. For example:
|
||||
|
||||
del group['property']
|
||||
|
||||
@ivar name: The name of the property
|
||||
@type name: string
|
||||
"""
|
||||
|
||||
def newProperty(type, name, array_type="Float", val=""):
|
||||
def pop(self, item):
|
||||
"""
|
||||
This function creates a new child ID property in the group.
|
||||
@type type: an int or a string
|
||||
@param type: The ID property type. Can be:
|
||||
"String" or Blender.IDPropTypes['String']
|
||||
"Int" or Blender.IDPropTypes['Int']
|
||||
"Float" or Blender.IDPropTypes['Float']
|
||||
"Array" or Blender.IDPropTypes['Array']
|
||||
"Group" or Blender.IDPropTypes['Group']
|
||||
Pop an item from the group property.
|
||||
@type item: string
|
||||
@param item: The item name.
|
||||
@rtype: can be dict, list, int, float or string.
|
||||
@return: The removed property.
|
||||
"""
|
||||
|
||||
def update(self, updatedict):
|
||||
"""
|
||||
Updates items in the dict, similar to normal python
|
||||
dictionary method .update().
|
||||
@type updatedict: dict
|
||||
@param updatedict: A dict of simple types to derive updated/new IDProperties from.
|
||||
@rtype: None
|
||||
@return: None
|
||||
"""
|
||||
|
||||
def deleteProperty(prop):
|
||||
def keys(self):
|
||||
"""
|
||||
deletes a property, takes either a name or a reference
|
||||
as an argument.
|
||||
Returns a list of the keys in this property group.
|
||||
@rtype: list of strings.
|
||||
@return: a list of the keys in this property group.
|
||||
"""
|
||||
|
||||
def values(self):
|
||||
"""
|
||||
Returns a list of the values in this property group.
|
||||
|
||||
Note that unless a value is itself a property group or an array, you
|
||||
cannot change it by changing the values in this list, you must change them
|
||||
in the parent property group.
|
||||
|
||||
For example,
|
||||
|
||||
group['some_property'] = new_value
|
||||
|
||||
. . .is correct, while,
|
||||
|
||||
values = group.values()
|
||||
values[0] = new_value
|
||||
|
||||
. . .is wrong.
|
||||
|
||||
@rtype: list of strings.
|
||||
@return: a list of the values in this property group.
|
||||
"""
|
||||
|
||||
def iteritems(self):
|
||||
"""
|
||||
Implements the python dictionary iteritmes method.
|
||||
|
||||
For example::
|
||||
|
||||
for k, v in group.iteritems():
|
||||
print "Property name: " + k
|
||||
print "Property value: " + str(v)
|
||||
|
||||
@rtype: an iterator that spits out items of the form [key, value]
|
||||
@return: an iterator.
|
||||
"""
|
||||
|
||||
def convert_to_pyobject(self):
|
||||
"""
|
||||
Converts the entire property group to a purely python form.
|
||||
|
||||
@rtype: dict
|
||||
@return: A python dictionary representing the property group
|
||||
"""
|
||||
|
||||
class IDArray:
|
||||
|
||||
@@ -65,16 +65,15 @@ def GetCurrent ():
|
||||
@return: The Current Blender Image, If there is no current image it returns None.
|
||||
"""
|
||||
|
||||
from IDProp import IDProperty, IDGroup, IDArray
|
||||
from IDProp import IDGroup, IDArray
|
||||
class Image:
|
||||
"""
|
||||
The Image object
|
||||
================
|
||||
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 properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
|
||||
image's ID Properties.
|
||||
@type properties: L{IDGroup<IDProp.IDGroup>}
|
||||
@ivar name: The name of this Image object.
|
||||
@ivar filename: The filename (path) to the image file loaded into this Image
|
||||
object.
|
||||
|
||||
@@ -106,12 +106,8 @@ class Material:
|
||||
The Material object
|
||||
===================
|
||||
This object gives access to Materials in Blender.
|
||||
@ivar properties: Returns an L{IDProperty<IDProp.IDProperty>} reference of
|
||||
type L{IDGroup<IDProp.IDGroup>} to this material's ID Properties. Note that
|
||||
dict access is available for groups on the parent
|
||||
L{IDProperty<IDProp.IDProperty>} object, but for everything else you need
|
||||
to get the L{IDGroup<IDProp.IDGroup>}
|
||||
object from the L{IDProperty<IDProp.IDProperty>}'s data member.
|
||||
@ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
|
||||
materials's ID Properties.
|
||||
@ivar B: Diffuse color (L{rgbCol}) blue component.
|
||||
Value is clamped to the range [0.0,1.0].
|
||||
@type B: float
|
||||
|
||||
@@ -691,7 +691,7 @@ class MFaceSeq:
|
||||
@rtype: list of ints
|
||||
"""
|
||||
|
||||
from IDProp import IDProperty, IDGroup, IDArray
|
||||
from IDProp import IDGroup, IDArray
|
||||
class Mesh:
|
||||
"""
|
||||
The Mesh Data object
|
||||
@@ -702,10 +702,9 @@ class Mesh:
|
||||
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
|
||||
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 properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
|
||||
mesh's ID Properties.
|
||||
@type properties: L{IDGroup<IDProp.IDGroup>}
|
||||
@ivar edges: The mesh's edges.
|
||||
@type edges: sequence of MEdges
|
||||
@ivar faces: The mesh's faces.
|
||||
|
||||
@@ -337,17 +337,16 @@ class NMFace:
|
||||
@param vertex: An NMVert object.
|
||||
"""
|
||||
|
||||
from IDProp import IDProperty, IDGroup, IDArray
|
||||
from IDProp import IDGroup, IDArray
|
||||
class NMesh:
|
||||
"""
|
||||
The NMesh Data object
|
||||
=====================
|
||||
This object gives access to mesh data in Blender. We refer to mesh as the
|
||||
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 properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
|
||||
objects's ID Properties.
|
||||
@type properties: L{IDGroup<IDProp.IDGroup>}
|
||||
@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).
|
||||
@ivar materials: The list of materials used by this NMesh. See
|
||||
|
||||
@@ -237,7 +237,7 @@ def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=
|
||||
Blender.Redraw()
|
||||
"""
|
||||
|
||||
from IDProp import IDProperty, IDGroup, IDArray
|
||||
from IDProp import IDGroup, IDArray
|
||||
class Object:
|
||||
"""
|
||||
The Object object
|
||||
@@ -251,10 +251,9 @@ class Object:
|
||||
To get these values in worldspace (taking into account vertex parents, constraints etc)
|
||||
pass the argument 'worldspace' to these functions.
|
||||
|
||||
@ivar properties: 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 properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
|
||||
objects's ID Properties.
|
||||
@type properties: L{IDGroup<IDProp.IDGroup>}
|
||||
@ivar restrictDisplay: Don't display this object in the 3D view: disabled by default, use the outliner to toggle.
|
||||
@type restrictDisplay: bool
|
||||
@ivar restrictSelect: Don't select this object in the 3D view: disabled by default, use the outliner to toggle.
|
||||
|
||||
@@ -74,16 +74,15 @@ def Unlink(scene):
|
||||
@param scene: The Scene to be unlinked.
|
||||
"""
|
||||
|
||||
from IDProp import IDProperty, IDGroup, IDArray
|
||||
from IDProp import IDGroup, IDArray
|
||||
class Scene:
|
||||
"""
|
||||
The Scene object
|
||||
================
|
||||
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.
|
||||
@ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
|
||||
scene's ID Properties.
|
||||
@type properties: L{IDGroup<IDProp.IDGroup>}
|
||||
@type name: string
|
||||
@ivar name: The Scene name.
|
||||
@type Layers: integer (bitmask)
|
||||
|
||||
@@ -241,7 +241,7 @@ def Get (name = None):
|
||||
- (): A list with all Texture objects in the current scene.
|
||||
"""
|
||||
|
||||
from IDProp import IDProperty, IDGroup, IDArray
|
||||
from IDProp import IDGroup, IDArray
|
||||
class Texture:
|
||||
"""
|
||||
The Texture object
|
||||
@@ -251,10 +251,8 @@ class Texture:
|
||||
Note that many of the attributes of this object are only relevant for
|
||||
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 properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this texture's ID Properties.
|
||||
@type properties: L{IDGroup<IDProp.IDGroup>}
|
||||
@ivar animFrames: Number of frames of a movie to use.
|
||||
Value is clamped to the range [0,30000].
|
||||
@type animFrames: int
|
||||
|
||||
Reference in New Issue
Block a user