Tue, Dec 24, 10:58 AM 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: Copy shader tree?


vholf ( ) posted Thu, 12 March 2009 at 11:12 PM · edited Tue, 24 December 2024 at 10:32 AM

Hi, I'm trying to copy an entire shader tree of a material to paste it on another material, do I have to manually set every node and inputs?

Here's part of the code I'm trying:

for mat in currentFigure.Materials():
    if mat.Name() in matsToCopy:
        print mat.Name()
        # Delete current nodes
        for node in mat.ShaderTree().Nodes():
            if node.Name() <> poser.kNodeTypeCodePOSERSURFACE:
                mat.ShaderTree().DeleteNode(node)
        # Copy nodes from selected mats
        for node in cShaderTree.Nodes():
            if node.Name() <> poser.kNodeTypeCodePOSERSURFACE:
                new_node = mat.ShaderTree().CreateNode( node.Type() )
                new_node = node

But of course that only copies the name, things like texture maps, inputs and such wont get copied, any idea?


svdl ( ) posted Fri, 13 March 2009 at 2:34 AM

It's easier to have Python save out the material as a temporary Poser .mt5 file, and then have it apply that mt5 to the second material. You can have Python delete the temporary mt5 file after you're done.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


svdl ( ) posted Fri, 13 March 2009 at 2:35 AM

Another way would be looking at the "Add Reflection" wacro source. It copies the Background shader tree, so it should give you an idea how to copy another shader tree.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


vholf ( ) posted Fri, 13 March 2009 at 3:16 AM

Great idea! thanks!


cmcc ( ) posted Sat, 14 March 2009 at 1:11 PM · edited Sat, 14 March 2009 at 1:12 PM

Attached Link: http://artcomp1.tripod.com

i'm no python scriptor though i wish i were but u can go to the top of the first block in the material editor and press select all then copy then go to a different object click on the top of the firdst bar in the first block and paste and all your nodes and everything will be copied there just identical to the first.

Computer Art by Charles McChesney


vholf ( ) posted Sun, 15 March 2009 at 12:38 AM

Yep, but for characters like Victoria 3 and the likes, where there are tons of materials with the same settings (body, arms, hip, legs, etc, all with the same material) it can be a pain to modify one tree and then have to copy that to 7 different materials, only to modify it later and have to do it again.

Python can be very useful for this, I just made a script to copy one victoria 3 material tree to all the other correct materials with a single click, be it head, body.

I can share it with you if you want.


jdredline ( ) posted Sun, 15 March 2009 at 12:31 PM

This sounds like a job for Bagginsbill's VSS. 

http://www.renderosity.com/mod/forumpro/showthread.php?thread_id=2737823&page=1

It's a lot of info in those 66 pages, but somewhere in there some one posted a "manual" with all the basic steps on how to use it.



IsaoShi ( ) posted Sun, 15 March 2009 at 3:17 PM

Yes, VSS does this. It uses the figure's current image maps but replaces the shader tree with your own design. You make any shader tree changes in one place, inside the VSS Utility Prop, then press a button to apply those changes to all relevant zones on your figure.

I think you would need to check that the material zone copy rules (in the VSS Utility Prop) were correct for V3's zone names, and then just replace bb's Template_Skin shader with yours, if you don't want to use the one he developed.

VSS uses the "save as an mc6/mcz file, then read it back in" method.

"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)


vholf ( ) posted Sun, 15 March 2009 at 10:50 PM

I love VSS, but for something as simple as changing the bump map values of the skin materials on Victoria 3 I think its too much, plus I just love to script =P.

Thanks.


Miss Nancy ( ) posted Mon, 16 March 2009 at 11:59 AM

dimension3d has got a "copy materials" script which will copy all channels and all nodes, and will also do some permutations on the above (OS X and XP/Vista), if desired.  technically the copy/paste command in the materials room should be useful, but it ain't IMVHO. "copy materials" and "reset materials" scripts particularly useful for human skin and for doing the fall-off shaders for toon inking.



cmcc ( ) posted Mon, 16 March 2009 at 12:04 PM

