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
9 changes: 6 additions & 3 deletions import_craft/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ def get_model(self):
props = self.model.mumodelprops
props.config = self.cfg.ToString(-1)
scale = self.rescaleFactor
model = self.instantiate(Vector((0, 0, 0)),
Quaternion((1,0,0,0)),
Vector((1, 1, 1)) * scale)
try:
model = self.instantiate(Vector((0, 0, 0)),
Quaternion((1,0,0,0)),
Vector((1, 1, 1)) * scale)
except:
model = None
return model

def instantiate(self, loc, rot, scale):
Expand Down
5 changes: 4 additions & 1 deletion import_mu/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def create_mesh(mu, mumesh, name):
create_uvs(mu, mumesh.uv2s, mesh, "UVMap2")
if mumesh.normals:
create_normals(mu, mumesh.normals, mesh)
create_colors(mu, mumesh.colors, mesh)

# does fall, needs fix. works well without it
#create_colors(mu, mumesh.colors, mesh)

#FIXME how to set tangents?
#if mumesh.tangents:
# for i, t in enumerate(mumesh.tangents):
Expand Down
7 changes: 4 additions & 3 deletions model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ def compile_model(db, path, type, name, cfg, collection):
if n.HasValue("scale"):
scale = parse_vector(n.GetValue("scale"))
mdl = db.model(submodelname)
obj = mdl.instantiate(f"{name}:submodel", position, rotation, scale)
model.objects.link(obj)
obj.parent = root
if mdl: # import wont fall if something can't be loaded, it will skip these parts of craft
obj = mdl.instantiate(f"{name}:submodel", position, rotation, scale)
model.objects.link(obj)
obj.parent = root
else:
mesh = db.model_by_path[path][0]
url = '/'.join((path, mesh))
Expand Down