Forum: Poser Python Scripting


Subject: all materials white ( poser 8 script)

ice-boy opened this issue on Aug 20, 2009 · 19 posts


ice-boy posted Thu, 20 August 2009 at 3:49 AM

can someone help me with a poser 8 script? i want to make every material white.not just on one prop or one figure. but on everything  in the scene. ground,figure,prop,....

like here


IsaoShi posted Thu, 20 August 2009 at 4:00 AM

I found markschum's script that sets all to mid-grey, on sharecg. Not the Mec4d download, but it's the same script, same author.

I changed the settings and filename from grey to white. Here it is.

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


ice-boy posted Thu, 20 August 2009 at 4:20 AM

thats good. but can we somehow make it only diffuse white? and everything turned off? 

that it replaces the material? 


ice-boy posted Thu, 20 August 2009 at 5:10 AM

for example i have a GC material from bagginsbill. its connected to the alternative diffuse. can we somehow make it that it replaces all the materials to the screenshot that i posted?


IsaoShi posted Thu, 20 August 2009 at 6:45 AM

Oh, I see what you mean... this script only does one little bit of what you want.
It can be certainly be done, but it's a bit beyond my Python skills at the moment.

Python Wizards, where are you?

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


semidieu posted Thu, 20 August 2009 at 8:02 AM

Do you want to remove also all nodes ? And set all values to what you have in the screenshot shown ?

This is an 'old' script I made... turning:

Rename the file frmo .txt to .py


PhilC posted Thu, 20 August 2009 at 8:16 AM

More scripts than you can shake a stick at. :)

This one may be more flexible, it will change all materials in the scene to match the material currently selected in the Material Room. If you want everything white just pick any actor, pick any of its materials, set that to white, then run the script.


# Script to change every material for every

# actor in the scene to match the material

# currently selected in the material room.

#

# by PhilC

# http://www.philc.net/index.php

import poser<br></br>
import os

scene = poser.Scene()

def main():<br></br>
    filename =
os.path.join(os.curdir,"temp.mt5")<br></br>
    mat = scene.CurrentMaterial()<br></br>
    mat.SaveMaterialSet(filename)

    for actor in scene.Actors():<br></br>
        try:<br></br>
           
print "Processing %s" % actor.Name()<br></br>
           
for mat in actor.Materials():<br></br>
               
try:<br></br>
                   
mat.SetSelected(1)   <br></br>
                   
mat.LoadMaterialSet(filename)<br></br>
                   
print "------ %s OK" % mat.Name()<br></br>
               
except:<br></br>
                   
print "------ %s FAILED" % mat.Name()<br></br>
        except:<br></br>
           
print "------ Bypassing %s" % actor.Name()<br></br>
main()

print "--------------------------"<br></br>
print "     TASK COMPLETED"<br></br>
print "--------------------------"<br></br>

PhilC posted Thu, 20 August 2009 at 8:21 AM

The line:

mat.SetSelected(1)

is possibly redundant.


markschum posted Thu, 20 August 2009 at 10:03 AM

I was gonna say set one material to what you want, and use the menu at the top right (kinda) to apply that to all materials, but I think thats per figure . 


semidieu posted Thu, 20 August 2009 at 11:08 AM

The apply to all is working only on the current figure (or prop).


ice-boy posted Thu, 20 August 2009 at 12:10 PM

thank you guys for your help.

your are fantastic.


ice-boy posted Thu, 20 August 2009 at 12:22 PM

**semidieu

the script works fantastic****
**


semidieu posted Thu, 20 August 2009 at 5:52 PM

Thanks for the feedback :)

Enjoy :)


papillon68 posted Thu, 29 April 2010 at 8:09 AM

I tried to use PhilC's script with Poser Pro and Poser 8, but the actor materials are not changed to match the one currently selected.
SaveMaterialSet and LoadMaterialSet return success, so I don't know what's going on.
Any idea ? Thanks

visit my blog:  www.alessandromastronardi.com

My Rendo Store


IsaoShi posted Thu, 29 April 2010 at 8:24 AM

Just a thought - are you running the script whilst in the Material Room?

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


papillon68 posted Thu, 29 April 2010 at 8:27 AM

Hi, I tried both in the Pose and in the Material Room. Also, I don't know if this helps, I'm on a Mac.
But I checked out and the temp material is correctly save, so I'm quite clueless...

visit my blog:  www.alessandromastronardi.com

My Rendo Store


IsaoShi posted Thu, 29 April 2010 at 8:41 AM

Hmmm... I'm fairly sure I had Phil's script working (it would have been in PPro, I think), but I'll check this evening when I get home. I'm on Mac too.

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)


papillon68 posted Thu, 29 April 2010 at 8:50 AM

Thank you very much !

visit my blog:  www.alessandromastronardi.com

My Rendo Store


IsaoShi posted Thu, 29 April 2010 at 1:44 PM

Well, the script ran okay (in Poser Pro 2010) for a scene with just props and the default Figure1, changing every material it found to the same as the one I had selected in the Material Room. I'm afraid I have no idea why it won't update your material zones, Mr Butterfly. Do you see a similar list to this when you run the script?

Anyway, I then added a figure (Miki2_Dev), selected my test prop material, and ran the script again. It took ages, and when it eventually finished, the output window explained why: for each one of Miki2's actors, it updated all of her material zones.

The only reason for this that I can think of is that material zones are assigned directly to the figure, rather than to its actors. A minor change to the script should resolve this issue.

"If I were a shadow, I know I wouldn't like to be half of what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki Murakami)