Forum: Poser Python Scripting


Subject: Add morph from deltas

EnglishBob opened this issue on Sep 22, 2011 · 9 posts


EnglishBob posted Thu, 22 September 2011 at 9:59 AM

I want to add morphs to an object in the scene, using pre-computed deltas. Since the object will have been generated procedurally rather than loaded from a library file, my options are limited...

I can't use a pose file since that requires channels to exist already, and there are none.

A PMD injection works, but it requires the object's internal name to match that expected in the PMD, and that can't be guaranteed. I want to be able to apply the same morph deltas to a number of objects which will all have unique internal names.

That leaves Python, reportedly. However I can only find methods for adding morphs using the current state of the vertices (spawnTarget), or from an external geometry (SpawnTargetFromGeometry). I can't use either of these a) because I don't have a deformed object in the scene or b) because the object will have an arbitrary shape, although the vertex count and order will be consistent.

Any cunning ideas? It would need to run under Poser 7, so a fairly old-hat implementation is probably required. :) 


PhilC posted Thu, 22 September 2011 at 10:46 AM

Try adding a morph with SpawnTargetFromGeometry() using itself as the geomety.

Then use SetMorphTargetDelta(index,dx,dy,dz)


markschum posted Thu, 22 September 2011 at 1:17 PM

You could also write an obj and calculate the vertices, then use it to load the morph.


colorcurvature posted Fri, 23 September 2011 at 1:41 AM

Speaking of it, did anyone ever succeed in deleting a morph target with poser python? I do not know what I am doing wrong but the API call would run through but the target is not getting deleted.


EnglishBob posted Fri, 23 September 2011 at 3:17 AM

Quote - Try adding a morph with SpawnTargetFromGeometry() using itself as the geomety. Then use SetMorphTargetDelta(index,dx,dy,dz)

Thanks Phil. That has the required amount of cunningness - I like it. :) 


EnglishBob posted Fri, 23 September 2011 at 3:19 AM

Quote - Speaking of it, did anyone ever succeed in deleting a morph target with poser python? I do not know what I am doing wrong but the API call would run through but the target is not getting deleted.

I found some references to this while I was searching, but they said it wasn't possible. Of course it wasn't the subject I was looking for so I may have overlooked some new development. 


EnglishBob posted Fri, 23 September 2011 at 8:57 AM

I got it to work - that's the good news. Thanks again Phil for the pointers.

The bad news is that the pre-computed deltas are only effective over a small range of object shapes (which I'd have realised if I'd thought about it a bit more thoroughly, duh). I really need to calculate the deltas according to the shape of the object.

Unfortunately that makes it more trouble than it's worth, given my level of trigonometrical expertise. The project is highly specific and unlikely to be of general interest, I think, so I won't beg for assistance in this forum. :)


markschum posted Fri, 23 September 2011 at 9:08 AM

Go on , ask, ya know you want too. ;)


EnglishBob posted Fri, 23 September 2011 at 2:43 PM

I wanted to add morphs to loops made by Cage's Mr.Looper script, over and above the optional 'fatness' morph that the script can do. Now I've thought about it, I can see that it would be better to do that in the script itself - but I don't think my abilities are up to it right now. :)