I want to do something very simple: Enter into a pick session & return the 1st object picked, ending the session & storing the object reference. I don't need a multi-pick session.
Here's my code:
def OnPick(flags, active, multi):
if flags & c4d.PICKSESSION_FLAG_CANCELED:
print "User cancel"
doc.StopPickSession(cancel = True)
else:
doc.StopPickSession(cancel = False)
print "active: ", active
def main():
doc = documents.GetActiveDocument()
doc.StartPickSession(OnPick, multi=False)
This seems to work & 'active' contains the picked object.
But I can't return any reference to the object in 'active'
as soon as I try to read it into a variable, or return it I get AttributeError: 'function' object has no attribute 'function'.
I'm afraid I just don't understand how pick sessions are supposed to work.
Any help would be very appreciated.