(materials, mtlfilename, basename)
return mtlColorArray
Extract diffuse colors from MTL materials
Extract diffuse colors from MTL materials
Extract diffuse colors from MTL materials
def extract_material_colors(materials, mtlfilename, basename):
    """Extract diffuse colors from MTL materials
    """

    if not materials:
        materials = { 'default': 0 }

    mtl = create_materials(materials, mtlfilename, basename)
    
    mtlColorArraySrt = []
    for m in mtl:
        if m in materials:
            index = materials[m]
            color = mtl[m].get("colorDiffuse", [1,0,0])
            mtlColorArraySrt.append([index, color])
       
    mtlColorArraySrt.sort()
    mtlColorArray = [x[1] for x in mtlColorArraySrt]

    return mtlColorArray
def extract_material_colors ( materials , mtlfilename , basename ) : if not materials : materials = { 'default' : 0 } mtl = create_materials ( materials , mtlfilename , basename ) mtlColorArraySrt = [ ] for m in mtl : if m in materials : index = materials [ m ] color = mtl [ m ] . get ( "colorDiffuse" , [ 1 , 0 , 0 ] ) mtlColorArraySrt . append ( [ index , color ] ) mtlColorArraySrt . sort ( ) mtlColorArray = [ x [ 1 ] for x in mtlColorArraySrt ] return mtlColorArray