jancory opened this issue on Feb 21, 2006 · 10 posts
jancory posted Tue, 21 February 2006 at 9:33 AM Online Now!
is there a P5 python script to align nodes? i downloaded a P6 version but don't know how to modify it into P5 (if it can even be modified)
here's the P6 version i have:
import poser
def align(mat):
scene = poser.Scene()
tree = mat.ShaderTree()
root = tree.Node(0)
for node in tree.Nodes():
if (node == root):
continue
(x,y) = node.Location()
node.SetLocation((x-x%220)+11, y)
tree.UpdatePreview()
mats = poser.Scene().WacroMaterials()
if (mats == None):
poser.DialogSimple.MessageBox(
"Please select a material first.")
else:
for mat in mats:
align(mat)
Message edited on: 02/21/2006 09:34
lost in the wilderness
Poser 13, Poser11, Win7Pro 64, now with 24GB ram
ooh! i guess i can add my new render(only) machine! Win11, I7, RTX 3060 12GB
svdl posted Tue, 21 February 2006 at 10:00 AM
Alas, not so. Poser 5 Python does not support the material room. You can have Python align the nodes by reading the mt5 text file, altering the node locations and writing them back to file. That's the best that P5 Python can do.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
jancory posted Tue, 21 February 2006 at 10:04 AM Online Now!
how do i do that? (or is that just edit the values by hand?)
lost in the wilderness
Poser 13, Poser11, Win7Pro 64, now with 24GB ram
ooh! i guess i can add my new render(only) machine! Win11, I7, RTX 3060 12GB
svdl posted Tue, 21 February 2006 at 10:13 AM
The workaround is complicated. First, your Python script must open a .mt5 file for reading. Not too difficult, it's a plain text file. Second, your script must read in the file, line by line, examine the line for a node location, store the line in a data structure, and if it's a line designating a node location, mark it. When all the lines have been processed, you can calculate the new node positions, alter the lines in your data structure, and then write out the data structure to a (new) .mt5 file. And I'm not even sure whether P5 Python can load a material from the library... In short - quite a lot of work.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
jancory posted Tue, 21 February 2006 at 10:49 AM Online Now!
thank you---not that i understand that either! i think i'll just try editing the nodes pos locations by hand.....arrgghhh
lost in the wilderness
Poser 13, Poser11, Win7Pro 64, now with 24GB ram
ooh! i guess i can add my new render(only) machine! Win11, I7, RTX 3060 12GB
Angelouscuitry posted Sun, 22 April 2007 at 3:55 PM
nruddock posted Sun, 22 April 2007 at 4:34 PM
Attached Link: http://www.stewreo.de/poser/
> Quote - Where did you DL the original script from?It was probably the script by stewer called "align_Nodes.py".
Link is to his Poser page, where you can download the script.
Angelouscuitry posted Sun, 22 April 2007 at 5:09 PM
Cage posted Sun, 22 April 2007 at 11:34 PM
*"is there a P5 python script to align nodes?"
*The "fix materials node coordinates" Python script on the scripts page in my sigline tries to be a standalone which will do pretty much what svdl outlines. Not brilliant code, but perhaps it can help....
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
Angelouscuitry posted Mon, 23 April 2007 at 12:23 AM