parameters: (materials, mtlfilename, basename)
return_statement: return mtlColorArray
docstring: Extract diffuse colors from MTL materials
docstring_summary: Extract diffuse colors from MTL materials
docstring_tokens: Extract diffuse colors from MTL materials
function: 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
function_tokens: 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