public static IValueOut CreateValueOutput(this IPluginHost host, OutputAttribute attribute, Type type) { attribute = NormalizePinAttribute(attribute, type); IValueOut result = null; host.CreateValueOutput(attribute.Name, attribute.Dimension, attribute.DimensionNames, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result); switch (attribute.Dimension) { case 2: result.SetSubType2D(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValues[0], attribute.DefaultValues[1], attribute.IsBang, attribute.IsToggle, attribute.AsInt); break; case 3: result.SetSubType3D(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValues[0], attribute.DefaultValues[1], attribute.DefaultValues[2], attribute.IsBang, attribute.IsToggle, attribute.AsInt); break; case 4: result.SetSubType4D(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValues[0], attribute.DefaultValues[1], attribute.DefaultValues[2], attribute.DefaultValues[3], attribute.IsBang, attribute.IsToggle, attribute.AsInt); break; default: result.SetSubType(attribute.MinValue, attribute.MaxValue, attribute.StepSize, attribute.DefaultValue, attribute.IsBang, attribute.IsToggle, attribute.AsInt); break; } result.Order = attribute.Order; return(result); }
//this method is called by vvvv when the node is created public void SetPluginHost(IPluginHost Host) { //assign host FHost = Host; //create inputs FHost.CreateValueInput("Refresh", 1, null, TSliceMode.Single, TPinVisibility.True, out FRefresh); FRefresh.SetSubType(0, 1, 1, 0, true, false, false); //create outputs FHost.CreateValueOutput("Resolution", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FResolutionOutput); FResolutionOutput.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, true); FHost.CreateValueOutput("Resolution Offset", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FResolutionOffsetOutput); FResolutionOffsetOutput.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, true); FHost.CreateValueOutput("Working Area", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FWorkAreaOutput); FWorkAreaOutput.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, true); FHost.CreateValueOutput("Working Area Offset", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FWorkAreaOffsetOutput); FWorkAreaOffsetOutput.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, true); FHost.CreateValueOutput("Bits Per Pixel", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FBitsPerPixel); FBitsPerPixel.SetSubType(0.0, 1.1, 0.01, 0, false, false, true); FHost.CreateStringOutput("Device Name", TSliceMode.Dynamic, TPinVisibility.True, out FDeviceName); FDeviceName.SetSubType("", false); FHost.CreateValueOutput("Is Primary", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FIsPrimary); FIsPrimary.SetSubType(0.0, 1.1, 0.01, 0, false, true, false); }
//this method is called by vvvv when the node is created public void SetPluginHost(IPluginHost Host) { //assign host FHost = Host; //create inputs FHost.CreateValueInput("Vertices ", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinInVertices); FPinInVertices.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, false); FHost.CreateValueInput("Center ", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinInCenter); FPinInCenter.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, false); FHost.CreateValueInput("Radius ", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinInRadius); FPinInRadius.SetSubType(0.01, double.MaxValue, 0.01, 1, false, false, false); //create outputs FHost.CreateValueOutput("Value Output", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutVertices); FPinOutVertices.SetSubType2D(double.MinValue, double.MaxValue, 0.01, 0, 0, false, false, false); }
public void Configurate(IPluginConfig Input) { /* * MotionPlus is included in the highly beta 1.8 version of brian peeks library * http://wiimotelib.codeplex.com/releases/view/30401 * * so far it only supports raw accelleration data, no tilt no nothing * * double motionplus; * FPinMotionPlus.GetValue(0, out motionplus); * * if ((motionplus==1d) != FUseMotionPlus) { * FUseMotionPlus = (motionplus==1d); * * if (FPinMotionPlusOutputAccelleration != null) FHost.DeletePin(FPinMotionPlusOutputAccelleration); * // if (FPinMotionPlusOutputTilt!= null)FHost.DeletePin(FPinMotionPlusOutputTilt); * * if (FUseMotionPlus) { * FHost.CreateValueOutput("MotionPlusAccelleration", 3, new string[3]{"X", "Y", "Z"}, TSliceMode.Dynamic, TPinVisibility.True, out FPinMotionPlusOutputAccelleration); * FPinMotionPlusOutputAccelleration.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false); * * // FHost.CreateValueOutput("MotionPlusTilt", 3, new string[3]{"Pitch", "Roll", "Yaw"}, TSliceMode.Dynamic, TPinVisibility.True, out FPinMotionPlusOutputTilt); * // FPinMotionPlusOutputTilt.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false); * * FRemote.InitializeMotionPlus(); * } * } */ int newExt; FPinConfigExtension.GetOrd(0, out newExt); if (newExt != FExtension) { if (FPinOutputExtAccelleration != null) { FHost.DeletePin(FPinOutputExtAccelleration); } if (FPinOutputExtTilt != null) { FHost.DeletePin(FPinOutputExtTilt); } if (FPinOutputExtButtons != null) { FHost.DeletePin(FPinOutputExtButtons); } if (FPinOutputExtCursor != null) { FHost.DeletePin(FPinOutputExtCursor); } if (FPinOutputExtControls != null) { FHost.DeletePin(FPinOutputExtControls); } if (FPinOutputExtJoystickLeft != null) { FHost.DeletePin(FPinOutputExtJoystickLeft); } if (FPinOutputExtJoystickRight != null) { FHost.DeletePin(FPinOutputExtJoystickRight); } if (FPinOutputExtControls2 != null) { FHost.DeletePin(FPinOutputExtControls2); } FExtension = newExt; switch (FExtension) { case 1: //Nunchuk FHost.Log(TLogType.Debug, "Nunchuk"); FHost.CreateValueOutput("Nunchuk Buttons", 2, new string[2] { "C", "Z" }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtButtons); FPinOutputExtButtons.SetSubType2D(0, 1, 1, 0, 0, false, true, false); FHost.CreateValueOutput("Nunchuk Accelleration", 3, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtAccelleration); FPinOutputExtAccelleration.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false); FHost.CreateValueOutput("Nunchuk Tilt", 3, new string[3] { "Pitch", "Roll", "Yaw" }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtTilt); FPinOutputExtTilt.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false); FHost.CreateValueOutput("Nunchuk Joystick", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtJoystickLeft); FPinOutputExtJoystickLeft.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false); break; case 2: // Classic FHost.Log(TLogType.Debug, "Classic"); FHost.CreateValueOutput("Classic Cursor", 4, new string[4] { "Up", "Down", "Left", "Right" }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtCursor); FPinOutputExtCursor.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false); FHost.CreateValueOutput("Classic Buttons", 4, new string[4] { "A", "B", "X", "Y" }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtButtons); FPinOutputExtButtons.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false); FHost.CreateValueOutput("Classic System", 3, new string[3] { "Plus", "Minus", "Home" }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtControls); FPinOutputExtControls.SetSubType3D(0, 1, 1, 0, 0, 0, false, true, false); FHost.CreateValueOutput("Classic Joystick Left", 2, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickLeft); FPinOutputExtJoystickLeft.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false); FHost.CreateValueOutput("Classic Joystick Right", 2, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickRight); FPinOutputExtJoystickRight.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false); FHost.CreateValueOutput("Classic Back Control", 4, new string[4] { "Left", "Right", "Left", "Right" }, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtControls2); FPinOutputExtControls2.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false); break; case 3: //BalanceBoard FHost.Log(TLogType.Debug, "BalanceBoard"); FHost.CreateValueOutput("Balance Board Weight (kg)", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtButtons); FPinOutputExtButtons.SetSubType(0, double.MaxValue, 1, 0, false, false, false); FHost.CreateValueOutput("Balance Board Corners", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtAccelleration); FPinOutputExtAccelleration.SetSubType(double.MinValue, double.MaxValue, 0.0001, 0, false, false, false); //FHost.CreateValueOutput("Balance Board Corners", 4, new string[4]{"TL", "TR", "BL", "BR"}, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtAccelleration); //FPinOutputExtAccelleration.SetSubType4D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, 0, false, false, false); FHost.CreateValueOutput("Balance Board Center Of Gravity", 2, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtJoystickLeft); FPinOutputExtJoystickLeft.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false); break; case 4: // Guitar FHost.Log(TLogType.Debug, "Guitar"); FHost.CreateValueOutput("Guitar Buttons", 4, new string[4] { "Plus", "Minus", "StrumUp", "StrumDown" }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtButtons); FPinOutputExtButtons.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false); FHost.CreateValueOutput("Guitar Color Bar", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputExtControls); FPinOutputExtControls.SetSubType(0, 1, 1, 0, false, true, false); FHost.CreateValueOutput("Guitar Whammy Bar", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickLeft); FPinOutputExtJoystickLeft.SetSubType2D(0, 1, 0.0001, 0, 0, false, false, false); FHost.CreateValueOutput("Guitar Joystick", 2, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputExtJoystickRight); FPinOutputExtJoystickRight.SetSubType2D(-1, 1, 0.0001, 0, 0, false, false, false); break; default: // None FHost.Log(TLogType.Debug, "No Extension"); break; } } FInvalidate = true; }