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 19c67a2af6 - Show all commits

View File

@ -1150,6 +1150,16 @@ def get_value(colors, idx):
return None return None
def get_parameter(colors, fmt):
if (fmt == 0x1):
siz = len(colors.data) - 12
para, offset = get_floats(colors.data, siz, 3)
else:
siz = len(colors.data) - 4
para, offset = get_float(colors.data, siz)
return para
def get_standard_material(refs): def get_standard_material(refs):
material = None material = None
try: try:
@ -1185,6 +1195,19 @@ def get_vray_material(vry):
return material return material
def get_corona_material(mtl):
material = Material()
try:
cor = mtl.children
material.set('diffuse', get_parameter(cor[3], 0x1))
material.set('specular', get_parameter(cor[4], 0x1))
material.set('emissive', get_parameter(cor[8], 0x1))
material.set('glossines', get_parameter(cor[9], 0x2))
except:
pass
return material
def get_arch_material(ad): def get_arch_material(ad):
material = Material() material = Material()
try: try:
@ -1209,6 +1232,9 @@ def adjust_material(obj, mat):
elif (uid == VRAY_MTL): # VRayMtl elif (uid == VRAY_MTL): # VRayMtl
refs = get_reference(mat) refs = get_reference(mat)
material = get_vray_material(refs[1]) material = get_vray_material(refs[1])
elif (uid == CORO_MTL): # Corona
refs = get_references(mat)
material = get_corona_material(refs[0])
elif (uid == ARCH_MTL): # Arch elif (uid == ARCH_MTL): # Arch
refs = get_references(mat) refs = get_references(mat)
material = get_arch_material(refs[0]) material = get_arch_material(refs[0])