Forum: Poser Python Scripting


Subject: Looking for an actor selector...

Spanki opened this issue on Dec 21, 2006 · 10 posts


crelus posted Mon, 26 February 2007 at 12:57 PM

Would something like this be what you are looking for? Call SelectActorsFromFigure() and this will give you a selected actor name. Then call GetActorFromFigure() with the same figure object and the name that was returned and you should have a reference to your actor object. Of course you'll want to check that an actor has been selected and the user didn't cancel, but this works for me without having to create any custom dialogs.

def GetActorsForFigure(figure):
    actorList = figure.Actors()
    return actorList

def GetActorNamesForFigure(figure):
    actorList = GetActorsForFigure(figure)
    actorNameList = []
    for actor in actorList:
        actorNameList.append(actor.Name())       
    return actorNameList

def SelectActorFromFigure(figure):
        names = GetActorNamesForFigure(figure)
        choice = AskMenu(title="Select Actor", message="Please Select an Actor", options=names)
        return choice

def GetActorFromFigure(fig,actorName):
    return fig.Actor(actorName)