[Bf-python] Patch to add new functions,
Campbell Barton
cbarton at metavr.com
Sun May 30 12:10:30 CEST 2004
Hi,
I have added some functions to the Object module.
Now you can select and unselect objects
getSel(), setSel(1/0), .sel
and Object.Centre(0/1/2)
All Epydocs have been updated.
Eg...
Object.Get()[0].setSel(1)
Object.Get()[1].setSel(0)
print ob.getSel()
# or as a Class Variable,
# Toggle selection eg.
for ob in Object.Get()
if ob.sel:
ob.sel = 0
else:
ob.sel = 1
This would be usefull for different things, but mainly when dealing with
large scenes.
It would be trivial to make a GUI script that Could load and save the
current selection into different slots.
The next functions implimentation might be disputed (sorry not to split
the patch up)
ob.centre(0/1/2)
This is basic in the way that it hooks the docentre() function.
0:Object->Centre
1:Centre->Object
2:Centre->Cursor
The issue with this is that it affects all selected objects so it relys
on setSel() for any control of exacthy what is affected.
eg
Window.SetCurserPos(1,2,3)
# Deselect all
for ob in Object.Get()
ob.sel = 0
# Select the 1st object
ob = Object.Get()[0]
ob.sel = 1
Object.Centre(2) # Centre around cursor.
___________
-Cam
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ob_sel_centre.txt
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20040530/2a9643db/attachment.txt>
More information about the Bf-python
mailing list