Module Group
[frames | no frames]

Module Group

The Blender.Group submodule.

Group

This module provides access to Group data in Blender.

Example:
       # Make Dupli's Real, as a python script.

       from Blender import *

       scn= Scene.GetCurrent()
       for ob in scn.objects:
               print 'Object Group Settings'
               print ob.name, ob.type
               print 'enableDupVerts:', ob.enableDupVerts
               print 'enableDupFrames:', ob.enableDupFrames
               print 'enableDupGroup:', ob.enableDupGroup
               print 'DupGroup:', ob.DupGroup
               dupe_obs= ob.DupObjects
               print 'num dup obs:', len(dupe_obs)

               for dup_ob, dup_matrix in dupe_obs:
                       print ' DupOb', dup_ob.name
                       scn.objects.new(dup_ob.data)
                       new_ob.setMatrix(dup_matrix)
                       new_ob.sel= 1 # select all real instances.

               ob.sel=0 # Desel the original object

       Window.RedrawAll()
Example:
       # Make a new group with the selected objects, and add an instance of this group.

       from Blender import *
       
       scn= Scene.GetCurrent()
       
       # New Group
       grp= Group.New('mygroup')
       grp.objects= scn.objects
       
       # Instance the group at an empty using dupligroups
       ob= scn.objects.new(None)
       ob.enableDupGroup= True
       ob.DupGroup= grp
       Window.RedrawAll()
Example:
       # Remove all non mesh objects from a group.

       from Blender import *
       
       scn= Scene.GetCurrent()
       
       # New Group
       grp= Group.Get('mygroup')
       for ob in list(grp.objects): # Convert to a list before looping because we are removing items
               if ob.type != 'Mesh':
                       grp.objects.unlink(ob)

Classes
Group This object gives access to Groups in Blender.

Function Summary
Blender Group or a list of Blender Groups Get(name)
Get the Group object(s) from Blender.
Blender Group New(name)
Make a new empty group, name optional, default is "Group"
  Unlink(group)
Unlink (delete) this group from Blender.

Function Details

Get(name=None)

Get the Group object(s) from Blender.
Parameters:
name - The name of the Group object.
           (type=string)
Returns:
It depends on the name parameter:
  • (name): The Group object called name, Exception if it is not found.
  • (): A list with all Group objects in the current blend file.

           (type=Blender Group or a list of Blender Groups)

New(name=None)

Make a new empty group, name optional, default is "Group"
Parameters:
name - The name of the new group.
           (type=string)
Returns:
A Empty Blender Group object
           (type=Blender Group)

Unlink(group)

Unlink (delete) this group from Blender.
Parameters:
group - A group to remove from this blend file, does not remove objects that this group uses.
           (type=group)

Note: No objects will be removed, just the group that references them.


Generated by Epydoc 2.1 on Thu May 10 20:31:59 2007 http://epydoc.sf.net