Pipeline - Serializing nodes

   2870   4   0
User Avatar
Member
6 posts
Joined: June 2015
Offline
Hi everyone,

I was hoping to find people who already use the functions in Houdini which allows to serialize nodes.

I'm currently trying these two functions :
hou.Node.saveItemsToFile() #used to export node from the current Houdini session.
hou.Node.loadItemsToFile() #used to import node in the current Houdini session.

I don't know if it's the same for you, I found the hou.Node.loadItemsFromFile() unstable.

I'm trying to find why Houdini crashes so often but maybe you already have some information about that (I can't tell if it's my nodes which cause that or if it's this function because it's not for the same reason).

I know it's possible to export nodes in a python file thanks to hou.Node.asCode() but I don't think it's a good solution even if it seems to be more stable.

FYI:
- I use Houdini Core 17.0.459
- File is exported in .cpio
- Nodes also containing custom HDA
- I already tried with only a simple node geo
- I run the script in the Python Shell

Thanks

Camelia
Edited by camelia - Feb. 19, 2019 12:44:02
FX TD - R&D
User Avatar
Member
6 posts
Joined: June 2015
Offline
When I use the copy/paste system, it creates a .cpio file in the temporary directory. I tried to do the same actions (by using Ctrl+V) and no crash.

I use the file generated by Houdini (OBJ_copy.cpio) and call the function hou.Node.loadItemsFromFile() and few actions later it crashes. The actions are just re-creating the node many times with the function above, or create a new scene and call the same function.

This is the crash log :

Uptime 1224 seconds
Tue Feb 19 11:20:18 2019
Caught signal 11

Traceback from 25106 ThreadId=0x7efeaf69fc80
AP_Interface::coreDumpChaser(UTsignalHandlerArg) <libHoudiniUI.so>
AP_Interface::si_CrashHandler::chaser(UTsignalHandlerArg) <libHoudiniUI.so>
signalCallback(UTsignalHandlerArg) <libHoudiniUT.so>
UT_Signal::UT_ComboSignalHandler:perator()(int, siginfo_t*, void*) const <libHoudiniUT.so>
UT_Signal::processSignal(int, siginfo_t*, void*) <libHoudiniUT.so>
_L_unlock_13 <libpthread.so.0>
je_arena_dalloc_bin_locked (arena.c:1897)
je_tcache_bin_flush_small (tcache.c:127)
je_tcache_event_hard (tcache.c:39)
vk_icdGetInstanceProcAddr <libGLX_nvidia.so.0>
FX TD - R&D
User Avatar
Member
6 posts
Joined: June 2015
Offline
I really think the issue is due to the Python Shell.
I don't know what's the big difference between calling the same script in the Python Shell and on another place (Tool in Shelf, python node, etc.).

As an example, the hscript command opread doesn't have the same result from the Python Shell and from the python node :

path = '/path/to/the/file.cpio'

objNode = hou.node('/obj')
hou.setPwd(objNode)
hou.hscript('opread {}'.format(path))

Maybe I don't do the right thing but this call in a python node import the contents of the cpio file BUT in the Python Shell it only returns without nothing imported:

('Loaded 0 operators, 0 network boxes\n', ‘\n’)

Hope it will help anyone who might have this issue.
FX TD - R&D
User Avatar
Member
1905 posts
Joined: Nov. 2006
Offline
camelia
I don't know what's the big difference between calling the same script in the Python Shell and on another place (Tool in Shelf, python node, etc.).

The main difference is that the Python Shell runs in a separate thread where as things like shelf tools, menu entries, etc are run in the main thread. A lot of things definitely can cause weird behavior/crashes when running from the shell (think Qt) so if you're doing something complex it'a always advised to do it via shelf tool or menu item.

We've been successfully using the hou.Node methods for quite a while without running into issues so it could be very specific to what you are attempting to copy.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
6 posts
Joined: June 2015
Offline
graham
camelia
I don't know what's the big difference between calling the same script in the Python Shell and on another place (Tool in Shelf, python node, etc.).

The main difference is that the Python Shell runs in a separate thread where as things like shelf tools, menu entries, etc are run in the main thread. A lot of things definitely can cause weird behavior/crashes when running from the shell (think Qt) so if you're doing something complex it'a always advised to do it via shelf tool or menu item.

We've been successfully using the hou.Node methods for quite a while without running into issues so it could be very specific to what you are attempting to copy.

Thank you Graham for your answer. You confirm what I thought.

Yes, one day I had this same weird behavior with a tool I did in Qt (events log when I move the cursor). On the Houdini documentation, there is a warning about that here [www.sidefx.com] but I thought it was just about UI. So now, I will only use the Python Shell for simple needs.
FX TD - R&D
  • Quick Links