Re: [Maya-Python] List referenced files

2015-08-12 Thread Sivanny Selvakumar
It's stored in internal data structures. So the only way to access/change it is via the referenceQuery command, the file command or MFnReference. On Wednesday, August 12, 2015 at 9:45:22 AM UTC-7, Marcus Ottosson wrote: > > Oh, that's an interesting note, thanks for sharing Sivanny. > > So, how w

Re: [Maya-Python] List referenced files

2015-08-12 Thread Marcus Ottosson
Oh, that's an interesting note, thanks for sharing Sivanny. So, how would one access the path from a reference node? Is the information not stored in the node at all? Where is it stored? On 12 August 2015 at 17:27, Sivanny Selvakumar wrote: > Hi Marcus, > > Just a quick note about the fileNames

Re: [Maya-Python] List referenced files

2015-08-12 Thread Sivanny Selvakumar
Hi Marcus, Just a quick note about the fileNames attribute. It's actually obsolete and hasn't been used since Maya 6.0. It was only kept around for backwards compatibility. After Maya 6.5, reference paths are only accessible via the referenceQuery and the file command. Other attributes that are

Re: [Maya-Python] List referenced files

2015-08-12 Thread Roy Nieterau
You could end up 'reading' custom attributes made by the user which you might not want to change/validate (eg. metadata/pipeline data or even unrelated data). Setting up a dictionary/set of attributes for those missing is a better and more lightweight solution. Also note that you could still re

Re: [Maya-Python] List referenced files

2015-08-12 Thread Fredrik Averpil
Yes, I used to parse .ma too. So that could be one way of dealing with it. I don't believe there is such a thing called a relative path inside of the .ma though. If I remember correctly, all paths are always absolute when you peak inside an .ma file. Some old notes which may or may not be complete

Re: [Maya-Python] List referenced files

2015-08-12 Thread Marcus Ottosson
validate all filepaths before publishing. You’re absolutely right. As I’m not alone in solving it, here’s some more research. I’ve found that if I temporarily export an .ma of nodes, excluding those that I know won’t have one and may be heavy to export (such as mesh), I can parse the resulting A

Re: [Maya-Python] List referenced files

2015-08-12 Thread Fredrik Averpil
Typing on the iPad really sucks... And with the line breaks bug in Google Inbox it's just... bad. ons 12 aug 2015 kl. 12:23 skrev Fredrik Averpil : > Hehe, it seems to me that you are trying to achieve something we do here; > validate all filepaths before publishing. > Am I right? ;) > We want all

Re: [Maya-Python] List referenced files

2015-08-12 Thread Fredrik Averpil
Hehe, it seems to me that you are trying to achieve something we do here; validate all filepaths before publishing. Am I right? ;) We want all our filepaths to be relative to the Maya project at all times and there's no silver bullet for this, I'm afraid. You're going to have to combine several met

Re: [Maya-Python] List referenced files

2015-08-12 Thread Roy Nieterau
And sorry for the spamming, but it seems that V-Ray 3.0 actually does register the types for its file attributes. In Maya 2015 it doesn't list the Alembic attributes, but I assume it will with coming version (maybe even Maya 2016)? Autodesk will likely push developers to register it for their cus

Re: [Maya-Python] List referenced files

2015-08-12 Thread Marcus Ottosson
cmds.file(query=True, list=True, unresolvedName=True) I think that’s it! ​ On 12 August 2015 at 09:07, Roy Nieterau wrote: > For completeness sake. This is how to list unresolved filenames with the > file command: > > files = cmds.file(query=True, list=True, unresolvedName=True) > > > On Wednes

Re: [Maya-Python] List referenced files

2015-08-12 Thread Roy Nieterau
For completeness sake. This is how to list unresolved filenames with the file command: files = cmds.file(query=True, list=True, unresolvedName=True) On Wednesday, August 12, 2015 at 9:12:17 AM UTC+2, Marcus Ottosson wrote: > > Thanks everyone for your replies! > > It certainly looks more challe

Re: [Maya-Python] List referenced files

2015-08-12 Thread Marcus Ottosson
Thanks everyone for your replies! It certainly looks more challenging than I would have thought, the cmds.file(query=True, list=True) is close, and the listFiles of filePathEditor almost got it, and though it looks to work with file nodes, it doesn’t seem to work with reference nodes, and I wonder

Re: [Maya-Python] List referenced files

