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 5:12 AM

Quote - Have I killed the thread again, like I did with my long digression into UV handling?  😟 

Nope, just the aforementioned planned absense (other obligations).  Here's a new one to tide you over a while...

Update: 03/30/08 (search on: "03/30/08" to see changes)

First off, a word about direction... as might be gleaned from recent developments within the class, my plan is to move away from the old 'Polygon List' and only develop new functionality based on the newer class. For the script writer, this typically adds one additional line of code to get to the vertex indices...

poly = polylist[i]

...becomes...

ngon = ngonlist[i]
poly = ngon.vertIndices

...or even just...

poly = ngonlist[i].vertIndices

...but that extra effort also gives you easy access to the other Ngon members (it's normal, plane equation, uv indices) - all in one place - so you don't have to manage 4-5 different lists of data for every polygon.

This (and use of the class in general) also helps me keep track of things internally, because (for example) the TriPolys can be directly generated from Ngons, instead of having to track and pass around 4-5 lists of data to create them (it also lets me make certain assumptions about the validity and formating of the data in many cases, reducing the amount of error and range-checking bloat in the code).

In short... the various old 'Polygon List' routines might (or might not) remain available, but my advice would be to try utilizing the instead. The routines I'm referring to are:

psrPolygonList() -> mesh.GetNgons() /
psrNgonList()  (new)<br></br>
psrTexPolygonList() ->
ngon.texIndices              
(member of NgonType)<br></br>
TriPolygonize() -> mesh.GetTriPolys() / TriPolysFromNgons()
(new)<br></br>
PolyFaceNormals() ->
ngon.normal                    
(member of NgonType)<br></br>
VertexPolys() -> mesh.GetVertNgons() / VertexNgons() (new)<br></br>
PolyVertexNormals() ->
mesh.GetWorldNormals()        (stand-alone
routine to come)<br></br>

...once I have suitable Ngon replacements in place for the above (which I mostly already have), the above routines (left-most column) hit the endangered-species list :).

[NOTE: rather than try to use the stand-alone functions, it's recommended to use the MeshType class, which does a lot of things like generating Ngon and tripoly face normals for you automatically. (ie. if you do: 'ngons = mesh.GetNgons(geom)' then the normals and plane equations (and tex indices list) of the Ngons are already filled in - if you call the new stand-alone 'ngons = psrNgonList(geom)' instead, the tex indices list is filled in, but the normal and plane members are not]

Individual updates list:

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.