Skip to content
This repository was archived by the owner on Jun 8, 2025. It is now read-only.
This repository was archived by the owner on Jun 8, 2025. It is now read-only.

enums und helppatch #20

@jonashae

Description

@jonashae

ist beim erstellen der Help Patches raus gekommen:

pepe erstellt und editiert ja die enums global, was ja auf der einen Seite super ist, da man sich die S&R nodes spart aber ich bekomme grade Probleme bei den Helppatches - da die parallel zum eigentlichen Programm ausgeführt werden können beißen sich die Enums, da pepe zweimal in VVVV auftaucht...

ist es möglich daher den Enum Kategorie Namen über Variablen zu verteilen? also das der name für die Enums über einen String von außerhalb bestimmt werden kann?

        [Input("Input", EnumName = "Timeline")]
        public IDiffSpread<EnumEntry> FInput;

wäre dann

        [Input("Input", EnumName = "irendein String der von VVVV Dynamisch erzeugt wird")]
        public IDiffSpread<EnumEntry> FInput;

Anbei noch der gesamte Code der node - Sollte das nicht möglich sein müsste man vielleicht das Enum Prinzip nochmal hinterfragen oder?

#region usings
using System;
using System.ComponentModel.Composition;
using System.Linq;

using VVVV.PluginInterfaces.V1;
using VVVV.PluginInterfaces.V2;
using VVVV.Utils.VColor;
using VVVV.Utils.VMath;

using VVVV.Core.Logging;
#endregion usings

namespace VVVV.Nodes
{ 
    #region PluginInfo
    [PluginInfo(Name = "Timeline", Category = "Enumerations", Version = "Dynamic", Help = "Basic template with dynamic custom enumeration", Tags = "")]
    #endregion PluginInfo
    public class DynamicEnumerationsTimelineNode : IPluginEvaluate
    {
        #region fields & pins
        [Input("Input", EnumName = "Timeline")]
        public IDiffSpread<EnumEntry> FInput;

        [Input("UpdateEnum", IsBang = true)]
        public ISpread<bool> FChangeEnum;

        [Input("Enum Entries")]
        public ISpread<string> FEnumStrings;

        [Output("Name")]
        public ISpread<string> FNameOutput;

        [Output("Index")]
        public ISpread<int> FOrdOutput;

        [Import()]
        public ILogger Flogger;
        #endregion fields & pins

        //add some entries to the enum in the constructor
        [ImportingConstructor()]
        public DynamicEnumerationsTimelineNode()
        {
            var s = new string[] {
                "Timeline00"
            };
            //Please rename your Enum Type to avoid 
            //numerous "MyDynamicEnum"s in the system
            EnumManager.UpdateEnum("Timeline", "two", s);
        }

        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            FNameOutput.SliceCount = FInput.SliceCount;
            FOrdOutput.SliceCount = FInput.SliceCount;

            if ((FChangeEnum[0]) && (FEnumStrings.SliceCount > 0)) {
                EnumManager.UpdateEnum("Timeline", FEnumStrings[0], FEnumStrings.ToArray());
            }

            if (FInput.IsChanged) {
                for (int i = 0; i < SpreadMax; i++) {
                    FNameOutput[i] = FInput[i].Name;
                    FOrdOutput[i] = FInput[i].Index;
                }

                Flogger.Log(LogType.Debug, "Input was changed");
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions