3
11

New Addon: Import Autodesk .max #22

Closed
Sebastian Sille wants to merge 38 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 8c92c2671b - Show all commits

View File

@ -1342,6 +1342,42 @@ def calc_point_float(data):
return points
def calc_point_3d(chunk):
data = chunk.data
count, offset = get_long(data, 0)
pointlist = []
try:
while (offset < len(data)):
pt = Point3d()
long, offset = get_long(data, offset)
pt.points, offset = get_longs(data, offset, long)
pt.flags, offset = get_short(data, offset)
if ((pt.flags & 0x01) != 0):
pt.f1, offset = get_long(data, offset)
if ((pt.flags & 0x08) != 0):
pt.fH, offset = get_short(data, offset)
if ((pt.flags & 0x10) != 0):
pt.f2, offset = get_long(data, offset)
if ((pt.flags & 0x20) != 0):
pt.fA, offset = get_longs(data, offset, 2 * (long - 3))
if (len(pt.points) > 0):
pointlist.append(pt)
except Exception as exc:
print('ArrayError:\n', "%s: offset = %d\n" %(exc, offset))
return pointlist
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 get_poly_4p(points):
vertex = {}
for point in points:
@ -1388,42 +1424,6 @@ def get_poly_data(chunk):
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):
data = chunk.data
count, offset = get_long(data, 0)
pointlist = []
try:
while (offset < len(data)):
pt = Point3d()
long, offset = get_long(data, offset)
pt.points, offset = get_longs(data, offset, long)
pt.flags, offset = get_short(data, offset)
if ((pt.flags & 0x01) != 0):
pt.f1, offset = get_long(data, offset)
if ((pt.flags & 0x08) != 0):
pt.fH, offset = get_short(data, offset)
if ((pt.flags & 0x10) != 0):
pt.f2, offset = get_long(data, offset)
if ((pt.flags & 0x20) != 0):
pt.fA, offset = get_longs(data, offset, 2 * (long - 3))
if (len(pt.points) > 0):
pointlist.append(pt)
except Exception as exc:
print('ArrayError:\n', "%s: offset = %d\n" %(exc, offset))
return pointlist
def create_editable_poly(context, node, msh, mat, mtx):
coords = point3i = point4i = point6i = pointNi = None
name = node.get_first(TYP_NAME).data