Accessing Plugins via Script
algovincian
Posts: 2,611
For example, anybody know if there's a way to simulate (via script) clicking on the "Drape" button of the Dynamic Clothing plugin?
If not, is it possible to set a hotkey for this action in DS? I've found "Freeze Simulation" under Actions->Miscellaneous (which I thought was a cloth plugin function), and "Simulate" under Actions->Simulation, but no "Drape".
Thanks in advance for any info anyone may have (even if it's just confirming that this is not exposed/possible would be helpful).
- Greg
Comments
Are you sure Simulate isn't the internal name for Drape? In general plug-in functions are available to script only if the plug-in creator chose to expose them.
Yeah - I created shortcuts for both, but neither seems to do anything (and nothing is written to the log). I think I'm going to play around with enumerating all the actions and see if anything turns up. Will post if I find anything.
Thank you for taking the time to respond, Richard - I appreciate it.
- Greg
Progress . . . so I was able to trigger the Freeze Simulation action programmatically, and it is in fact a dynamic cloth function, so there's hope yet!
Here's the entry for "Simulate":
2017-03-12 16:28:15.630 DEBUG: Simulation : Simulate : DzSimulateAction
Triggering this one using the following code doesn't appear to do anything on a piece of dynamic clothing:
var oMgr = MainWindow.getActionMgr();
oAction = oMgr.findAction("DzSimulateAction");
if( oAction ){
oAction.trigger();
}
Here's the log (nothing except successful script execution):
2017-03-12 18:47:50.875 Loading script: C:/algovincian/dyn/actiontrigger.dsa
2017-03-12 18:47:50.876 Script executed successfully: C:/algovincian/dyn/actiontrigger.dsa
Must have been added to the actions list by another plugin or something.
On the upside, the list of actions and the code to trigger them should prove useful. Attached is the list in case it helps anybody else.
- Greg