Skip to content

Commit 6aee3d7

Browse files
committed
CharMorph 0.3.0
1 parent bebd2c5 commit 6aee3d7

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
bl_info = {
3030
"name": "CharMorph",
3131
"author": "Michael Vigovsky",
32-
"version": (0, 2, 9),
32+
"version": (0, 3, 0),
3333
"blender": (2, 83, 0),
3434
"location": "View3D > Tools > CharMorph",
3535
"description": "Character creation and morphing, cloth fitting and rigging tools",

cmedit/__init__.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,16 @@ def normalize(v):
361361
continue
362362
v2 = counterpart_vertex(mesh.vertices, kd, v)
363363
if v2 is None:
364+
print("no counterpart", v.index)
364365
continue
365366
gdict = {obj.vertex_groups[g.group].name: g for g in v2.groups}
366367

367368
wgt2 = 0
368369
#cleanup groups without counterparts before normalizing
369370
for g in v.groups:
371+
if g.group > len(obj.vertex_groups) or g.group < 0:
372+
print("bad vg id", v.index, g.group)
373+
continue
370374
vg = obj.vertex_groups[g.group]
371375
g2e = gdict.get(swap_l_r(vg.name))
372376
if g2e:
@@ -400,8 +404,8 @@ def normalize(v):
400404
return {"FINISHED"}
401405

402406
if abs(g1e.weight-g2w) >= 0.00001:
403-
if not is_deform(g2name):
404-
print("Normalizing non-deform", v.index, v2.index, g2name)
407+
#if not is_deform(g2name):
408+
# print("Normalizing non-deform", v.index, v2.index, g2name)
405409
#print("Normalizing", v.index, v2.index, g1e.weight, g2w, wgt2, g2name)
406410
if v2.select:
407411
wgt = (g1e.weight+g2w)/2

cmedit/file_io.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def execute(self, context):
109109
def float_dtype(context):
110110
return numpy.float64 if context.window_manager.cmedit_ui.morph_float_precicion == "64" else numpy.float32
111111

112+
def flatten(arr, dtype):
113+
return numpy.block([numpy.array(item, dtype=dtype) for item in arr])
114+
112115
class OpVgExport(bpy.types.Operator, bpy_extras.io_utils.ExportHelper):
113116
bl_idname = "cmedit.vg_export"
114117
bl_label = "Export VGs"
@@ -129,8 +132,8 @@ def execute(self, context):
129132
numpy.savez_compressed(self.filepath,
130133
names=b'\0'.join(name.encode("utf-8") for name in names),
131134
cnt=numpy.array(cnt, dtype=numpy.uint16 if max(cnt) > 255 else numpy.uint8),
132-
idx=numpy.array(idx, dtype=numpy.uint16),
133-
weights=numpy.array(weights, dtype = float_dtype(context))
135+
idx=flatten(idx, numpy.uint16),
136+
weights=flatten(weights, float_dtype(context))
134137
)
135138

136139
return {"FINISHED"}

0 commit comments

Comments
 (0)