public static IEnumIn CreateEnumInput(this IPluginHost host, InputAttribute attribute, Type type)
        {
            //this creates and sets the default for a .NET enum
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                var entries = Enum.GetNames(type);
                host.UpdateEnum(type.FullName, entries[0], entries);
            }

            IEnumIn result = null;

            host.CreateEnumInput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);

            if (!string.IsNullOrWhiteSpace(attribute.DefaultEnumEntry))
            {
                result.SetDefaultEntry(attribute.DefaultEnumEntry);
            }

            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                result.SetSubType(type.FullName);
            }
            else
            {
                result.SetSubType(attribute.EnumName);
            }

            SetInputProperties(result, attribute);

            return(result);
        }
Beispiel #2
0
        //this method is called by vvvv when the node is created
        public void SetPluginHost(IPluginHost Host)
        {
            //assign host
            FHost = Host;

            //create inputs
            FHost.CreateStringInput("Input", TSliceMode.Single, TPinVisibility.True, out FStringInput);
            FStringInput.SetSubType("", false);

            FHost.CreateValueInput("Speed", 1, null, TSliceMode.Single, TPinVisibility.True, out FSpeedInput);
            //Supported values range from -10 to 10
            FSpeedInput.SetSubType(-10.0, 10.0, 1.0, 5.0, false, false, true);

            FHost.CreateValueInput("Speak", 1, null, TSliceMode.Single, TPinVisibility.True, out FSpeakInput);
            FSpeakInput.SetSubType(0.0, 1.0, 1.0, 0.0, true, false, true);

            string[] narrators = new string[vox.GetVoices(string.Empty, string.Empty).Count];
            int      i         = 0;

            foreach (ISpeechObjectToken Token in vox.GetVoices(string.Empty, string.Empty))
            {
                narrators[i++] = Token.GetAttribute("Name");
            }

            FHost.CreateEnumInput("Narrator", TSliceMode.Single, TPinVisibility.True, out FNarratorInput);
            FNarratorInput.SetSubType("SpeechSynthesisNarrator");
            FHost.UpdateEnum("SpeechSynthesisNarrator", narrators[0], narrators);

            //create outputs
            FHost.CreateValueOutput("Done", 1, null, TSliceMode.Single, TPinVisibility.True, out FDoneOutput);
            FDoneOutput.SetSubType(0.0, 1.0, 1.0, 0.0, true, false, true);
        }
Beispiel #3
0
        //this method is called by vvvv when the node is created
        public void SetPluginHost(IPluginHost Host)
        {
            //assign host
            FHost = Host;

            System.Guid[] guids = new System.Guid[1];
            guids[0] = new Guid("AB312E34-8025-40F2-8241-1958793F3D39");

            //create inputs

            FHost.CreateStringInput("Joint Name", TSliceMode.Dynamic, TPinVisibility.True, out FJointNameInput);

            FHost.CreateStringInput("Parent Name", TSliceMode.Dynamic, TPinVisibility.True, out FParentNameInput);

            FHost.CreateTransformInput("Base Transformation", TSliceMode.Dynamic, TPinVisibility.True, out FBaseTransformInput);

            String[] dimensions = new String[2];
            dimensions[0] = "Min";
            dimensions[1] = "Max";

            FHost.CreateValueInput("Constraints", 2, dimensions, TSliceMode.Dynamic, TPinVisibility.True, out FConstraintsInput);
            FConstraintsInput.SetSubType2D(-1.0, 1.0, 0.1, -1.0, 1.0, false, false, false);


            String[] offsetModes = new String[2];
            offsetModes[0] = "parent";
            offsetModes[1] = "world";
            FHost.UpdateEnum("OffsetModes", "parent", offsetModes);
            FHost.CreateEnumInput("Position relative to", TSliceMode.Single, TPinVisibility.True, out FOffsetModeInput);
            FOffsetModeInput.SetSubType("OffsetModes");

            FHost.CreateNodeOutput("Skeleton", TSliceMode.Single, TPinVisibility.True, out FSkeletonOutput);
            FSkeletonOutput.SetSubType(guids, "Skeleton");
        }
