[Python] Storing datas in a UserDataBlob

2012-05-29 Thread Jeremie Passerin
Hi list ! This morning I've been trying to do something that I thought would be fairly easy... but I'm stuck How do you store a dictionary inside a userdatablob in Python? My dictionary is just made of integer, strings, float... nothing fancy And it doesn't have to be a dictionary... I just need

Re: [Python] Storing datas in a UserDataBlob

2012-05-29 Thread Francois Lord
I've done it for binary data with pickle and base64. Yes I know, it's very ugly. On 29/05/2012 14:03, Jeremie Passerin wrote: Hi list ! This morning I've been trying to do something that I thought would be fairly easy... but I'm stuck How do you store a dictionary inside a userdatablob in

Re: [Python] Storing datas in a UserDataBlob

2012-05-29 Thread Jeremie Passerin
okay.. I was thinking of that too... just wondering if that was the only way... so it looks like this for me : # Python code starts import pickle import base64 root = Application.ActiveSceneRoot blob = root.Properties(Test) if not blob: blob = root.AddProperty(UserDataBlob, False, Test)

Re: [Python] Storing datas in a UserDataBlob

2012-05-29 Thread Alan Fregtman
For a dictionary the json module is nice: http://docs.python.org/library/json.html A bit less ugly than storing base64 text. On Tue, May 29, 2012 at 2:34 PM, Jeremie Passerin gerem@gmail.comwrote: okay.. I was thinking of that too... just wondering if that was the only way... so it

Re: [Python] Storing datas in a UserDataBlob

2012-05-29 Thread Jeremie Passerin
Interesting ! That looks nicer import json root = Application.ActiveSceneRoot blob = root.Properties(Test) if not blob: blob = root.AddProperty(UserDataBlob, False, Test) LogMessage(blob) data = {} data[test] = 123 data[hello] = hello d = json.dumps(data) blob.Value = d out =

Re: [Python] Storing datas in a UserDataBlob

2012-05-29 Thread Rob Chapman
hey , its been a while but is this the Softimage badass thread? :) python... meh! On 29 May 2012 20:24, Jeremie Passerin gerem@gmail.com wrote: Interesting ! That looks nicer import json root = Application.ActiveSceneRoot blob = root.Properties(Test) if not blob: blob =