Add option to move properties in image editor vertical

This commit is contained in:
KillzXGaming 2019-04-11 18:51:59 -04:00
parent 99d7827466
commit 619c1f7ec5
14 changed files with 312 additions and 212 deletions

Binary file not shown.

View file

@ -169,9 +169,20 @@ namespace FirstPlugin
drawables.Remove(skeleton); drawables.Remove(skeleton);
} }
List<AbstractGlDrawable> drawables = new List<AbstractGlDrawable>(); List<AbstractGlDrawable> drawables = new List<AbstractGlDrawable>();
public void LoadEditors(object SelectedSection) public void LoadEditors(object SelectedSection)
{ {
bool IsSimpleEditor = PluginRuntime.UseSimpleBfresEditor;
if (IsSimpleEditor)
{
}
else
{
BfresEditor bfresEditor = (BfresEditor)LibraryGUI.Instance.GetActiveContent(typeof(BfresEditor)); BfresEditor bfresEditor = (BfresEditor)LibraryGUI.Instance.GetActiveContent(typeof(BfresEditor));
bool HasModels = BFRESRender.models.Count > 0; bool HasModels = BFRESRender.models.Count > 0;
@ -362,6 +373,7 @@ namespace FirstPlugin
editor.LoadAnim((FMAA)SelectedSection); editor.LoadAnim((FMAA)SelectedSection);
}*/ }*/
} }
}
private SubFileEditor OpenSubFileEditor<T>(object node, BfresEditor bfresEditor) where T : STGenericWrapper private SubFileEditor OpenSubFileEditor<T>(object node, BfresEditor bfresEditor) where T : STGenericWrapper
{ {

View file

@ -9,6 +9,8 @@ namespace FirstPlugin
{ {
public class PluginRuntime public class PluginRuntime
{ {
public static bool UseSimpleBfresEditor = false;
public static Dictionary<string, BFLIM> bflimTextures = new Dictionary<string, BFLIM>(); public static Dictionary<string, BFLIM> bflimTextures = new Dictionary<string, BFLIM>();
public static List<BNTX> bntxContainers = new List<BNTX>(); public static List<BNTX> bntxContainers = new List<BNTX>();
public static List<BFRESGroupNode> ftexContainers = new List<BFRESGroupNode>(); public static List<BFRESGroupNode> ftexContainers = new List<BFRESGroupNode>();

View file

@ -37,6 +37,7 @@
this.pictureBoxCustom1 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); this.pictureBoxCustom1 = new Switch_Toolbox.Library.Forms.PictureBoxCustom();
this.blueChannelBtn = new Switch_Toolbox.Library.Forms.STButton(); this.blueChannelBtn = new Switch_Toolbox.Library.Forms.STButton();
this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.toggleAlphaChk = new Switch_Toolbox.Library.Forms.STCheckBox();
this.saveBtn = new Switch_Toolbox.Library.Forms.STButton(); this.saveBtn = new Switch_Toolbox.Library.Forms.STButton();
this.arrayLevelCounterLabel = new Switch_Toolbox.Library.Forms.STLabel(); this.arrayLevelCounterLabel = new Switch_Toolbox.Library.Forms.STLabel();
this.BtmMipsLeft = new Switch_Toolbox.Library.Forms.STButton(); this.BtmMipsLeft = new Switch_Toolbox.Library.Forms.STButton();
@ -53,6 +54,7 @@
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.propertyGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.propertyGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.channelViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.channelViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayVerticalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.imageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.imageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reEncodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.reEncodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -64,7 +66,6 @@
this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.hueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.brightnessContrastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.brightnessContrastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toggleAlphaChk = new Switch_Toolbox.Library.Forms.STCheckBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
@ -93,7 +94,7 @@
// //
this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.splitContainer1.Size = new System.Drawing.Size(715, 502); this.splitContainer1.Size = new System.Drawing.Size(715, 502);
this.splitContainer1.SplitterDistance = 519; this.splitContainer1.SplitterDistance = 520;
this.splitContainer1.TabIndex = 5; this.splitContainer1.TabIndex = 5;
// //
// stPanel2 // stPanel2
@ -102,7 +103,7 @@
this.stPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.stPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.stPanel2.Location = new System.Drawing.Point(0, 501); this.stPanel2.Location = new System.Drawing.Point(0, 501);
this.stPanel2.Name = "stPanel2"; this.stPanel2.Name = "stPanel2";
this.stPanel2.Size = new System.Drawing.Size(519, 1); this.stPanel2.Size = new System.Drawing.Size(520, 1);
this.stPanel2.TabIndex = 1; this.stPanel2.TabIndex = 1;
// //
// stPanel1 // stPanel1
@ -118,7 +119,7 @@
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(0, 0); this.stPanel1.Location = new System.Drawing.Point(0, 0);
this.stPanel1.Name = "stPanel1"; this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(519, 502); this.stPanel1.Size = new System.Drawing.Size(520, 502);
this.stPanel1.TabIndex = 2; this.stPanel1.TabIndex = 2;
// //
// alphaChannelBtn // alphaChannelBtn
@ -141,7 +142,7 @@
this.stPanel4.Controls.Add(this.pictureBoxCustom1); this.stPanel4.Controls.Add(this.pictureBoxCustom1);
this.stPanel4.Location = new System.Drawing.Point(3, 74); this.stPanel4.Location = new System.Drawing.Point(3, 74);
this.stPanel4.Name = "stPanel4"; this.stPanel4.Name = "stPanel4";
this.stPanel4.Size = new System.Drawing.Size(513, 425); this.stPanel4.Size = new System.Drawing.Size(514, 425);
this.stPanel4.TabIndex = 8; this.stPanel4.TabIndex = 8;
// //
// pictureBoxCustom1 // pictureBoxCustom1
@ -151,7 +152,7 @@
this.pictureBoxCustom1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBoxCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxCustom1.Location = new System.Drawing.Point(0, 0); this.pictureBoxCustom1.Location = new System.Drawing.Point(0, 0);
this.pictureBoxCustom1.Name = "pictureBoxCustom1"; this.pictureBoxCustom1.Name = "pictureBoxCustom1";
this.pictureBoxCustom1.Size = new System.Drawing.Size(513, 425); this.pictureBoxCustom1.Size = new System.Drawing.Size(514, 425);
this.pictureBoxCustom1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBoxCustom1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxCustom1.TabIndex = 1; this.pictureBoxCustom1.TabIndex = 1;
this.pictureBoxCustom1.TabStop = false; this.pictureBoxCustom1.TabStop = false;
@ -183,6 +184,19 @@
this.stPanel3.Size = new System.Drawing.Size(715, 51); this.stPanel3.Size = new System.Drawing.Size(715, 51);
this.stPanel3.TabIndex = 3; this.stPanel3.TabIndex = 3;
// //
// toggleAlphaChk
//
this.toggleAlphaChk.AutoSize = true;
this.toggleAlphaChk.Checked = true;
this.toggleAlphaChk.CheckState = System.Windows.Forms.CheckState.Checked;
this.toggleAlphaChk.Location = new System.Drawing.Point(50, 7);
this.toggleAlphaChk.Name = "toggleAlphaChk";
this.toggleAlphaChk.Size = new System.Drawing.Size(83, 17);
this.toggleAlphaChk.TabIndex = 15;
this.toggleAlphaChk.Text = "Show Alpha";
this.toggleAlphaChk.UseVisualStyleBackColor = true;
this.toggleAlphaChk.CheckedChanged += new System.EventHandler(this.toggleAlphaChk_CheckedChanged);
//
// saveBtn // saveBtn
// //
this.saveBtn.BackColor = System.Drawing.Color.Transparent; this.saveBtn.BackColor = System.Drawing.Color.Transparent;
@ -307,7 +321,7 @@
this.adjustmentsToolStripMenuItem}); this.adjustmentsToolStripMenuItem});
this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0); this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stContextMenuStrip1.Name = "stContextMenuStrip1"; this.stContextMenuStrip1.Name = "stContextMenuStrip1";
this.stContextMenuStrip1.Size = new System.Drawing.Size(519, 24); this.stContextMenuStrip1.Size = new System.Drawing.Size(520, 24);
this.stContextMenuStrip1.TabIndex = 0; this.stContextMenuStrip1.TabIndex = 0;
this.stContextMenuStrip1.Text = "stContextMenuStrip1"; this.stContextMenuStrip1.Text = "stContextMenuStrip1";
// //
@ -330,7 +344,8 @@
// //
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.propertyGridToolStripMenuItem, this.propertyGridToolStripMenuItem,
this.channelViewToolStripMenuItem}); this.channelViewToolStripMenuItem,
this.displayVerticalToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View"; this.viewToolStripMenuItem.Text = "View";
@ -341,17 +356,24 @@
this.propertyGridToolStripMenuItem.CheckOnClick = true; this.propertyGridToolStripMenuItem.CheckOnClick = true;
this.propertyGridToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.propertyGridToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.propertyGridToolStripMenuItem.Name = "propertyGridToolStripMenuItem"; this.propertyGridToolStripMenuItem.Name = "propertyGridToolStripMenuItem";
this.propertyGridToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.propertyGridToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this.propertyGridToolStripMenuItem.Text = "Property Grid"; this.propertyGridToolStripMenuItem.Text = "Property Grid";
this.propertyGridToolStripMenuItem.Click += new System.EventHandler(this.propertyGridToolStripMenuItem_Click); this.propertyGridToolStripMenuItem.Click += new System.EventHandler(this.propertyGridToolStripMenuItem_Click);
// //
// channelViewToolStripMenuItem // channelViewToolStripMenuItem
// //
this.channelViewToolStripMenuItem.Name = "channelViewToolStripMenuItem"; this.channelViewToolStripMenuItem.Name = "channelViewToolStripMenuItem";
this.channelViewToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.channelViewToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this.channelViewToolStripMenuItem.Text = "Channel View"; this.channelViewToolStripMenuItem.Text = "Channel View";
this.channelViewToolStripMenuItem.Click += new System.EventHandler(this.channelViewToolStripMenuItem_Click); this.channelViewToolStripMenuItem.Click += new System.EventHandler(this.channelViewToolStripMenuItem_Click);
// //
// displayVerticalToolStripMenuItem
//
this.displayVerticalToolStripMenuItem.Name = "displayVerticalToolStripMenuItem";
this.displayVerticalToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this.displayVerticalToolStripMenuItem.Text = "Display Vertical";
this.displayVerticalToolStripMenuItem.Click += new System.EventHandler(this.displayVerticalToolStripMenuItem_Click);
//
// imageToolStripMenuItem // imageToolStripMenuItem
// //
this.imageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.imageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -439,19 +461,6 @@
this.brightnessContrastToolStripMenuItem.Size = new System.Drawing.Size(185, 22); this.brightnessContrastToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.brightnessContrastToolStripMenuItem.Text = "Brightness / Contrast"; this.brightnessContrastToolStripMenuItem.Text = "Brightness / Contrast";
// //
// toggleAlphaChk
//
this.toggleAlphaChk.AutoSize = true;
this.toggleAlphaChk.Checked = true;
this.toggleAlphaChk.CheckState = System.Windows.Forms.CheckState.Checked;
this.toggleAlphaChk.Location = new System.Drawing.Point(50, 7);
this.toggleAlphaChk.Name = "toggleAlphaChk";
this.toggleAlphaChk.Size = new System.Drawing.Size(83, 17);
this.toggleAlphaChk.TabIndex = 15;
this.toggleAlphaChk.Text = "Show Alpha";
this.toggleAlphaChk.UseVisualStyleBackColor = true;
this.toggleAlphaChk.CheckedChanged += new System.EventHandler(this.toggleAlphaChk_CheckedChanged);
//
// ImageEditorBase // ImageEditorBase
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -511,5 +520,6 @@
private STButton saveBtn; private STButton saveBtn;
private System.Windows.Forms.ToolStripMenuItem reEncodeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem reEncodeToolStripMenuItem;
private STCheckBox toggleAlphaChk; private STCheckBox toggleAlphaChk;
private System.Windows.Forms.ToolStripMenuItem displayVerticalToolStripMenuItem;
} }
} }

