Esempio n. 1
0
    public void CreateHan()
    {
        MMainTrack = Resources.Load <Material>("Material/MMainTrack");
        MLine      = Resources.Load <Material>("Material/Mline");
        MOutSide   = Resources.Load <Material>("Material/MOutSide");
        MWall      = Resources.Load <Material>("Material/MWall");

        PFTrack = Resources.Load <CTrack>("Prefabs/PFTrack");

        PFStartTrack = Resources.Load <CTrackParts>("Prefabs/PFStartTrack");

        PFVerticalTrack   = Resources.Load <CTrackParts>("Prefabs/PFVerticalTrack");
        PFHorizontalTrack = Resources.Load <CTrackParts>("Prefabs/PFHorizontalTrack");

        PFUpLeftTrack  = Resources.Load <CTrackParts>("Prefabs/PFUpLeftTrack");
        PFLeftUpTrack  = Resources.Load <CTrackParts>("Prefabs/PFLeftUpTrack");
        PFUpRightTrack = Resources.Load <CTrackParts>("Prefabs/PFUpRightTrack");
        PFRightUpTrack = Resources.Load <CTrackParts>("Prefabs/PFRightUpTrack");

        PFEndTrack = Resources.Load <CTrackParts>("Prefabs/PFEndTrack");

        mTrackKind = new Dictionary <CTrackFactory.TRACKKIND, CTrackParts>();

        mTrackKind.Add(CTrackFactory.TRACKKIND.START, PFStartTrack);

        mTrackKind.Add(CTrackFactory.TRACKKIND.VERTICAL, PFVerticalTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.HORIZONTAL, PFHorizontalTrack);

        mTrackKind.Add(CTrackFactory.TRACKKIND.UPLEFT, PFUpLeftTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.LEFTUP, PFLeftUpTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.UPRIGHT, PFUpRightTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.RIGHTUP, PFRightUpTrack);
        mTrackKind.Add(CTrackFactory.TRACKKIND.END, PFEndTrack);
    }
Esempio n. 2
0
        public CTrack GetTimeTrack(BaseDocument doc)
        {
            global::System.IntPtr cPtr = C4dApiPINVOKE.CTrack_GetTimeTrack(swigCPtr, BaseDocument.getCPtr(doc));
            CTrack ret = (cPtr == global::System.IntPtr.Zero) ? null : new CTrack(cPtr, false);

            return(ret);
        }
Esempio n. 3
0
        public CTrack GetTrack()
        {
            global::System.IntPtr cPtr = C4dApiPINVOKE.CCurve_GetTrack(swigCPtr);
            CTrack ret = (cPtr == global::System.IntPtr.Zero) ? null : new CTrack(cPtr, false);

            return(ret);
        }
Esempio n. 4
0
        public CTrack GetFirstCTrack()
        {
            global::System.IntPtr cPtr = C4dApiPINVOKE.BaseList2D_GetFirstCTrack(swigCPtr);
            CTrack ret = (cPtr == global::System.IntPtr.Zero) ? null : new CTrack(cPtr, false);

            return(ret);
        }
