Wed, Jan 8, 5:21 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 Dec 02 3:16 pm)

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: best way to restrict to Mil4 figures


grichter ( ) posted Wed, 09 February 2011 at 7:48 PM · edited Mon, 04 November 2024 at 7:54 PM

Not at my python computer so might have this backwards. You can check by internal name which I believe returns just figure1, etc. Or by external name ala V4.2, but the user can change that (which I have myself done). Plus if you add more then one figure of the same name it adds the 1 etc on the end of the figure name.

So is the best way to check the object file to make sure the character you are about to run a script on belongs to V4 (A4, G4, SP4) or is there another sure-fire way that everybody uses? Have a script I am studying that uses the object file method, which I have yet to try. But everything else I have dreamed up based on trying to use figure names has failed so far.

TIA

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


bagginsbill ( ) posted Wed, 09 February 2011 at 9:54 PM

The set of all material names is pretty unique to Daz Mil4.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


markschum ( ) posted Wed, 09 February 2011 at 10:30 PM

You can get the geometry file name, or you can get the geometry itself and check the vertex count. I am not sure that unique though. Geom file name seems easiest.


grichter ( ) posted Wed, 09 February 2011 at 10:31 PM

True. Have a check on 2_SkinTorso.

 

Looked at two different scripts and both used two different methods. One was troubling because it created a figureList which also picked the first character that matched "2_SkinTorso". So if you had V4 and SP4 in the scene and tried to apply the script to SP4 it was a no go if they were in the scene after V4. Same applied to 2 V4's. Like the script was designed for there never to be more then one figure in the scene. Which then lead me to look in another script that looked for the various blmilwom_v4 object files.

Guess I should revert to keep it simple stupid, instead of trying to be overly complex for no apparent reason.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


markschum ( ) posted Wed, 09 February 2011 at 11:21 PM

You have to loop through all figures and build a list of which ones are what you want if theres more than 1.

I do most of my scripts to work on currentfigure, and test for the geom file if it must be V4. I have a couple scripts that load and conform clothing that do a check. 

 


grichter ( ) posted Wed, 09 February 2011 at 11:50 PM

My test scene had 2 V4's and 1 SP4 in it and using f = poser.Scene().CurrentFigure() to start my figure check and then test the material zones allows me to apply a second skin IE: BB's nylons textures with a pantyhose displacement map I created etc to any valid fgure (hip, leg and foot) in the scene that is selected.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


PhilC ( ) posted Thu, 10 February 2011 at 4:48 AM · edited Thu, 10 February 2011 at 4:48 AM

I would use this method:-

import poser
import os
scene = poser.Scene()
for fig in scene.Figures():
    geomFile = os.path.split(fig.GeomFileName())[1]
    if geomFile == "blMilMan_m4b.obj":
        print "%s based on %s IS an M4 figure" % (fig.Name(),geomFile)
    else:
        print "%s based on %s IS NOT an M4 figure" % (fig.Name(),geomFile)

 


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.