Fix preview scale for SMO costumes

This commit is contained in:
KillzXGaming 2019-10-19 15:48:18 -04:00
parent 5f2dbd1b56
commit 440939f91d
8 changed files with 177 additions and 34 deletions

View file

@ -1307,6 +1307,16 @@ namespace LayoutBXLYT
public BxlanPAT1 AnimationTag;
public BxlanPAI1 AnimationInfo;
public BxlanPaiEntry TryGetTag(string name)
{
for (int i = 0; i < AnimationInfo.Entries?.Count; i++)
{
if (AnimationInfo.Entries[i].Name == name)
return AnimationInfo.Entries[i];
}
return null;
}
public virtual void Read(FileReader reader, BXLAN header)
{

View file

@ -349,7 +349,7 @@ namespace FirstPlugin
shader = OpenTKSharedResources.shaders["BFRES_PBR"];
shader.UseProgram();
control.UpdateModelMatrix(Matrix4.CreateScale(Runtime.previewScale) * ModelTransform);
control.UpdateModelMatrix(ModelTransform * Matrix4.CreateScale(Runtime.previewScale));
Matrix4 camMat = control.CameraMatrix;
Matrix4 mdlMat = control.ModelMatrix;

View file

@ -73,6 +73,8 @@ namespace LayoutBXLYT
ActivePane = pane;
SetUIState();
nameTB.Bind(pane, "Name");
tranXUD.Value = pane.Translate.X;
tranYUD.Value = pane.Translate.Y;
@ -96,6 +98,55 @@ namespace LayoutBXLYT
Loaded = true;
}
public override void SetUIState()
{
if (parentEditor.AnimationMode)
{
if (parentEditor.ActiveAnimation != null)
{
var anim = parentEditor.ActiveAnimation;
var paneAnim = anim.TryGetTag(ActivePane.Name);
if (paneAnim != null)
{
foreach (var tag in paneAnim.Tags)
{
foreach (var entry in tag.Entries)
{
}
}
}
}
//Change any UI that can be keyed or is keyed
tranXUD.ReloadTheme();
tranYUD.ReloadTheme();
tranZUD.ReloadTheme();
rotXUD.ReloadTheme();
rotYUD.ReloadTheme();
rotZUD.ReloadTheme();
scaleXUD.ReloadTheme();
scaleYUD.ReloadTheme();
sizeXUD.ReloadTheme();
sizeYUD.ReloadTheme();
alphaUD.ReloadTheme();
}
else
{
//Set UI to default theme colors
tranXUD.ReloadTheme();
tranYUD.ReloadTheme();
tranZUD.ReloadTheme();
rotXUD.ReloadTheme();
rotYUD.ReloadTheme();
rotZUD.ReloadTheme();
scaleXUD.ReloadTheme();
scaleYUD.ReloadTheme();
sizeXUD.ReloadTheme();
sizeYUD.ReloadTheme();
alphaUD.ReloadTheme();
}
}
public void RefreshEditor()
{
Loaded = false;

View file

@ -14,5 +14,7 @@ namespace LayoutBXLYT
{
return DisplayRectangle.Location;
}
public virtual void SetUIState() { }
}
}

View file

