override public void ShowPane()
        {
            try
            {
                GUI.enabled = this.GuiEnabled;

                if (!this.maidLoader.IsInitted)
                {
                    this.maidLoader.Init();
                }

                float seek       = this.seekerPos + PANEL_WIDTH - this.scrollPosition.x;
                Rect  seekerRect = new Rect(ControlBase.FixedMargin + seek, 0, 20, 40);

                Rect labelRect = new Rect(seekerRect.x + seekerRect.width + 5, seekerRect.y, 100, 40);
                GUI.Label(labelRect, Translation.GetText("Timeline", "frame") + " " + this.currentFrame);

                if (GUI.RepeatButton(seekerRect, "") || (draggingSeeker && Input.GetMouseButton(0)))
                {
                    draggingSeeker = true;
                    this.seekerPos = Input.mousePosition.x - this.ScreenPos.x + this.scrollPosition.x - 10 - PANEL_WIDTH;
                    this.updated   = true;
                }
                else
                {
                    draggingSeeker = false;
                }

                Rect trackPanelRect = new Rect(0, ControlBase.FixedMargin + 20, PANEL_WIDTH, 400 - ControlBase.FixedMargin * 4);

                GUILayout.BeginArea(trackPanelRect);
                for (int i = 0; i < this.take.tracks.Count; i++)
                {
                    MovieTrack track = this.take.tracks[i];
                    Rect       panel = new Rect(0,
                                                this.scrollPosition.y + (this.ControlHeight * 2 * i),
                                                PANEL_WIDTH - 150,
                                                this.ControlHeight * 2);

                    GUILayout.BeginArea(panel);

                    track.DrawPanel(this.currentFrame / framesPerSecond);

                    if (track.inserted)
                    {
                        this.updated = true;
                    }

                    GUILayout.EndArea();

                    GUIStyle style = new GUIStyle("label");
                    style.alignment = TextAnchor.MiddleLeft;
                    panel.x         = PANEL_WIDTH - 150 + ControlBase.FixedMargin;
                    panel.width     = 150 - ControlBase.FixedMargin * 2;
                    GUI.Label(panel, this.take.tracks[i].GetName(), style);
                }
                GUILayout.EndArea();

                Rect rectScroll     = new Rect(PANEL_WIDTH, ControlBase.FixedMargin + 20, this.rectGui.width - ControlBase.FixedMargin - PANEL_WIDTH, 400 - ControlBase.FixedMargin * 4);
                Rect rectScrollView = new Rect(0, 0, guiScrollWidth, guiScrollHeight);

                this.scrollPosition = GUI.BeginScrollView(rectScroll, this.scrollPosition, rectScrollView);


                for (int i = this.take.tracks.Count - 1; i >= 0; i--)
                {
                    if (this.take.tracks[i].wantsDelete)
                    {
                        // reset to the value at the beginning of the track, instead of in the middle
                        this.take.tracks[i].PreviewTime(0f);
                        this.take.tracks.RemoveAt(i);
                    }
                }
                for (int i = 0; i < this.take.tracks.Count; i++)
                {
                    this.drawTrack(i);
                }

                guiScrollHeight = (this.take.tracks.Count) * this.ControlHeight * 2;
                GUI.EndScrollView();

                Rect lineRect = new Rect(ControlBase.FixedMargin + seek, 0, 1, 400);
                GUI.DrawTexture(lineRect, this.lineTexture);

                this.playButton.Left    = this.Left + ControlBase.FixedMargin;
                this.playButton.Top     = rectScroll.yMax + ControlBase.FixedMargin;
                this.playButton.Width   = 50;
                this.playButton.Height  = this.ControlHeight;
                this.playButton.Visible = true;
                this.playButton.OnGUI();

                this.stopButton.Left    = this.playButton.Left + this.playButton.Width;
                this.stopButton.Top     = this.playButton.Top;
                this.stopButton.Width   = this.playButton.Width;
                this.stopButton.Height  = this.ControlHeight;
                this.stopButton.Visible = true;
                this.stopButton.OnGUI();

                this.addButton.Left    = this.stopButton.Left + this.stopButton.Width;
                this.addButton.Top     = this.stopButton.Top;
                this.addButton.Width   = 100;
                this.addButton.Height  = this.ControlHeight;
                this.addButton.Visible = true;
                this.addButton.OnGUI();

                this.copyClipButton.Left    = this.addButton.Left + this.addButton.Width;
                this.copyClipButton.Top     = this.addButton.Top;
                this.copyClipButton.Width   = this.addButton.Width;
                this.copyClipButton.Height  = this.ControlHeight;
                this.copyClipButton.Visible = true;
                this.copyClipButton.OnGUI();

                this.deleteClipButton.Left    = this.copyClipButton.Left + this.copyClipButton.Width;
                this.deleteClipButton.Top     = this.copyClipButton.Top;
                this.deleteClipButton.Width   = this.copyClipButton.Width;
                this.deleteClipButton.Height  = this.ControlHeight;
                this.deleteClipButton.Visible = true;
                this.deleteClipButton.OnGUI();

                Rect toggleRect = this.deleteClipButton.WindowRect;
                toggleRect.x     += toggleRect.width + ControlBase.FixedMargin * 2;
                toggleRect.width *= 1.5f;
                int iTmp;
                if ((iTmp = GUI.Toolbar(toggleRect, (int)this.dragMode, DRAG_MODES)) >= 0)
                {
                    this.dragMode = (DragMode)iTmp;
                }
                //this.Height = GUIUtil.GetHeightForParent(this) + 5 * this.ControlHeight;

                toggleRect.x     += toggleRect.width + ControlBase.FixedMargin * 2;
                toggleRect.width *= 1.80f;
                if ((iTmp = GUI.Toolbar(toggleRect, (int)this.curvePane.mode, CURVE_PANE_MODES)) >= 0)
                {
                    this.curvePane.mode = (CurvePane.CurvePaneMode)iTmp;
                }

                // toggleRect.x += toggleRect.width + ControlBase.FixedMargin * 4;
                // string sTmp =
                // toggleRect.x += toggleRect.width + ControlBase.FixedMargin * 4;

                Rect curveRect = new Rect(0, toggleRect.yMax, 1000, 300);
                this.curvePane.SetFromRect(curveRect);
                this.curvePane.UpdateOffsets(curveRect, this.rectGui);

                GUI.BeginGroup(curveRect);
                if (this.ClipIsSelected())
                {
                    this.curvePane.Draw(curveRect, this.take.tracks[this.selectedTrackIndex].clips, this.selectedClipIndex, this.selectedTrackIndex);
                }
                else if (this.IsDataView())
                {
                    this.curvePane.DrawDataView(curveRect);
                }
                GUI.EndGroup();

                if (this.curvePane.needsUpdate)
                {
                    this.updated = true;
                }
                if (this.curvePane.wantsSave)
                {
                    Serialize.Save(this.curvePane.typedSaveName, this.take);
                    this.curvePane.LoadSavefileNames();
                    this.curvePane.wantsSave = false;
                }
                if (this.curvePane.wantsLoad)
                {
                    XDocument doc = Deserialize.LoadFileFromSave(this.curvePane.selectedSaveName);

                    List <string> guids = Deserialize.GetMaidGuids(doc);
                    this.maidLoader.SelectMaidsWithGuids(guids);
                    this.maidLoader.onMaidsLoaded = () => {
                        this.take = Deserialize.DeserializeTake(doc);
                        this.Stop(this, new EventArgs());
                        this.Update();
                    };

                    this.maidLoader.StartLoad();

                    this.curvePane.wantsLoad = false;
                }

                ControlBase.TryFocusGUI(this.rectGui);
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }
        }
Example #2
0
 public virtual string GetName() => Translation.GetText("UI", "track");
Example #3
0
 public override string GetName() => Translation.GetText("UI", "camera");
Example #4
0
 public override string GetName() => Translation.GetText("UI", "face") + ": " + this.maid.name;