original_docstring: Generate JS array of materials objects
      
docstring: Generate JS array of materials objects
docstring_tokens: Generate JS array of materials objects
code: def generate_materials(mtl, materials, draw_type):
      """Generate JS array of materials objects
      """
  
      mtl_array = []
      for m in mtl:
          index = materials[m]
  
          # add debug information
          #  materials should be sorted according to how
          #  they appeared in OBJ file (for the first time)
          #  this index is identifier used in face definitions
          mtl[m]['DbgName'] = m
          mtl[m]['DbgIndex'] = index
          mtl[m]['DbgColor'] = generate_color(index)
  
          if draw_type in [ "BOUNDS", "WIRE" ]:
              mtl[m]['wireframe'] = True
              mtl[m]['DbgColor'] = 0xff0000
  
          mtl_raw = ",\n".join(['\t"%s" : %s' % (n, value2string(v)) for n,v in sorted(mtl[m].items())])
          mtl_string = "\t{\n%s\n\t}" % mtl_raw
          mtl_array.append([index, mtl_string])
  
      return ",\n\n".join([m for i,m in sorted(mtl_array)]), len(mtl_array)
code_tokens: def generate_materials ( mtl , materials , draw_type ) : mtl_array = [ ] for m in mtl : index = materials [ m ] mtl [ m ] [ 'DbgName' ] = m mtl [ m ] [ 'DbgIndex' ] = index mtl [ m ] [ 'DbgColor' ] = generate_color ( index ) if draw_type in [ "BOUNDS" , "WIRE" ] : mtl [ m ] [ 'wireframe' ] = True mtl [ m ] [ 'DbgColor' ] = 0xff0000 mtl_raw = ",\n" . join ( [ '\t"%s" : %s' % ( n , value2string ( v ) ) for n , v in sorted ( mtl [ m ] . items ( ) ) ] ) mtl_string = "\t{\n%s\n\t}" % mtl_raw mtl_array . append ( [ index , mtl_string ] ) return ",\n\n" . join ( [ m for i , m in sorted ( mtl_array ) ] ) , len ( mtl_array )
short_docstring: Generate JS array of materials objects
short_docstring_tokens: Generate JS array of materials objects
comment: """Generate JS array of materials objects
      """$SEP$# add debug information$SEP$#  materials should be sorted according to how$SEP$#  they appeared in OBJ file (for the first time)$SEP$#  this index is identifier used in face definitions