[Bf-python] Blender.Group

cpbarton at iinet.net.au cpbarton at iinet.net.au
Mon Mar 13 09:21:17 CET 2006


Hello Self,

Patch tracker link to Blender.Group module
Main files are Group.c and Group.h so there just in a zip.

It should be okay for the new API,
Example::

gp= Group.Get("Group")

for ob in Object.GetSelected():
gp.objects.append(ob)

gp.objects.remove( gp.objects[0] )

print len(gp.objects)

gp.name= "MyGroup"

- Cam


Quoting Campbell J Barton <cbarton at metavr.com>:

> Hello Pythoners..
> Ever since groups were added I wanted to use them - dupligroups esp!
> But no python support means I cant use them for exporting to out engine...
> 
> To get to the point, I got stuck at LA airport and had a go at Blender.Group
> 
> Its small, but groups arnt that complex.
> 
> The module uses getsetattrs, and an iterator for objects, wich fits realy
> nice
> with listbase's and general speedyness.
> 
> Syntax is as follows.
> 
> g= Group.Get('SomeGroup')
> g.name= 'NewName'
> for ob in g.objects: print ob.name
> 
> newob= Object.Get('myob')
> g.objects.append(newob)
> 
> # Empty the group
> for ob in g.objects:
>   g.objects.remove(ob)
> 
> 
> Setfaulting at the moment us Group.Unlink() and directly assigning lists to
> g.objects.
> 
> ken/will- once its stabalized Ill submit a patch.
> - Cam
> 
> 
> -- 
> Campbell J Barton
> 
> 133 Hope Street
> Geelong West, Victoria 3218 Australia
> 
> URL:    http://www.metavr.com
> e-mail: cbarton at metavr.com
> phone: AU (03) 5229 0241 
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
> 





More information about the Bf-python mailing list