Hi there, all.
I'm trying to create a script that would cut a maxi dForce skirt to different lengths by deleting N rows from the bottom. Because it has a surface for the hem, it can be done by selecting it, growing it, reassigning to the hem surface, shrinking it down to what is actually be deleted, and then deleting the selection. And the sprawling, sparse documentation has been tough to navigate, but I got it mostly figured out. Deleting a selection of facets seems... clunky, at best. There's an undocumented function, `removeSelectedFacets()`, and it does not seem to do anything. So instead I make a face group, assign the facets to be deleted to that face group, and use `removeFaceGroup()`, and that deletes them.
But I have clearly done it the completely wrong way, because there are a whole bunch of problems when I use the cut script on the skirt.
The first, and most pressing one, is that you can't reload the original skirt to get back the original length if you cut too much off. When you delete the trimmed skirt and load the original one, it has the trimmed length. It's not permanent as in the file has been modified; if you exit and reload Daz Studio, you can get the original length back.
You can't save scenes with the trimmed skirt. If you do, and then you reload the scene, instead of the skirt, you get bounding boxes for all of the areas of the skirt.
It doesn't *immediately* nuke morphs on the skirt... but it nukes morphs on the skirt. If the smoothing modifier is on and you use a particularly strong morph right after trimming, you can notice it trying to taper at the edges of the modified shape toward the unmorphed, original shape. It's a weird thing that's hard to describe. But when you reload the scene or reload the skirt and get the trimmed length, the morphs are gone.
I've uploaded my script as an attachment; what am I doing wrong? Should I be taking another approach entirely?
Another method I've thought about is hiding polygons instead of deleting them. That way, you could actually even go back to a longer length, and there's less risk of nuking the morphs, which in and of itself might be a good enough reason. I tried this once manually when trying to conceptualize this script. One good thing is that the hidden polygons are ignored by dForce, which is exactly what we'd want. But the very last row of non-hidden polygons has weird shading, because it's connected to the unhidden polygons. This can be worked around by creating a new surface with a cutout opacity of 0, and leaving one row of polygons unhidden. This method seems to work great when I do it manually. But I'd have to figure out how to clone the hem surface in creating it, so it retains its dForce properties. Further to the point, there is a `hideSelectedPolygons()` method, but not a `showSelectedPolygons()` method, so I am not sure how I would reverse trimming if I did it this way. Still, should I prefer this method of trimming a skirt, perhaps?
Thanks for your time. :)