Ejemplo n.º 1
0
        public void UpdateEditor()
        {
            if (Parent != null && Parent.Parent != null && Parent.Parent is BFRES)
            {
                ((BFRES)Parent.Parent).LoadEditors(this);
                return;
            }

            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                editor      = new ImageEditorBase();
                editor.Dock = DockStyle.Fill;

                LibraryGUI.LoadEditor(editor);
            }
            editor.Text = Text;
            editor.LoadProperties(this.texture, OnPropertyChanged);
            editor.LoadImage(this);

            if (texture.UserData != null)
            {
                UserDataEditor userEditor = (UserDataEditor)editor.GetActiveTabEditor(typeof(UserDataEditor));
                if (userEditor == null)
                {
                    userEditor      = new UserDataEditor();
                    userEditor.Name = "User Data";
                    editor.AddCustomControl(userEditor, typeof(UserDataEditor));
                }
                userEditor.LoadUserData(texture.UserData);
            }
        }
Ejemplo n.º 2
0
        private void UpdateEditor()
        {
            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                editor      = new ImageEditorBase();
                editor.Dock = DockStyle.Fill;
                LibraryGUI.LoadEditor(editor);
            }

            Properties prop = new Properties();

            prop.Width      = Width;
            prop.Height     = Height;
            prop.Depth      = Depth;
            prop.MipCount   = MipCount;
            prop.ArrayCount = ArrayCount;
            prop.ImageSize  = (uint)TextureTGLP.SheetDataList[SheetIndex].Length;
            prop.Format     = Format;

            editor.Text = Text;
            editor.LoadProperties(prop);
            editor.LoadImage(this);
        }
Ejemplo n.º 3
0
        public void UpdateEditor()
        {
            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                editor      = new ImageEditorBase();
                editor.Dock = DockStyle.Fill;

                LibraryGUI.Instance.LoadEditor(editor);
            }
            editor.Text = Text;
            editor.LoadProperties(this.texture);
            editor.LoadImage(this);

            if (texture.UserData != null)
            {
                UserDataEditor userEditor = (UserDataEditor)editor.GetActiveTabEditor(typeof(UserDataEditor));
                if (userEditor == null)
                {
                    userEditor      = new UserDataEditor();
                    userEditor.Name = "User Data";
                    editor.AddCustomControl(userEditor, typeof(UserDataEditor));
                }
                userEditor.LoadUserData(texture.UserData);
            }
        }
Ejemplo n.º 4
0
        private bool IsEditorActive()
        {
            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 5
0
        private void UpdateEditor()
        {
            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                editor      = new ImageEditorBase();
                editor.Dock = DockStyle.Fill;
                LibraryGUI.LoadEditor(editor);
            }

            editor.LoadProperties(GenericProperties);
            editor.LoadImage(this);
        }
Ejemplo n.º 6
0
        public override void OnClick(TreeView treeView)
        {
            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                editor      = new ImageEditorBase();
                editor.Dock = DockStyle.Fill;
                LibraryGUI.LoadEditor(editor);
            }

            editor.LoadProperties(GenericProperties);
            editor.LoadImage(this);
        }
Ejemplo n.º 7
0
            public void UpdateEditor()
            {
                ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase));

                if (editor == null)
                {
                    editor      = new ImageEditorBase();
                    editor.Dock = DockStyle.Fill;

                    LibraryGUI.Instance.LoadEditor(editor);
                }
                editor.Text = Text;
                editor.LoadImage(this);
            }
Ejemplo n.º 8
0
        private bool IsEditorActive()
        {
            BfresEditor bfresEditor = (BfresEditor)LibraryGUI.GetActiveContent(typeof(BfresEditor));

            if (bfresEditor != null)
            {
                var imageEditor = bfresEditor.GetActiveEditor(typeof(ImageEditorBase));
                return(imageEditor != null);
            }
            else
            {
                ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));
                return(editor != null);
            }
        }
Ejemplo n.º 9
0
            private void UpdateEditor()
            {
                ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

                if (editor == null)
                {
                    editor      = new ImageEditorBase();
                    editor.Dock = DockStyle.Fill;
                    LibraryGUI.LoadEditor(editor);
                }

                editor.LoadProperties(new WtaProperties(Format,
                                                        Width, Height, Depth, SurfaceType, ImageSize, HeaderSize));
                editor.LoadImage(this);
            }
