Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-10 Thread AK Eric
Another great solution, thanks!

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9c3a1378-c862-4987-a4f2-0e5412d217a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-10 Thread Joss13
And it will work in python as well:
import sys, os, shutil, subprocess, time


curdir = os.path.dirname(__file__)
target = os.path.join(curdir, 'test_subject.txt')
target2 = os.path.join(curdir, 'test_subject.txt:attr1')


shutil.copy2('c:/windows/explorer.exe', target)
os.system('dir /r')
time.sleep(3)


shutil.copy2('c:/windows/win.ini', target2)
os.system('dir /r')
time.sleep(3)



On Thursday, May 10, 2018 at 12:33:11 PM UTC-7, Joss13 wrote:
>
> Some more examples here: 
> http://www.flexhex.com/docs/articles/alternate-streams.phtml
>
>
> On Thursday, May 10, 2018 at 12:31:27 PM UTC-7, Joss13 wrote:
>>
>>
>>
>> On Thursday, May 3, 2018 at 3:26:33 PM UTC-7, Marcus Ottosson wrote:
>>>
>>> Basically you can write anything to your 
>>> “c:/project/mayascene.mb:trololo”, “:attr1”, “:whatever” even with the 
>>> shell commands, or your file manager.
>>>
>>> Sounds interesting! Would you be able to post an example?​
>>>
>> Simple windows cmd script, create empty directory somewhere and run it:
>> ---
>> @echo off
>> copy c:\windows\explorer.exe test_subject.txt
>> dir /r
>> pause
>>
>>
>> type c:\windows\win.ini > test_subject.txt:attr1
>> dir /r
>> pause
>>
>>
>> more < test_subject.txt:attr1
>>
>> At the end you will have a single 'test_subject.txt' file with the 
>> contents of explorer.exe in the main stream and 'win.ini' attached as 
>> 'test_subject.txt:attr1
>>
>>
>> ---
>>  
>>
>>> ​
>>>
>>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e12146e2-56f1-423f-9bc8-d6fd85940139%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-10 Thread Joss13
Some more examples 
here: http://www.flexhex.com/docs/articles/alternate-streams.phtml


On Thursday, May 10, 2018 at 12:31:27 PM UTC-7, Joss13 wrote:
>
>
>
> On Thursday, May 3, 2018 at 3:26:33 PM UTC-7, Marcus Ottosson wrote:
>>
>> Basically you can write anything to your 
>> “c:/project/mayascene.mb:trololo”, “:attr1”, “:whatever” even with the 
>> shell commands, or your file manager.
>>
>> Sounds interesting! Would you be able to post an example?​
>>
> Simple windows cmd script, create empty directory somewhere and run it:
> ---
> @echo off
> copy c:\windows\explorer.exe test_subject.txt
> dir /r
> pause
>
>
> type c:\windows\win.ini > test_subject.txt:attr1
> dir /r
> pause
>
>
> more < test_subject.txt:attr1
>
> At the end you will have a single 'test_subject.txt' file with the 
> contents of explorer.exe in the main stream and 'win.ini' attached as 
> 'test_subject.txt:attr1
>
>
> ---
>  
>
>> ​
>>
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c8920035-30d9-4262-8d5f-a073d5bce2fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-10 Thread Kthulhu Fhtagn


On Thursday, May 3, 2018 at 3:26:33 PM UTC-7, Marcus Ottosson wrote:
>
> Basically you can write anything to your 
> “c:/project/mayascene.mb:trololo”, “:attr1”, “:whatever” even with the 
> shell commands, or your file manager.
>
> Sounds interesting! Would you be able to post an example?​
>
Simple windows cmd script, create empty directory somewhere and run it:
---
@echo off
copy c:\windows\explorer.exe test_subject.txt
dir /r
pause


type c:\windows\win.ini > test_subject.txt:attr1
dir /r
pause


more < test_subject.txt:attr1

At the end you will have a single 'test_subject.txt' file with the contents 
of explorer.exe in the main stream and 'win.ini' attached as 
'test_subject.txt:attr1


---
 

> ​
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/177e3d76-7695-48b9-adfa-b8c0047d2c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-03 Thread Marcus Ottosson
Basically you can write anything to your “c:/project/mayascene.mb:trololo”,
“:attr1”, “:whatever” even with the shell commands, or your file manager.

