HDK: Saving and loading nodes

   3847   6   0
User Avatar
Member
30 posts
Joined: 7月 2007
Offline
Hey all,

Yet another question for the HDK users/developers out there. I'm trying to add support for copying/pasting my custom node. After some searching, it turns out that the save and load functions need to be overloaded to handle this as it is used for not only disk saving and loading but also for regular copying and pasting.

There are two samples that show how to do this: CHOP_FifthGlove and SOP_BlindData. Both of these examples save to a path with a custom extension. This seems to only work in the disk scenario, however, as the load call never gets called with that extension with a copy/paste. Is that expected behavior? And if so, is the best way to handle this by calling the base class's save function on the ‘param’ extension first and then tacking data onto the end of the stream?

Thanks for any info you can provide on this!

–Joel
Joel Van Eenwyk
Programmer and FX Artist
Homepage: VFX Journal [vfxjournal.net]
User Avatar
Member
7726 posts
Joined: 7月 2005
Offline
I haven't tried but a brief look at SOP_BlindData seems to do the right thing. Did you test with that first? Notice that load() will only get get called with a particular extension if you saved a UT_CPIO packet with that extension.
User Avatar
Member
30 posts
Joined: 7月 2007
Offline
Hi Edward,

Seems you are always the one who responds the fastest. Thanks for all the help!

You're right, they do indeed seem to be doing the right thing. I did test their sample, though, and when you copy/paste the node, it never gets to loadPrivateData.

Any suggestions?

–Joel
Joel Van Eenwyk
Programmer and FX Artist
Homepage: VFX Journal [vfxjournal.net]
User Avatar
Member
7726 posts
Joined: 7月 2005
Offline
That's odd. It seems to work fine for me. I just put cerr's into each of the functions and compiled SOP_BlindData.C. Then I start Houdini and put down a BlindData SOP, Ctrl+c, Ctrl+v and I get:

save mydata
savePrivateData
load def
load parm
load mydata
loadPrivateData

I also printed out theExtension and extension during load/save.
User Avatar
Member
30 posts
Joined: 7月 2007
Offline
That is very odd. What version are you using on which platform?

Note: I have tested it on v9.0.719 and v9.0.739. Typically I use custom compiling and linking flags, but just to verify, I used ‘hcustom’ as well. Also, I'm developing on WinXP32.

–Joel
Joel Van Eenwyk
Programmer and FX Artist
Homepage: VFX Journal [vfxjournal.net]
User Avatar
Member
7726 posts
Joined: 7月 2005
Offline
WinXP 32-bit 9.0.730. Because the HDK htools directory was missing, I compiled SOP_BlindData like this:
hcustom -i $HH/dso -I $HFS/toolkit/include/htools SOP_BlindData.C

I can't think of why SOP_BlindData won't work since that's exactly what native SOPs (eg. Edit SOP) used. If the mechanism didn't work, it would means copy/pasting Edit SOPs (with embedded changes) would not work also.
User Avatar
Member
30 posts
Joined: 7月 2007
Offline
Quick update on this. Turns out that the save/load functions do not work correctly on the Apprentice version. When running the plugin in the commercial version, the plugin (even though it was compiled with the Apprentice version HDK) worked fine.

I have submitted a bug report on this, so hopefully we can get a solution to this from SideFX relatively soon.

–Joel
Joel Van Eenwyk
Programmer and FX Artist
Homepage: VFX Journal [vfxjournal.net]
  • Quick Links