Beispiel #4
0
        public void SetPluginHost(IPluginHost Host)
        {
            FHost = Host;


            //INPUT-PINS
            FHost.CreateStringInput("Input", TSliceMode.Dynamic, TPinVisibility.True, out FDataIn);
            FDataIn.SetSubType("", false);

            FHost.CreateValueInput("Do Send", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FDoSendIn);
            FDoSendIn.SetSubType(0, 1, 1, 0, true, false, true);

            FHost.CreateValueInput("Keep Last Data", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FKeepLastDataIn);
            FKeepLastDataIn.SetSubType(0, 1, 1, 0, false, false, true);

            FHost.CreateValueInput("Baudrate", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FBaudrateIn);
            FBaudrateIn.SetSubType(Double.MinValue, Double.MaxValue, 1, 9600, false, false, true);

            FHost.CreateEnumInput("Data Bits", TSliceMode.Dynamic, TPinVisibility.True, out FDatabitsIn);
            FDatabitsIn.SetSubType("DataBits");

            FHost.CreateEnumInput("Stop Bits", TSliceMode.Dynamic, TPinVisibility.True, out FStopbitsIn);
            FStopbitsIn.SetSubType("StopBits");

            FHost.CreateEnumInput("Parity", TSliceMode.Dynamic, TPinVisibility.True, out FParityIn);
            FParityIn.SetSubType("Parity");

            FHost.CreateEnumInput("Hand Shake", TSliceMode.Dynamic, TPinVisibility.True, out FHandShakeIn);
            FHandShakeIn.SetSubType("Hand Shake");
            FHost.UpdateEnum("Hand Shake", "None", new string[] { "None", "RequestToSend", "RequestToSendXOnXOff", "XOnXOff" });

            FHost.CreateValueInput("ReadBuffer Size", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FReadBufferIn);
            FReadBufferIn.SetSubType(0, Double.MaxValue, 1, 4096, false, false, true);

            FHost.CreateValueInput("Enabled", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FEnableIn);
            FEnableIn.SetSubType(0, 1, 1, 0, false, false, true);

            FHost.CreateValueInput("ComPort", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPortNumberIn);
            FPortNumberIn.SetSubType(1, double.MaxValue, 1, 1, false, false, true);


            // OUTPUT-PINS
            FHost.CreateStringOutput("Output", TSliceMode.Dynamic, TPinVisibility.True, out FDataOut);
            FDataOut.SetSubType("", false);

            FHost.CreateValueOutput("On Data", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FOnDataOut);
            FOnDataOut.SetSubType(0, 1, 1, 0, true, false, true);

            FHost.CreateValueOutput("IsConnected", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FConnectedOut);
            FConnectedOut.SetSubType(0, 1, 1, 0, false, false, true);

            FHost.CreateValueOutput("Available Ports", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPortsOut);
            FPortsOut.SetSubType(1, 15, 1, 1, false, false, true);

            FHost.CreateValueOutput("ReadBuffer Size", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FReadBufferOut);
            FReadBufferOut.SetSubType(0, Double.MaxValue, 1, 0, false, false, true);

            FPortsOut.SliceCount = _AvailablePorts.Length;
        }
Beispiel #5
0
        public static IEnumIn CreateEnumInput(this IPluginHost host, InputAttribute attribute, Type type)
        {
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                var entries  = Enum.GetNames(type);
                var defEntry = !string.IsNullOrEmpty(attribute.DefaultEnumEntry) ? attribute.DefaultEnumEntry : entries[0];
                host.UpdateEnum(type.FullName, defEntry, entries);
            }

            IEnumIn result = null;

            host.CreateEnumInput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                result.SetSubType(type.FullName);
            }
            else
            {
                result.SetSubType(attribute.EnumName);
            }
            SetInputProperties(result, attribute);
            return(result);
        }
