Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # cwisbg
- from pymel.core import*
- sl = selected()
- # Attributes to get, add any as needed
- attrList = ("diffuse","diffuse_weight","diffuse_roughness","refl_color",
- "reflectivity","refl_gloss","refl_gloss_samples","refr_ior","refr_color",
- "transparency","refr_gloss","refr_gloss_samples","overall_bump")
- fileName = promptDialog(button = "ok", t= "File Name?")# Name that will be given to File
- fileName = promptDialog(q=1,t=1)
- filePath = "E:/" # file Destination (where the txt. file will be created)
- matInfo = open("{0}{1}.txt".format(filePath,fileName), "a+")
- type = " Material: {0}\r\n".format(sl[0])
- matInfo.write(type)
- for s in sl:
- for a in listAttr(s):
- for attr in attrList:
- if a == attr:
- try:
- texCheck = listConnections("{0}.{1}".format(s,a))
- except:
- pass
- if texCheck:
- attribute = " Texture\r\n"
- matInfo.write("\r\n{0}\r\n".format(a))
- matInfo.write(" {0}".format(attribute))
- else:
- attribute = getAttr("{0}.{1}".format(s,a))
- attrType = getAttr("{0}.{1}".format(s,a),typ = 1)
- a = str(a)
- if a == "refr_ior":
- matInfo.write("\r\nrefr_IndexOfRefraction\r\n")
- matInfo.write(" {0:.2f}".format(attribute))
- matInfo.write("\r\n")#blank line
- elif a == "overall_bump":
- try:
- texCheck = listConnections("{0}.{1}".format(s,a))
- except:
- pass
- if texCheck:
- matInfo.write("\r\noverall_bump\r\n")
- matInfo.write(" Texture")
- matInfo.write("\r\n")#blank line
- else:
- pass
- elif attrType == "float":
- matInfo.write("\r\n{0}\r\n".format(a))
- matInfo.write(" {0:.2f}".format(attribute))
- matInfo.write("\r\n")#blank line
- elif attrType == "float3":
- matInfo.write("\r\n{0}\r\n".format(a))
- for i in attribute:
- matInfo.write(" {0:.2f}".format(i))
- matInfo.write("\r\n")#blank line
- else:
- matInfo.write("\r\n{0}\r\n".format(a))
- matInfo.write(" {0}".format(attribute))
- matInfo.write("\r\n")#blank line
- matInfo.close()
- print "done"
Advertisement
Add Comment
Please, Sign In to add comment