Forum: Poser Python Scripting


Subject: Moving morphs between different figures

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


Spanki posted Thu, 06 March 2008 at 4:50 PM

re: Angle limiting issue...

The testing for angle limits was causing false hits in some cases.  Basically, the code is/was looking for the "closest match" (polygon intersection) within some region, but screening out polygons that didn't meet the angle limit test.  If it found some hit, the xpolys[] array was set to the hit poly for that vertex.

On the next pass, the angle limit was relaxed, but the only vertices tested were ones that didn't yet have an xpolys[] entry (no hit yet).

The problem with this is that the 'best match' poly (say, on the chin) could have failed the more stringent angle limit test on the first pass (when a bad poly on the nostril/inner_mouth got selected) because it was never tested.

If the angle test was not there,  the code would have still hit the nose/mouth poly, but later found a better match on the chin poly.

The solution to this problem is to stop weeding out steep angled polygons, which means you only need to do one pass through that code (relative to this issue).

re: Longest-edge region expansion issue...

To be honest, I had forgotten about this.  I'd recommend just doing this for the first (or only) pass. Alternately, putting the "if xpolys[vi] == -1:" test back in, but also passing a flag to the routine to determine whether or not to do that test, because of the next issue...

re: Polys/Verts can belong to more than one region...

It's also recently occured to me that when the regions are inflated/expanded (without looking, I think the original regions are/were also inflated by some small amount), then the "best match" might actually be in some 'other' region than the one being tested, so we can get false hits in some cases because of this.  Currently, there are two issues related to fixing this...

  1. the "if xpolys[vi] == -1:"  test would keep you from finding newer/better matches in other regions.

  2. Once #1 is fixed (don't use that test on the first (or only) pass), there's still a problem that the matchdist variable gets re-initialized (for each vertex) within each region test.

...to fix this second issue, you need another array of matchdistances (one per dest vertex) instead of the single local variable.  This array should be initialized to 10000.0 (or more), before calling linecast_loop().  This would let the code look at all relevent polygons, storing the closest match it found (regardless of which region it was in).

In short:

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.