Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions makehuman/compile_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def compileMesh(path):
#print ('Compiling mesh to binary: %s' % npzpath)
try:
files3d.loadTextMesh(obj, path)
except:
print('Could not load OBJ file %s. Perhaps it mixes tris and quads.' % path)
except Exception as ex:
print('Could not load OBJ file %s. Perhaps it mixes tris and quads.' % path, ex)
#import traceback
#traceback.print_exc(file=sys.stdout)
return False
files3d.saveBinaryMesh(obj, npzpath)
except:
print('Unable to save compiled mesh for file %s' % path)
except Exception as ex:
print('Unable to save compiled mesh for file %s' % path, ex)
#import traceback
#traceback.print_exc(file=sys.stdout)
return False
Expand Down
7 changes: 4 additions & 3 deletions makehuman/core/files3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def packStringList(strings):
for string in strings:
index.append(len(text))
text += string
text = np.fromstring(text, dtype='S1')
#text = np.fromstring(text, dtype='S1')
text = np.frombuffer(text.encode(),dtype='S1')
index = np.array(index, dtype=np.uint32)
return text, index

Expand All @@ -87,11 +88,11 @@ def unpackStringList(text, index):
last = None
for i in index:
if last is not None:
name = str(text[last:i].tostring(), 'utf-8')
name = str(text[last:i].tobytes(), 'utf-8')
strings.append(name)
last = i
if last is not None:
name = str(text[last:].tostring(), 'utf8')
name = str(text[last:].tobytes(), 'utf8')
strings.append(name)

return strings
Expand Down
2 changes: 1 addition & 1 deletion makehuman/lib/image_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def load(path):

pixels = im.bits().asstring(h * w * 4)

pixels = np.fromstring(pixels, dtype=np.uint32).reshape((h, w))
pixels = np.frombuffer(pixels, dtype=np.uint32).reshape((h, w))
del im

a = (pixels >> 24).astype(np.uint8)
Expand Down
2 changes: 1 addition & 1 deletion makehuman/makehuman.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def _packStringDict(stringDict):
index.append(len(key))
index.append(len(value))
text += key + value
text = np.fromstring(text, dtype='S1')
text = np.frombuffer(text.encode('utf-8'), dtype='S1')
index = np.array(index, dtype=np.uint32)
return np.array([text, index], dtype=object)

Expand Down
17 changes: 8 additions & 9 deletions makehuman/shared/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,25 +555,24 @@ def _properPath(path):

folder = os.path.dirname(path)


vars_ = dict(
#proxyType = np.fromstring(proxy.type, dtype='S1'), # TODO store proxy type?
name = np.fromstring(proxy.name, dtype='S1'),
uuid = np.fromstring(proxy.uuid, dtype='S1'),
description = np.fromstring(proxy.description, dtype='S1'),
basemesh = np.fromstring(proxy.basemesh, dtype='S1'),
name = np.frombuffer(proxy.name.encode(),dtype='S1'),
uuid = np.frombuffer(proxy.uuid.encode(), dtype='S1'),
description = np.frombuffer(proxy.description.encode(), dtype='S1'),
basemesh = np.frombuffer(proxy.basemesh.encode(), dtype='S1'),
tags_str = tagStr,
tags_idx = tagIdx,
lic_str = licStr,
lic_idx = licIdx,
uvLayers_str = uvStr,
uvLayers_idx = uvIdx,
obj_file = np.fromstring(_properPath(proxy.obj_file), dtype='S1'),
obj_file = np.frombuffer(_properPath(proxy.obj_file).encode(), dtype='S1'),
version = np.asarray(proxy.version, dtype=np.int32)
)

if proxy.material_file:
vars_["material_file"] = np.fromstring(_properPath(proxy.material_file), dtype='S1')
vars_["material_file"] = np.frombuffer(_properPath(proxy.material_file).encode(), dtype='S1')

if np.any(proxy.deleteVerts):
vars_["deleteVerts"] = proxy.deleteVerts
Expand Down Expand Up @@ -608,7 +607,7 @@ def _properPath(path):
vars_['num_refverts'] = np.asarray(num_refverts, dtype=np.int32)

if proxy.vertexBoneWeights_file:
vars_['vertexBoneWeights_file'] = np.fromstring(_properPath(proxy.vertexBoneWeights_file), dtype='S1')
vars_['vertexBoneWeights_file'] = np.frombuffer(_properPath(proxy.vertexBoneWeights_file).encode(), dtype='S1')

np.savez_compressed(fp, **vars_)
os.utime(path, None) # Ensure modification time is updated
Expand Down Expand Up @@ -1043,7 +1042,7 @@ def _packStringList(strings):
asbytes = bytearray(text,'utf-8')
index.append(len(asbytes))
text += string
text = np.fromstring(text, dtype='S1')
text = np.frombuffer(text.encode(), dtype='S1')
index = np.array(index, dtype=np.uint32)
return text, index

Expand Down