Fix UV editor issues
This commit is contained in:
parent
c30f758f8d
commit
7df5effdc2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -86,6 +86,10 @@ namespace FirstPlugin
|
||||
|
||||
for (int i = 0; i < files.Count; i++)
|
||||
{
|
||||
Nodes.Add(files[i]);
|
||||
|
||||
continue;
|
||||
|
||||
if (files[i].FileType == FileEntry.FileDataType.Texture)
|
||||
{
|
||||
if (files[i].Unknown3 == 1) //Info
|
||||
|
Binary file not shown.
Binary file not shown.
@ -37,11 +37,11 @@
|
||||
this.scaleXUD = new Switch_Toolbox.Library.Forms.NumericUpDownFloat();
|
||||
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
|
||||
this.btnApplyTransform = new Switch_Toolbox.Library.Forms.STButton();
|
||||
this.barSlider1 = new ColorSlider.ColorSlider();
|
||||
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
|
||||
this.comboBox2 = new Switch_Toolbox.Library.Forms.STComboBox();
|
||||
this.comboBox1 = new Switch_Toolbox.Library.Forms.STComboBox();
|
||||
this.stLabel1 = new Switch_Toolbox.Library.Forms.STLabel();
|
||||
this.barSlider1 = new ColorSlider.ColorSlider();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scaleYUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.transYUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.transXUD)).BeginInit();
|
||||
@ -51,8 +51,8 @@
|
||||
//
|
||||
// gL_ControlLegacy2D1
|
||||
//
|
||||
this.gL_ControlLegacy2D1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
this.gL_ControlLegacy2D1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.gL_ControlLegacy2D1.BackColor = System.Drawing.Color.Black;
|
||||
this.gL_ControlLegacy2D1.Location = new System.Drawing.Point(0, 70);
|
||||
@ -182,9 +182,9 @@
|
||||
//
|
||||
// stPanel1
|
||||
//
|
||||
this.stPanel1.Controls.Add(this.barSlider1);
|
||||
this.stPanel1.Controls.Add(this.btnApplyTransform);
|
||||
this.stPanel1.Controls.Add(this.scaleYUD);
|
||||
this.stPanel1.Controls.Add(this.barSlider1);
|
||||
this.stPanel1.Controls.Add(this.transYUD);
|
||||
this.stPanel1.Controls.Add(this.stLabel2);
|
||||
this.stPanel1.Controls.Add(this.transXUD);
|
||||
@ -211,10 +211,43 @@
|
||||
this.btnApplyTransform.UseVisualStyleBackColor = false;
|
||||
this.btnApplyTransform.Click += new System.EventHandler(this.btnApplyTransform_Click);
|
||||
//
|
||||
// barSlider1
|
||||
//
|
||||
this.barSlider1.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.barSlider1.BarPenColorBottom = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.barSlider1.BarPenColorTop = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.barSlider1.BorderRoundRectSize = new System.Drawing.Size(8, 8);
|
||||
this.barSlider1.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.ElapsedPenColorBottom = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.ElapsedPenColorTop = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F);
|
||||
this.barSlider1.ForeColor = System.Drawing.Color.White;
|
||||
this.barSlider1.LargeChange = ((uint)(5u));
|
||||
this.barSlider1.Location = new System.Drawing.Point(65, 7);
|
||||
this.barSlider1.MouseEffects = false;
|
||||
this.barSlider1.Name = "barSlider1";
|
||||
this.barSlider1.ScaleDivisions = 10;
|
||||
this.barSlider1.ScaleSubDivisions = 5;
|
||||
this.barSlider1.ShowDivisionsText = true;
|
||||
this.barSlider1.ShowSmallScale = false;
|
||||
this.barSlider1.Size = new System.Drawing.Size(212, 19);
|
||||
this.barSlider1.SmallChange = ((uint)(1u));
|
||||
this.barSlider1.TabIndex = 18;
|
||||
this.barSlider1.Text = "colorSlider1";
|
||||
this.barSlider1.ThumbInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.ThumbPenColor = System.Drawing.Color.Silver;
|
||||
this.barSlider1.ThumbRoundRectSize = new System.Drawing.Size(8, 8);
|
||||
this.barSlider1.ThumbSize = new System.Drawing.Size(8, 8);
|
||||
this.barSlider1.TickAdd = 0F;
|
||||
this.barSlider1.TickColor = System.Drawing.Color.White;
|
||||
this.barSlider1.TickDivide = 0F;
|
||||
this.barSlider1.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.barSlider1.ValueChanged += new System.EventHandler(this.barSlider1_ValueChanged);
|
||||
this.barSlider1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.barSlider1_Scroll);//
|
||||
// stLabel2
|
||||
//
|
||||
this.stLabel2.AutoSize = true;
|
||||
this.stLabel2.Location = new System.Drawing.Point(3, 7);
|
||||
this.stLabel2.Location = new System.Drawing.Point(3, 13);
|
||||
this.stLabel2.Name = "stLabel2";
|
||||
this.stLabel2.Size = new System.Drawing.Size(56, 13);
|
||||
this.stLabel2.TabIndex = 2;
|
||||
@ -222,7 +255,8 @@
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboBox2.BorderColor = System.Drawing.Color.Empty;
|
||||
this.comboBox2.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
|
||||
this.comboBox2.ButtonColor = System.Drawing.Color.Empty;
|
||||
@ -258,40 +292,6 @@
|
||||
this.stLabel1.TabIndex = 4;
|
||||
this.stLabel1.Text = "Active Channel:";
|
||||
//
|
||||
// barSlider1
|
||||
//
|
||||
this.barSlider1.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.barSlider1.BarPenColorBottom = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.barSlider1.BarPenColorTop = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.barSlider1.BorderRoundRectSize = new System.Drawing.Size(8, 8);
|
||||
this.barSlider1.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.ElapsedPenColorBottom = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.ElapsedPenColorTop = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F);
|
||||
this.barSlider1.ForeColor = System.Drawing.Color.White;
|
||||
this.barSlider1.LargeChange = ((uint)(5u));
|
||||
this.barSlider1.Location = new System.Drawing.Point(65, 7);
|
||||
this.barSlider1.MouseEffects = false;
|
||||
this.barSlider1.Name = "barSlider1";
|
||||
this.barSlider1.ScaleDivisions = 10;
|
||||
this.barSlider1.ScaleSubDivisions = 5;
|
||||
this.barSlider1.ShowDivisionsText = true;
|
||||
this.barSlider1.ShowSmallScale = false;
|
||||
this.barSlider1.Size = new System.Drawing.Size(212, 19);
|
||||
this.barSlider1.SmallChange = ((uint)(1u));
|
||||
this.barSlider1.TabIndex = 18;
|
||||
this.barSlider1.Text = "colorSlider1";
|
||||
this.barSlider1.ThumbInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.barSlider1.ThumbPenColor = System.Drawing.Color.Silver;
|
||||
this.barSlider1.ThumbRoundRectSize = new System.Drawing.Size(8, 8);
|
||||
this.barSlider1.ThumbSize = new System.Drawing.Size(8, 8);
|
||||
this.barSlider1.TickAdd = 0F;
|
||||
this.barSlider1.TickColor = System.Drawing.Color.White;
|
||||
this.barSlider1.TickDivide = 0F;
|
||||
this.barSlider1.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.barSlider1.ValueChanged += new System.EventHandler(this.barSlider1_ValueChanged);
|
||||
this.barSlider1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.barSlider1_Scroll);
|
||||
//
|
||||
// UVEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -323,7 +323,7 @@
|
||||
private NumericUpDownFloat transXUD;
|
||||
private NumericUpDownFloat transYUD;
|
||||
private NumericUpDownFloat scaleYUD;
|
||||
private STButton btnApplyTransform;
|
||||
private ColorSlider.ColorSlider barSlider1;
|
||||
private STButton btnApplyTransform;
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ namespace Switch_Toolbox.Library.Forms
|
||||
comboBox1.Items.Add(2);
|
||||
|
||||
comboBox1.SelectedIndex = 0;
|
||||
barSlider1.Value = 50;
|
||||
barSlider1.Value = 0;
|
||||
}
|
||||
|
||||
public class ActiveTexture
|
||||
@ -101,33 +101,30 @@ namespace Switch_Toolbox.Library.Forms
|
||||
Vector2 v2 = new Vector2(0);
|
||||
Vector2 v3 = new Vector2(0);
|
||||
|
||||
if (f.Count < (v + 2) && genericObject.vertices.Count > f[v + 2])
|
||||
if (UvChannelIndex == 0)
|
||||
{
|
||||
if (UvChannelIndex == 0)
|
||||
{
|
||||
v1 = genericObject.vertices[f[v]].uv0;
|
||||
v2 = genericObject.vertices[f[v + 1]].uv0;
|
||||
v3 = genericObject.vertices[f[v + 2]].uv0;
|
||||
}
|
||||
if (UvChannelIndex == 1)
|
||||
{
|
||||
v1 = genericObject.vertices[f[v]].uv1;
|
||||
v2 = genericObject.vertices[f[v + 1]].uv1;
|
||||
v3 = genericObject.vertices[f[v + 2]].uv1;
|
||||
}
|
||||
if (UvChannelIndex == 2)
|
||||
{
|
||||
v1 = genericObject.vertices[f[v]].uv2;
|
||||
v2 = genericObject.vertices[f[v + 1]].uv2;
|
||||
v3 = genericObject.vertices[f[v + 2]].uv2;
|
||||
}
|
||||
|
||||
v1 = new Vector2(v1.X, 1 - v1.Y);
|
||||
v2 = new Vector2(v2.X, 1 - v2.Y);
|
||||
v3 = new Vector2(v3.X, 1 - v3.Y);
|
||||
|
||||
DrawUVTriangleAndGrid(v1, v2, v3, divisions, uvColor, lineWidth, gridColor);
|
||||
v1 = genericObject.vertices[f[v]].uv0;
|
||||
v2 = genericObject.vertices[f[v + 1]].uv0;
|
||||
v3 = genericObject.vertices[f[v + 2]].uv0;
|
||||
}
|
||||
if (UvChannelIndex == 1)
|
||||
{
|
||||
v1 = genericObject.vertices[f[v]].uv1;
|
||||
v2 = genericObject.vertices[f[v + 1]].uv1;
|
||||
v3 = genericObject.vertices[f[v + 2]].uv1;
|
||||
}
|
||||
if (UvChannelIndex == 2)
|
||||
{
|
||||
v1 = genericObject.vertices[f[v]].uv2;
|
||||
v2 = genericObject.vertices[f[v + 1]].uv2;
|
||||
v3 = genericObject.vertices[f[v + 2]].uv2;
|
||||
}
|
||||
|
||||
v1 = new Vector2(v1.X, 1 - v1.Y);
|
||||
v2 = new Vector2(v2.X, 1 - v2.Y);
|
||||
v3 = new Vector2(v3.X, 1 - v3.Y);
|
||||
|
||||
DrawUVTriangleAndGrid(v1, v2, v3, divisions, uvColor, lineWidth, gridColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -247,10 +244,10 @@ namespace Switch_Toolbox.Library.Forms
|
||||
if (ActiveObjects.Count <= 0 || ActiveMaterial == null || Runtime.OpenTKInitialized == false)
|
||||
return;
|
||||
|
||||
SetupRendering(1);
|
||||
|
||||
gL_ControlLegacy2D1.MakeCurrent();
|
||||
|
||||
SetupRendering(1);
|
||||
|
||||
GL.ClearColor(System.Drawing.Color.FromArgb(40, 40, 40));
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
|
||||
@ -274,7 +271,6 @@ namespace Switch_Toolbox.Library.Forms
|
||||
GL.PushMatrix();
|
||||
GL.Scale(PlaneScaleY * ZoomValue, -PlaneScaleX * ZoomValue, 1);
|
||||
GL.Translate(PosX, PosY, 0);
|
||||
GL.Rotate(180, 1, 0, 0);
|
||||
|
||||
if (activeTexture.texture != null)
|
||||
{
|
||||
@ -357,9 +353,7 @@ namespace Switch_Toolbox.Library.Forms
|
||||
private void OnMouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if (e.Delta > 0 && ZoomValue > 0) ZoomValue += 0.1f;
|
||||
if (e.Delta < 0 && ZoomValue < 30 && ZoomValue > 0.2) ZoomValue -= 0.1f;
|
||||
|
||||
Console.WriteLine("ZoomValue " + ZoomValue);
|
||||
if (e.Delta < 0 && ZoomValue < 30 && ZoomValue > 0.1) ZoomValue -= 0.1f;
|
||||
|
||||
gL_ControlLegacy2D1.Invalidate();
|
||||
}
|
||||
@ -424,6 +418,16 @@ namespace Switch_Toolbox.Library.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void barSlider1_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void barSlider1_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
brightness = (float)barSlider1.Value / 100;
|
||||
gL_ControlLegacy2D1.Invalidate();
|
||||
}
|
||||
|
||||
private void OnNumbicValueSRT_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
@ -436,8 +440,8 @@ namespace Switch_Toolbox.Library.Forms
|
||||
Vector2 Translate = new Vector2((float)transXUD.Value, (float)transYUD.Value);
|
||||
|
||||
shape.TransformUVs(Translate, Scale, UvChannelIndex);
|
||||
shape.UpdateVertexData();
|
||||
shape.SaveVertexBuffer();
|
||||
shape.UpdateVertexData();
|
||||
}
|
||||
|
||||
scaleXUD.Value = 1;
|
||||
@ -452,16 +456,5 @@ namespace Switch_Toolbox.Library.Forms
|
||||
{
|
||||
gL_ControlLegacy2D1.Invalidate();
|
||||
}
|
||||
|
||||
private void barSlider1_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void barSlider1_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
brightness = (float)barSlider1.Value / 100;
|
||||
gL_ControlLegacy2D1.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user