private void UpdatePropertiesView()
        {
            STPropertyGrid editor = GetActiveEditor <STPropertyGrid>();

            editor.Text = Text;
            //  editor.LoadProperty(ArchiveFileInfo.DisplayProperties);
        }
示例#2
0
        public override UserControl GetEditor()
        {
            STPropertyGrid editor = new STPropertyGrid();

            editor.Text = Text;
            editor.Dock = DockStyle.Fill;
            return(editor);
        }
示例#3
0
        private void LoadPropertyGrid(object property, BcresEditor bcresEditor, Action OnPropertyChanged)
        {
            STPropertyGrid editor = (STPropertyGrid)bcresEditor.GetActiveEditor(typeof(STPropertyGrid));

            if (editor == null)
            {
                editor      = new STPropertyGrid();
                editor.Dock = DockStyle.Fill;
                bcresEditor.LoadEditor(editor);
            }
            editor.LoadProperty(property, OnPropertyChanged);
        }
示例#4
0
            public override void OnClick(TreeView treeview)
            {
                STPropertyGrid editor = (STPropertyGrid)LibraryGUI.GetActiveContent(typeof(STPropertyGrid));

                if (editor == null)
                {
                    editor = new STPropertyGrid();
                    LibraryGUI.LoadEditor(editor);
                }
                editor.Text = Text;
                editor.Dock = DockStyle.Fill;
                editor.LoadProperty(MetaFile.Data, OnPropertyChanged);
            }
示例#5
0
        public override void OnClick(TreeView treeview)
        {
            STPropertyGrid editor = (STPropertyGrid)LibraryGUI.GetActiveContent(typeof(STPropertyGrid));

            if (editor == null)
            {
                editor = new STPropertyGrid();
                LibraryGUI.LoadEditor(editor);
            }

            var prop = new BarsProperty(bars);

            editor.Text = Text;
            editor.Dock = DockStyle.Fill;
            editor.LoadProperty(prop, null);
        }
示例#6
0
        public void LoadProperties(object properties)
        {
            Reset();

            MaterialMode = false;

            AddTab("Properties");

            if (propertyGrid == null || propertyGrid.Disposing || propertyGrid.IsDisposed)
            {
                propertyGrid      = new STPropertyGrid();
                propertyGrid.Dock = DockStyle.Fill;
                stPanel1.Controls.Add(propertyGrid);
            }

            propertyGrid.LoadProperty(properties, ProperyChanged);
        }
示例#7
0
 public void LoadPropertyData(object sender, EventArgs e)
 {
     UpdateTabIndex();
     propertyGrid = GetActiveEditor <STPropertyGrid>();
     propertyGrid.LoadProperty(activeProperty, ProperyChanged);
 }
示例#8
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>();
        }