Thanks so much Alexander and Amorano, I really appreciate you guys taking the time to answer my question.
I am almost done with the tool. The functionally of the tool is not only to list all the textures in your scene but also to export the current maya file as well as all the textures being used in that particular scene to a user designated location. Here is part of the tool, still work in progress. import maya.cmds as cmds import os import shutil def copyToNewLocation(): """ This function queries the location of the opened file as well as the path of all the textures. It will then place the textures and the the scene file on the expecified path by the user. """ newLocation ='C:\Users\FFION2\Documents\TestTextureProject\NewLoc' #hardcoded > enter your target directory. #multipleFilters = "Maya Files (*.ma *.mb);;Maya ASCII (*.ma);;Maya Binary (*.mb);;All Files (*.*)" #newLocation = cmds.fileDialog2(fileFilter=multipleFilters, dialogStyle=2) # mySceneAssets = cmds.file( q=True, l=True, loc=True ) #It goes trough each texture and the maya file and place them in the new location. for i in mySceneAssets: print(i) shutil.copy(i,newLocation ) #Call the function. copyToNewLocation() Thanks again for your help guys, I am really enjoying scripting in Pytho On Sun, Mar 20, 2011 at 7:06 AM, Alexander Mirgorodsky <amir...@gmail.com>wrote: > Hi Martin! I think is what I understood You. > Below I give snipets from my render-toolkit code. > It only extracts because this toolkit complikated and renderman-aimed. > But I hope it will come across you on the right ideas. > So if we really want geting info from selected obj then: > > 1. Getting list shading engines: > def getsListShadingEngines(currentObj): > sgConections = mc.listConnections(currentObj,t="shadingEngine", d=1) > if sgConections != None: > ##remove duplicates from list > inicSgConnections =[ u for u in sgConections if u not in locals()['_[1]'] > ] > return inicSgConnections > > 2. Finding shaders connected to shading engine: > > def rpExportMetaDataSG(currentObj, currentSG, time): > mayaShadersList = [] > co_shader_strings = "" # Its may co-shader special variable, in your case > its may be ane variable > shaderStringContent = " > if mc.connectionInfo( (currentSG+".surfaceShader"), isDestination=True) > == 1: > mayaShadersList = mc.listConnections((currentSG+".surfaceShader")) > ##!!!!!Check -If Not Connect > currentMayaShader = mayaShadersList[0] > shaderType = mc.nodeType(currentMayaShader) > #print currentMayaShader > > # Ok Martin - we know maya shader BUT if this "layer shader" or other > specific shaders like "useBackground" > > if shaderType == "layeredShader": > layerShadersConnection = mc.listConnections(currentMayaShader,t="lambert") > layerShadersConnection += mc.listConnections(currentMayaShader,t="blinn") > ..................................... > unicLayerShadersConnection = [ u for u in layerShadersConnection if u not > in locals()['_[1]'] ] > countLayers = len(unicLayerShadersConnection)-1 > while countLayers >=0: > co_shader_strings = #// MARTIN, NEXT YOUR CODE FOR working with > unicLayerShadersConnection[countLayers] > ......... > countLayers -= 1 > > elif shaderType == "useBackground": > shaderStringContent = # In this case Your procedure for getting connected > slots in useBackgound shaders > > ##elif shaderType == ##"Other specific"###: > > else: > shaderStringContent = ### Your procedure for finding connected slots in > current shader > > return shaderStringContent #My procedure return string - but your code can > return list of texture(file) nodes and file places on storage. > > 3. Example for working with finded(in consruction above) surface shader > > def mMainShaderAttrs(currentMayaShader,time): > surfaceColorContent = '' > if mc.connectionInfo((currentMayaShader+'.color'), isDestination=1): > listColorTextures = mc.listConnections(currentMayaShader+'.color') > if str(mc.nodeType(listColorTextures[0])) == 'file': > mayaColorTextureFile = > mc.getAttr(listColorTextures[0]+'.fileTextureName', time=time) > ................................. > > PS. I use time attribute as I work with animated shader attributes. You can > remove "time" - flag > > Alex Mirgorodsky. > Shading TD/ Lighting TD > Renovatio Entertainment. > > > > On Fri, Mar 18, 2011 at 6:57 PM, martinmrom...@gmail.com < > martinmrom...@gmail.com> wrote: > >> Hi >> Alexander, >> >> Basically what I am trying to do is to get a list of all of the >> textures in my scene. >> From time to time I see people working on scenes where they are >> pulling textures from different locations. I want to make a tool that >> will gather the location of every texture in my scene. >> >> Here is a little bit of my sudo code. >> >> def Textures( listOfTexturesFilePaths=[], destinationDir: >> ''' >> Parameter Example: >> listOfTexturesFilePaths = [ 'c:/temp/water.tga', 'c:/temp/ >> textures/ground.tga', 'c:/temp/textures/stuff.tga' ] >> destinationDir = 'c:/newLocation' >> ''' >> >> # look at import os >> >> pass >> >> # Do the copy of the maya file and patch it to the new textures >> >> Hope this makes a lot of sense and thanks for your help. >> >> Martin >> >> On Mar 18, 5:00 am, Alexander Mirgorodsky <amir...@gmail.com> wrote: >> > Hi Martin! >> > Do You mean by word "object" >> > If this is geometry object that it does not store this information. >> > You can find it by going througр the chain "geometryShape -> Shading >> Engine >> > -> Shader(Surface, Displace, Volumetric etc) >> > ->Color(Float)Attribute->TextureNode->FileName"). >> > Can You explain the details of your problem? >> > >> > Alex Mirgorodsky. >> > Shading TD/ Lighting TD >> > Renovation Entertainment. >> > >> > On Fri, Mar 18, 2011 at 9:50 AM, martinmrom...@gmail.com < >> > >> > martinmrom...@gmail.com> wrote: >> > > Does anyone know the name of the command or the way that I can get the >> > > full path of the textures from a selected object? >> > >> > > Thanks, >> > > -m >> > >> > > -- >> > >http://groups.google.com/group/python_inside_maya >> >> -- >> http://groups.google.com/group/python_inside_maya >> > > -- > http://groups.google.com/group/python_inside_maya > -- Martin La Land Romero www.martinromerovfx.com http://martinromerovfx.blogspot.com/ martinmrom...@gmail.com (415)261-2172 -- http://groups.google.com/group/python_inside_maya