Sounds interesting! Would you be able to post an example?​
​

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCDiNqB-x6ckVXvjMQEvTjC5E8zSt2SU8W%2B%2BkOv_%2BSL8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-03 Thread ajoss
On Tuesday, February 13, 2018 at 8:56:56 PM UTC-8, AK Eric wrote:
> Right on, credit :)
> 
> 
> FYI, I figured out you can use cpickle.dumps to embed arbitrary python data 
> straight into the value of fileInfo, allowing you to query it outside of 
> Maya, powerful.
> 
> 
> However, on large files (200+megs) it can still take a good 20 seconds to 
> parse.  I may end up just storing all this data to a folder on a server for 
> easy/fast lookup, but it was still a fun exercise.  Thanks for the help 
> everyone.

What file system are you using?
You can directly use NTFS ADS(Alternate Data Streams) if you're on Windows.

Basically you can write anything to your "c:/project/mayascene.mb:trololo", 
":attr1", ":whatever" even with the shell commands, or your file manager.
You can even keep Maya scene versions inside of a single file, tagging all 
other copies with attribute like "mayascene.mb:v001"


-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/92004d2a-71cd-4995-bf10-67808e5603cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-04-17 Thread Mark Jackson
Damn this is a nice idea, never thought of the fileInfo command, I've got
to dig into this thanks guys!

On 14 February 2018 at 04:56, AK Eric  wrote:

> Right on, credit :)
>
> FYI, I figured out you can use cpickle.dumps to embed arbitrary python
> data straight into the value of fileInfo, allowing you to query it outside
> of Maya, powerful.
>
> However, on large files (200+megs) it can still take a good 20 seconds to
> parse.  I may end up just storing all this data to a folder on a server for
> easy/fast lookup, but it was still a fun exercise.  Thanks for the help
> everyone.
>
> --
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/563ef7ef-a5a4-4007-aa2d-
> f978cf569aff%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-
Mark Jackson
CEO / Technical Director
red9consultancy.com

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FHNsda3_DH5-Fpo-vK7Ew0Wc9Qd5ZTOFXNQ1Zeoj9hOiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-13 Thread AK Eric
Right on, credit :)

FYI, I figured out you can use cpickle.dumps to embed arbitrary python data 
straight into the value of fileInfo, allowing you to query it outside of 
Maya, powerful.

However, on large files (200+megs) it can still take a good 20 seconds to 
parse.  I may end up just storing all this data to a folder on a server for 
easy/fast lookup, but it was still a fun exercise.  Thanks for the help 
everyone.

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/563ef7ef-a5a4-4007-aa2d-f978cf569aff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-12 Thread Marcus Ottosson
Glad it works, however I can't take much credit for the parser; I believe
most of the work is originally from cgkit, and the rest from the parent
repository of my fork, https://github.com/agibli/sansapp

On 12 February 2018 at 17:50, AK Eric  wrote:

> Thanks Alok & Marcus:  I tried that code and it does indeed work.  Nice
> job on the scenefile parser 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/6c44d89c-d1c5-4c93-9ffa-
> d2466b6b9617%40googlegroups.com
> 
> .
>
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA9Vjpc-nHFe7iUGpnfNuPqw-rM%2B5G%3DTaT2SQyp4XLG8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-12 Thread AK Eric
Thanks Alok & Marcus:  I tried that code and it does indeed work.  Nice job 
on the scenefile parser 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6c44d89c-d1c5-4c93-9ffa-d2466b6b9617%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-12 Thread Marcus Ottosson
By golly, that does actually work!

from maya_scenefile_parser import MayaBinaryParser

fname =  "C:/Users/marcus/Desktop/temp.mb"
class Parser(MayaBinaryParser):
def on_file_info(self, key, value):
print("%s = %s" % (key, value))
with open(fname, "rb") as f:
parser = Parser(f)
parser.parse()

Output:

mykey = myvalue
application = maya
product = Maya 2015
version = 2015
cutIdentifier = 201503261530-955654
osv = Microsoft Windows 8 Enterprise Edition, 64-bit  (Build 9200)\n

Where mykey = myvalue was added via cmds.fileInfo("myvalue", "mykey")
before saving the mb file. Tested on a file saved with Maya 2015.

   - https://github.com/mottosso/maya-scenefile-parser

