Exemplo n.º 1
0
        private void CloseFiles()
        {
            currentAtlasFile = null;
            if (data.Texture != null)
            {
                data.Texture.Dispose();
                data.Texture = null;
            }
            atlasView.Image = null;

            currentBuildFile = null;
            data.Build       = null;

            currentAnimFile = null;
            data.Anim       = null;

            data = null;

            UpdateBuildTree(null);

            propertyGrid.SelectedObject = null;

            closeToolStripMenuItem.Enabled               = false;
            convertToSCMLToolStripMenuItem.Enabled       = false;
            splitTextureAtlasToolStripMenuItem.Enabled   = false;
            rebuildTextureAtlasToolStripMenuItem.Enabled = false;
            saveTextureAtlasToolStripMenuItem.Enabled    = false;
            saveBuildFileToolStripMenuItem.Enabled       = false;
            previewAnimToolStripMenuItem.Enabled         = false;
        }
Exemplo n.º 2
0
        public void SetData(KAnimPackage pkg)
        {
            Debug.Assert(pkg.IsComplete);

            data = pkg;

            renderer.SetTexture(data.Texture);

            foreach (KAnimBank bank in data.Anim.Banks)
            {
                listBoxBanks.Items.Add(bank);
            }
        }
Exemplo n.º 3
0
        private void UpdateBuildTree(KAnimPackage data)
        {
            buildTreeView.Nodes.Clear();

            if (data == null)
            {
                return;
            }

            if (data.Build != null)
            {
                TreeNode buildNode = new TreeNode(data.Build.ToString());
                buildNode.Tag = data.Build;

                foreach (KSymbol symbol in data.Build.Symbols)
                {
                    TreeNode symbolNode = new TreeNode(symbol.Name);
                    symbolNode.Tag = symbol;

                    foreach (KFrame frame in symbol.Frames)
                    {
                        TreeNode frameNode = new TreeNode(frame.Index.ToString());
                        frameNode.Tag = frame;

                        symbolNode.Nodes.Add(frameNode);
                    }

                    buildNode.Nodes.Add(symbolNode);
                }

                buildTreeView.Nodes.Add(buildNode);
            }

            if (data.Anim != null)
            {
                TreeNode animNode = new TreeNode("Animations");
                animNode.Tag = data.Anim;

                foreach (KAnimBank bank in data.Anim.Banks)
                {
                    TreeNode bankNode = new TreeNode(bank.Name);
                    bankNode.Tag = bank;

                    animNode.Nodes.Add(bankNode);
                }

                buildTreeView.Nodes.Add(animNode);
            }

            //buildTreeView.ExpandAll();
        }
Exemplo n.º 4
0
        private void OpenData(Bitmap atlas, KBuild build, KAnim anim)
        {
            data         = new KAnimPackage();
            data.Texture = atlas;
            UpdateAtlasView(data.Texture);

            data.Build = build;
            data.Anim  = anim;
            UpdateBuildTree(data);

            closeToolStripMenuItem.Enabled               = FilesAreOpen;
            convertToSCMLToolStripMenuItem.Enabled       = data.IsComplete;
            splitTextureAtlasToolStripMenuItem.Enabled   = data.IsValidAtlas;
            rebuildTextureAtlasToolStripMenuItem.Enabled = data.IsValidAtlas;
            saveTextureAtlasToolStripMenuItem.Enabled    = data.HasTexture;
            saveBuildFileToolStripMenuItem.Enabled       = data.HasBuild;
            saveAnimFileToolStripMenuItem.Enabled        = data.HasAnim;
            previewAnimToolStripMenuItem.Enabled         = data.IsComplete;
        }