Beispiel #6
0
        public void SetPluginHost(IPluginHost Host)
        {
            FHost = Host;

            //INPUT-PINS
            FHost.CreateStringInput("Mask", TSliceMode.Dynamic, TPinVisibility.True, out FMask);
            FMask.SetSubType("*.*", false);

            FHost.CreateStringInput("Directory", TSliceMode.Single, TPinVisibility.True, out FDirectory);
            FDirectory.SetSubType2("", int.MaxValue, string.Empty, TStringType.Directory);

            FHost.CreateValueInput("Include Subdirectories", 1, null, TSliceMode.Single, TPinVisibility.True, out FSubdirectories);
            FSubdirectories.SetSubType(0, 1, 1, 0, false, true, true);

            FHost.CreateValueInput("Show Short Filename", 1, null, TSliceMode.Single, TPinVisibility.False, out FShortFilenameIn);
            FShortFilenameIn.SetSubType(0, 1, 1, 1, false, true, true);

            FHost.UpdateEnum("Sort Order", "Name", new string[] { "Name", "FullName", "FileSize", "Extension", "LastAccess", "LastWriteTime", "CreationTime" });
            FHost.CreateEnumInput("Sort Order", TSliceMode.Single, TPinVisibility.True, out FMaskRule);
            FMaskRule.SetSubType("Sort Order");

            FHost.CreateValueInput("Count", 1, null, TSliceMode.Single, TPinVisibility.True, out FCountIn);
            FCountIn.SetSubType(0, double.MaxValue, 1, 0, false, false, true);

            FHost.UpdateEnum("Count Selection", "First", new string[] { "First", "Last" });
            FHost.CreateEnumInput("Count Selection", TSliceMode.Single, TPinVisibility.True, out FCountOrder);
            FCountOrder.SetSubType("Count Selection");

            FHost.CreateValueInput("Update", 1, null, TSliceMode.Single, TPinVisibility.True, out FUpdate);
            FUpdate.SetSubType(0, 1, 1, 0, true, false, true);


            // OUTPUT-PINS
            FHost.CreateStringOutput("Filenames", TSliceMode.Dynamic, TPinVisibility.True, out FFiles);
            FFiles.SetSubType("", true);

            FHost.CreateStringOutput("Short Filenames", TSliceMode.Dynamic, TPinVisibility.True, out FShortFilenameOut);
            FShortFilenameOut.SetSubType("", false);

            FHost.CreateValueOutput("File Count", 1, null, TSliceMode.Single, TPinVisibility.True, out FCountOut);
            FCountOut.SetSubType(0, double.MaxValue, 1, 0, false, false, true);

            FHost.CreateStringOutput("Message", TSliceMode.Single, TPinVisibility.Hidden, out FMessage);
            FMessage.SetSubType("OK", false);
        }
Beispiel #7
0
        //this method is called by vvvv when the node is created
        public void SetPluginHost(IPluginHost Host)
        {
            //assign host
            FHost = Host;

            //create inputs
            var guids = new System.Guid[1];

            guids[0] = SkeletonNodeIO.GUID;
            FHost.CreateNodeInput("Skeleton", TSliceMode.Single, TPinVisibility.True, out FSkeletonInput);
            FSkeletonInput.SetSubType(guids, "Skeleton");
            FHost.CreateTransformInput("Inverse Bind Pose", TSliceMode.Dynamic, TPinVisibility.True, out FInverseBindPoseInput);
            FHost.UpdateEnum("SkinningMatricesOutputMode", "Dynamic", new string[] { "Dynamic", "Fixed to 60" });
            FHost.CreateEnumInput("Output Transform Count", TSliceMode.Single, TPinVisibility.True, out FOutputModeInput);
            FOutputModeInput.SetSubType("SkinningMatricesOutputMode");
            FHost.CreateStringInput("Joint Name", TSliceMode.Dynamic, TPinVisibility.True, out FJointNameInput);

            // create outputs
            FHost.CreateTransformOutput("Transform", TSliceMode.Dynamic, TPinVisibility.True, out FTransformOutput);
        }