Nice one, Alok!
​

On 12 February 2018 at 10:39, Alok Gandhi  wrote:

> Why not use the fileInfo() to store the data?
>
> Can be read outside maya as well by parsing the ma/mb
>
> Sent from my iPhone
>
> > On 12-Feb-2018, at 00:10, Juan Cristóbal Quesada <
> juan.cristobal...@gmail.com> wrote:
> >
> > following your attempts at using cPickle in mb files which seems
> interesting to me... Cant you just append a binary datablock with your data
> at the end of the .mb file and just preprocess the file reading and
> deleting that appended block of data before opening the file in Maya? If
> you do it right you should leave de postprocessed file as the original one
> exactly with same size. Using a fixed sized datablock big enough to hold
> your metadata should be easier. As a drawback you should code your own
> "file open.."
> >
> >
> >> El 11/02/2018 a las 15:38, fruityfr...@gmail.com escribió:
> >> I'd be curious to find something as well ! I had a quick look at it
> ages ago, and couldn't find anything robust. If you're on Unix, you can
> attach infos against a file (including a .mb), but that doesn't seem to
> exist on windows. And I'd like to find something cross-platform
> >> You can also write notes in maya, but then, as you said, you need to
> open the file, and even in standalone mode, it can take some time..
> >> However, I think the safest option would be to deal with separated
> config files. As you say, one can 'break' the pipeline by moving the config
> file away from its scene file, but I'd say it is acceptable... I mean if an
> animator removes everything in the outliner, he can't complain the rig is
> broken ; if someone starts messing around with files he doesn't know,
> pipeline can't be responsible for that.
> >> Still, by curiosity, I'd be curious to know if there is a way of
> storing infos against an .mb file
> >>
> >> Le vendredi 9 février 2018 18:08:05 UTC-5, AK Eric a écrit :
> >>> It would be of great use if I could (somehow) tag mb files with
> metadata that could be read at system level, never having to open the mb
> itself in Maya.
> >>>
> >>>
> >>> I already have a solution that will save out a json/xml next to the
> file whenever the users saves, with queryable info.  But this is lossy, can
> decouple from the file if it's ever moved, etc.
> >>>
> >>>
> >>> Being able to tag an actual mb with data would be great (in the same
> way you can say, check exif data on an image).
> >>>
> >>>
> >>> I've tried some examples doing this in Python with pickle, on both ma
> & mb files, but... it corrupts the files.  Ironically, I can store and
> retrieve metadata, it just wrecks everything else in the file :P
> >>>
> >>>
> >>> Maybe not possible.  But I thought I'd see if someone actually had a
> more elegant solution for this.
> >>>
> >>>
> >>> thanks
> >
> > --
> > 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 python_inside_maya+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/065048f8-05b6-beea-10d1-2302693168d2%40gmail.com.
> > 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/64C17806-7F48-456D-B05B-01DA327C8106%40gmail.com.
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOATkpb-YPsHimC3Qb4K7cipHPe_MfEX%3DQW6LUCqnrB_og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-12 Thread Alok Gandhi
Why not use the fileInfo() to store the data?

Can be read outside maya as well by parsing the ma/mb

Sent from my iPhone

