Forum: Poser Python Scripting


Subject: Exporting posed and premorphed figure to modeller

adp001 opened this issue on Nov 28, 2020 ยท 40 posts


adp001 posted Sat, 28 November 2020 at 2:59 AM

I am currently working on transferring Poser models to Blender with as little effort as possible. For this purpose I'm using parts of "PoMo" (FullbodyMorphs_wx4.py) from the beginning of the year, besides some other scripts. Again I stumbled over the problem with the unused vertices that Poser does not remove from the "UniMesh".

Old thread: https://www.renderosity.com/rr/mod/forumpro/?thread_id=2941172

Now I was forced to take care of the problem and came up with the following, really simple solution:

    def used_list(_geom):
        """
        Return a list with 1 at positions of used vertices
        and 0 at unused vertices.
        """
        sets = _geom.Sets()
        ar = np.zeros(_geom.NumVertices(), np.int8)
        for poly in _geom.Polygons():
            start = poly.Start()
            numv = poly.NumVertices()
            for _idx in sets[start:start + numv]:
                ar[_idx] = 1
        return ar

The returned list is then used in the following function, which creates a crosslist:

    def crosslist(_used, _verts):
        cl = np.zeros(len(_verts), np.int32)
        not_empty_idx = 0
        for _idx in range(len(_verts)):
            if _used[_idx] != 0:
                cl[_idx] = not_empty_idx
                not_empty_idx += 1
        return cl

And the problem is solved. Quick and simple.

The new crosslist is used in the above mentioned script just like the previously created crosslist. But I don't save it anymore, I create it every time anew. The recalculation costs almost not noticeably more time.