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 4db63f4d4d - Show all commits

View File

@ -15,7 +15,7 @@ bl_info = {
"name": "Import Autodesk MAX (.max)",
"author": "Sebastian Sille, Philippe Lagadec, Jens M. Plonka",
"version": (1, 1, 2),
"blender": (4, 0, 0),
"blender": (3, 6, 0),
"location": "File > Import",
"description": "Import 3DSMAX meshes & materials",
"warning": "",
@ -451,7 +451,6 @@ class ImportMaxFile:
self.fp = None
self.header_clsid = None
self.header_signature = None
self.metadata = None
self.mini_sector_shift = None
self.mini_sector_size = None
self.mini_stream_cutoff_size = None
@ -684,9 +683,7 @@ class ImportMaxFile:
def get_rootentry_name(self):
return self.root.name
def getproperties(self, filename, convert_time=False, no_conversion=None):
if no_conversion == None:
no_conversion = []
def getproperties(self, filename):
streampath = filename
if not isinstance(streampath, str):
streampath = '/'.join(streampath)
@ -732,7 +729,7 @@ class ImportMaxFile:
value = self._decode_utf16_str(stream[offset + 8:offset + 8 + count * 2])
elif property_type == VT_FILETIME:
value = int(i32(stream, offset + 4)) + (int(i32(stream, offset + 8)) << 32)
if convert_time and property_id not in no_conversion:
if property_id != 10:
_FILETIME_null_date = datetime.datetime(1601, 1, 1, 0, 0, 0)
value = _FILETIME_null_date + datetime.timedelta(microseconds=value // 10)
else:
@ -1290,7 +1287,6 @@ def get_arch_material(ad):
material = Material()
try:
material.set('diffuse', get_color(ad, 0x1A))
material.set('specular', get_color(ad, 0x02))
except:
pass
return material
@ -1593,8 +1589,8 @@ def read_scene(context, maxfile, filename, mscale, usemat, uvmesh, transform):
def read(context, filename, mscale, usemat, uvmesh, transform):
if (is_maxfile(filename)):
maxfile = ImportMaxFile(filename)
prop = maxfile.getproperties('\x05DocumentSummaryInformation', convert_time=True, no_conversion=[10])
prop = maxfile.getproperties('\x05SummaryInformation', convert_time=True, no_conversion=[10])
prop = maxfile.getproperties('\x05DocumentSummaryInformation')
prop = maxfile.getproperties('\x05SummaryInformation')
read_class_data(maxfile, filename)
read_config(maxfile, filename)
read_directory(maxfile, filename)