I’d like to write a script to help me crease only the corners of meshes from Marvelous Designer, since simply applying a subsurf leads to rounded corners and gaps in the garment.
I just can’t figure out their specifics. Angle selection (via bevel modifier etc.) also grabs edges in the middle of the garment.
Thanks for your input. I was looking for a more automated way to do this, since I’ll have a ton of meshes that I wanted to crease that way. I’ll keep investigating.
I managed to write a little script that does exactly what I need. I ended up creasing all the sharp edges, since it doesn’t really make a difference in this case.
For anyone interested in how to get garments from Marvelous Designer to Blender and prepare them for a subsurf modifier, here’s my workflow and script:
Export from MD as FBX, multiple objects, thick
Import FBX to blender, select all pattern pieces and have an active object
Run script
import bpy
import bmesh
objs = bpy.context.selected_objects
# remove doubles
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.remove_doubles(threshold=0.00001, use_unselected=False, use_sharp_edge_from_normals=True)
for obj in objs:
# crease edges
me = obj.data
bm = bmesh.from_edit_mesh(me)
creaseLayer = bm.edges.layers.crease.verify()
selectedEdges = [ e for e in bm.edges if not e.smooth ]
for e in selectedEdges: e[ creaseLayer ] = 1.0
bpy.ops.object.mode_set(mode='OBJECT')
This barely took two seconds for a fairly complex garment.
I hope this helps anyone who’s trying to do the same thing.