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 79d9c07b6e - Show all commits

View File

@ -168,9 +168,8 @@ DIFSECT = 0xFFFFFFFC # (-4) denotes a DIFAT sector in a FAT
FATSECT = 0xFFFFFFFD # (-3) denotes a FAT sector in a FAT
ENDOFCHAIN = 0xFFFFFFFE # (-2) end of a virtual stream chain
FREESECT = 0xFFFFFFFF # (-1) unallocated sector
STGTY_STREAM = 2 # element is a stream object
STGTY_ROOT = 5 # element is a root storage
MAX_STREAM = 2 # element is a stream object
ROOT_STORE = 5 # element is a root storage
TYP_NAME = 0x0962
INVALID_NAME = re.compile('^[0-9].*')
@ -372,9 +371,9 @@ class MaxFileDirEntry:
self.size = self.sizeLow + (int(self.sizeHigh) << 32)
self.clsid = _clsid(clsid)
self.is_minifat = False
if self.entry_type in (STGTY_ROOT, STGTY_STREAM) and self.size > 0:
if self.entry_type in (ROOT_STORE, MAX_STREAM) and self.size > 0:
if self.size < maxfile.minisectorcutoff \
and self.entry_type == STGTY_STREAM: # only streams can be in MiniFAT
and self.entry_type == MAX_STREAM: # only streams can be in MiniFAT
self.is_minifat = True
else:
self.is_minifat = False
@ -384,7 +383,7 @@ class MaxFileDirEntry:
def build_sect_chain(self, maxfile):
if self.sect_chain:
return
if self.entry_type not in (STGTY_ROOT, STGTY_STREAM) or self.size == 0:
if self.entry_type not in (ROOT_STORE, MAX_STREAM) or self.size == 0:
return
self.sect_chain = list()
if self.is_minifat and not maxfile.minifat:
@ -656,27 +655,6 @@ class ImportMaxFile:
entry = self.direntries[sid]
return self._open(entry.isectStart, entry.size)
def get_type(self, filename):
try:
sid = self._find(filename)
entry = self.direntries[sid]
return entry.entry_type
except:
return False
def getclsid(self, filename):
sid = self._find(filename)
entry = self.direntries[sid]
return entry.clsid
def get_size(self, filename):
sid = self._find(filename)
entry = self.direntries[sid]
return entry.size
def get_rootentry_name(self):
return self.root.name
###################
# DATA PROCESSING #