Esempio n. 1
0
            public override void OnExpand()
            {
                if (Expanded)
                {
                    return;
                }

                var layoutFile = (BxlytHeader)Tag;

                Nodes.Clear();

                Expanded = true;

                var animations = ParentEditor.AnimationFiles;

                foreach (var pane in layoutFile.PaneLookup.Values)
                {
                    string matName = "";

                    //Find materials
                    var mat = pane.TryGetActiveMaterial();
                    if (mat != null)
                    {
                        matName = mat.Name;
                    }

                    //search archive
                    var archive = layoutFile.FileInfo.IFileInfo.ArchiveParent;
                    if (archive != null)
                    {
                        foreach (var file in archive.Files)
                        {
                            if (Utils.GetExtension(file.FileName) == ".bflan" &&
                                !animations.Any(x => x.FileName == file.FileName))
                            {
                                if (BxlanHeader.ContainsEntry(file.FileData, new string[2] {
                                    pane.Name, matName
                                }))
                                {
                                    var paneNode = CreatePaneWrapper(pane);
                                    Nodes.Add(paneNode);
                                }
                            }
                        }
                    }

                    //Search opened animations
                    for (int i = 0; i < animations?.Count; i++)
                    {
                        if (animations[i].ContainsEntry(pane.Name) || animations[i].ContainsEntry(matName))
                        {
                            var paneNode = CreatePaneWrapper(pane);
                            Nodes.Add(paneNode);
                        }
                    }
                }
            }
Esempio n. 2
0
        private void SearchActiveAnimations(BasePane pane)
        {
            Console.WriteLine($"SearchActiveAnimations {pane.Name} {pane.LayoutFile == null}");

            if (pane.LayoutFile == null)
            {
                return;
            }

            var    animations = GetAnimations();
            var    material   = pane.TryGetActiveMaterial();
            string matName    = material != null ? material.Name : "";

            var archive = pane.LayoutFile.FileInfo.IFileInfo.ArchiveParent;

            if (archive != null)
            {
                foreach (var file in archive.Files)
                {
                    string ext     = Utils.GetExtension(file.FileName);
                    bool   isBxlan = ext == ".bflan" || ext == ".bclan" || ext == ".brlan";
                    if (isBxlan && !animations.Any(x => x.FileName == file.FileName))
                    {
                        if (BxlanHeader.ContainsEntry(file.FileData, new string[2] {
                            pane.Name, matName
                        }))
                        {
                            animationCB.Items.Add(new AnimationComboboxItem(file.FileName)
                            {
                                Tag = file
                            });
                        }
                    }
                }
            }

            for (int i = 0; i < animations?.Count; i++)
            {
                if (animations[i].ContainsEntry(pane.Name) || animations[i].ContainsEntry(matName))
                {
                    animationCB.Items.Add(new AnimationComboboxItem(animations[i].FileName)
                    {
                        Tag = animations[i]
                    });
                }
            }

            if (animationCB.Items.Count > 0)
            {
                animationCB.SelectedIndex = 0;
            }
        }
Esempio n. 3
0
        public void LoadPane(BasePane pane, PaneEditor paneEditor)
        {
            ParentEditor = paneEditor;

            var    animations = ParentEditor.GetAnimations();
            var    material   = pane.TryGetActiveMaterial();
            string matName    = material != null ? material.Name : "";

            listViewCustom1.Items.Clear();

            var archive = pane.LayoutFile.FileInfo.IFileInfo.ArchiveParent;

            if (archive != null)
            {
                foreach (var file in archive.Files)
                {
                    if (Utils.GetExtension(file.FileName) == ".bflan" &&
                        !animations.Any(x => x.FileName == file.FileName))
                    {
                        if (BxlanHeader.ContainsEntry(file.FileData, new string[2] {
                            pane.Name, matName
                        }))
                        {
                            listViewCustom1.Items.Add(new ListViewItem(file.FileName)
                            {
                                Tag = file
                            });
                        }
                    }
                }
            }

            for (int i = 0; i < animations?.Count; i++)
            {
                if (animations[i].ContainsEntry(pane.Name) || animations[i].ContainsEntry(matName))
                {
                    listViewCustom1.Items.Add(new ListViewItem(animations[i].FileName)
                    {
                        Tag = animations[i]
                    });
                }
            }
            LayoutAnimEditorBasic editor = new LayoutAnimEditorBasic();

            stPanel1.Controls.Add(editor);
        }