@ -16,6 +16,11 @@ namespace LayoutBXLYT
{
public EventHandler PropertyChanged;
public bool AnimationMode
{
get { return ParentEditor.AnimationMode; }
}
public PaneEditor()
{
InitializeComponent();
@ -34,6 +39,13 @@ namespace LayoutBXLYT
stPanel1.Controls.Clear();
}
public void ReloadEditor()
{
if (ActivePane != null)
LoadPane(ActivePane, ParentEditor);
}
public BxlanHeader ActiveAnimation;
private LayoutEditor ParentEditor;
private BxlytMaterial ActiveMaterial;

View file

@ -47,6 +47,8 @@
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.transformChildrenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.renderInGamePreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -63,8 +65,9 @@
this.resetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showGameWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.transformChildrenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
this.editorModeCB = new Toolbox.Library.Forms.STComboBox();
this.chkAutoKey = new Toolbox.Library.Forms.STCheckBox();
((System.ComponentModel.ISupportInitialize)(this.backColorDisplay)).BeginInit();
this.stToolStrip1.SuspendLayout();
this.stMenuStrip1.SuspendLayout();
@ -75,7 +78,7 @@
this.dockPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dockPanel1.Location = new System.Drawing.Point(0, 49);
this.dockPanel1.Name = "dockPanel1";
this.dockPanel1.Size = new System.Drawing.Size(549, 349);
this.dockPanel1.Size = new System.Drawing.Size(955, 504);
this.dockPanel1.TabIndex = 6;
this.dockPanel1.ActiveDocumentChanged += new System.EventHandler(this.dockPanel1_ActiveDocumentChanged);
//
@ -91,7 +94,7 @@
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(301, 28);
this.stLabel1.Location = new System.Drawing.Point(289, 28);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(84, 13);
this.stLabel1.TabIndex = 14;
@ -104,7 +107,7 @@
this.debugShading.ButtonColor = System.Drawing.Color.Empty;
this.debugShading.FormattingEnabled = true;
this.debugShading.IsReadOnly = false;
this.debugShading.Location = new System.Drawing.Point(391, 25);
this.debugShading.Location = new System.Drawing.Point(379, 25);
this.debugShading.Name = "debugShading";
this.debugShading.Size = new System.Drawing.Size(146, 21);
this.debugShading.TabIndex = 13;
@ -132,7 +135,7 @@
this.toolstripOrthoBtn});
this.stToolStrip1.Location = new System.Drawing.Point(0, 24);
this.stToolStrip1.Name = "stToolStrip1";
this.stToolStrip1.Size = new System.Drawing.Size(549, 25);
this.stToolStrip1.Size = new System.Drawing.Size(955, 25);
this.stToolStrip1.TabIndex = 3;
this.stToolStrip1.Text = "stToolStrip1";
//
@ -167,9 +170,9 @@
this.windowToolStripMenuItem});
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stMenuStrip1.Name = "stMenuStrip1";
this.stMenuStrip1.Size = new System.Drawing.Size(549, 24);
this.stMenuStrip1.Size = new System.Drawing.Size(955, 24);
this.stMenuStrip1.TabIndex = 0;
this.stMenuStrip1.Text = "stMenuStrip1";
this.stMenuStrip1.Text = "editorModeCB:";
//
// fileToolStripMenuItem
//
@ -186,35 +189,35 @@
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Text = "Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// clearWorkspaceToolStripMenuItem
//
this.clearWorkspaceToolStripMenuItem.Name = "clearWorkspaceToolStripMenuItem";
this.clearWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.clearWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.clearWorkspaceToolStripMenuItem.Text = "Clear Files";
this.clearWorkspaceToolStripMenuItem.Click += new System.EventHandler(this.clearWorkspaceToolStripMenuItem_Click);
//
// saveToolStripMenuItem1
//
this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
this.saveToolStripMenuItem1.Size = new System.Drawing.Size(157, 22);
this.saveToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem1.Text = "Save Layout";
this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click);
//
// saveAnimationToolStripMenuItem
//
this.saveAnimationToolStripMenuItem.Name = "saveAnimationToolStripMenuItem";
this.saveAnimationToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.saveAnimationToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveAnimationToolStripMenuItem.Text = "Save Animation";
this.saveAnimationToolStripMenuItem.Click += new System.EventHandler(this.saveAnimationToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "Save As";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
@ -242,6 +245,22 @@
this.redoToolStripMenuItem.Text = "Redo";
this.redoToolStripMenuItem.Click += new System.EventHandler(this.redoToolStripMenuItem_Click);
//
// panesToolStripMenuItem
//
this.panesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.transformChildrenToolStripMenuItem});
this.panesToolStripMenuItem.Name = "panesToolStripMenuItem";
this.panesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.panesToolStripMenuItem.Text = "Panes";
//
// transformChildrenToolStripMenuItem
//
this.transformChildrenToolStripMenuItem.CheckOnClick = true;
this.transformChildrenToolStripMenuItem.Name = "transformChildrenToolStripMenuItem";
this.transformChildrenToolStripMenuItem.Size = new System.Drawing.Size(176, 22);
this.transformChildrenToolStripMenuItem.Text = "Transform Children";
this.transformChildrenToolStripMenuItem.Click += new System.EventHandler(this.transformChildrenToolStripMenuItem_Click);
//
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -388,28 +407,49 @@
this.showGameWindowToolStripMenuItem.Text = "Show Game Window";
this.showGameWindowToolStripMenuItem.Click += new System.EventHandler(this.showGameWindowToolStripMenuItem_Click);
//
// panesToolStripMenuItem
// stLabel2
//
this.panesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.transformChildrenToolStripMenuItem});
this.panesToolStripMenuItem.Name = "panesToolStripMenuItem";
this.panesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.panesToolStripMenuItem.Text = "Panes";
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(530, 28);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(67, 13);
this.stLabel2.TabIndex = 18;
this.stLabel2.Text = "Editor Mode:";
//
// transformChildrenToolStripMenuItem
// editorModeCB
//
this.transformChildrenToolStripMenuItem.CheckOnClick = true;
this.transformChildrenToolStripMenuItem.Name = "transformChildrenToolStripMenuItem";
this.transformChildrenToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.transformChildrenToolStripMenuItem.Text = "Transform Children";
this.transformChildrenToolStripMenuItem.Click += new System.EventHandler(this.transformChildrenToolStripMenuItem_Click);
this.editorModeCB.BorderColor = System.Drawing.Color.Empty;
this.editorModeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.editorModeCB.ButtonColor = System.Drawing.Color.Empty;
this.editorModeCB.FormattingEnabled = true;
this.editorModeCB.IsReadOnly = false;
this.editorModeCB.Location = new System.Drawing.Point(603, 24);
this.editorModeCB.Name = "editorModeCB";
this.editorModeCB.Size = new System.Drawing.Size(146, 21);
this.editorModeCB.TabIndex = 17;
this.editorModeCB.SelectedIndexChanged += new System.EventHandler(this.editorModeCB_SelectedIndexChanged);
//
// chkAutoKey
//
this.chkAutoKey.AutoSize = true;
this.chkAutoKey.Checked = true;
this.chkAutoKey.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkAutoKey.Location = new System.Drawing.Point(755, 27);
this.chkAutoKey.Name = "chkAutoKey";
this.chkAutoKey.Size = new System.Drawing.Size(69, 17);
this.chkAutoKey.TabIndex = 19;
this.chkAutoKey.Text = "Auto Key";
this.chkAutoKey.UseVisualStyleBackColor = true;
//
// LayoutEditor
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(549, 398);
this.ClientSize = new System.Drawing.Size(955, 553);
this.Controls.Add(this.chkAutoKey);
this.Controls.Add(this.stLabel2);
this.Controls.Add(this.editorModeCB);
this.Controls.Add(this.stLabel1);
this.Controls.Add(this.debugShading);
this.Controls.Add(this.backColorDisplay);
@ -472,5 +512,8 @@
private System.Windows.Forms.ToolStripMenuItem viewPartsAsNullPanesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem panesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem transformChildrenToolStripMenuItem;
private Toolbox.Library.Forms.STLabel stLabel2;
private Toolbox.Library.Forms.STComboBox editorModeCB;
private Toolbox.Library.Forms.STCheckBox chkAutoKey;
}
}

