New Addon: Import Autodesk .max #22
@ -1236,7 +1236,7 @@ def get_property(properties, idx):
|
||||
def get_color(colors, idx):
|
||||
prop = get_property(colors, idx)
|
||||
if (prop is not None):
|
||||
siz = 15 if (len(prop.data) > 23) else 11
|
||||
siz = len(prop.data) - 12
|
||||
col, offset = get_floats(prop.data, siz, 3)
|
||||
return (col[0], col[1], col[2])
|
||||
return None
|
||||
@ -1245,7 +1245,7 @@ def get_color(colors, idx):
|
||||
def get_value(colors, idx):
|
||||
prop = get_property(colors, idx)
|
||||
if (prop is not None):
|
||||
siz = 15 if (len(prop.data) > 17) else 11
|
||||
siz = len(prop.data) - 4
|
||||
val, offset = get_float(prop.data, siz)
|
||||
return val
|
||||
return None
|
||||
@ -1262,9 +1262,10 @@ def get_standard_material(refs):
|
||||
material.set('diffuse', get_color(parameters, 0x01))
|
||||
material.set('specular', get_color(parameters, 0x02))
|
||||
material.set('emissive', get_color(parameters, 0x08))
|
||||
material.set('shinines', get_value(parameters, 0x0A))
|
||||
reflect = refs[4] # ParameterBlock2
|
||||
material.set('reflect', get_value(reflect, 0x02))
|
||||
material.set('shinines', get_value(parameters, 0x0B))
|
||||
parablock = refs[4] # ParameterBlock2
|
||||
material.set('glossines', get_value(parablock, 0x02))
|
||||
material.set('metallic', get_value(parablock, 0x05))
|
||||
except:
|
||||
pass
|
||||
return material
|
||||
@ -1275,6 +1276,11 @@ def get_vray_material(vry):
|
||||
try:
|
||||
material.set('diffuse', get_color(vry, 0x01))
|
||||
material.set('specular', get_color(vry, 0x02))
|
||||
material.set('shinines', get_value(vry, 0x03))
|
||||
material.set('ior', get_value(vry, 0x09))
|
||||
material.set('emissive', get_color(vry, 0x17))
|
||||
material.set('glossines', get_value(vry, 0x18))
|
||||
material.set('metallic', get_value(vry, 0x19))
|
||||
except:
|
||||
pass
|
||||
return material
|
||||
@ -1312,9 +1318,11 @@ def adjust_material(obj, mat):
|
||||
matShader = PrincipledBSDFWrapper(objMaterial, is_readonly=False, use_nodes=True)
|
||||
matShader.base_color = objMaterial.diffuse_color[:3] = material.get('diffuse', (0.8,0.8,0.8))
|
||||
matShader.specular_tint = objMaterial.specular_color[:3] = material.get('specular', (1.0,1.0,1.0))
|
||||
matShader.specular = objMaterial.specular_intensity = material.get('reflect', 0.5)
|
||||
matShader.specular = objMaterial.specular_intensity = material.get('glossines', 0.5)
|
||||
matShader.roughness = objMaterial.roughness = 1.0 - material.get('shinines', 0.6)
|
||||
matShader.metallic = objMaterial.metallic = material.get('metallic', 0)
|
||||
matShader.emission_color = material.get('emissive', (0,0,0))
|
||||
matShader.ior = material.get('ior', 1.45)
|
||||
|
||||
|
||||
def adjust_matrix(obj, node):
|
||||
@ -1602,6 +1610,7 @@ def load(operator, context, filepath="", scale_objects=1.0, use_material=True,
|
||||
mscale = mathutils.Matrix.Scale(scale_objects, 4)
|
||||
if global_matrix is not None:
|
||||
mscale = global_matrix @ mscale
|
||||
|
||||
read(context, filepath, mscale, usemat=use_material, uvmesh=use_uv_mesh, transform=use_apply_matrix)
|
||||
|
||||
return {'FINISHED'}
|
Reference in New Issue
Block a user