View file

@ -114,20 +114,12 @@ namespace Switch_Toolbox.Library.Forms
propertiesEditor.Dock = DockStyle.Fill; propertiesEditor.Dock = DockStyle.Fill;
if (!propertyGridToolStripMenuItem.Checked) if (!propertyGridToolStripMenuItem.Checked)
{ HidePropertyGrid(true);
splitContainer1.Panel2Collapsed = true;
splitContainer1.Panel2.Hide();
}
else else
{ HidePropertyGrid(false);
splitContainer1.Panel2Collapsed = false;
splitContainer1.Panel2.Show();
}
if (ShowChannelEditor) if (ShowChannelEditor)
{
LoadChannelEditor(null); LoadChannelEditor(null);
}
if (PropertyShowTop) if (PropertyShowTop)
{ {
@ -681,5 +673,82 @@ namespace Switch_Toolbox.Library.Forms
{ {
UpdatePictureBox(); UpdatePictureBox();
} }
private void displayVerticalToolStripMenuItem_Click(object sender, EventArgs e)
{
if (displayVerticalToolStripMenuItem.Checked)
{
DisplayHorizontal();
displayVerticalToolStripMenuItem.Checked = false;
}
else
{
DisplayVertical();
displayVerticalToolStripMenuItem.Checked = true;
}
}
private void DisplayHorizontal()
{
var ImagePanel = stPanel1;
var PropertiesEditor = propertiesEditor;
//Swap panels
splitContainer1.Panel1.Controls.Clear();
splitContainer1.Panel2.Controls.Clear();
splitContainer1.Orientation = Orientation.Vertical;
splitContainer1.Panel1.Controls.Add(ImagePanel);
splitContainer1.Panel2.Controls.Add(PropertiesEditor);
PropertiesEditor.HideHintPanel(true);
PropertiesEditor.Width = this.Width / 2;
splitContainer1.SplitterDistance = this.Width / 2;
}
private void HidePropertyGrid(bool Hide)
{
if (Hide)
{
if (splitContainer1.Panel1.Contains(propertiesEditor)) {
splitContainer1.Panel1Collapsed = true;
splitContainer1.Panel1.Hide();
}
if (splitContainer1.Panel2.Contains(propertiesEditor)) {
splitContainer1.Panel2Collapsed = true;
splitContainer1.Panel2.Hide();
}
}
else
{
if (splitContainer1.Panel1.Contains(propertiesEditor)) {
splitContainer1.Panel1Collapsed = false;
splitContainer1.Panel1.Show();
}
if (splitContainer1.Panel2.Contains(propertiesEditor)) {
splitContainer1.Panel2Collapsed = false;
splitContainer1.Panel2.Show();
}
}
}
private void DisplayVertical()
{
var ImagePanel = stPanel1;
var PropertiesEditor = propertiesEditor;
//Swap panels
splitContainer1.Panel1.Controls.Clear();
splitContainer1.Panel2.Controls.Clear();
splitContainer1.Orientation = Orientation.Horizontal;
splitContainer1.Panel2.Controls.Add(ImagePanel);
splitContainer1.Panel1.Controls.Add(PropertiesEditor);
splitContainer1.SplitterDistance = this.Height / 2;
PropertiesEditor.HideHintPanel(false);
}
} }
} }