View file

@ -25,6 +25,8 @@ namespace LayoutBXLYT
/// </summary>
public static bool UseLegacyGL = true;
public bool AnimationMode = false;
public LayoutViewer GamePreviewWindow;
private LayoutCustomPaneMapper CustomMapper;
@ -50,6 +52,9 @@ namespace LayoutBXLYT
public LayoutEditor()
{
InitializeComponent();
chkAutoKey.Hide();
CustomMapper = new LayoutCustomPaneMapper();
Textures = new Dictionary<string, STGenericTexture>();
@ -69,6 +74,10 @@ namespace LayoutBXLYT
viewportBackColorCB.Items.Add("Back Color : Custom");
orthographicViewToolStripMenuItem.Checked = true;
editorModeCB.Items.Add("Normal");
editorModeCB.Items.Add("Animation");
editorModeCB.SelectedIndex = 0;
foreach (var type in Enum.GetValues(typeof(Runtime.LayoutEditor.DebugShading)).Cast<Runtime.LayoutEditor.DebugShading>())
debugShading.Items.Add(type);
@ -1108,5 +1117,17 @@ namespace LayoutBXLYT
private void transformChildrenToolStripMenuItem_Click(object sender, EventArgs e) {
Runtime.LayoutEditor.TransformChidlren = transformChildrenToolStripMenuItem.Checked;
}
private void editorModeCB_SelectedIndexChanged(object sender, EventArgs e)
{
AnimationMode = editorModeCB.SelectedIndex == 1;
if (AnimationMode)
chkAutoKey.Show();
else
chkAutoKey.Hide();
if (LayoutPaneEditor != null)
LayoutPaneEditor.ReloadEditor();
}
}
}

View file

@ -1240,6 +1240,17 @@ namespace BarSlider
DisplayInterlapsedBar = true;
ReloadTheme();
textBox = new BarTextBox();
textBox.Visible = false;
textBox.Enabled = true;
textBox.KeyUp += new KeyEventHandler(textBox1_KeyUp);
Controls.Add(textBox);
}
public void ReloadTheme()
{
BackColor = FormThemes.BaseTheme.ValueBarSliderElapseBottmColor;
ThumbPenColor = FormThemes.BaseTheme.ValueBarSliderElapseBottmColor;
@ -1253,13 +1264,6 @@ namespace BarSlider
BarPenColorTop = FormThemes.BaseTheme.ValueBarSliderTopColor;
BarPenColorMiddle = FormThemes.BaseTheme.ValueBarSliderMiddleColor;
BarPenColorBottom = FormThemes.BaseTheme.ValueBarSliderBottmColor;
textBox = new BarTextBox();
textBox.Visible = false;
textBox.Enabled = true;
textBox.KeyUp += new KeyEventHandler(textBox1_KeyUp);
Controls.Add(textBox);
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)