Thanks Joe! Now, depending on what you’re trying to do, you *could* simply parse the scene data itself, and store that in memory, and then you could do whatever you want with it
Yes, this is essentially what I’m looking to do, but to rely on the export mechanism as opposed to making calls to cmds.ls, cmds.listAttr and cmds.getAttr for performance reasons, as they take quite the amount of time to run/query, whereas an export is (exponentially?) faster. So the reason for looking to bypass the file-system in this case was simply to avoid the cost of de-touring the hard-disk and go directly from serialising to parsing. I had a quick look at writing a custom exporter/translator. After just a quick read, it did look rather hard-coded that the end result should be a file so I’m not sure that’s the tree I should be barking up on. Would anyone have enough experience writing a file translator to know whether it’s possible to translate to memory instead? Alternatively, I also had an idea of perhaps mapping a portion of memory into a file-path, and then simply exporting to that. Basically, the inverse of a memory-mapped file. - http://en.wikipedia.org/wiki/Memory-mapped_file In which the file-path would actually be pointing to a location in memory, as opposed to on disk, if that makes sense? I should also note that not all data is relevant; I’m only looking to serialise names of nodes, along with their attributes and values that are of type string and number. Here’s a performance test for a cmds.getAttr approach, along with some results. https://gist.github.com/mottosso/e2d33de7f22f5370aa02 Test A Number of nodes: 288 Number of attributes: 48371 Time taken to generate instance: 1.64s Size of instance: 2.536 kb Size of compressed instance: 0.73 kb Test B Number of nodes: 574 Number of attributes: 87591 Time taken to generate instance: 3.04s Size of instance: 4.848 kb Size of compressed instance: 1.346 kb Whereas the time it takes to export, which includes polygonal data, meaning it could potentially be optimised further. Test A Time taken, including writing to disk (SSD): 0.078s Size of instance: 223.00 kb Test B Time taken, including writing to disk (SSD): 0.295s Size of instance: 1940.00 kb Note that my use of instance in this case is analogous to output. Best, Marcus -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAgzwxNWeT-zrxcXZqDbxmr1GWEsaQhjFaDT7jO%3D9Z8UA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
