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 a6e1722429 - Show all commits

View File

@ -304,10 +304,8 @@ def is_maxfile (filename):
class MaxStream(io.BytesIO): class MaxStream(io.BytesIO):
"""Returns an instance of the BytesIO class as read-only file object.""" """Returns an instance of the BytesIO class as read-only file object."""
def __init__(self, fp, sect, size, offset, sectorsize, fat, filesize): def __init__(self, fp, sect, size, offset, sectorsize, fat, filesize):
unknown_size = False
if size == UNKNOWN_SIZE: if size == UNKNOWN_SIZE:
size = len(fat) * sectorsize size = len(fat) * sectorsize
unknown_size = True
nb_sectors = (size + (sectorsize-1)) // sectorsize nb_sectors = (size + (sectorsize-1)) // sectorsize
data = [] data = []
@ -1178,7 +1176,7 @@ def get_vray_material(vry):
material.set('diffuse', get_color(vry, 0x01)) material.set('diffuse', get_color(vry, 0x01))
material.set('specular', get_color(vry, 0x02)) material.set('specular', get_color(vry, 0x02))
material.set('shinines', get_value(vry, 0x03)) material.set('shinines', get_value(vry, 0x03))
material.set('ior', get_value(vry, 0x09)) material.set('refraction', get_value(vry, 0x09))
material.set('emissive', get_color(vry, 0x17)) material.set('emissive', get_color(vry, 0x17))
material.set('glossines', get_value(vry, 0x18)) material.set('glossines', get_value(vry, 0x18))
material.set('metallic', get_value(vry, 0x19)) material.set('metallic', get_value(vry, 0x19))
@ -1224,7 +1222,7 @@ def adjust_material(obj, mat):
matShader.roughness = objMaterial.roughness = 1.0 - material.get('shinines', 0.6) matShader.roughness = objMaterial.roughness = 1.0 - material.get('shinines', 0.6)
matShader.metallic = objMaterial.metallic = material.get('metallic', 0) matShader.metallic = objMaterial.metallic = material.get('metallic', 0)
matShader.emission_color = material.get('emissive', (0,0,0)) matShader.emission_color = material.get('emissive', (0,0,0))
matShader.ior = material.get('ior', 1.45) matShader.ior = material.get('refraction', 1.45)
def adjust_matrix(obj, node): def adjust_matrix(obj, node):