New Addon: Import Autodesk .max #105013
@ -397,7 +397,7 @@ class MaxFileDirEntry:
|
|||||||
|
|
||||||
class ImportMaxFile:
|
class ImportMaxFile:
|
||||||
"""Representing an interface for importing .max files."""
|
"""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.write_mode = write_mode
|
||||||
self._filesize = None
|
self._filesize = None
|
||||||
self.byte_order = None
|
self.byte_order = None
|
||||||
@ -1178,19 +1178,19 @@ def create_matrix(prc):
|
|||||||
def get_matrix_mesh_material(node):
|
def get_matrix_mesh_material(node):
|
||||||
refs = get_reference(node)
|
refs = get_reference(node)
|
||||||
if (refs):
|
if (refs):
|
||||||
mtx = refs.get(0, None)
|
prs = refs.get(0, None)
|
||||||
msh = refs.get(1, None)
|
msh = refs.get(1, None)
|
||||||
mat = refs.get(3, None)
|
mat = refs.get(3, None)
|
||||||
lyr = refs.get(6, None)
|
lyr = refs.get(6, None)
|
||||||
else:
|
else:
|
||||||
refs = get_references(node)
|
refs = get_references(node)
|
||||||
mtx = refs[0]
|
prs = refs[0]
|
||||||
msh = refs[1]
|
msh = refs[1]
|
||||||
mat = refs[3]
|
mat = refs[3]
|
||||||
lyr = None
|
lyr = None
|
||||||
if (len(refs) > 6):
|
if (len(refs) > 6):
|
||||||
lyr = refs[6]
|
lyr = refs[6]
|
||||||
return mtx, msh, mat, lyr
|
return prs, msh, mat, lyr
|
||||||
|
|
||||||
|
|
||||||
def get_property(properties, idx):
|
def get_property(properties, idx):
|
||||||
@ -1506,15 +1506,15 @@ def create_object(context, node, mscale, transform):
|
|||||||
parent = get_node_parent(node)
|
parent = get_node_parent(node)
|
||||||
node.parent = parent
|
node.parent = parent
|
||||||
name = get_node_name(node)
|
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)):
|
while ((parent is not None) and (get_guid(parent) != 0x0002)):
|
||||||
name = "%s/%s" %(get_node_name(parent), name)
|
name = "%s/%s" %(get_node_name(parent), name)
|
||||||
parent_mtx = parent.matrix
|
parent_mtx = parent.matrix
|
||||||
if (parent_mtx):
|
if (parent_mtx):
|
||||||
mtx = mtx.dot(parent_mtx)
|
prs = prs.dot(parent_mtx)
|
||||||
parent = get_node_parent(parent)
|
parent = get_node_parent(parent)
|
||||||
if (transform):
|
if (transform):
|
||||||
mtx = create_matrix(mtx) @ mscale
|
mtx = create_matrix(prs) @ mscale
|
||||||
else:
|
else:
|
||||||
mtx = mscale
|
mtx = mscale
|
||||||
created, uid = create_mesh(context, node, msh, mtx, mat)
|
created, uid = create_mesh(context, node, msh, mtx, mat)
|
||||||
|
Loading…
Reference in New Issue
Block a user