예제 #1
0
            public void SearchTypes(object value)
            {
                Console.WriteLine($"TYPE {value}");
                if (value is Controls.TabControl)
                {
                    var tabProperty = (Controls.TabControl)value;

                    STTabControl tabControl = new STTabControl();
                    tabControl.Dock = DockStyle.Fill;
                    Control.Controls.Add(tabControl);

                    foreach (var page in tabProperty.Pages)
                    {
                        var control = GUIGenerator.Generate(page);
                        if (control != null)
                        {
                            TabPage pg = new TabPage();
                            pg.Text = page.Text;
                            pg.DataBindings.Add(new Binding("Text", page, "Text", false, DataSourceUpdateMode.OnPropertyChanged));
                            control.Dock = DockStyle.Fill;
                            pg.Controls.Add(control);
                            tabControl.TabPages.Add(pg);
                        }
                    }

                    Console.WriteLine($"tab {tabControl.TabPages.Count}");
                }
            }
 private void UpdateSettingsDisplay()
 {
     if (GUIHandle == null || GUIHandle.GetType() != ActiveSetting.GetGUIHandler().GetType())
     {
         GUIHandle = ActiveSetting.GetGUIHandler();
         GUIHandle.UpdateSettings(ActiveSetting);
         var control = GUIGenerator.Generate(GUIHandle);
         control.Dock = DockStyle.Fill;
         stPanel1.Controls.Clear();
         stPanel1.Controls.Add(control);
     }
     else
     {
         GUIHandle.UpdateSettings(ActiveSetting);
     }
 }
        private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewCustom1.SelectedItems.Count == 0)
            {
                return;
            }

            int index = listViewCustom1.SelectedIndices[0];

            if (index == 0)
            {
                splitContainer1.Panel1Collapsed = true;
            }
            else
            {
                splitContainer1.Panel1Collapsed = false;
            }

            var settings = Settings[index];
            var control  = GUIGenerator.Generate(settings);

            stPanel2.Controls.Clear();
            stPanel2.Controls.Add(control);
        }
예제 #4
0
        private void SelectionChanged(ObjectTreeNode obj)
        {
            obj.OnClick();

            bool tryUpdateViewport = false;

            if (Runtime.SelectedBoneIndex != -1)
            {
                tryUpdateViewport         = true;
                Runtime.SelectedBoneIndex = -1;
            }

            if (obj.Tag is ArchiveFileInfo)
            {
                var fileInfo = (ArchiveFileInfo)obj.Tag;

                if (fileInfo.OpenFileFormatOnLoad)
                {
                    fileInfo.FileFormat = fileInfo.OpenFile();
                }
                if (fileInfo.FileFormat != null)
                {
                    var fileNode = ObjectListWrapperLoader.OpenFormat(imgList, fileInfo.FileFormat);
                    obj.Tag = fileInfo.FileFormat;
                    foreach (var child in fileNode.Children)
                    {
                        obj.AddChild(child);
                    }
                    SelectionChanged(obj);
                    return;
                }

                ArchiveFilePanel hexEditor = GetActiveEditor <ArchiveFilePanel>();
                hexEditor.LoadFile(this, fileInfo);
            }
            else if (obj.Tag is STGenericTexture)
            {
                var tex = (STGenericTexture)obj.Tag;

                ImageEditorBase editor = GetActiveEditor <ImageEditorBase>();
                editor.LoadProperties(tex.DisplayProperties);
                editor.LoadImage(tex);
            }
            else if (obj.Tag is IPropertyDisplay)
            {
                var property = (IPropertyDisplay)obj.Tag;

                STPropertyGrid editor = GetActiveEditor <STPropertyGrid>();
                editor.LoadProperty(property.PropertyDisplay);
            }
            else if (obj.Tag is IEditorDisplay)
            {
                var property = (IEditorDisplay)obj.Tag;
                Console.WriteLine($"IEditorDisplay {property}");

                var gui = GUIGenerator.Generate(property);
                gui.Dock = DockStyle.Fill;

                STPanel editor = GetActiveEditor <STPanel>();
                editor.Controls.Clear();
                editor.Controls.Add(gui);
            }
            else if (obj.Tag is System.IO.Stream)
            {
                var stream = (System.IO.Stream)obj.Tag;

                HexEditor hexEditor = GetActiveEditor <HexEditor>();
                hexEditor.LoadData(stream);
            }
            else if (obj.Tag is IVideoFormat)
            {
                VideoPlayer editor = GetActiveEditor <VideoPlayer>();
                editor.LoadVideoFile((IVideoFormat)obj.Tag);
            }
            else if (obj.Tag is STGenericMesh)
            {
                var mesh = (STGenericMesh)obj.Tag;
                mesh.SelectMesh?.Invoke(mesh, EventArgs.Empty);

                if (WorkspacePanel == null)
                {
                    WorkspacePanel = CreateWorkspacePanel();
                }

                WorkspacePanel workspace  = GetActiveEditor <WorkspacePanel>(WorkspacePanel);
                var            meshEditor = workspace.GetActiveEditor <MeshEditor>();
                meshEditor.LoadMesh(mesh);
                workspace.UpdateViewport();
                ObjectHiearchy.Focus();
            }
            else if (obj.Tag is STGenericMaterial)
            {
                var mat = (STGenericMaterial)obj.Tag;

                if (WorkspacePanel == null)
                {
                    WorkspacePanel = CreateWorkspacePanel();
                }

                WorkspacePanel workspace      = GetActiveEditor <WorkspacePanel>(WorkspacePanel);
                var            materialEditor = workspace.GetActiveEditor <MaterialEditor>();
                materialEditor.LoadMaterial(mat);
                workspace.UpdateViewport();
            }
            else if (obj.Tag is IModelFormat)
            {
                if (WorkspacePanel == null)
                {
                    WorkspacePanel = CreateWorkspacePanel();
                }

                WorkspacePanel workspace = GetActiveEditor <WorkspacePanel>(WorkspacePanel);
                workspace.LoadFileFormat((IModelFormat)(obj.Tag));
                workspace.UpdateViewport();
            }
            else if (obj.Tag is IModelSceneFormat)
            {
                if (WorkspacePanel == null)
                {
                    WorkspacePanel = CreateWorkspacePanel();
                }

                WorkspacePanel workspace = GetActiveEditor <WorkspacePanel>(WorkspacePanel);
                workspace.LoadFileFormat((IModelSceneFormat)(obj.Tag));
                workspace.UpdateViewport();
            }
            else if (obj.Tag is STAnimation)
            {
                if (WorkspacePanel == null)
                {
                    WorkspacePanel = CreateWorkspacePanel();
                }

                WorkspacePanel workspace = GetActiveEditor <WorkspacePanel>(WorkspacePanel);
                workspace.LoadFileFormat((STAnimation)(obj.Tag));
                workspace.UpdateViewport();
            }
            else if (obj.Tag is STBone)
            {
                var bone = (STBone)obj.Tag;
                Runtime.SelectedBoneIndex = bone.Index;
                WorkspacePanel.UpdateViewport();
            }

            if (tryUpdateViewport && WorkspacePanel != null)
            {
                WorkspacePanel.UpdateViewport();
            }
            // else
            //    GetActiveEditor<STPanel>();
        }