[Sidefx-houdini-list] Save hou.session.listX with hip file

Andrew Lyons tstexture at gmail.com
Mon Apr 9 11:18:08 EDT 2012


JSON is human readable. It looks like a big python dictionary, so
people can go at it in a text editor. It only stores generic types in
mappings of key value pairs though.

People tend to favor binary pickles - and you can't hand edit those so
easily. Pickles however have the advantage that they rebuild python
types on read. For this reason they store all manner of python data
structures happily - with the exception of the swig objects
(parmTemplates). I found that writing a new format to store
parmTemplates, and classes for every type from keyframe to node I was
able to store an entire hipfile as pickles in a shelve. It's fully
indexable, and you can write readers and writers for Qt and other
applications. We used it for loading Maya scenes into Houdini at IMD
before it closed. Alembic is going to provide some new options there
though...

Cheers

On 9 April 2012 01:18, Nick van Zutphen <nvanzutphen at live.com> wrote:
> Ah! Now I understand, yep the pickle method of storing a dict as a string on the root node works perfectly and suits my needs :-D.
> I was using pickle any way to store the data in a file, so thats not so much of a difference. I'll use cpickle for speed.
>
> Being a little off topic, what exactly is JSON. I've noticed specific people, which I consider to be pretty smart ;-), being really exited that Houdini supports it. I understand I could use it for my current project as well, why should I, is it faster easier to use, other benefits?
>
> Cheers,
>
> Be Nick, be Nimble
> ----
> http://www.nickvanzutphen.com/ngtl
>
>
>
>
> On Apr 9, 2012, at 4:23 AM, jiversen wrote:
>
>> Perhaps you can pickle it?
>>
>> Lars van der Bijl wrote:
>>> i'm sure repr could do it.
>>>
>>> unless your using something special repr will give you a string you
>>> can easy store on "/"
>>>
>>>
>>>
>>> On Sun, Apr 8, 2012 at 9:20 PM, Nick van Zutphen <nvanzutphen at live.com>wrote:
>>>
>>>
>>>> That sounds very clever, but am I right that userdata is limited to
>>>> strings? Unfortunately I would like to store a rather complicated
>>>> dictionary.
>>>> I'm building an automatic node color system which can be fully configured
>>>> by an .otl. In its core it works perfectly, how ever it still depends on a
>>>> file on disk which is loaded into hou.session. This limits per file color
>>>> adjustments, I'm eigher  to get that working. The task at hand is rather
>>>> simple in its description:
>>>>
>>>> How do I save an dictionary with an .hip file?
>>>>
>>>> Be Nick, be Nimble
>>>> ----
>>>> http://www.nickvanzutphen.com/ngtl
>>>>
>>>>
>>>>
>>>>
>>>> On Apr 8, 2012, at 7:57 PM, Graham Thompson wrote:
>>>>
>>>>
>>>>> Can you not just store all your data on the root node ('/')?
>>>>>
>>>>> On Sun, Apr 8, 2012 at 11:50 AM, Nick van Zutphen <nvanzutphen at live.com>
>>>>>
>>>> wrote:
>>>>
>>>>>> Maybe I should be a bit more specific, this data needs to be available
>>>>>>
>>>> to onCreate.py. I guess node specific data isn't?
>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Be Nick, be Nimble
>>>>>> ----
>>>>>> http://www.nickvanzutphen.com/ngtl
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Apr 8, 2012, at 7:28 PM, Graham Thompson wrote:
>>>>>>
>>>>>>
>>>>>>> The best way to save data is to use node user data:
>>>>>>> http://www.sidefx.com/docs/houdini12.0/hom/nodeuserdata
>>>>>>>
>>>>>>> On Sun, Apr 8, 2012 at 11:11 AM, Nick van Zutphen <
>>>>>>>
>>>> nvanzutphen at live.com> wrote:
>>>>
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> I just discovered that hou.session is not saved with the hip file
>>>>>>>>
>>>> :-(. I would like to store a dictionairy or a list for simplicities sake,
>>>> which is accessible by scripts and saved with the hip file.
>>>>
>>>>>>>> I discovered: hou.appendSessionModuleSource, but its not totally
>>>>>>>>
>>>> clear what its proper usage is. Any suggestions?
>>>>
>>>>>>>> Be Nick, be Nimble
>>>>>>>> ----
>>>>>>>> http://www.nickvanzutphen.com/ngtl
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Sidefx-houdini-list mailing list
>>>>>>>> Sidefx-houdini-list at sidefx.com
>>>>>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Sidefx-houdini-list mailing list
>>>>>>> Sidefx-houdini-list at sidefx.com
>>>>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Sidefx-houdini-list mailing list
>>>>>> Sidefx-houdini-list at sidefx.com
>>>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>>>
>>>>> _______________________________________________
>>>>> Sidefx-houdini-list mailing list
>>>>> Sidefx-houdini-list at sidefx.com
>>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Sidefx-houdini-list mailing list
>>>> Sidefx-houdini-list at sidefx.com
>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>
>>>>
>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list



-- 
=======================================
Andrew D Lyons | Digital Artist | http://www.tstex.com
=======================================



More information about the Sidefx-houdini-list mailing list