Ejemplo n.º 10
0
            public override void Replace(string FileName)
            {
                FTEX ftex = new FTEX();

                ftex.ReplaceTexture(FileName, Format);
                if (ftex.texture != null)
                {
                    surface.swizzle    = ftex.texture.Swizzle;
                    surface.tileMode   = (uint)ftex.texture.TileMode;
                    surface.format     = (uint)ftex.texture.Format;
                    surface.aa         = (uint)ftex.texture.AAMode;
                    surface.use        = (uint)ftex.texture.Use;
                    surface.alignment  = (uint)ftex.texture.Alignment;
                    surface.dim        = (uint)ftex.texture.Dim;
                    surface.width      = (uint)ftex.texture.Width;
                    surface.height     = (uint)ftex.texture.Height;
                    surface.depth      = (uint)ftex.texture.Depth;
                    surface.numMips    = (uint)ftex.texture.MipCount;
                    surface.imageSize  = (uint)ftex.texture.Data.Length;
                    surface.mipSize    = (uint)ftex.texture.MipData.Length;
                    surface.data       = ftex.texture.Data;
                    surface.mipData    = ftex.texture.MipData;
                    surface.mipOffset  = ftex.texture.MipOffsets;
                    surface.firstMip   = ftex.texture.ViewMipFirst;
                    surface.firstSlice = 0;
                    surface.numSlices  = ftex.texture.ArrayLength;
                    surface.imageCount = ftex.texture.MipCount;
                    surface.pitch      = ftex.texture.Pitch;
                    surface.texRegs    = GX2.CreateRegisters(surface);

                    SetChannelComponents();

                    Format     = FTEX.ConvertFromGx2Format((Syroot.NintenTools.Bfres.GX2.GX2SurfaceFormat)surface.format);
                    Width      = surface.width;
                    Height     = surface.height;
                    MipCount   = surface.numMips;
                    ArrayCount = surface.depth;

                    ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

                    if (editor != null)
                    {
                        UpdateEditor();
                    }
                }
            }
Ejemplo n.º 11
0
            public void UpdateEditor()
            {
                ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

                if (editor == null)
                {
                    editor      = new ImageEditorBase();
                    editor.Dock = DockStyle.Fill;

                    LibraryGUI.LoadEditor(editor);
                }
                editor.Text = Text;
                var tex = FTEX.FromGx2Surface(surface, Text);

                tex.MipCount = MipCount;
                editor.LoadProperties(tex);
                editor.LoadImage(this);
            }
Ejemplo n.º 12
0
        public void UpdateEditor()
        {
            //Here we check for an active editor and load a new one if not found
            //This is used when a tree/object editor is used
            ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

            if (editor == null)
            {
                editor      = new ImageEditorBase();
                editor.Dock = DockStyle.Fill;
                LibraryGUI.LoadEditor(editor);
            }

            //Load our image and any properties
            //If you don't make a class for properties you can use a generic class provided in STGenericTexture
            editor.LoadProperties(GenericProperties);
            editor.LoadImage(this);
        }
Ejemplo n.º 13
0
            public void UpdateEditor()
            {
                ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase));

                if (editor == null)
                {
                    editor      = new ImageEditorBase();
                    editor.Dock = DockStyle.Fill;

                    LibraryGUI.Instance.LoadEditor(editor);
                }
                editor.Text = Text;

                UserDataEditor userDataEditor = new UserDataEditor();

                userDataEditor.Name = "User Data";
                editor.LoadImage(this);
                editor.AddCustomControl(userDataEditor, typeof(UserDataEditor));
            }
Ejemplo n.º 14
0
            public override void OnClick(TreeView treeview)
            {
                ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));

                if (editor == null)
                {
                    editor      = new ImageEditorBase();
                    editor.Dock = DockStyle.Fill;
                    LibraryGUI.LoadEditor(editor);
                }

                if (GX2Surface != null)
                {
                    var tex = Bfres.Structs.FTEX.FromGx2Surface(GX2Surface, Text);
                    editor.LoadProperties(tex);
                }

                editor.Text = Text;
                editor.LoadImage(this);
            }