> On 12-Feb-2018, at 00:10, Juan Cristóbal Quesada 
>  wrote:
> 
> following your attempts at using cPickle in mb files which seems interesting 
> to me... Cant you just append a binary datablock with your data at the end of 
> the .mb file and just preprocess the file reading and deleting that appended 
> block of data before opening the file in Maya? If you do it right you should 
> leave de postprocessed file as the original one exactly with same size. Using 
> a fixed sized datablock big enough to hold your metadata should be easier. As 
> a drawback you should code your own "file open.."
> 
> 
>> El 11/02/2018 a las 15:38, fruityfr...@gmail.com escribió:
>> I'd be curious to find something as well ! I had a quick look at it ages 
>> ago, and couldn't find anything robust. If you're on Unix, you can attach 
>> infos against a file (including a .mb), but that doesn't seem to exist on 
>> windows. And I'd like to find something cross-platform
>> You can also write notes in maya, but then, as you said, you need to open 
>> the file, and even in standalone mode, it can take some time..
>> However, I think the safest option would be to deal with separated config 
>> files. As you say, one can 'break' the pipeline by moving the config file 
>> away from its scene file, but I'd say it is acceptable... I mean if an 
>> animator removes everything in the outliner, he can't complain the rig is 
>> broken ; if someone starts messing around with files he doesn't know, 
>> pipeline can't be responsible for that.
>> Still, by curiosity, I'd be curious to know if there is a way of storing 
>> infos against an .mb file
>> 
>> Le vendredi 9 février 2018 18:08:05 UTC-5, AK Eric a écrit :
>>> It would be of great use if I could (somehow) tag mb files with metadata 
>>> that could be read at system level, never having to open the mb itself in 
>>> Maya.
>>> 
>>> 
>>> I already have a solution that will save out a json/xml next to the file 
>>> whenever the users saves, with queryable info.  But this is lossy, can 
>>> decouple from the file if it's ever moved, etc.
>>> 
>>> 
>>> Being able to tag an actual mb with data would be great (in the same way 
>>> you can say, check exif data on an image).
>>> 
>>> 
>>> I've tried some examples doing this in Python with pickle, on both ma & mb 
>>> files, but... it corrupts the files.  Ironically, I can store and retrieve 
>>> metadata, it just wrecks everything else in the file :P
>>> 
>>> 
>>> Maybe not possible.  But I thought I'd see if someone actually had a more 
>>> elegant solution for this.
>>> 
>>> 
>>> thanks
> 
> -- 
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/python_inside_maya/065048f8-05b6-beea-10d1-2302693168d2%40gmail.com.
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/64C17806-7F48-456D-B05B-01DA327C8106%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-11 Thread Ian Jones
Well if you like your MB and your current json/xml file solution but just
want them tied together so they don't get disconnected you may want to
consider just using a .zip to bind them. Uncompressed they can be very fast
and you can access files directly (to query your metadata etc) without
having to extract the zip with python. You'll just need a bit of code to
enable opening/saving them back together.

https://docs.python.org/2/library/zipfile.html

Ian
On Sun, Feb 11, 2018, 8:34 PM AK Eric  wrote:

> Marcus:  MA not an option, so no comment blocks, but thanks, good idea.
> However, I like your idea of just writing data to somewhere on the server
> that corresponds to the Maya file in question.  That could be a legit
> answer.  not tagging the file with metadata itself, but the data isn't
> living next to the Maya file itself, which I find scary :P
>
> Juan:  Your thought has merit, and technically I could do it with a
> pre-scene-open callback.  Would be worth a test to prove out, but it's a
> little scary that unless that callback fires, your scene is garbage.
> However, it does make for an interesting way to copy-protect in-house
> data
>
> --
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/4485d4ba-a768-4116-a1da-87445e01da69%40googlegroups.com
> 
> .
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAL6_5Q_HHnsEY74HbZhZnpMZ_v%3D12MHFoRB6E1rz%2B8bW9CEYLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-11 Thread AK Eric
Marcus:  MA not an option, so no comment blocks, but thanks, good idea.  
However, I like your idea of just writing data to somewhere on the server 
that corresponds to the Maya file in question.  That could be a legit 
answer.  not tagging the file with metadata itself, but the data isn't 
living next to the Maya file itself, which I find scary :P

Juan:  Your thought has merit, and technically I could do it with a 
pre-scene-open callback.  Would be worth a test to prove out, but it's a 
little scary that unless that callback fires, your scene is garbage.  
However, it does make for an interesting way to copy-protect in-house 
data

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4485d4ba-a768-4116-a1da-87445e01da69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-11 Thread Juan Cristóbal Quesada
following your attempts at using cPickle in mb files which seems 
interesting to me... Cant you just append a binary datablock with your 
data at the end of the .mb file and just preprocess the file reading and 
deleting that appended block of data before opening the file in Maya? If 
you do it right you should leave de postprocessed file as the original 
one exactly with same size. Using a fixed sized datablock big enough to 
hold your metadata should be easier. As a drawback you should code your 
own "file open.."



El 11/02/2018 a las 15:38, fruityfr...@gmail.com escribió:

