New addon: Import Autodesk .max #17
@ -278,7 +278,7 @@ class MaxFileDirEntry:
|
|||||||
self.sizeHigh
|
self.sizeHigh
|
||||||
) = struct.unpack(MaxFileDirEntry.STRUCT_DIRENTRY, entry)
|
) = struct.unpack(MaxFileDirEntry.STRUCT_DIRENTRY, entry)
|
||||||
|
|
||||||
if self.namelength>64:
|
if self.namelength > 64:
|
||||||
self.namelength = 64
|
self.namelength = 64
|
||||||
self.name_utf16 = self.name_raw[:(self.namelength - 2)]
|
self.name_utf16 = self.name_raw[:(self.namelength - 2)]
|
||||||
self.name = maxfile._decode_utf16_str(self.name_utf16)
|
self.name = maxfile._decode_utf16_str(self.name_utf16)
|
||||||
@ -1324,23 +1324,6 @@ def get_poly_6p(data):
|
|||||||
return polylist
|
return polylist
|
||||||
|
|
||||||
|
|
||||||
def get_poly_ngon(polys):
|
|
||||||
vertex = []
|
|
||||||
offset = 0
|
|
||||||
while (offset < len(polys)):
|
|
||||||
num = polys[offset]
|
|
||||||
offset += 1
|
|
||||||
ngon = []
|
|
||||||
keys = 0
|
|
||||||
while (keys < num):
|
|
||||||
pt = points[polys[offset]][1]
|
|
||||||
ngon.append(pt)
|
|
||||||
offset += 1
|
|
||||||
keys += 1
|
|
||||||
vertex.extend(ngon)
|
|
||||||
return vertex
|
|
||||||
|
|
||||||
|
|
||||||
def get_poly_data(chunk):
|
def get_poly_data(chunk):
|
||||||
offset = 0
|
offset = 0
|
||||||
polylist = []
|
polylist = []
|
||||||
@ -1352,6 +1335,17 @@ def get_poly_data(chunk):
|
|||||||
return polylist
|
return polylist
|
||||||
|
|
||||||
|
|
||||||
|
def get_point_array(values):
|
||||||
|
verts = []
|
||||||
|
if len(values) >= 4:
|
||||||
|
count, offset = get_long(values, 0)
|
||||||
|
while (count > 0):
|
||||||
|
floats, offset = get_floats(values, offset, 3)
|
||||||
|
verts.extend(floats)
|
||||||
|
count -= 1
|
||||||
|
return verts
|
||||||
|
|
||||||
|
|
||||||
def calc_point_3d(chunk):
|
def calc_point_3d(chunk):
|
||||||
data = chunk.data
|
data = chunk.data
|
||||||
count, offset = get_long(data, 0)
|
count, offset = get_long(data, 0)
|
||||||
@ -1391,8 +1385,6 @@ def create_editable_poly(context, node, msh, mat, mtx):
|
|||||||
point6i = child.data
|
point6i = child.data
|
||||||
elif (child.types == 0x011A):
|
elif (child.types == 0x011A):
|
||||||
point4i = calc_point_3d(child)
|
point4i = calc_point_3d(child)
|
||||||
elif (child.types == 0x0310):
|
|
||||||
pointNi = child.data
|
|
||||||
if (point4i is not None):
|
if (point4i is not None):
|
||||||
vertex = get_poly_4p(point4i)
|
vertex = get_poly_4p(point4i)
|
||||||
if (len(vertex) > 0):
|
if (len(vertex) > 0):
|
||||||
@ -1403,23 +1395,9 @@ def create_editable_poly(context, node, msh, mat, mtx):
|
|||||||
elif (point6i is not None):
|
elif (point6i is not None):
|
||||||
ngons = get_poly_6p(point6i)
|
ngons = get_poly_6p(point6i)
|
||||||
created = create_shape(context, coords, ngons, node, None, mtx, mat)
|
created = create_shape(context, coords, ngons, node, None, mtx, mat)
|
||||||
elif (pointNi is not None):
|
|
||||||
ngons = get_poly_ngon(pointNi)
|
|
||||||
created = create_shape(context, coords, ngons, node, None, mtx, mat)
|
|
||||||
return created
|
return created
|
||||||
|
|
||||||
|
|
||||||
def get_point_array(values):
|
|
||||||
verts = []
|
|
||||||
if len(values) >= 4:
|
|
||||||
count, offset = get_long(values, 0)
|
|
||||||
while (count > 0):
|
|
||||||
floats, offset = get_floats(values, offset, 3)
|
|
||||||
verts.extend(floats)
|
|
||||||
count -= 1
|
|
||||||
return verts
|
|
||||||
|
|
||||||
|
|
||||||
def create_editable_mesh(context, node, msh, mat, mtx):
|
def create_editable_mesh(context, node, msh, mat, mtx):
|
||||||
name = node.get_first(TYP_NAME).data
|
name = node.get_first(TYP_NAME).data
|
||||||
poly = msh.get_first(0x08FE)
|
poly = msh.get_first(0x08FE)
|
||||||
@ -1466,12 +1444,6 @@ def create_shell(context, node, shell, mat, mtx):
|
|||||||
return created
|
return created
|
||||||
|
|
||||||
|
|
||||||
def create_boolean(context, node, pro, mat, mtx):
|
|
||||||
name = node.get_first(TYP_NAME).data
|
|
||||||
pBlocks = get_references(pro)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def create_skipable(context, node, msh, mat, mtx, skip):
|
def create_skipable(context, node, msh, mat, mtx, skip):
|
||||||
name = node.get_first(TYP_NAME).data
|
name = node.get_first(TYP_NAME).data
|
||||||
print(" skipping %s '%s'... " %(skip, name))
|
print(" skipping %s '%s'... " %(skip, name))
|
||||||
|
Reference in New Issue
Block a user