Notifications
Clear all
[Closed] How to pass a controller to the C#
Jan 25, 2019 11:51 pm
How we can pass a controller to the C# function and cast it to the IControl class?
2 Replies
Jan 25, 2019 11:51 pm
A Controller is an animatable, thus you can pass its ‘HandleByAnim’ to you C# method.
In C# you can retreive it:
IControl myCtrl = (IControl)global.Animatable.GetAnimByHandle(controllerHandle)
Haven’t tested but should work.
Jan 25, 2019 11:51 pm
Thank You! It works:
public static class MyClass
{
static IGlobal globalInterface = GlobalInterface.Instance;
public static void GetValue(UIntPtr controlHandle)
{
IControl control = (IControl)globalInterface.Animatable.GetAnimByHandle(controlHandle);
int time = globalInterface.COREInterface.Time;
object val = null;
val = 0.0f;
control.GetValue(time, ref val, globalInterface.Interval.Create(), GetSetMethod.Relative);
MessageBox.Show(val.ToString());
}
}
just note that “GetHandleByAnim” is the correct function name. I really appreciate if you also take a look at my main question described here: Controller Callback
And tell is it possible to implement a OnValueChanged event raising for this controller?