I'd be curious to find something as well ! I had a quick look at it ages ago, 
and couldn't find anything robust. If you're on Unix, you can attach infos 
against a file (including a .mb), but that doesn't seem to exist on windows. 
And I'd like to find something cross-platform
You can also write notes in maya, but then, as you said, you need to open the 
file, and even in standalone mode, it can take some time..
However, I think the safest option would be to deal with separated config 
files. As you say, one can 'break' the pipeline by moving the config file away 
from its scene file, but I'd say it is acceptable... I mean if an animator 
removes everything in the outliner, he can't complain the rig is broken ; if 
someone starts messing around with files he doesn't know, pipeline can't be 
responsible for that.
Still, by curiosity, I'd be curious to know if there is a way of storing infos 
against an .mb file

Le vendredi 9 février 2018 18:08:05 UTC-5, AK Eric a écrit :

It would be of great use if I could (somehow) tag mb files with metadata that 
could be read at system level, never having to open the mb itself in Maya.


I already have a solution that will save out a json/xml next to the file 
whenever the users saves, with queryable info.  But this is lossy, can decouple 
from the file if it's ever moved, etc.


Being able to tag an actual mb with data would be great (in the same way you 
can say, check exif data on an image).


I've tried some examples doing this in Python with pickle, on both ma & mb 
files, but... it corrupts the files.  Ironically, I can store and retrieve 
metadata, it just wrecks everything else in the file :P


Maybe not possible.  But I thought I'd see if someone actually had a more 
elegant solution for this.


thanks


--
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/065048f8-05b6-beea-10d1-2302693168d2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-11 Thread Juan Cristóbal Quesada
following your attempts at using cPickle in mb files which seems 
interesting to me... Cant you just append a binary datablock with your 
data at the end of the .mb file and just preprocess the file reading and 
deleting that appended block of data before opening the file in Maya? If 
you do it right you should leave de postprocessed file as the original 
one exactly with same size. Using a fixed sized datablock big enough to 
hold your metadata should be easier. As a drawback you should code your 
own "file open.."



El 11/02/2018 a las 15:38, fruityfr...@gmail.com escribió:

I'd be curious to find something as well ! I had a quick look at it ages ago, 
and couldn't find anything robust. If you're on Unix, you can attach infos 
against a file (including a .mb), but that doesn't seem to exist on windows. 
And I'd like to find something cross-platform
You can also write notes in maya, but then, as you said, you need to open the 
file, and even in standalone mode, it can take some time..
However, I think the safest option would be to deal with separated config 
files. As you say, one can 'break' the pipeline by moving the config file away 
from its scene file, but I'd say it is acceptable... I mean if an animator 
removes everything in the outliner, he can't complain the rig is broken ; if 
someone starts messing around with files he doesn't know, pipeline can't be 
responsible for that.
Still, by curiosity, I'd be curious to know if there is a way of storing infos 
against an .mb file

Le vendredi 9 février 2018 18:08:05 UTC-5, AK Eric a écrit :

It would be of great use if I could (somehow) tag mb files with metadata that 
could be read at system level, never having to open the mb itself in Maya.


I already have a solution that will save out a json/xml next to the file 
whenever the users saves, with queryable info.  But this is lossy, can decouple 
from the file if it's ever moved, etc.


Being able to tag an actual mb with data would be great (in the same way you 
can say, check exif data on an image).


I've tried some examples doing this in Python with pickle, on both ma & mb 
files, but... it corrupts the files.  Ironically, I can store and retrieve 
metadata, it just wrecks everything else in the file :P


Maybe not possible.  But I thought I'd see if someone actually had a more 
elegant solution for this.


thanks


--
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/21450ab3-b9d1-908e-8ad8-ebdad5180f5b%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-11 Thread Marcus Ottosson
If .ma is an option, then it supports comment blocks.

// Comment here
...
addAttr ...
connectAttr..

A perhaps more common approach might be to store metadata relative an
absolute path in a database.

{
  "c:\path\to\some\file.mb": {
"any": "data",
"here": True
  }}

Then you can query files and metadata somewhat similarly.

fname = r"c:\path\to\some\file.mb"
with open(fname) as f:
  f.read()
with metadata(fname) as f:
  f.read()

Where metadata() is a function of your own design, for example..

import contextlibimport mongo
@contextlib.contextmanagerdef metadata(fname):
  return mongofind_one({"fname": fname})

Leaving out the details of how to communicate with the database for brevity.
​
​

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAhQ7HYaEvwqoh1KaA8sS-VXuXVERReUB6NU%2B-jZKkC5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.