Forum: Poser Technical


Subject: Antonia Technical

odf opened this issue on Aug 20, 2009 · 49 posts


odf posted Sun, 30 August 2009 at 3:49 AM

Here's what I have so far. The library is attached. With that in your PYTHONPATH, you can use the following script to add the same set of channels to every actor (the first two arguments are the input and output file, the rest are the channel names). Python 2.5 required.
#!/usr/bin/env
python<br></br><br></br>
import sys<br></br>
from poserFile import *<br></br><br></br>
TEMPLATE_TEXT = """<br></br>
targetGeom -<br></br>
    {<br></br>
    name -<br></br>
    initValue 0<br></br>
    hidden 1<br></br>
    forceLimits 4<br></br>
    min -10000<br></br>
    max 10000<br></br>
    trackingScale 0.01<br></br>
    keys<br></br>
           
{<br></br>
           
static  0<br></br>
           
k  0  0<br></br>
           
}<br></br>
    interpStyleLocked 0<br></br>
    }<br></br>
"""<br></br>
template =
PoserFile(TEMPLATE_TEXT.splitlines()).root.firstChild<br></br><br></br><br></br>
if __name__ == "__main__":<br></br>
    content = PoserFile(file(sys.argv[1]))<br></br>
   <br></br>
    for body in content.figureRoots:<br></br>
        for actor in
body.descendants:<br></br>
           
channels = actor.content.select('channels')[0]<br></br>
           
for name in sys.argv[3:]:<br></br>
               
node = template.clone()<br></br>
               
node.fields[1] = name<br></br>
               
node.select('name')[0].fields[1] = name<br></br>
               
channels.appendChild(node)<br></br><br></br>
    content.writeTo(file(sys.argv[2],
"w"))<br></br>

-- I'm not mad at you, just Westphalian.