I wrote a plugin. The plugin's code referenced houdini HDK, Dynamic Simulations plugin example, see this page: https://www.sidefx.com/docs/hdk/_h_d_k__intro__creating_plugins.html [www.sidefx.com]
Now I want to implement dynamic loading for this plugin. But there were some problems.
First, I tried to use python API to load it.
hou.nodeTypeCategories()['Dop'].loadDSO('--dll path--')
Then, I tried to use _ctypes to load it.
import _ctypes handle = _ctypes.LoadLibrary('--dll path--')
Due to my SOP plugins can be loaded by
hou.nodeTypeCategories()['Sop'].loadDSO('--dll path--')
static UT_DSOHandle* dsoHandle; UT_DSO dso; UT_String* errorOutput = NULL; const char dsoFile[] = "--dll path--"; dsoHandle = dso.loadDSO(dsoFile, false, errorOutput ); const char symbolName[] = "initializeSIM"; UT_StringHolder* errorOutput1 = NULL; UT_StringHolder fileName = dso.getFilePath(dsoHandle, *errorOutput1); bool result = dso.run(dsoFile, symbolName);
Another idea is to dynamic update the HOUDINI_DSO_PATH, and rescan this path.
The python code like:
import hou current_dso_path = hou.getenv("HOUDINI_DSO_PATH") my_plugin_path = "/path/to/my/custom/plugins" new_dso_path = current_dso_path + ";" + my_plugin_path hou.putenv("HOUDINI_DSO_PATH", new_dso_path)
My expectation is that when this plugin is not in the dso folder, it can be loaded and used without restarting houdini.
Is there any solution for this problem?
Thank you very much!