Sun, Nov 24, 11:20 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Looking for an actor selector...


Spanki ( ) posted Thu, 21 December 2006 at 8:11 AM · edited Sun, 24 November 2024 at 11:17 PM

Howdi,

What I'm looking for is a dialog that will display a list (not drop-down) of all actors of the selected figure, with a select/de-select checkbox (boolean value) for each.  I guess something like the tree-view in the Heirarchy window or the .obj Export window might be cleanest - particularly if the top level of each branch would enable/disable the children checkboxes.

This sort of dialog seems like it would be very generally useful for dozens of script applications(performing some acion on the resulting selected actors).   I noticed that Cage might have something like that set up in his partial-pose thing, but I'm getting an error trying to run that in P7 (line 48, in findParts - "for i in range(0,len(parts[part])):" - TypeError: len() of unsized object ).

I also note that there's some sort of SimpleDialog.AskActor(), but I assume this is just going to display a drop-down selection list (?).

Anyway, has anyone already come up with such a beast that would work in P7? (bonus if it works in other versions and/or Mac).

Thanks,

Keith

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


Spanki ( ) posted Thu, 21 December 2006 at 4:35 PM

I can't edit it now, but the title of this thread would more appropriately be "Looking for an actor list selector...".  Ideally, it would just be a function call, that returned a list of selected actors.

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


nruddock ( ) posted Thu, 21 December 2006 at 4:52 PM

I think it's a case of making your own dialog using posework's PzrXML library.
The XML generated should be usable in P7, but you'll need to use P6 to create until the library gets recompiled for the new Python version in P7.

Now that tkInter works on Macs, if your script is for P7 only, then it will be easier to do (one or more of ockham's scripts likely has something in).


Spanki ( ) posted Thu, 21 December 2006 at 4:59 PM

Thanks - I'm still a python neophyte (been a C programmer for 20+ years though).  I assume(d) that something like this was bound to have already been written, so I didn't want to reinvent the wheel if it was already available.  Can you even do tree-view gadgets using the PzrXML library?  And, where can I find info (docs, etc) on that library?

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


tromnek ( ) posted Thu, 21 December 2006 at 6:54 PM

I have a real nice treeview that I started hacking up for this kind of task.
Attached is a 'proof of concept'. It needs to be rewritten so I can be subclassed for any purpose.
It can support drag and drop.

I settled on this one because it can run under Poser Pro Pack.

I haven't worked on it in some time. I have alot of other projects I working on right now.
I want to release it either GPL or Lessor GPL.

Let me know if you're interested in working on such a project.


tromnek ( ) posted Thu, 21 December 2006 at 6:57 PM

file_363273.doc

Oops, forgot this forum doesn't like .zip files. Here's the python script with a .doc extention, rename with a .py extension and check it out.


Spanki ( ) posted Thu, 21 December 2006 at 7:41 PM

Cool beans - thanks.  I'll take a look and get back with you.

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


nruddock ( ) posted Thu, 21 December 2006 at 7:49 PM

Attached Link: http://www.poseworks.com/serendipity/index.php?/categories/4-PzrXml

> Quote - I assume(d) that something like this was bound to have already been written, so I didn't want to reinvent the wheel if it was already available.

I'm sure some of ockham's scripts have actor selection.
These will be tk list boxes (with multiselect turned on when appropriate) that are populated at runtime.

Quote - Can you even do tree-view gadgets using the PzrXML library?

Not tree views.
Poser's own dialog stuff is quite limited in scope, posework's library allows dynamic creation, so you can build a list of actors on the fly.
Tree widgets are available (and have been for a long while) for tkInter, but need to find and install them.
Tix has the sort of widgets your wanting (see -> http://tix.sourceforge.net/dist/current/docs/html/TixUser/subsubsection3_3_1_3.html#SECTION00031300000000000000), has Python support and build support for it is part of the Python distribution.
It's not, however part of Poser Python (no DLLs or tcl files), so you have to obtain and install.

Quote - And, where can I find info (docs, etc) on that library?

See attached link.


Spanki ( ) posted Thu, 21 December 2006 at 8:17 PM

Thanks, it look like ockhams BVH Mixer might have something I can use.

Tromnek,

That's a spiffy treeview!  If I get some time, I'll see if I can dig into it (looks overly complex for what I need it to do, but the interface is certainly there).

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


crelus ( ) posted Mon, 26 February 2007 at 12:57 PM · edited Mon, 26 February 2007 at 12:58 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)


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.