5
This type supports both iteration and the []
6
operator to get child ID properties.
8
You can also add new properties using the [] operator.
11
group['a float!'] = 0.0
13
group['a string!'] = "hi!"
14
group['an array!'] = [0, 0, 1.0, 0]
16
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
17
"another subgroup": {"a": 0.0, "str": "bleh"}}
19
Note that for arrays, the array type defaults to int unless a float is found
20
while scanning the template list; if any floats are found, then the whole
21
array is float. Note that double-precision floating point numbers are used for
22
python-created float ID properties and arrays (though the internal C api does
23
support single-precision floats, and the python code will read them).
25
You can also delete properties with the del operator. For example:
29
To get the type of a property, use the type() operator, for example::
31
if type(group['bleh']) == str: pass
33
To tell if the property is a group or array type, import the Blender.Types module and test
34
against IDGroupType and IDArrayType, like so::
36
from Blender.Types import IDGroupType, IDArrayType.
38
if type(group['bleghr']) == IDGroupType:
41
@ivar name: The name of the property
47
Pop an item from the group property.
49
@param item: The item name.
50
@rtype: can be dict, list, int, float or string.
51
@return: The removed property.
54
def update(updatedict):
56
Updates items in the dict, similar to normal python
57
dictionary method .update().
58
@type updatedict: dict
59
@param updatedict: A dict of simple types to derive updated/new IDProperties from.
66
Returns a list of the keys in this property group.
67
@rtype: list of strings.
68
@return: a list of the keys in this property group.
73
Returns a list of the values in this property group.
75
Note that unless a value is itself a property group or an array, you
76
cannot change it by changing the values in this list, you must change them
77
in the parent property group.
81
group['some_property'] = new_value
83
. . .is correct, while,
85
values = group.values()
90
@rtype: list of strings.
91
@return: a list of the values in this property group.
96
Implements the python dictionary iteritmes method.
100
for k, v in group.iteritems():
101
print "Property name: " + k
102
print "Property value: " + str(v)
104
@rtype: an iterator that spits out items of the form [key, value]
105
@return: an iterator.
108
def convert_to_pyobject():
110
Converts the entire property group to a purely python form.
113
@return: A python dictionary representing the property group
121
@ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
124
def __getitem__(index):
127
def __setitem__(index, value):