13
# Make Dupli's Real, as a python script.
17
scn= Scene.GetCurrent()
18
for ob in scn.objects:
19
print 'Object Group Settings'
20
print ob.name, ob.type
21
print 'enableDupVerts:', ob.enableDupVerts
22
print 'enableDupFrames:', ob.enableDupFrames
23
print 'enableDupGroup:', ob.enableDupGroup
24
print 'DupGroup:', ob.DupGroup
25
dupe_obs= ob.DupObjects
26
print 'num dup obs:', len(dupe_obs)
28
for dup_ob, dup_matrix in dupe_obs:
29
print '\tDupOb', dup_ob.name
30
scn.objects.new(dup_ob.data)
31
new_ob.setMatrix(dup_matrix)
32
new_ob.sel= 1 # select all real instances.
34
ob.sel=0 # Desel the original object
40
# Make a new group with the selected objects, and add an instance of this group.
44
scn= Scene.GetCurrent()
47
grp= Group.New('mygroup')
48
grp.objects= scn.objects
50
# Instance the group at an empty using dupligroups
51
ob= scn.objects.new(None)
52
ob.enableDupGroup= True
59
# Remove all non mesh objects from a group.
63
scn= Scene.GetCurrent()
66
grp= Group.Get('mygroup')
67
for ob in list(grp.objects): # Convert to a list before looping because we are removing items
69
grp.objects.unlink(ob)
13
# Make Dupli's Real, as a python script.
17
scn= Scene.GetCurrent()
18
for ob in scn.objects:
19
print 'Object Group Settings'
20
print ob.name, ob.type
21
print 'enableDupVerts:', ob.enableDupVerts
22
print 'enableDupFrames:', ob.enableDupFrames
23
print 'enableDupGroup:', ob.enableDupGroup
24
print 'DupGroup:', ob.DupGroup
25
dupe_obs= ob.DupObjects
26
print 'num dup obs:', len(dupe_obs)
28
for dup_ob, dup_matrix in dupe_obs:
29
print '\tDupOb', dup_ob.name
30
scn.objects.new(dup_ob.data)
31
new_ob.setMatrix(dup_matrix)
32
new_ob.sel= 1 # select all real instances.
34
ob.sel=0 # Desel the original object
40
# Make a new group with the selected objects, and add an instance of this group.
44
scn= Scene.GetCurrent()
47
grp= Group.New('mygroup')
48
grp.objects= scn.objects
50
# Instance the group at an empty using dupligroups
51
ob= scn.objects.new(None)
52
ob.enableDupGroup= True
59
# Remove all non mesh objects from a group.
63
scn= Scene.GetCurrent()
66
grp= Group.Get('mygroup')
67
for ob in list(grp.objects): # Convert to a list before looping because we are removing items
69
grp.objects.unlink(ob)
72
72
def New (name = None):
74
Make a new empty group, name optional, default is "Group"
76
@param name: The name of the new group.
78
@return: A Empty Blender Group object
74
Make a new empty group, name optional, default is "Group"
76
@param name: The name of the new group.
78
@return: A Empty Blender Group object
81
81
def Get (name = None):
83
Get the Group object(s) from Blender.
85
@param name: The name of the Group object.
86
@rtype: Blender Group or a list of Blender Groups
87
@return: It depends on the I{name} parameter:
88
- (name): The Group object called I{name}, Exception if it is not found.
89
- (): A list with all Group objects in the current blend file.
83
Get the Group object(s) from Blender.
85
@param name: The name of the Group object.
86
@rtype: Blender Group or a list of Blender Groups
87
@return: It depends on the I{name} parameter:
88
- (name): The Group object called I{name}, Exception if it is not found.
89
- (): A list with all Group objects in the current blend file.
92
92
def Unlink (group):
94
Unlink (delete) this group from Blender.
95
@Note: No objects will be removed, just the group that references them.
97
@param group: A group to remove from this blend file, does not remove objects that this group uses.
94
Unlink (delete) this group from Blender.
95
@Note: No objects will be removed, just the group that references them.
97
@param group: A group to remove from this blend file, does not remove objects that this group uses.
105
This object gives access to Groups in Blender.
106
@ivar name: The name of this Group object.
108
@ivar users: Number of users this group has (read only)
110
@ivar fakeUser: The fake user status.
111
Enabling this will keep it in the blend even if there are no users.
113
@ivar layers: Layer bitmask for this group.
115
@ivar objects: Objects that this group uses.
116
This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
117
The groups objects can be set by assigning a list or iterator of objects to the groups objects.
118
objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
120
B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
121
after Blender 2.43 append() and remove() will not be available.
122
@type objects: custom object sequence
127
Make a copy of this group
129
@return: a copy of this group
b'\\ No newline at end of file'
105
This object gives access to Groups in Blender.
106
@ivar layers: Layer bitmask for this group.
108
@ivar objects: Objects that this group uses.
109
This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
110
The groups objects can be set by assigning a list or iterator of objects to the groups objects.
111
objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
113
B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
114
after Blender 2.43 append() and remove() will not be available.
115
@type objects: custom object sequence
120
Make a copy of this group
122
@return: a copy of this group
126
Group.__doc__ += id_generics.attributes