Forum: Poser Python Scripting


Subject: Moving morphs between different figures

Cage opened this issue on Dec 20, 2006 · 1232 posts


Spanki posted Wed, 02 April 2008 at 11:59 PM

Ok, I'm not getting those results.  When you downloaded that new file above, did you quit Poser, download that file (overwriting the _tdmt.pyd file in the PoersRuntimePythonDLLs folder), then re-start Poser and try again?

I just tested with this:

import poser<br></br>
import math, Numeric<br></br>
import time, os<br></br>
from _tdmt import *

def vertneighbors(mesh): # _tdmt.pyd
GetVertNeighborsByNgons() doesn't return the same data....<br></br>
 ngons = mesh.GetNgons()<br></br>
 pgons = [i.vertIndices for i in ngons]<br></br>
 vpolys = mesh.GetVertNgons()<br></br>
 vneighbors = [[] for i in range(len(vpolys))]<br></br>
 for vi in range(len(vpolys)):<br></br>
  screen = [vi] # Need to exclude the vert itself!<br></br>
  for ps in vpolys[vi]:<br></br>
   for v in pgons[ps]:<br></br>
    if not v in screen:<br></br>
     vneighbors[vi].append(v)<br></br>
    screen.append(v)<br></br>
 vneighbors = [Numeric.array(i,Numeric.Int) for i in
vneighbors]<br></br>
 return vneighbors

scene = poser.Scene()<br></br>
actor = scene.CurrentActor()

if actor:<br></br>
 geom = actor.Geometry()<br></br>
 if geom:<br></br>
  mesh = Mesh(geom)<br></br>
  vn = mesh.GetVertNeighborsByNgons()<br></br>
  vn2 = vertneighbors(mesh)<br></br>
  for vi in range(len(vn)):<br></br>
   print vi, vn2[vi], vn[vi]<br></br>

...and got this result:

0 [1 2 3] [1, 2, 3]
1 [0 2 3] [0, 2, 3]
2 [0 1 3] [0, 1, 3]
3 [0 1 2] [0, 1, 2]
4 [7 6 5] [7, 6, 5]
5 [7 6 4] [7, 6, 4]
6 [7 5 4] [7, 5, 4]
7 [6 5 4] [6, 5, 4]
 

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.