Quick script to help with cloth sim



  • Hi,

    I had a need to shrink v4s neck as it was poking through my clothing mesh If I scaled it down the head moved so I wrote this to allow me to shrink, or expand along the actors normals. I've needed this for clothes before, and would export to blender, Alt-S then export and load as a morph target. I can now create this with this script. It creates a "Deflate" morph on the selected actor. Can take a while if there is a lot of geometry. Hope someone finds it useful.

    BTW how do I get privs to upload files?

    import poser
    scene = poser.Scene()
    figure = scene.CurrentFigure()
    object = scene.CurrentActor()
    
    def deflate_morph(act):
    	amt = -0.01
    	act.SpawnTarget("Deflate")
    	morph = act.Parameter("Deflate")
    	geom=act.Geometry()
    	for vi in range(geom.NumVertices()):
    		vert = geom.Vertices()[vi]
    		norm = geom.Normals()[vi]
    		deltax = (vert.X() + (norm.X() * amt)) - vert.X()
    		deltay = (vert.Y() + (norm.Y() * amt)) - vert.Y()
    		deltaz = (vert.Z() + (norm.Z() * amt)) - vert.Z()
    		morph.SetMorphTargetDelta(vi,deltax,deltay,deltaz)
    
    deflate_morph(object)
    

    Amanda



  • This post is deleted!


  • @amethystpendant I had previously upvoted your post assuming, erroneously, that this was a reputation linked privilege. Much embarrassment ensued from realising that I'd seen many, many of your posts previously, and a subsequent check confirmed that your reputation was, indeed, significantly higher than my own [blush]. Thus, I must report that my own attempt to use "Upload File" with a tiny python script also failed with a privilege error. Alas, I have no answer for your question.

    Thank you for the script :-). My previous answer (prior to the neighbours calling the fire brigade over the ruddy glow they observed through my window) included suggestions for free file uploaders like dropbox or ShareCG, but I'm sure you're already aware of those. [Proudest achievement: teaching both my Grannies which end of the egg to suck!]



  • @anomalaus Many thanks, yes I usually upload to my stash on DA and link from there but as it was so small I thought I might be able to do it as there is an upload file button, oh well, nothing horrendous has happened , no bones broken :)