I have a button setup like so in a FX_GUI.xml file for a plugin
I see how you can setup script actions for the button but how do we call a C++ function.
More specifically does it send C++ the state of the button? and how do I trigger it both ways. Have it send the state and have it receive a state up or down.
Thx
Hmmm thinking about it a little I might have answered my own question unless there is a better way to do so. Does the solution include setting an up down script like so.
Not quite working. Keeping my eye out here for any ideas on how this normally works.
<button action="?????????">
<tooltip>MyToggle</tooltip>
<pos x="142" y="48"/>
<size width="55" height="26"/>
<up x="+0" y="+0"/>
<selected x="+0" y="+0"/>
<over x="+0" y="+0"/>
<overselected x="+0" y="+0"/>
<down x="51" y="431"/>
</button>
I see how you can setup script actions for the button but how do we call a C++ function.
More specifically does it send C++ the state of the button? and how do I trigger it both ways. Have it send the state and have it receive a state up or down.
Thx
Hmmm thinking about it a little I might have answered my own question unless there is a better way to do so. Does the solution include setting an up down script like so.
down ? set '$myToggle' -1 : up ? set '$myToggle' 1 : set '$myToggle' 0
Not quite working. Keeping my eye out here for any ideas on how this normally works.
Posted Tue 07 Mar 17 @ 5:41 pm
So I must have the logic wrong somewhere. I would guess that the OnParameter function gets called as soon as a user touches a control on my custom GUI but the following doesn't show the debugger reaching that part of code
HRESULT VDJ_API myPlugin::OnParameter(int id)
{
switch (id)
{
case myPlugin_Param_Toggle:
//Now my custom code
//but it's not reaching here when I click on my custom button
break;
}
return S_OK;
}
Posted Tue 07 Mar 17 @ 6:46 pm
The command is effect_button (or effect_slider for sliders)
You define which buttons are available in your plugin in OnLoad, and then you will receive OnParameter.
The other way, you simply need to alter the variable you referenced in OnLoad to make the button change state from your plugin.
You define which buttons are available in your plugin in OnLoad, and then you will receive OnParameter.
The other way, you simply need to alter the variable you referenced in OnLoad to make the button change state from your plugin.
Posted Tue 07 Mar 17 @ 7:20 pm
Yes I had Onload already setup like so.
OK using option 1 above I changed the .xml to be:
action="effect_button 1"
and now the debugger is reaching the function correctly and the parameter toggles between 1 and 0 each time the button is pressed.
The problem now is that after I click on the button once, it stays lit. It is displaying the 'down' state. I disabled the custom GUI to look at the default gui and it's showing the same thing. I don't have sample code to get the trick of it.
I got it for the local built in GUI since I had a custom messagebox popping up which was messing that up.
Now the problem still is the custom GUI which i reenabled which is not toggling yet. Hmmmmm OK I think I got it. I was using down as the selected state.
HRESULT VDJ_API myPlugin::OnLoad()
{
DeclareParameterSwitch(&parToggle, myPlugin_Param_Toggle, "Toggle" , "T" , false); //Starts Up 0
//the rest of my OnLoad...
}
OK using option 1 above I changed the .xml to be:
action="effect_button 1"
and now the debugger is reaching the function correctly and the parameter toggles between 1 and 0 each time the button is pressed.
The problem now is that after I click on the button once, it stays lit. It is displaying the 'down' state. I disabled the custom GUI to look at the default gui and it's showing the same thing. I don't have sample code to get the trick of it.
HRESULT VDJ_API myPlugin::OnParameter(int id)
{
switch (id)
{
case myPlugin_Param_Toggle:
//Now my the debugger is showing parToggle changes between 0 and 1 each time
//but after the first click it's stuck down. I am probably missing something very simple to release the button back to the up state
break;
}
return S_OK;
}
I got it for the local built in GUI since I had a custom messagebox popping up which was messing that up.
Now the problem still is the custom GUI which i reenabled which is not toggling yet. Hmmmmm OK I think I got it. I was using down as the selected state.
Posted Tue 07 Mar 17 @ 8:15 pm
YEP that was it, it's working like it should. Thanks @Adion
Posted Tue 07 Mar 17 @ 8:30 pm