Liu Pengfei
DlPF
About Me
Connect
LOCATION
ShangHai,
China
ウェブサイト
Houdini Skills
Availability
Not Specified
Recent Forum Posts
How to dynamic load custom "Dynamic Simulations" plugins? 2024年4月24日23:29
Hi all,
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.
Since its registration function is initializeSIM () and not newDopOperator (). Therefore the load fails.
Then, I tried to use _ctypes to load it.
The handle is not None. But I can't create the node in Dop Network. I think I missed some operations like registering it in houdini. But I don't know how to do it.
Due to my SOP plugins can be loaded by
Maybe I can use a SOP to load Dynamic Simulations plugins! I made the following attempts in a SOP plugin C++ code.
I think the dll is loaded, but it still not create node in dop network.
Another idea is to dynamic update the HOUDINI_DSO_PATH, and rescan this path.
The python code like:
But I can't find the rescan command.
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!
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!