Beispiel #8
0
        //this method is called by vvvv when the node is created
        public void SetPluginHost(IPluginHost Host)
        {
            FHost = Host;

            FHost.CreateStringInput("Wiimote ID", TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinInputID);
            FPinInputID.SetSubType("-1", false);

            FHost.CreateValueInput("Enable", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinInputEnable);
            FPinInputEnable.SetSubType(0, 1, 1, 0, false, true, false);

            FHost.CreateValueInput("LED", 4, new string[4] {
                "0", "1", "2", "3"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinInputLED);
            FPinInputLED.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

            FHost.CreateValueInput("Rumble", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinInputRumble);
            FPinInputRumble.SetSubType(0, 1, 1, 0, false, true, false);

            FHost.UpdateEnum("WiimoteInfraredMode", "Extended", new string[4] {
                "Full", "Extended", "Basic", "Off"
            });

            FHost.CreateEnumInput("Infrared Mode", TSliceMode.Dynamic, TPinVisibility.True, out FPinInputMode);
            FPinInputMode.SetSubType("WiimoteInfraredMode");

            FHost.CreateValueFastInput("Calibration ZeroG", 3, null, TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinInputCalibrationZeroG);
            FPinInputCalibrationZeroG.SetSubType3D(0, 0xFF, 1, 126, 126, 131, false, false, true);

            FHost.CreateValueFastInput("Calibration OneG", 3, null, TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinInputCalibrationOneG);
            FPinInputCalibrationOneG.SetSubType3D(0, 0xFF, 1, 151, 151, 151, false, false, true);

            FHost.CreateValueInput("Calibrate", 1, null, TSliceMode.Single, TPinVisibility.OnlyInspector, out FPinInputCalibrate);
            FPinInputCalibrate.SetSubType(0, 1, 1, 0, true, false, false);

            FHost.CreateValueInput("Force Reset", 1, null, TSliceMode.Single, TPinVisibility.OnlyInspector, out FPinForceReset);
            FPinForceReset.SetSubType(0, 1, 1, 0, true, false, false);

            FHost.UpdateEnum("WiimoteExtensionEnum", "none", new string[5] {
                "none", "Nunchuk", "Classic", "BalanceBoard", "Guitar"
            });
            FHost.CreateEnumConfig("Extension", TSliceMode.Single, TPinVisibility.True, out FPinConfigExtension);
            FPinConfigExtension.SetSubType("WiimoteExtensionEnum");

//			FHost.CreateValueConfig("MotionPlus", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinMotionPlus);
//			FPinMotionPlus.SetSubType(0, 1, 1, 0, false, true, false);

            //create outputs
            FHost.CreateStringOutput("Available Wiimotes", TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FPinOutputAvailable);
            FPinOutputAvailable.SetSubType("none", false);

            FHost.CreateStringOutput("Working", TSliceMode.Single, TPinVisibility.True, out FPinOutputWorking);
            FPinOutputWorking.SetSubType("Initializing", false);

            FHost.CreateStringOutput("Extension Found", TSliceMode.Single, TPinVisibility.True, out FPinOutputExtensionFound);
            FPinOutputExtensionFound.SetSubType("none", false);

            FHost.CreateValueOutput("Battery", 1, null, TSliceMode.Single, TPinVisibility.True, out FPinOutputBattery);
            FPinOutputBattery.SetSubType(double.MinValue, double.MaxValue, 0.0001, 0, false, false, false);

            FHost.CreateValueOutput("Cursor", 4, new string[4] {
                "Up", "Down", "Left", "Right"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputCursor);
            FPinOutputCursor.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

            FHost.CreateValueOutput("Buttons", 4, new string[4] {
                "A", "B", "1", "2"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputButtons);
            FPinOutputButtons.SetSubType4D(0, 1, 1, 0, 0, 0, 0, false, true, false);

            FHost.CreateValueOutput("System", 3, new string[3] {
                "Plus", "Minus", "Home"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputControls);
            FPinOutputControls.SetSubType3D(0, 1, 1, 0, 0, 0, false, true, false);

            FHost.CreateValueOutput("Acceleration", 3, null, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputAccelleration);
            FPinOutputAccelleration.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);

            FHost.CreateValueOutput("Angle", 3, new string[3] {
                "Pitch", "Roll", "Yaw"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputTilt);
            FPinOutputTilt.SetSubType3D(double.MinValue, double.MaxValue, 0.0001, 0, 0, 0, false, false, false);

            FHost.CreateValueOutput("Infrared", 3, new string[3] {
                "X", "Y", "Size"
            }, TSliceMode.Dynamic, TPinVisibility.True, out FPinOutputInfraredBlobs);
            FPinOutputInfraredBlobs.SetSubType3D(0, 1023, 1, 0, 0, 0, false, false, true);

            Enable();
        }