protected override string GetSlice(int index)
        {
            string result;

            FStringConfig.GetString(index, out result);
            result = result ?? string.Empty;
            return(result);
        }
Beispiel #2
0
 public override void Configurate(IPluginConfig Input, bool FirstFrame)
 {
     if (Input == FFilenameIn)
     {
         string fn;
         FFilenameIn.GetString(0, out fn);
         SetMidiFile(fn);
     }
 }
Beispiel #3
0
        public void Configurate(IPluginConfig Input)
        {
            try
            {
                if (Input == FCases)
                {
                    string caseString;
                    FCases.GetString(0, out caseString);
                    string[] inArr = caseString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    int formerPinCount = FPinArr.Length;
                    if (inArr.Length != formerPinCount)
                    {
                        FEvaluate = true;
                    }

                    if (inArr.Length < formerPinCount)
                    {
                        for (int d = formerPinCount - 1; d >= inArr.Length; d--)
                        {
                            FHost.DeletePin(FPinArr[d]);
                        }
                    }

                    Array.Resize(ref FPinArr, inArr.Length);
                    Array.Resize(ref FCaseArr, inArr.Length);

                    for (int i = 0; i < inArr.Length; i++)
                    {
                        string curName = inArr[i].Trim();
                        if (FCaseArr[i] != curName)
                        {
                            if (i < formerPinCount)
                            {
                                FHost.DeletePin(FPinArr[i]);
                            }
                            IValueIn newPin;
                            FHost.CreateValueInput(curName, 1, null, TSliceMode.Dynamic, TPinVisibility.True, out newPin);
                            newPin.SetSubType(double.MinValue, double.MaxValue, 0.01, 0.0, false, false, false);
                            FPinArr[i]  = newPin;
                            FCaseArr[i] = curName;
                            FEvaluate   = true;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                FHost.Log(TLogType.Debug, e.Message);
                FHost.Log(TLogType.Debug, e.StackTrace);
            }
        }
Beispiel #4
0
        public override void Configurate(IPluginConfig Input, bool FirstFrame)
        {
            //if Input = last ConfigInput created!
            if (Input == FKeyValue && FirstFrame)
            {
                FKeyFrames.Clear();

                double time, flag;
                string val;
                for (int i = 0; i < FKeyValue.SliceCount; i++)
                {
                    FKeyTime.GetValue(i, out time);
                    FKeyFlagY.GetValue(i, out flag);
                    FKeyValue.GetString(i, out val);
                    AddKeyFrame(time, (float)flag, val);
                }

                FKeyFrames.Sort(delegate(TLBaseKeyFrame k0, TLBaseKeyFrame k1) { return(k0.Time.CompareTo(k1.Time)); });
            }

            base.Configurate(Input, FirstFrame);
        }
Beispiel #5
0
        public override void Configurate(IPluginConfig Input, bool FirstFrame)
        {
            //if Input = last ConfigInput created!
            if (Input == FStateEvents && FirstFrame)
            {
                FKeyFrames.Clear();

                string name, events;
                double time;

                for (int i = 0; i < FStateEvents.SliceCount; i++)
                {
                    FStateTime.GetValue(i, out time);
                    FStateName.GetString(i, out name);
                    FStateEvents.GetString(i, out events);
                    AddKeyFrame(name, time, events);
                }

                FKeyFrames.Sort(delegate(TLBaseKeyFrame k0, TLBaseKeyFrame k1) { return(k0.Time.CompareTo(k1.Time)); });
            }

            //make sure every state's events have according input-pins
            //remove all inputs that don't have an according event
            //go through all events and find a corresponding pin
            List <IValueFastIn> tmpList = new List <IValueFastIn>();
            IValueFastIn        tmpEventPin;

            foreach (TLStateKeyFrame skf in FKeyFrames)
            {
                foreach (TLEvent e in skf.Events)
                {
                    if (e.Name != "OnEnd")
                    {
                        IValueFastIn ep = FEventPins.Find(delegate(IValueFastIn p) { return(p.Name == e.Name); });

                        if (ep == null)
                        {
                            FHost.CreateValueFastInput(e.Name, 1, null, TSliceMode.Single, TPinVisibility.True, out tmpEventPin);
                            tmpEventPin.SetSubType(0, 1, 1, 0, false, false, false);
                            e.EventPin = tmpEventPin;
                            tmpList.Add(tmpEventPin);
                            FEventPins.Add(tmpEventPin);
                        }
                        else
                        {
                            e.EventPin = ep;
                            if (!tmpList.Contains(ep))
                            {
                                tmpList.Add(ep);
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < FEventPins.Count; i++)
            {
                if (!tmpList.Contains(FEventPins[i]))
                {
                    FHost.DeletePin(FEventPins[i]);
                }
            }

            FEventPins.Clear();
            FEventPins.AddRange(tmpList);
        }