Also, I did a quick test using a named pipe, but it doesn't work since I
think Maya writes out its file to a temp area and the moves it into place,
as opposed to opening the filepath you give it and writing to it. That
would end up preventing you from using pipes or memory mapped files (I
think).
I've never done a file translator plugin, but if it give you control of the
actual writting process and not just telling it a path that Maya handles,
then maybe it would work correctly since you can open the existing path.

On Sun, 15 Mar 2015 10:12 AM Justin Israel <[email protected]> wrote:

> Ya that would be an actual memory mapped file (not an inverse of it). A
> memory mapped file is exactly how you described it. On posix filesystem
> there is usually also some kind of a tmpfs virtual filesystem available,
> which acts the same way, on top of mmap. You make a file using the same
> standard file system commands but it isn't a block device, rather a memory
> backed file. The closest thing on Windows is called ram disks but I think
> you have to explicitly mount those yourself as opposed to one usually being
> available.
>
> On Sun, 15 Mar 2015 10:04 AM Marcus Ottosson <[email protected]>
> wrote:
>
>> 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
>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAgzwxNWeT-zrxcXZqDbxmr1GWEsaQhjFaDT7jO%3D9Z8UA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/CAPGFgA3DWS4zUK0aUexJW%2BaOxWj3s46EQ1saEXSh%2BFmgm%2B5d7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to