Esempio n. 5
0
        public bool SetAnimatedParameter(CTrack track, DescID id, GeData t_data1, GeData t_data2, double mix, DESCFLAGS_SET flags)
        {
            bool ret = C4dApiPINVOKE.BaseList2D_SetAnimatedParameter(swigCPtr, CTrack.getCPtr(track), DescID.getCPtr(id), GeData.getCPtr(t_data1), GeData.getCPtr(t_data2), mix, (int)flags);

            if (C4dApiPINVOKE.SWIGPendingException.Pending)
            {
                throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 6
0
        public static CTrack Alloc(BaseList2D bl, DescID id)
        {
            global::System.IntPtr cPtr = C4dApiPINVOKE.CTrack_Alloc(BaseList2D.getCPtr(bl), DescID.getCPtr(id));
            CTrack ret = (cPtr == global::System.IntPtr.Zero) ? null : new CTrack(cPtr, false);

            if (C4dApiPINVOKE.SWIGPendingException.Pending)
            {
                throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 7
0
        public CTrack FindCTrack(DescID id)
        {
            global::System.IntPtr cPtr = C4dApiPINVOKE.BaseList2D_FindCTrack(swigCPtr, DescID.getCPtr(id));
            CTrack ret = (cPtr == global::System.IntPtr.Zero) ? null : new CTrack(cPtr, false);

            if (C4dApiPINVOKE.SWIGPendingException.Pending)
            {
                throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 8
0
        private void importMIDIToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (seq == null)
            {
                seq = new CSEQ();
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "MIDI File (*.mid)|*.mid";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                MidiFile midi = new MidiFile(ofd.FileName);

                Sequence newMidi = new Sequence();

                for (int i = 0; i < midi.Tracks; i++)
                {
                    CTrack track = new CTrack();
                    track.trackNum = i;
                    track.name     = $"track_{i.ToString("00")}";
                    track.FromMidiEventList(midi.Events.GetTrackEvents(i).ToList());
                    newMidi.tracks.Add(track);
                }

                foreach (var x in newMidi.tracks)
                {
                    Command c = new Command();
                    c.evt   = CSEQEvent.ChangePatch;
                    c.pitch = (byte)x.trackNum;
                    c.wait  = 0;
                    x.cmd.Insert(0, c);
                }

                seq.sequences.Add(newMidi);

                FillUI(loadedfile);
            }
        }
Esempio n. 9
0
        private bool SaveTracks(BaseObject ob, SceneNodeContainer snc, bool slerpRotation)
        {
            var builder = new TrackBuilder();

            builder.LerpType = (slerpRotation) ? LerpType.Slerp : LerpType.Lerp;
            CTrack track = ob.GetFirstCTrack();

            // First occurence of animation tracks?
            if (track == null)
            {
                return(false);
            }

            while (track != null)
            {
                DescID    testID = track.GetDescriptionID();
                DescLevel lv1    = testID.GetAt(0);
                DescLevel lv2    = testID.GetAt(1);

                CCurve curve = track.GetCurve();
                if (curve != null)
                {
                    int keyCount = curve.GetKeyCount();

                    CKey     key = null;
                    BaseTime time;
                    for (int i = 0; i < keyCount; i++)
                    {
                        key  = curve.GetKey(i);
                        time = key.GetTime();

                        switch (lv1.id)
                        {
                        case 903:     // should be replaced with "ID_BASEOBJECT_REL_POSITION"
                            switch (lv2.id)
                            {
                            case 1000: builder.AddTranslationValue("x", (float)time.Get(), key.GetValue()); break;

                            case 1001: builder.AddTranslationValue("y", (float)time.Get(), key.GetValue()); break;

                            case 1002: builder.AddTranslationValue("z", (float)time.Get(), key.GetValue()); break;
                            }
                            break;

                        case 904:     // should be replaced with "ID_BASEOBJECT_REL_ROTATION"
                            switch (lv2.id)
                            {
                            case 1000: builder.AddRotationValue("x", (float)time.Get(), key.GetValue()); break;

                            case 1001: builder.AddRotationValue("y", (float)time.Get(), key.GetValue()); break;

                            case 1002: builder.AddRotationValue("z", (float)time.Get(), key.GetValue()); break;
                            }
                            break;

                        case 905:     // should be replaced with "ID_BASEOBJECT_REL_SCALE"
                            switch (lv2.id)
                            {
                            case 1000: builder.AddScaleValue("x", (float)time.Get(), key.GetValue()); break;

                            case 1001: builder.AddScaleValue("y", (float)time.Get(), key.GetValue()); break;

                            case 1002: builder.AddScaleValue("z", (float)time.Get(), key.GetValue()); break;
                            }
                            break;
                        }
                    }
                }
                track = track.GetNext();
            }

            builder.BuildTracks(snc, _tracks);

            if (_animationsPresent)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 10
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CTrack obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 11
0
 public void SetTimeTrack(CTrack track)
 {
     C4dApiPINVOKE.CTrack_SetTimeTrack(swigCPtr, CTrack.getCPtr(track));
 }
Esempio n. 12
0
 public void InsertTrackSorted(CTrack track)
 {
     C4dApiPINVOKE.BaseList2D_InsertTrackSorted(swigCPtr, CTrack.getCPtr(track));
 }