New Addon: Import Autodesk .max #105013
@ -43,6 +43,7 @@ class Import_max(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
|
||||
"""Import Autodesk MAX"""
|
||||
bl_idname = "import_autodesk.max"
|
||||
bl_label = "Import Autodesk MAX (.max)"
|
||||
bl_options = {'PRESET', 'UNDO'}
|
||||
|
||||
filename_ext = ".max"
|
||||
filter_glob: bpy.props.StringProperty(default="*.max", options={'HIDDEN'},)
|
||||
@ -825,7 +826,7 @@ class ChunkReader():
|
||||
long, ofst = get_long(data, ofst)
|
||||
if (short == 0x8B1F):
|
||||
short, ofst = get_long(data, ofst)
|
||||
if (short == 0x0B000000):
|
||||
if (short == 0xB000000):
|
||||
data = zlib.decompress(data, zlib.MAX_WBITS|32)
|
||||
print(" reading '%s'..."%self.name, len(data))
|
||||
while offset < len(data):
|
||||
@ -1043,9 +1044,9 @@ def get_position(pos):
|
||||
uid = get_guid(pos)
|
||||
if (uid == 0xFFEE238A118F7E02): # Position XYZ
|
||||
position = get_point_3d(pos)
|
||||
elif (uid == 0x0000000000442312): # TCB Position
|
||||
elif (uid == 0x442312): # TCB Position
|
||||
position = pos.get_first(0x2503).data
|
||||
elif (uid == 0x0000000000002008): # Bezier Position
|
||||
elif (uid == 0x2008): # Bezier Position
|
||||
position = pos.get_first(0x2503).data
|
||||
if (position):
|
||||
mtx = mathutils.Matrix.Translation(position)
|
||||
@ -1060,10 +1061,10 @@ def get_rotation(pos):
|
||||
if (uid == 0x2012): # Euler XYZ
|
||||
rot = get_point_3d(pos)
|
||||
rotation = mathutils.Euler((rot[2], rot[1], rot[0])).to_quaternion()
|
||||
elif (uid == 0x0000000000442313): # TCB Rotation
|
||||
elif (uid == 0x442313): # TCB Rotation
|
||||
rot = pos.get_first(0x2504).data
|
||||
rotation = mathutils.Quaternion((rot[0], rot[1], rot[2], rot[3]))
|
||||
elif (uid == 0x000000004B4B1003): #'Rotation List
|
||||
elif (uid == 0x4B4B1003): #'Rotation List
|
||||
refs = get_references(pos)
|
||||
if (len(refs) > 3):
|
||||
return get_rotation(refs[0])
|
||||
@ -1083,7 +1084,7 @@ def get_scale(pos):
|
||||
if (scale is None):
|
||||
scale = pos.get_first(0x2505)
|
||||
pos = scale.data
|
||||
elif (uid == 0x0000000000442315): # TCB Zoom
|
||||
elif (uid == 0x442315): # TCB Zoom
|
||||
scale = pos.get_first(0x2501)
|
||||
if (scale is None):
|
||||
scale = pos.get_first(0x2505)
|
||||
@ -1198,7 +1199,7 @@ def adjust_material(obj, mat):
|
||||
if (uid == 0x0002): # Standard
|
||||
refs = get_references(mat)
|
||||
material = get_standard_material(refs)
|
||||
elif (uid == 0x0000000000000200): # Multi/Sub-Object
|
||||
elif (uid == 0x0200): # Multi/Sub-Object
|
||||
refs = get_references(mat)
|
||||
material = adjust_material(obj, refs[-1])
|
||||
elif (uid == 0x7034695C37BF3F2F): # VRayMtl
|
||||
@ -1348,7 +1349,6 @@ def calc_point_3d(chunk):
|
||||
pointlist.append(pt)
|
||||
except Exception as exc:
|
||||
print('ArrayError:\n', "%s: offset = %d\n" %(exc, offset))
|
||||
raise exc
|
||||
return pointlist
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user