2015-08-11 Thread Roy Nieterau
Ok, so the filePathEditor command does allow you to retrieve the attribute belonging to a certain file. So I assume it would also allow you to query the unresolved path? from maya import cmds def grouper(iterable, n, fillvalue=None): "Collect data into fixed-length chunks or blocks" # g

Re: [Maya-Python] List referenced files

2015-08-11 Thread Geordie Martinez
there used to be a script on creative crash called "File Path Manager" that did this with textures On Tue, Aug 11, 2015 at 9:59 PM, Geordie Martinez wrote: > pymel is super useful for this > > import pymel.core as pm > # GET A LIST OF REFERENCES > refs = pm.listReferences() > # LOOP THROUGH AND

Re: [Maya-Python] List referenced files

2015-08-11 Thread Geordie Martinez
pymel is super useful for this import pymel.core as pm # GET A LIST OF REFERENCES refs = pm.listReferences() # LOOP THROUGH AND PRINT THE PATH# for ref in refs: # PATH print("path: %s"% ref.path) # NAMESPACE print("namespace: %s" % ref.namespace) On Tue, Aug 11, 2015 at 1:34

Re: [Maya-Python] List referenced files

2015-08-11 Thread Sivanny Selvakumar
`file -q -list` will return all the file reference paths and string attributes marked as usedAsFilename. So it saves you from having to iterate over the nodes in the scene yourself. This is how Maya gets a list of files for the File > Archive Scene feature. You can also access this functionalit

Re: [Maya-Python] List referenced files

2015-08-11 Thread damon shelton
Also, you can use listAttr to list attrs that are usedAsFilename. Command only returns attribute name but then you can loop through getting all objects with attribute name and querying it and checking the path. you can also list string attributes if you want to take it further, you would have to tu

Re: [Maya-Python] List referenced files

2015-08-11 Thread Robert White
So if you want the texture file nodes in the scene, you can get them from pymel with: import pymel.core as pm file_nodes = pm.ls(type=pm.nt.File) file_paths = [fyle.fileTextureName.get() for fyle in file_nodes] with cmds: import maya.cmds as cmds file_nodes = cmds.ls(type='file') file_paths = [c

Re: [Maya-Python] List referenced files

2015-08-11 Thread Marcus Ottosson
Thanks guys for a quick reply. @Arvid and Fredrik: Would it possible to share this dictionary? On 11 August 2015 at 20:23, Robert White wrote: > So if you want the texture file nodes in the scene, you can get them from > pymel with: > > import pymel.core as pm > file_nodes = pm.ls(type=pm.nt.Fi

Re: [Maya-Python] List referenced files

2015-08-11 Thread Fredrik Averpil
> Oh, you're just talking about Maya references? Sorry, getting tired :) re-read your initial question and I still don't think you can do what you want to achieve without parsing all nodes and all their attributes and then filter the value manually in order to determine whether the value is a fold

Re: [Maya-Python] List referenced files

2015-08-11 Thread Fredrik Averpil
Oh, you're just talking about Maya references? I thought you wanted to find e.g. ies files or vrmesh files etc and other files which are "referenced" (without being a "Maya reference"). tis 11 aug 2015 kl. 19:18 skrev Fredrik Averpil : > I ended up making a dictionary of nodes and attributes and

Re: [Maya-Python] List referenced files

2015-08-11 Thread Fredrik Averpil
I ended up making a dictionary of nodes and attributes and query these "manually" since there is (to my understanding) no way to really just find all filepaths existing in some shape or form in the scene. Just think about plugins. You can never know if the developer properly registered the attribu

Re: [Maya-Python] List referenced files

2015-08-11 Thread damon shelton
I would look at the referenceQuery cmd. this will let you query the unresolved path as well as use this command to tell if a particular node is referenced or not. I think this command is exactly what you need. On Tue, Aug 11, 2015 at 10:11 AM, Arvid Schneider wrote: > I did a similiar thing..but

Re: [Maya-Python] List referenced files

2015-08-11 Thread Arvid Schneider
I did a similiar thing..but it wasnt a one function solution. Its tool which catches all paths ( files ) and copies them to a given directory and remaps all the paths to the new set directory. To get it to work though, I created a dictionary with nodeType and path attribute eg. file:filepath etc. A

Re: [Maya-Python] List referenced files

2015-08-11 Thread Marcus Ottosson
Also, importantly, I’d like their unresolved entry, no the resolve one. The command above only returns resolved paths. # Right$ROOT/parent/file.mb # Wrong /server/projects/myproject/parent/file.mb ​ On 11 August 2015 at 16:59, Marcus Ottosson wrote: > I’m looking for a way to list all nodes th