New Addon: Import Autodesk .max #105013
@ -206,6 +206,7 @@ def _clsid(clsid):
|
||||
tuple(map(i8, clsid[8:16]))))
|
||||
|
||||
def is_maxfile (filename):
|
||||
"""Test if file is a MAX OLE2 container."""
|
||||
if hasattr(filename, 'read'):
|
||||
header = filename.read(len(MAGIC))
|
||||
filename.seek(0)
|
||||
@ -221,7 +222,7 @@ def is_maxfile (filename):
|
||||
|
||||
|
||||
class MaxStream(io.BytesIO):
|
||||
|
||||
"""Returns an instance of the BytesIO class as read-only file object."""
|
||||
def __init__(self, fp, sect, size, offset, sectorsize, fat, filesize):
|
||||
unknown_size = False
|
||||
if size == UNKNOWN_SIZE:
|
||||
@ -251,6 +252,7 @@ class MaxStream(io.BytesIO):
|
||||
|
||||
|
||||
class MaxFileDirEntry:
|
||||
"""Directory Entry for a stream or storage."""
|
||||
STRUCT_DIRENTRY = '<64sHBBIII16sIQQIII'
|
||||
DIRENTRY_SIZE = 128
|
||||
assert struct.calcsize(STRUCT_DIRENTRY) == DIRENTRY_SIZE
|
||||
@ -348,7 +350,7 @@ class MaxFileDirEntry:
|
||||
|
||||
|
||||
class ImportMaxFile:
|
||||
|
||||
"""Representing an interface for importing .max files."""
|
||||
def __init__(self, filename=None, write_mode=False, debug=False):
|
||||
self.write_mode = write_mode
|
||||
self._filesize = None
|
||||
@ -691,7 +693,7 @@ class ImportMaxFile:
|
||||
|
||||
|
||||
class MaxChunk():
|
||||
|
||||
"""Representing a chunk of a .max file."""
|
||||
def __init__(self, types, size, level, number):
|
||||
self.number = number
|
||||
self.types = types
|
||||
@ -712,7 +714,7 @@ class MaxChunk():
|
||||
|
||||
|
||||
class ByteArrayChunk(MaxChunk):
|
||||
|
||||
"""A byte array of a .max chunk."""
|
||||
def __init__(self, types, data, level, number):
|
||||
MaxChunk.__init__(self, types, data, level, number)
|
||||
|
||||
@ -761,7 +763,7 @@ class ByteArrayChunk(MaxChunk):
|
||||
|
||||
|
||||
class ClassIDChunk(ByteArrayChunk):
|
||||
|
||||
"""The class ID subchunk of a .max chunk."""
|
||||
def __init__(self, types, data, level, number):
|
||||
MaxChunk.__init__(self, types, data, level, number)
|
||||
self.dll = None
|
||||
@ -777,7 +779,7 @@ class ClassIDChunk(ByteArrayChunk):
|
||||
|
||||
|
||||
class DirectoryChunk(ByteArrayChunk):
|
||||
|
||||
"""The directory chunk of a .max file."""
|
||||
def __init__(self, types, data, level, number):
|
||||
MaxChunk.__init__(self, types, data, level, number)
|
||||
|
||||
@ -789,7 +791,7 @@ class DirectoryChunk(ByteArrayChunk):
|
||||
|
||||
|
||||
class ContainerChunk(MaxChunk):
|
||||
|
||||
"""A container chunk in a .max file wich includes byte arrays."""
|
||||
def __init__(self, types, data, level, number, primitiveReader=ByteArrayChunk):
|
||||
MaxChunk.__init__(self, types, data, level, number)
|
||||
self.primitiveReader = primitiveReader
|
||||
@ -813,7 +815,7 @@ class ContainerChunk(MaxChunk):
|
||||
|
||||
|
||||
class SceneChunk(ContainerChunk):
|
||||
|
||||
"""The scene chunk of a .max file wich includes the relevant data for blender."""
|
||||
def __init__(self, types, data, level, number, primitiveReader=ByteArrayChunk):
|
||||
MaxChunk.__init__(self, types, data, level, number)
|
||||
self.primitiveReader = primitiveReader
|
||||
@ -833,7 +835,7 @@ class SceneChunk(ContainerChunk):
|
||||
|
||||
|
||||
class ChunkReader():
|
||||
|
||||
"""The chunk reader class for decoding the byte arrays."""
|
||||
def __init__(self, name=None):
|
||||
self.name = name
|
||||
|
||||
@ -872,7 +874,7 @@ class ChunkReader():
|
||||
|
||||
|
||||
class Point3d():
|
||||
|
||||
"""Representing a three dimensional vector plus pointflag."""
|
||||
def __init__(self):
|
||||
self.points = None
|
||||
self.flags = 0
|
||||
@ -886,7 +888,7 @@ class Point3d():
|
||||
|
||||
|
||||
class Material():
|
||||
|
||||
"""Representing a material chunk of a scene chunk."""
|
||||
def __init__(self):
|
||||
self.data = {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user