//here we go, thats the method called by vvvv each frame //all data handling should be in here public void Evaluate(int SpreadMax) { double pinInputEnable, pinInputDigitizing; FPinInputEnable.GetValue(0, out pinInputEnable); FPinInputDigitizing.GetValue(0, out pinInputDigitizing); if (FPinInputEnable.PinIsChanged) { if (pinInputEnable == 1d) { Enable(); } else { Disable(); } } if (Tablet == null) { return; } if (FPinInputDigitizing.PinIsChanged) { digitizing = (pinInputDigitizing == 1d); if (pinInputEnable == 1d) { Disable(); } Disconnect(); Connect(); if (pinInputEnable == 1d) { Enable(); } } if ((pinInputEnable == 1d)) { FPinOutputProximity.SetValue(0, InContext ? 1 : 0); FPinOutputX.SetValue(0, X); FPinOutputY.SetValue(0, Y); FPinOutputPressure.SetValue(0, NormalPressure); FPinOutputCursor.SetValue(0, CursorNum); FPinOutputSerialNo.SetValue(0, SerialNo); FPinOutputCursorType.SetValue(0, CursorType); FPinOutputCursorSubtype.SetValue(0, CursorSubtype); FPinOutputButtons.SliceCount = NumButtons; for (int i = 0; i < NumButtons; i++) { FPinOutputButtons.SetValue(i, ((Buttons & (1 << i)) != 0) ? 1 : 0); } FPinOutputAzimuth.SetValue(0, Azimuth); FPinOutputTilt.SetValue(0, Tilt); if (FPinDebugButtons != null) { FPinDebugButtons.SetValue(0, NumButtons); } FPinOutputDimensions.SliceCount = 2; FPinOutputDimensions.SetValue(0, Tablet.Context.InputExtentX); FPinOutputDimensions.SetValue(1, Tablet.Context.InputExtentY); FPinOutputCursorName.SetString(0, CursorName); } }
//this method is called by vvvv when the node is created public void SetPluginHost(IPluginHost Host) { //assign host FHost = Host; //create inputs FHost.CreateValueConfig("Debug Pins", 1, null, TSliceMode.Single, TPinVisibility.OnlyInspector, out FPinConfigDebug); FPinConfigDebug.SetSubType(0, 1, 1, 0, false, true, false); FHost.CreateValueInput("Enable", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinInputEnable); FPinInputEnable.SetSubType(0, 1, 1, 0, false, true, false); FHost.CreateValueInput("Exclusive", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinInputDigitizing); FPinInputDigitizing.SetSubType(0, 1, 1, 1, false, true, false); //create outputs FHost.CreateValueOutput("X", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputX); FPinOutputX.SetSubType(-1, 1, 0.01, 0, false, false, false); FHost.CreateValueOutput("Y", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputY); FPinOutputY.SetSubType(-1, 1, 0.01, 0, false, false, false); FHost.CreateValueOutput("Pressure", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputPressure); FPinOutputPressure.SetSubType(0, 1, 0.01, 0, false, false, false); FHost.CreateValueOutput("Proximity", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputProximity); FPinOutputProximity.SetSubType(0, 1, 1, 0, false, true, false); FHost.CreateValueOutput("Tilt", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputTilt); FPinOutputTilt.SetSubType(-1, 1, 0.01, 0, false, false, false); FHost.CreateValueOutput("Azimuth", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputAzimuth); FPinOutputAzimuth.SetSubType(0, 1, 0.01, 0, false, false, false); FHost.CreateValueOutput("Cursor", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputCursor); FPinOutputCursor.SetSubType(int.MinValue, int.MaxValue, 1, 0, false, false, true); FHost.CreateValueOutput("Cursor Serial No.", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputSerialNo); FPinOutputSerialNo.SetSubType(int.MinValue, int.MaxValue, 1, 0, false, false, true); FHost.CreateValueOutput("Cursor Type", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputCursorType); FPinOutputCursorType.SetSubType(int.MinValue, int.MaxValue, 1, 0, false, false, true); FHost.CreateValueOutput("Cursor Subtype", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputCursorSubtype); FPinOutputCursorSubtype.SetSubType(int.MinValue, int.MaxValue, 1, 0, false, false, true); FHost.CreateStringOutput("Cursor Name", TSliceMode.Single, TPinVisibility.True, out FPinOutputCursorName); FPinOutputCursorName.SetSubType("", false); FHost.CreateValueOutput("Dimensions", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputDimensions); FPinOutputDimensions.SetSubType(double.MinValue, double.MaxValue, 0.01, 0, false, false, false); FHost.CreateValueOutput("Buttons", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputButtons); FPinOutputButtons.SetSubType(0, 1, 1, 0, false, true, true); if (Tablet != null) { Connect(); } Configurate(FPinConfigDebug); }