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")

LogMessage(blob)

data = {}
data["test"] = 123
data["hello"] = "hello"

d = base64.b64encode(pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL))

blob.Value = d

out = pickle.loads(base64.b64decode(blob.Value))

LogMessage(out)
# Python Code ends



On 29 May 2012 11:26, Francois Lord <flordli...@gmail.com> wrote:

> 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 Python?
>> My dictionary is just made of integer, strings, float... nothing fancy
>> And it doesn't have to be a dictionary... I just need a way to connect a
>> value to a name...
>>
>> I've seen this example :
>> http://softimage.wiki.**softimage.com/sdkdocs/**scriptsdb/scriptsdb/**
>> UserDataBlob_ByteArray_1_pys.**htm<http://softimage.wiki.softimage.com/sdkdocs/scriptsdb/scriptsdb/UserDataBlob_ByteArray_1_pys.htm>
>>
>> but I would need a untyped array as my values are not all of the same
>> type.
>>
>>
>> Any idea ?
>>
>> cheers,
>> Jeremie
>>
>>
>>

Reply via email to