Пример #1
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;
            }
        }
Пример #2
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);
        }