New Addon: Import Autodesk .max #105013

Closed
Sebastian Sille wants to merge 136 commits from (deleted):nrgsille-import_max into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 364dfe1e20 - Show all commits

View File

@ -397,7 +397,7 @@ class MaxFileDirEntry:
class ImportMaxFile:
"""Representing an interface for importing .max files."""
def __init__(self, filename=None, write_mode=False, debug=False):
def __init__(self, filename=None, write_mode=False):
self.write_mode = write_mode
self._filesize = None
self.byte_order = None
@ -1178,19 +1178,19 @@ def create_matrix(prc):
def get_matrix_mesh_material(node):
refs = get_reference(node)
if (refs):
mtx = refs.get(0, None)
prs = refs.get(0, None)
msh = refs.get(1, None)
mat = refs.get(3, None)
lyr = refs.get(6, None)
else:
refs = get_references(node)
mtx = refs[0]
prs = refs[0]
msh = refs[1]
mat = refs[3]
lyr = None
if (len(refs) > 6):
lyr = refs[6]
return mtx, msh, mat, lyr
return prs, msh, mat, lyr
def get_property(properties, idx):
@ -1506,15 +1506,15 @@ def create_object(context, node, mscale, transform):
parent = get_node_parent(node)
node.parent = parent
name = get_node_name(node)
mtx, msh, mat, lyr = get_matrix_mesh_material(node)
prs, msh, mat, lyr = get_matrix_mesh_material(node)
while ((parent is not None) and (get_guid(parent) != 0x0002)):
name = "%s/%s" %(get_node_name(parent), name)
parent_mtx = parent.matrix
if (parent_mtx):
mtx = mtx.dot(parent_mtx)
prs = prs.dot(parent_mtx)
parent = get_node_parent(parent)
if (transform):
mtx = create_matrix(mtx) @ mscale
mtx = create_matrix(prs) @ mscale
else:
mtx = mscale
created, uid = create_mesh(context, node, msh, mtx, mat)