View file

@ -117,9 +117,6 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBoxCustom1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureBoxCustom1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
@ -328,6 +325,9 @@
mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value> <value>25</value>
</metadata> </metadata>

View file

@ -45,6 +45,11 @@ namespace Switch_Toolbox.Library.Forms
stTabControl1.TabPages.Add(page); stTabControl1.TabPages.Add(page);
} }
public void HideHintPanel(bool HideHint)
{
stPropertyGrid1.DisableHintDisplay = HideHint;
}
public UserControl GetActiveTabControl(Type type) public UserControl GetActiveTabControl(Type type)
{ {
foreach (TabPage pge in stTabControl1.TabPages) foreach (TabPage pge in stTabControl1.TabPages)

View file

@ -44,7 +44,7 @@ namespace Switch_Toolbox.Library.Forms
} }
public ActiveTexture activeTexture = new ActiveTexture(); public ActiveTexture activeTexture = new ActiveTexture();
public float brightness = 0; //To see uv maps easier public float brightness = 0.5f; //To see uv maps easier
public int UvChannelIndex = 0; public int UvChannelIndex = 0;
public STGenericMaterial ActiveMaterial; public STGenericMaterial ActiveMaterial;
@ -55,6 +55,8 @@ namespace Switch_Toolbox.Library.Forms
bool IsSRTLoaded = false; bool IsSRTLoaded = false;
public void Reset() public void Reset()
{ {
barSlider1.Value = brightness;
scaleXUD.Value = 1; scaleXUD.Value = 1;
scaleYUD.Value = 1; scaleYUD.Value = 1;
transXUD.Value = 0; transXUD.Value = 0;
@ -350,7 +352,7 @@ namespace Switch_Toolbox.Library.Forms
private void OnMouseWheel(object sender, System.Windows.Forms.MouseEventArgs e) private void OnMouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{ {
if (e.Delta > 0 && ZoomValue > 0) ZoomValue += 0.1f; if (e.Delta > 0 && ZoomValue > 0) ZoomValue += 0.1f;
if (e.Delta < 0 && ZoomValue < 5 && ZoomValue > 0.1) ZoomValue -= 0.1f; if (e.Delta < 0 && ZoomValue < 30 && ZoomValue > 0.1) ZoomValue -= 0.1f;
gL_ControlLegacy2D1.Invalidate(); gL_ControlLegacy2D1.Invalidate();
} }