Attached Link: http://artcomp1.tripod.com

i see how these could be helpful.

Computer Art by Charles McChesney


vholf ( ) posted Tue, 17 March 2009 at 11:26 PM

Yes Miss Nancy, thanks. Most of the time however I refuse to buy ANY python script or program related to poser because I love programing and its one of the things I enjoy the most.

I have a script to "Isolate" a figure or prop in the scene that I've been working on to be released as a freebie but I never have the time to give it a proper GUI. Someday...

I'll make a post about it and ask for some feedback when I have some free time. If there's isn't anything like that out there already that is.


cmcc ( ) posted Wed, 18 March 2009 at 12:13 AM

Attached Link: http://artcomp1.tripod.com

i'm not nancy but i think poser scripting is cool and i'd love to do some.

Computer Art by Charles McChesney


vholf ( ) posted Wed, 18 March 2009 at 1:20 AM

Quote - i'm not nancy ....

lol

Well you could start here http://www.python.org/

Poser has python scripting, so learn python and you'll know how to apply that into poser, there's a ton of documentation and tutorials.

http://docs.python.org/tutorial/


cmcc ( ) posted Wed, 18 March 2009 at 10:35 PM

Attached Link: http://artcomp1.tripod.com

there's a lot i want to do and i don't have time for it all. i've been there and done some of that. some other things that i've done that are along these same lines that u would probably think are fun are writing povray code. writing gimp script-fu. there are even ways u can create script-fu plugins for gimp with python. i think about getting that philc pyhon deal where he shows u how he made his python scripts. if moray gets back going u might want to write luna scripts for it. cooler yet learn build wings 3d plugins with erlang. maybe one day but now i'm trying to focus on animtion. creating bvh files with poser and raw data from the melan institute. becoming more proficient at building animations in povray (poser has some great tools), becoming more proficient with anime studio, virtual dub, radvideo, movie maker, gimp gap, audacity, speech synthesis, character formation, and morphing, using philc s bvh poser python scripts, using renderstudio python scripts for lighting, building animations in daz, bryce, daz and bryce togetherto make animations, etc. somewhere down the road there i'm going t get to poser python scripting or die first. i'm betting on the die first.

Computer Art by Charles McChesney


vholf ( ) posted Wed, 18 March 2009 at 11:03 PM

Heh, that kind of sounds like me you know, I know python quite well, animation however is an unknown world of me. Trying to learn so many things at once makes you leave some stuff aside, for me its video/audio editing, now getting into hobbiest comics and mostly programing, game programing, scripting, php, mysql, c/c++, etc etc.

Too much stuff, so little time, 24 hours a day is not enough =P


cmcc ( ) posted Sun, 22 March 2009 at 1:49 AM · edited Sun, 22 March 2009 at 1:53 AM

Attached Link: http://artcomp1.tripod.com

     i hear u and i must admit i'm kind of jealous. believe me i've got a big pull in that direction myself. when i get a big bad urge to write code i'll do something with povray. u might try doing that yourself just as a curiosity. try saving a poser file. converting it to povray with poseray and then try to fix the povray code so that you get something decent by rewriting the povray code so that your picture will at first render anything and the render a decent picture . and then as an even more fun exercixe rewrite the code that you've made so that it animates. ah there i am back to animation.      something more practical and perhaps even profitable might be writing a python script that writes a tif or png to a transparent plane that can then be moved around easily in your scene with more python scripting that would keep it upright and parrallel to the x axis or maybe just parrallel to the main camera. at your discretion it would or wouldn't leave shadows. this would be particularly useful in creating text with other programs (could even be 3d text with shading.) lots of free programs do this. i do this in post editing with gimp and make it look fancy and even looks like i did it within poser. it's hard though and takes  lot of fancy 2d layer work, but it's probaly easier than importing 3d text made with another 3d program into poser then posing it and then texturing it and all that. would be a chore, but by just laying some transparent lettering already textured on to a transparent screen that was limited so that it had to keep facing the main camera. instant layering. and it would probably be easy to script and it could be very useful.

Computer Art by Charles McChesney


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.