Improve layout editor more.

Part pane scaling type can be edited.
Additional texture coordinates can be added/removed.
Fixed editing user info string.
Display tex coord gen sources in texture map editor.
Default texture map wrap mode to linear when created.
This commit is contained in:
KillzXGaming 2020-02-15 16:30:10 -05:00
parent efd98b3bac
commit a91dd6ae8e
17 changed files with 559 additions and 130 deletions

View file

@ -120,7 +120,7 @@ namespace LayoutBXLYT
for (int i = 0; i < material.TexCoordGens?.Length; i++)
{
shader.SetInt($"texCoords{i}GenType", (int)material.TexCoordGens[i].GenType);
shader.SetInt($"texCoords{i}GenType", (int)material.TexCoordGens[i].Matrix);
shader.SetInt($"texCoords{i}Source", (int)material.TexCoordGens[i].Source);
}

View file

@ -90,16 +90,10 @@ namespace LayoutBXLYT.Cafe
[DisplayName("White Color"), CategoryAttribute("Color")]
public override STColor8 WhiteColor { get; set; }
[DisplayName("Texture Coordinate Params"), CategoryAttribute("Texture")]
public TexCoordGen[] TexCoordGens { get; set; }
[DisplayName("Indirect Parameter"), CategoryAttribute("Texture")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public IndirectParameter IndParameter { get; set; }
[DisplayName("Projection Texture Coord Parameters"), CategoryAttribute("Texture")]
public ProjectionTexGenParam[] ProjTexGenParams { get; set; }
[DisplayName("Font Shadow Parameters"), CategoryAttribute("Font")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public FontShadowParameter FontShadowParameter { get; set; }
@ -115,6 +109,20 @@ namespace LayoutBXLYT.Cafe
return "";
}
public override bool RemoveTexCoordSources(int index)
{
foreach (var texGen in TexCoordGens)
{
//Shift all tex coord types down when an index is removed
if (texGen.Source > TexGenType.TextureCoord0 &&
texGen.Source <= TexGenType.TextureCoord2)
{
texGen.Source = texGen.Source - 1;
}
}
return true;
}
public override BxlytMaterial Clone()
{
Material mat = new Material();
@ -269,7 +277,7 @@ namespace LayoutBXLYT.Cafe
for (int i = 0; i < TexCoordGens.Length; i++)
{
flags += Bit.BitInsert(1, 1, 2, 26);
TexCoordGens[i].Write(writer);
((TexCoordGen)TexCoordGens[i]).Write(writer);
}
for (int i = 0; i < TevStages.Length; i++)

View file

@ -2,17 +2,14 @@
namespace LayoutBXLYT.Cafe
{
public class TexCoordGen
public class TexCoordGen : BxlytTexCoordGen
{
public MatrixType GenType { get; set; }
public TextureGenerationType Source { get; set; }
byte[] unkData;
public TexCoordGen(FileReader reader, BxlytHeader header)
{
GenType = reader.ReadEnum<MatrixType>(false);
Source = reader.ReadEnum<TextureGenerationType>(false);
Matrix = reader.ReadEnum<TexGenMatrixType>(false);
Source = reader.ReadEnum<TexGenType>(false);
if (header.VersionMajor >= 8)
unkData = reader.ReadBytes(0xE);
else
@ -21,24 +18,9 @@ namespace LayoutBXLYT.Cafe
public void Write(FileWriter writer)
{
writer.Write(GenType, false);
writer.Write(Matrix, false);
writer.Write(Source, false);
writer.Write(unkData);
}
public enum MatrixType : byte
{
Matrix2x4 = 0
}
public enum TextureGenerationType : byte
{
Tex0 = 0,
Tex1 = 1,
Tex2 = 2,
Ortho = 3,
PaneBased = 4,
PerspectiveProj = 5
}
}
}

View file

@ -25,9 +25,6 @@ namespace LayoutBXLYT.Cafe
}
}
[DisplayName("Parts Flag"), CategoryAttribute("Flags")]
public byte PaneMagFlags { get; set; }
[DisplayName("Influence Alpha"), CategoryAttribute("Alpha")]
public override bool InfluenceAlpha
{
@ -41,9 +38,6 @@ namespace LayoutBXLYT.Cafe
}
}
[DisplayName("User Data Info"), CategoryAttribute("User Data")]
public string UserDataInfo { get; set; }
[DisplayName("User Data"), CategoryAttribute("User Data")]
public UserData UserData { get; set; }

View file

@ -60,9 +60,6 @@ namespace LayoutBXLYT.CTR
{
public STColor8[] TevConstantColors { get; set; }
[DisplayName("Texture Coordinate Params"), CategoryAttribute("Texture")]
public TexCoordGen[] TexCoordGens { get; set; }
[DisplayName("Indirect Parameter"), CategoryAttribute("Texture")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public IndirectParameter IndParameter { get; set; }
@ -84,6 +81,20 @@ namespace LayoutBXLYT.CTR
return "";
}
public override bool RemoveTexCoordSources(int index)
{
foreach (var texGen in TexCoordGens)
{
//Shift all tex coord types down when an index is removed
if (texGen.Source > TexGenType.TextureCoord0 &&
texGen.Source <= TexGenType.TextureCoord2)
{
texGen.Source = texGen.Source - 1;
}
}
return true;
}
public Material()
{
TextureMaps = new TextureRef[0];
@ -217,7 +228,7 @@ namespace LayoutBXLYT.CTR
for (int i = 0; i < TexCoordGens?.Length; i++)
{
flags += Bit.BitInsert(1, 1, 2, 26);
TexCoordGens[i].Write(writer);
((TexCoordGen)TexCoordGens[i]).Write(writer);
}
for (int i = 0; i < TevStages?.Length; i++)

View file

@ -2,40 +2,22 @@
namespace LayoutBXLYT.CTR
{
public class TexCoordGen
public class TexCoordGen : BxlytTexCoordGen
{
public MatrixType GenType { get; set; }
public TextureGenerationType Source { get; set; }
ushort Unknown { get; set; }
public TexCoordGen(FileReader reader, BxlytHeader header)
{
GenType = (MatrixType)reader.ReadByte();
Source = (TextureGenerationType)reader.ReadByte();
Matrix = (TexGenMatrixType)reader.ReadByte();
Source = (TexGenType)reader.ReadByte();
Unknown = reader.ReadUInt16();
}
public void Write(FileWriter writer)
{
writer.Write((byte)GenType);
writer.Write((byte)Matrix);
writer.Write((byte)Source);
writer.Write(Unknown);
}
public enum MatrixType : byte
{
Matrix2x4 = 0
}
public enum TextureGenerationType : byte
{
Tex0 = 0,
Tex1 = 1,
Tex2 = 2,
Ortho = 3,
PaneBased = 4,
PerspectiveProj = 5
}
}
}

View file

@ -38,10 +38,6 @@ namespace LayoutBXLYT.CTR
}
}
public byte PartsScale { get; set; }
public byte PaneMagFlags { get; set; }
[DisplayName("User Data"), CategoryAttribute("User Data")]
public UserData UserData { get; set; }

View file

@ -94,6 +94,12 @@ namespace LayoutBXLYT
}
}
[DisplayName("Parts Flag"), CategoryAttribute("Flags")]
public byte PaneMagFlags { get; set; }
[DisplayName("User Data Info"), CategoryAttribute("User Data")]
public string UserDataInfo { get; set; }
[DisplayName("Is Visible"), CategoryAttribute("Flags")]
public virtual bool Visible { get; set; }
@ -681,6 +687,28 @@ namespace LayoutBXLYT
}
}
public enum TexGenMatrixType : byte
{
Matrix2x4 = 0
}
public enum TexGenType : byte
{
TextureCoord0 = 0,
TextureCoord1 = 1,
TextureCoord2 = 2,
OrthographicProjection = 3,
PaneBasedProjection = 4,
PerspectiveProjection = 5
}
public enum PartPaneScaling
{
Scaling = 0,
Ignore = 1,
FitBoundries = 2,
}
public enum FilterMode
{
Near = 0,
@ -721,8 +749,8 @@ namespace LayoutBXLYT
public virtual WrapMode WrapModeU { get; set; }
public virtual WrapMode WrapModeV { get; set; }
public virtual FilterMode MinFilterMode { get; set; }
public virtual FilterMode MaxFilterMode { get; set; }
public virtual FilterMode MinFilterMode { get; set; } = FilterMode.Linear;
public virtual FilterMode MaxFilterMode { get; set; } = FilterMode.Linear;
}
public class BxlytAlphaCompare
@ -2387,6 +2415,16 @@ namespace LayoutBXLYT
}
}
/// <summary>
/// Removes any texture coordinate references when a texture coordinate is removed.
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public virtual bool RemoveTexCoordSources(int index)
{
return false;
}
public virtual void AddTexture(string texture)
{
int index = ParentLayout.AddTexture(texture);
@ -2444,6 +2482,18 @@ namespace LayoutBXLYT
[DisplayName("Tev Stages"), CategoryAttribute("Tev")]
public BxlytTevStage[] TevStages { get; set; }
[DisplayName("Texture Coordinate Params"), CategoryAttribute("Texture")]
public BxlytTexCoordGen[] TexCoordGens { get; set; }
[DisplayName("Projection Texture Coord Parameters"), CategoryAttribute("Texture")]
public ProjectionTexGenParam[] ProjTexGenParams { get; set; }
}
public class BxlytTexCoordGen
{
public TexGenMatrixType Matrix { get; set; }
public TexGenType Source { get; set; }
}
public class BxlytTevStage

View file

@ -88,6 +88,20 @@ namespace LayoutBXLYT.Revolution
return mat;
}
public override bool RemoveTexCoordSources(int index)
{
foreach (var texGen in TexCoordGens)
{
//Shift all tex coord types down when an index is removed
if (texGen.Source >= TexCoordGenSource.GX_TG_TEX1 &&
texGen.Source < TexCoordGenSource.GX_TG_TEX7)
{
texGen.Source = texGen.Source - 1;
}
}
return true;
}
public bool HasMaterialColor { get; set; }
public bool HasChannelControl { get; set; }
public bool HasBlendMode { get; set; }

View file

@ -45,10 +45,6 @@ namespace LayoutBXLYT.Revolution
public byte PartsScale { get; set; }
public byte PaneMagFlags { get; set; }
public string UserDataInfo { get; set; }
public PAN1() { }
public PAN1(BxlytHeader header, string name) : base()

View file

@ -75,6 +75,8 @@
this.radioBottomBtnParent = new Toolbox.Library.Forms.STRadioButton();
this.radioTopBtnParent = new Toolbox.Library.Forms.STRadioButton();
this.radioCenterBtnParent = new Toolbox.Library.Forms.STRadioButton();
this.partPaneScalingCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel8 = new Toolbox.Library.Forms.STLabel();
this.stFlowLayoutPanel1.SuspendLayout();
this.stDropDownPanel1.SuspendLayout();
this.stDropDownPanel2.SuspendLayout();
@ -158,6 +160,8 @@
// stDropDownPanel2
//
this.stDropDownPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.stDropDownPanel2.Controls.Add(this.stLabel8);
this.stDropDownPanel2.Controls.Add(this.partPaneScalingCB);
this.stDropDownPanel2.Controls.Add(this.rotZUD);
this.stDropDownPanel2.Controls.Add(this.tranZUD);
this.stDropDownPanel2.Controls.Add(this.sizeYUD);
@ -182,7 +186,7 @@
this.stDropDownPanel2.SetIcon = null;
this.stDropDownPanel2.SetIconAlphaColor = System.Drawing.SystemColors.Control;
this.stDropDownPanel2.SetIconColor = System.Drawing.SystemColors.Control;
this.stDropDownPanel2.Size = new System.Drawing.Size(477, 166);
this.stDropDownPanel2.Size = new System.Drawing.Size(477, 181);
this.stDropDownPanel2.TabIndex = 5;
//
// rotZUD
@ -204,7 +208,7 @@
this.rotZUD.IncrementAmount = 0.01F;
this.rotZUD.InputName = "Z";
this.rotZUD.LargeChange = 5F;
this.rotZUD.Location = new System.Drawing.Point(347, 60);
this.rotZUD.Location = new System.Drawing.Point(335, 59);
this.rotZUD.Maximum = 300000F;
this.rotZUD.Minimum = -300000F;
this.rotZUD.Name = "rotZUD";
@ -247,7 +251,7 @@
this.tranZUD.IncrementAmount = 0.01F;
this.tranZUD.InputName = "Z";
this.tranZUD.LargeChange = 5F;
this.tranZUD.Location = new System.Drawing.Point(347, 29);
this.tranZUD.Location = new System.Drawing.Point(335, 28);
this.tranZUD.Maximum = 300000F;
this.tranZUD.Minimum = -300000F;
this.tranZUD.Name = "tranZUD";
@ -290,7 +294,7 @@
this.sizeYUD.IncrementAmount = 0.01F;
this.sizeYUD.InputName = "Y";
this.sizeYUD.LargeChange = 5F;
this.sizeYUD.Location = new System.Drawing.Point(234, 122);
this.sizeYUD.Location = new System.Drawing.Point(222, 121);
this.sizeYUD.Maximum = 300000F;
this.sizeYUD.Minimum = -300000F;
this.sizeYUD.Name = "sizeYUD";
@ -333,7 +337,7 @@
this.scaleYUD.IncrementAmount = 0.01F;
this.scaleYUD.InputName = "Y";
this.scaleYUD.LargeChange = 5F;
this.scaleYUD.Location = new System.Drawing.Point(234, 91);
this.scaleYUD.Location = new System.Drawing.Point(222, 90);
this.scaleYUD.Maximum = 300000F;
this.scaleYUD.Minimum = -300000F;
this.scaleYUD.Name = "scaleYUD";
@ -376,7 +380,7 @@
this.rotYUD.IncrementAmount = 0.01F;
this.rotYUD.InputName = "Y";
this.rotYUD.LargeChange = 5F;
this.rotYUD.Location = new System.Drawing.Point(234, 60);
this.rotYUD.Location = new System.Drawing.Point(222, 59);
this.rotYUD.Maximum = 300000F;
this.rotYUD.Minimum = -300000F;
this.rotYUD.Name = "rotYUD";
@ -419,7 +423,7 @@
this.tranYUD.IncrementAmount = 0.01F;
this.tranYUD.InputName = "Y";
this.tranYUD.LargeChange = 5F;
this.tranYUD.Location = new System.Drawing.Point(234, 29);
this.tranYUD.Location = new System.Drawing.Point(222, 28);
this.tranYUD.Maximum = 300000F;
this.tranYUD.Minimum = -300000F;
this.tranYUD.Name = "tranYUD";
@ -462,7 +466,7 @@
this.sizeXUD.IncrementAmount = 0.01F;
this.sizeXUD.InputName = "X";
this.sizeXUD.LargeChange = 5F;
this.sizeXUD.Location = new System.Drawing.Point(121, 122);
this.sizeXUD.Location = new System.Drawing.Point(109, 121);
this.sizeXUD.Maximum = 300000F;
this.sizeXUD.Minimum = -300000F;
this.sizeXUD.Name = "sizeXUD";
@ -505,7 +509,7 @@
this.scaleXUD.IncrementAmount = 0.01F;
this.scaleXUD.InputName = "X";
this.scaleXUD.LargeChange = 5F;
this.scaleXUD.Location = new System.Drawing.Point(121, 91);
this.scaleXUD.Location = new System.Drawing.Point(109, 90);
this.scaleXUD.Maximum = 300000F;
this.scaleXUD.Minimum = -300000F;
this.scaleXUD.Name = "scaleXUD";
@ -548,7 +552,7 @@
this.rotXUD.IncrementAmount = 0.01F;
this.rotXUD.InputName = "X";
this.rotXUD.LargeChange = 5F;
this.rotXUD.Location = new System.Drawing.Point(121, 60);
this.rotXUD.Location = new System.Drawing.Point(109, 59);
this.rotXUD.Maximum = 300000F;
this.rotXUD.Minimum = -300000F;
this.rotXUD.Name = "rotXUD";
@ -591,7 +595,7 @@
this.tranXUD.IncrementAmount = 0.01F;
this.tranXUD.InputName = "X";
this.tranXUD.LargeChange = 5F;
this.tranXUD.Location = new System.Drawing.Point(121, 29);
this.tranXUD.Location = new System.Drawing.Point(109, 28);
this.tranXUD.Maximum = 300000F;
this.tranXUD.Minimum = -300000F;
this.tranXUD.Name = "tranXUD";
@ -661,7 +665,7 @@
this.stDropDownPanel3.Controls.Add(this.stLabel7);
this.stDropDownPanel3.ExpandedHeight = 105;
this.stDropDownPanel3.IsExpanded = true;
this.stDropDownPanel3.Location = new System.Drawing.Point(0, 271);
this.stDropDownPanel3.Location = new System.Drawing.Point(0, 286);
this.stDropDownPanel3.Margin = new System.Windows.Forms.Padding(0);
this.stDropDownPanel3.Name = "stDropDownPanel3";
this.stDropDownPanel3.PanelName = "Visibilty";
@ -767,7 +771,7 @@
this.stDropDownPanel4.Controls.Add(this.radioCenterBtn);
this.stDropDownPanel4.ExpandedHeight = 0;
this.stDropDownPanel4.IsExpanded = true;
this.stDropDownPanel4.Location = new System.Drawing.Point(0, 376);
this.stDropDownPanel4.Location = new System.Drawing.Point(0, 391);
this.stDropDownPanel4.Margin = new System.Windows.Forms.Padding(0);
this.stDropDownPanel4.Name = "stDropDownPanel4";
this.stDropDownPanel4.PanelName = "Orientation";
@ -891,7 +895,7 @@
this.stDropDownPanel5.Controls.Add(this.radioCenterBtnParent);
this.stDropDownPanel5.ExpandedHeight = 0;
this.stDropDownPanel5.IsExpanded = true;
this.stDropDownPanel5.Location = new System.Drawing.Point(0, 485);
this.stDropDownPanel5.Location = new System.Drawing.Point(0, 500);
this.stDropDownPanel5.Margin = new System.Windows.Forms.Padding(0);
this.stDropDownPanel5.Name = "stDropDownPanel5";
this.stDropDownPanel5.PanelName = "Parent Orientation";
@ -1001,6 +1005,28 @@
this.radioCenterBtnParent.Text = "Center";
this.radioCenterBtnParent.UseVisualStyleBackColor = true;
//
// partPaneScalingCB
//
this.partPaneScalingCB.BorderColor = System.Drawing.Color.Empty;
this.partPaneScalingCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.partPaneScalingCB.ButtonColor = System.Drawing.Color.Empty;
this.partPaneScalingCB.FormattingEnabled = true;
this.partPaneScalingCB.IsReadOnly = false;
this.partPaneScalingCB.Location = new System.Drawing.Point(109, 152);
this.partPaneScalingCB.Name = "partPaneScalingCB";
this.partPaneScalingCB.Size = new System.Drawing.Size(180, 21);
this.partPaneScalingCB.TabIndex = 52;
this.partPaneScalingCB.SelectedIndexChanged += new System.EventHandler(this.partPaneScalingCB_SelectedIndexChanged);
//
// stLabel8
//
this.stLabel8.AutoSize = true;
this.stLabel8.Location = new System.Drawing.Point(34, 155);
this.stLabel8.Name = "stLabel8";
this.stLabel8.Size = new System.Drawing.Size(67, 13);
this.stLabel8.TabIndex = 53;
this.stLabel8.Text = "Part Scaling:";
//
// BasePaneEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1074,5 +1100,7 @@
private Toolbox.Library.Forms.STRadioButton radioBottomBtnParent;
private Toolbox.Library.Forms.STRadioButton radioCenterBtnParent;
private Toolbox.Library.Forms.STRadioButton radioTopBtnParent;
private Toolbox.Library.Forms.STLabel stLabel8;
private Toolbox.Library.Forms.STComboBox partPaneScalingCB;
}
}

View file

@ -20,12 +20,16 @@ namespace LayoutBXLYT
{
InitializeComponent();
userNameTB.MaxLength = 8;
stDropDownPanel1.ResetColors();
stDropDownPanel2.ResetColors();
stDropDownPanel3.ResetColors();
stDropDownPanel4.ResetColors();
stDropDownPanel5.ResetColors();
partPaneScalingCB.LoadEnum(typeof(PartPaneScaling));
alphaSelectorHorizontalPanel1.AlphaChanged += OnAlphaSliderChanged;
alphaUD.ValueChanged += OnAlphaChanged;
@ -77,6 +81,8 @@ namespace LayoutBXLYT
SetUIState();
nameTB.Bind(pane, "Name");
userNameTB.Bind(pane, "UserDataInfo");
partPaneScalingCB.SelectedItem = (PartPaneScaling)pane.PaneMagFlags;
SetTransform();
@ -476,5 +482,11 @@ namespace LayoutBXLYT
private void BasePaneEditor_MouseEnter(object sender, EventArgs e) {
RefreshEditor();
}
private void partPaneScalingCB_SelectedIndexChanged(object sender, EventArgs e) {
if (!Loaded) return;
var scalingMode = (PartPaneScaling)partPaneScalingCB.SelectedItem;
ActivePane.PaneMagFlags = (byte)scalingMode;
}
}
}

View file

@ -47,6 +47,8 @@
this.topLeftYUD = new BarSlider.BarSlider();
this.topLeftXUD = new BarSlider.BarSlider();
this.stLabel6 = new Toolbox.Library.Forms.STLabel();
this.btnAdd = new Toolbox.Library.Forms.STButton();
this.btnRemove = new Toolbox.Library.Forms.STButton();
this.stFlowLayoutPanel1.SuspendLayout();
this.stDropDownPanel1.SuspendLayout();
this.stDropDownPanel3.SuspendLayout();
@ -111,6 +113,8 @@
// stDropDownPanel3
//
this.stDropDownPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.stDropDownPanel3.Controls.Add(this.btnRemove);
this.stDropDownPanel3.Controls.Add(this.btnAdd);
this.stDropDownPanel3.Controls.Add(this.texCoordIndexCB);
this.stDropDownPanel3.Controls.Add(this.bottomRightYUD);
this.stDropDownPanel3.Controls.Add(this.bottomRightXUD);
@ -166,7 +170,6 @@
this.bottomRightYUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.bottomRightYUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.bottomRightYUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.bottomRightYUD.ForeColor = System.Drawing.Color.White;
this.bottomRightYUD.IncrementAmount = 0.01F;
this.bottomRightYUD.InputName = "Y";
this.bottomRightYUD.LargeChange = 5F;
@ -210,7 +213,6 @@
this.bottomRightXUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.bottomRightXUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.bottomRightXUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.bottomRightXUD.ForeColor = System.Drawing.Color.White;
this.bottomRightXUD.IncrementAmount = 0.01F;
this.bottomRightXUD.InputName = "X";
this.bottomRightXUD.LargeChange = 5F;
@ -263,7 +265,6 @@
this.bottomLeftYUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.bottomLeftYUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.bottomLeftYUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.bottomLeftYUD.ForeColor = System.Drawing.Color.White;
this.bottomLeftYUD.IncrementAmount = 0.01F;
this.bottomLeftYUD.InputName = "Y";
this.bottomLeftYUD.LargeChange = 5F;
@ -307,7 +308,6 @@
this.bottomLeftXUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.bottomLeftXUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.bottomLeftXUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.bottomLeftXUD.ForeColor = System.Drawing.Color.White;
this.bottomLeftXUD.IncrementAmount = 0.01F;
this.bottomLeftXUD.InputName = "X";
this.bottomLeftXUD.LargeChange = 5F;
@ -360,7 +360,6 @@
this.topRightYUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.topRightYUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.topRightYUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.topRightYUD.ForeColor = System.Drawing.Color.White;
this.topRightYUD.IncrementAmount = 0.01F;
this.topRightYUD.InputName = "Y";
this.topRightYUD.LargeChange = 5F;
@ -404,7 +403,6 @@
this.topRightXUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.topRightXUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.topRightXUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.topRightXUD.ForeColor = System.Drawing.Color.White;
this.topRightXUD.IncrementAmount = 0.01F;
this.topRightXUD.InputName = "X";
this.topRightXUD.LargeChange = 5F;
@ -457,7 +455,6 @@
this.topLeftYUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.topLeftYUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.topLeftYUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.topLeftYUD.ForeColor = System.Drawing.Color.White;
this.topLeftYUD.IncrementAmount = 0.01F;
this.topLeftYUD.InputName = "Y";
this.topLeftYUD.LargeChange = 5F;
@ -501,7 +498,6 @@
this.topLeftXUD.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.topLeftXUD.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.topLeftXUD.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.topLeftXUD.ForeColor = System.Drawing.Color.White;
this.topLeftXUD.IncrementAmount = 0.01F;
this.topLeftXUD.InputName = "X";
this.topLeftXUD.LargeChange = 5F;
@ -538,6 +534,28 @@
this.stLabel6.TabIndex = 47;
this.stLabel6.Text = "Top Left:";
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(187, 22);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(27, 23);
this.btnAdd.TabIndex = 60;
this.btnAdd.Text = "+";
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnRemove
//
this.btnRemove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRemove.Location = new System.Drawing.Point(154, 22);
this.btnRemove.Name = "btnRemove";
this.btnRemove.Size = new System.Drawing.Size(27, 23);
this.btnRemove.TabIndex = 61;
this.btnRemove.Text = "-";
this.btnRemove.UseVisualStyleBackColor = false;
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
//
// BasePictureboxEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -574,5 +592,7 @@
private BarSlider.BarSlider topLeftXUD;
private Toolbox.Library.Forms.STLabel stLabel6;
private Toolbox.Library.Forms.STComboBox texCoordIndexCB;
private Toolbox.Library.Forms.STButton btnRemove;
private Toolbox.Library.Forms.STButton btnAdd;
}
}

View file

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
using Toolbox.Library.IO;
namespace LayoutBXLYT
{
@ -50,16 +51,30 @@ namespace LayoutBXLYT
vertexColorBox1.BottomRightColor = pane.ColorBottomRight.Color;
vertexColorBox1.Refresh();
texCoordIndexCB.Items.Clear();
for (int i = 0; i < pane.TexCoords?.Length; i++)
texCoordIndexCB.Items.Add($"TexCoord [{i}]");
if (pane.TexCoords?.Length > 0)
texCoordIndexCB.SelectedIndex = 0;
ReloadTexCoord(0);
Loaded = true;
}
private void ReloadTexCoord(int index) {
texCoordIndexCB.Items.Clear();
for (int i = 0; i < ActivePane.TexCoords?.Length; i++)
texCoordIndexCB.Items.Add($"TexCoord [{i}]");
if (ActivePane.TexCoords?.Length > index)
texCoordIndexCB.SelectedIndex = index;
if (ActivePane.TexCoords.Length == 3)
btnAdd.Enabled = false;
else
btnAdd.Enabled = true;
if (ActivePane.TexCoords.Length == 1)
btnRemove.Enabled = false;
else
btnRemove.Enabled = true;
}
private void OnColorChanged(object sender, EventArgs e)
{
if (!Loaded) return;
@ -131,5 +146,34 @@ namespace LayoutBXLYT
public override void OnControlClosing() {
vertexColorBox1.DisposeControl();
}
private void btnAdd_Click(object sender, EventArgs e) {
if (ActivePane.Material == null) return;
if (ActivePane.Material.TextureMaps.Length <= ActivePane.TexCoords.Length) {
MessageBox.Show($"You should have atleast {ActivePane.Material.TextureMaps.Length + 1} " +
"textures to add new texture coordinates!");
return;
}
ActivePane.TexCoords = ActivePane.TexCoords.AddToArray(new TexCoord());
ReloadTexCoord(ActivePane.TexCoords.Length - 1);
}
private void btnRemove_Click(object sender, EventArgs e) {
int index = texCoordIndexCB.SelectedIndex;
if (index == -1 || ActivePane.Material == null) return;
var result = MessageBox.Show($"Are you sure you want to remove texture coordinate {index}? This will make any texture mapped to this to the first one.",
"Layout Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes) {
bool removed = ActivePane.Material.RemoveTexCoordSources(index);
if (removed)
ActivePane.TexCoords = ActivePane.TexCoords.RemoveAt(index);
ReloadTexCoord(ActivePane.TexCoords.Length - 1);
}
}
}
}

View file

@ -41,6 +41,8 @@
this.stFlowLayoutPanel1 = new Toolbox.Library.Forms.STFlowLayoutPanel();
this.stDropDownPanel1 = new Toolbox.Library.Forms.STDropDownPanel();
this.stDropDownPanel2 = new Toolbox.Library.Forms.STDropDownPanel();
this.textureNameTB = new Toolbox.Library.Forms.STTextBox();
this.stLabel8 = new Toolbox.Library.Forms.STLabel();
this.shrinkCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel3 = new Toolbox.Library.Forms.STLabel();
this.expandCB = new Toolbox.Library.Forms.STComboBox();
@ -50,6 +52,16 @@
this.wrapModeUCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.stDropDownPanel3 = new Toolbox.Library.Forms.STDropDownPanel();
this.projectionParamsPanel = new Toolbox.Library.Forms.STPanel();
this.stLabel11 = new Toolbox.Library.Forms.STLabel();
this.barSlider5 = new BarSlider.BarSlider();
this.barSlider2 = new BarSlider.BarSlider();
this.barSlider4 = new BarSlider.BarSlider();
this.barSlider3 = new BarSlider.BarSlider();
this.stLabel12 = new Toolbox.Library.Forms.STLabel();
this.stLabel10 = new Toolbox.Library.Forms.STLabel();
this.stLabel9 = new Toolbox.Library.Forms.STLabel();
this.transformTypeCB = new Toolbox.Library.Forms.STComboBox();
this.rotUD = new BarSlider.BarSlider();
this.transYUD = new BarSlider.BarSlider();
this.transXUD = new BarSlider.BarSlider();
@ -58,8 +70,6 @@
this.stLabel5 = new Toolbox.Library.Forms.STLabel();
this.scaleYUD = new BarSlider.BarSlider();
this.scaleXUD = new BarSlider.BarSlider();
this.stLabel8 = new Toolbox.Library.Forms.STLabel();
this.textureNameTB = new Toolbox.Library.Forms.STTextBox();
((System.ComponentModel.ISupportInitialize)(this.stPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.stPanel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.stPanel3)).BeginInit();
@ -68,6 +78,7 @@
this.stDropDownPanel1.SuspendLayout();
this.stDropDownPanel2.SuspendLayout();
this.stDropDownPanel3.SuspendLayout();
this.projectionParamsPanel.SuspendLayout();
this.SuspendLayout();
//
// addbtn
@ -240,6 +251,23 @@
this.stDropDownPanel2.Size = new System.Drawing.Size(408, 214);
this.stDropDownPanel2.TabIndex = 1;
//
// textureNameTB
//
this.textureNameTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textureNameTB.Location = new System.Drawing.Point(263, 28);
this.textureNameTB.Name = "textureNameTB";
this.textureNameTB.Size = new System.Drawing.Size(142, 20);
this.textureNameTB.TabIndex = 16;
//
// stLabel8
//
this.stLabel8.AutoSize = true;
this.stLabel8.Location = new System.Drawing.Point(183, 30);
this.stLabel8.Name = "stLabel8";
this.stLabel8.Size = new System.Drawing.Size(38, 13);
this.stLabel8.TabIndex = 15;
this.stLabel8.Text = "Name:";
//
// shrinkCB
//
this.shrinkCB.BorderColor = System.Drawing.Color.Empty;
@ -331,6 +359,9 @@
// stDropDownPanel3
//
this.stDropDownPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.stDropDownPanel3.Controls.Add(this.projectionParamsPanel);
this.stDropDownPanel3.Controls.Add(this.stLabel9);
this.stDropDownPanel3.Controls.Add(this.transformTypeCB);
this.stDropDownPanel3.Controls.Add(this.rotUD);
this.stDropDownPanel3.Controls.Add(this.transYUD);
this.stDropDownPanel3.Controls.Add(this.transXUD);
@ -349,9 +380,240 @@
this.stDropDownPanel3.SetIcon = null;
this.stDropDownPanel3.SetIconAlphaColor = System.Drawing.SystemColors.Control;
this.stDropDownPanel3.SetIconColor = System.Drawing.SystemColors.Control;
this.stDropDownPanel3.Size = new System.Drawing.Size(408, 150);
this.stDropDownPanel3.Size = new System.Drawing.Size(408, 282);
this.stDropDownPanel3.TabIndex = 2;
//
// projectionParamsPanel
//
this.projectionParamsPanel.Controls.Add(this.stLabel11);
this.projectionParamsPanel.Controls.Add(this.barSlider5);
this.projectionParamsPanel.Controls.Add(this.barSlider2);
this.projectionParamsPanel.Controls.Add(this.barSlider4);
this.projectionParamsPanel.Controls.Add(this.barSlider3);
this.projectionParamsPanel.Controls.Add(this.stLabel12);
this.projectionParamsPanel.Controls.Add(this.stLabel10);
this.projectionParamsPanel.Location = new System.Drawing.Point(14, 155);
this.projectionParamsPanel.Name = "projectionParamsPanel";
this.projectionParamsPanel.Size = new System.Drawing.Size(341, 124);
this.projectionParamsPanel.TabIndex = 61;
//
// stLabel11
//
this.stLabel11.AutoSize = true;
this.stLabel11.Location = new System.Drawing.Point(18, 6);
this.stLabel11.Name = "stLabel11";
this.stLabel11.Size = new System.Drawing.Size(95, 13);
this.stLabel11.TabIndex = 62;
this.stLabel11.Text = "Projection Params:";
//
// barSlider5
//
this.barSlider5.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.barSlider5.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.barSlider5.BarPenColorBottom = System.Drawing.Color.Empty;
this.barSlider5.BarPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider5.BarPenColorTop = System.Drawing.Color.Empty;
this.barSlider5.BorderRoundRectSize = new System.Drawing.Size(32, 32);
this.barSlider5.DataType = null;
this.barSlider5.DrawSemitransparentThumb = false;
this.barSlider5.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider5.ElapsedPenColorBottom = System.Drawing.Color.Empty;
this.barSlider5.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider5.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.barSlider5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.barSlider5.IncrementAmount = 0.01F;
this.barSlider5.InputName = "U";
this.barSlider5.LargeChange = 5F;
this.barSlider5.Location = new System.Drawing.Point(68, 32);
this.barSlider5.Maximum = 300000F;
this.barSlider5.Minimum = -300000F;
this.barSlider5.Name = "barSlider5";
this.barSlider5.Precision = 0.01F;
this.barSlider5.ScaleDivisions = 1;
this.barSlider5.ScaleSubDivisions = 2;
this.barSlider5.ShowDivisionsText = false;
this.barSlider5.ShowSmallScale = false;
this.barSlider5.Size = new System.Drawing.Size(107, 25);
this.barSlider5.SmallChange = 0.01F;
this.barSlider5.TabIndex = 62;
this.barSlider5.Text = "barSlider2";
this.barSlider5.ThumbInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider5.ThumbPenColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider5.ThumbRoundRectSize = new System.Drawing.Size(1, 1);
this.barSlider5.ThumbSize = new System.Drawing.Size(1, 1);
this.barSlider5.TickAdd = 0F;
this.barSlider5.TickColor = System.Drawing.Color.White;
this.barSlider5.TickDivide = 0F;
this.barSlider5.TickStyle = System.Windows.Forms.TickStyle.None;
this.barSlider5.UseInterlapsedBar = false;
this.barSlider5.Value = 1F;
//
// barSlider2
//
this.barSlider2.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.barSlider2.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.barSlider2.BarPenColorBottom = System.Drawing.Color.Empty;
this.barSlider2.BarPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider2.BarPenColorTop = System.Drawing.Color.Empty;
this.barSlider2.BorderRoundRectSize = new System.Drawing.Size(32, 32);
this.barSlider2.DataType = null;
this.barSlider2.DrawSemitransparentThumb = false;
this.barSlider2.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider2.ElapsedPenColorBottom = System.Drawing.Color.Empty;
this.barSlider2.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider2.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.barSlider2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.barSlider2.IncrementAmount = 0.01F;
this.barSlider2.InputName = "V";
this.barSlider2.LargeChange = 5F;
this.barSlider2.Location = new System.Drawing.Point(181, 63);
this.barSlider2.Maximum = 300000F;
this.barSlider2.Minimum = -300000F;
this.barSlider2.Name = "barSlider2";
this.barSlider2.Precision = 0.01F;
this.barSlider2.ScaleDivisions = 1;
this.barSlider2.ScaleSubDivisions = 2;
this.barSlider2.ShowDivisionsText = false;
this.barSlider2.ShowSmallScale = false;
this.barSlider2.Size = new System.Drawing.Size(107, 25);
this.barSlider2.SmallChange = 0.01F;
this.barSlider2.TabIndex = 68;
this.barSlider2.Text = "barSlider2";
this.barSlider2.ThumbInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider2.ThumbPenColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider2.ThumbRoundRectSize = new System.Drawing.Size(1, 1);
this.barSlider2.ThumbSize = new System.Drawing.Size(1, 1);
this.barSlider2.TickAdd = 0F;
this.barSlider2.TickColor = System.Drawing.Color.White;
this.barSlider2.TickDivide = 0F;
this.barSlider2.TickStyle = System.Windows.Forms.TickStyle.None;
this.barSlider2.UseInterlapsedBar = false;
this.barSlider2.Value = 0F;
//
// barSlider4
//
this.barSlider4.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.barSlider4.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.barSlider4.BarPenColorBottom = System.Drawing.Color.Empty;
this.barSlider4.BarPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider4.BarPenColorTop = System.Drawing.Color.Empty;
this.barSlider4.BorderRoundRectSize = new System.Drawing.Size(32, 32);
this.barSlider4.DataType = null;
this.barSlider4.DrawSemitransparentThumb = false;
this.barSlider4.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider4.ElapsedPenColorBottom = System.Drawing.Color.Empty;
this.barSlider4.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider4.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.barSlider4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.barSlider4.IncrementAmount = 0.01F;
this.barSlider4.InputName = "V";
this.barSlider4.LargeChange = 5F;
this.barSlider4.Location = new System.Drawing.Point(181, 32);
this.barSlider4.Maximum = 300000F;
this.barSlider4.Minimum = -300000F;
this.barSlider4.Name = "barSlider4";
this.barSlider4.Precision = 0.01F;
this.barSlider4.ScaleDivisions = 1;
this.barSlider4.ScaleSubDivisions = 2;
this.barSlider4.ShowDivisionsText = false;
this.barSlider4.ShowSmallScale = false;
this.barSlider4.Size = new System.Drawing.Size(107, 25);
this.barSlider4.SmallChange = 0.01F;
this.barSlider4.TabIndex = 63;
this.barSlider4.Text = "barSlider2";
this.barSlider4.ThumbInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider4.ThumbPenColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider4.ThumbRoundRectSize = new System.Drawing.Size(1, 1);
this.barSlider4.ThumbSize = new System.Drawing.Size(1, 1);
this.barSlider4.TickAdd = 0F;
this.barSlider4.TickColor = System.Drawing.Color.White;
this.barSlider4.TickDivide = 0F;
this.barSlider4.TickStyle = System.Windows.Forms.TickStyle.None;
this.barSlider4.UseInterlapsedBar = false;
this.barSlider4.Value = 1F;
//
// barSlider3
//
this.barSlider3.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.barSlider3.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.barSlider3.BarPenColorBottom = System.Drawing.Color.Empty;
this.barSlider3.BarPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider3.BarPenColorTop = System.Drawing.Color.Empty;
this.barSlider3.BorderRoundRectSize = new System.Drawing.Size(32, 32);
this.barSlider3.DataType = null;
this.barSlider3.DrawSemitransparentThumb = false;
this.barSlider3.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider3.ElapsedPenColorBottom = System.Drawing.Color.Empty;
this.barSlider3.ElapsedPenColorMiddle = System.Drawing.Color.Empty;
this.barSlider3.ElapsedPenColorTop = System.Drawing.Color.Empty;
this.barSlider3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
this.barSlider3.IncrementAmount = 0.01F;
this.barSlider3.InputName = "U";
this.barSlider3.LargeChange = 5F;
this.barSlider3.Location = new System.Drawing.Point(68, 63);
this.barSlider3.Maximum = 300000F;
this.barSlider3.Minimum = -300000F;
this.barSlider3.Name = "barSlider3";
this.barSlider3.Precision = 0.01F;
this.barSlider3.ScaleDivisions = 1;
this.barSlider3.ScaleSubDivisions = 2;
this.barSlider3.ShowDivisionsText = false;
this.barSlider3.ShowSmallScale = false;
this.barSlider3.Size = new System.Drawing.Size(107, 25);
this.barSlider3.SmallChange = 0.01F;
this.barSlider3.TabIndex = 67;
this.barSlider3.Text = "barSlider2";
this.barSlider3.ThumbInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider3.ThumbPenColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.barSlider3.ThumbRoundRectSize = new System.Drawing.Size(1, 1);
this.barSlider3.ThumbSize = new System.Drawing.Size(1, 1);
this.barSlider3.TickAdd = 0F;
this.barSlider3.TickColor = System.Drawing.Color.White;
this.barSlider3.TickDivide = 0F;
this.barSlider3.TickStyle = System.Windows.Forms.TickStyle.None;
this.barSlider3.UseInterlapsedBar = false;
this.barSlider3.Value = 0F;
//
// stLabel12
//
this.stLabel12.AutoSize = true;
this.stLabel12.Location = new System.Drawing.Point(4, 37);
this.stLabel12.Name = "stLabel12";
this.stLabel12.Size = new System.Drawing.Size(37, 13);
this.stLabel12.TabIndex = 64;
this.stLabel12.Text = "Scale:";
//
// stLabel10
//
this.stLabel10.AutoSize = true;
this.stLabel10.Location = new System.Drawing.Point(5, 68);
this.stLabel10.Name = "stLabel10";
this.stLabel10.Size = new System.Drawing.Size(54, 13);
this.stLabel10.TabIndex = 66;
this.stLabel10.Text = "Translate:";
//
// stLabel9
//
this.stLabel9.AutoSize = true;
this.stLabel9.Location = new System.Drawing.Point(19, 28);
this.stLabel9.Name = "stLabel9";
this.stLabel9.Size = new System.Drawing.Size(34, 13);
this.stLabel9.TabIndex = 60;
this.stLabel9.Text = "Type:";
//
// transformTypeCB
//
this.transformTypeCB.BorderColor = System.Drawing.Color.Empty;
this.transformTypeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.transformTypeCB.ButtonColor = System.Drawing.Color.Empty;
this.transformTypeCB.FormattingEnabled = true;
this.transformTypeCB.IsReadOnly = false;
this.transformTypeCB.Location = new System.Drawing.Point(82, 25);
this.transformTypeCB.Name = "transformTypeCB";
this.transformTypeCB.Size = new System.Drawing.Size(175, 21);
this.transformTypeCB.TabIndex = 59;
this.transformTypeCB.SelectedIndexChanged += new System.EventHandler(this.transformTypeCB_SelectedIndexChanged);
//
// rotUD
//
this.rotUD.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
@ -370,7 +632,7 @@
this.rotUD.IncrementAmount = 0.01F;
this.rotUD.InputName = "";
this.rotUD.LargeChange = 5F;
this.rotUD.Location = new System.Drawing.Point(86, 73);
this.rotUD.Location = new System.Drawing.Point(82, 81);
this.rotUD.Maximum = 300000F;
this.rotUD.Minimum = -300000F;
this.rotUD.Name = "rotUD";
@ -413,7 +675,7 @@
this.transYUD.IncrementAmount = 0.01F;
this.transYUD.InputName = "V";
this.transYUD.LargeChange = 5F;
this.transYUD.Location = new System.Drawing.Point(199, 104);
this.transYUD.Location = new System.Drawing.Point(195, 112);
this.transYUD.Maximum = 300000F;
this.transYUD.Minimum = -300000F;
this.transYUD.Name = "transYUD";
@ -456,7 +718,7 @@
this.transXUD.IncrementAmount = 0.01F;
this.transXUD.InputName = "U";
this.transXUD.LargeChange = 5F;
this.transXUD.Location = new System.Drawing.Point(86, 104);
this.transXUD.Location = new System.Drawing.Point(82, 112);
this.transXUD.Maximum = 300000F;
this.transXUD.Minimum = -300000F;
this.transXUD.Name = "transXUD";
@ -484,7 +746,7 @@
// stLabel7
//
this.stLabel7.AutoSize = true;
this.stLabel7.Location = new System.Drawing.Point(23, 109);
this.stLabel7.Location = new System.Drawing.Point(19, 117);
this.stLabel7.Name = "stLabel7";
this.stLabel7.Size = new System.Drawing.Size(54, 13);
this.stLabel7.TabIndex = 55;
@ -493,7 +755,7 @@
// stLabel6
//
this.stLabel6.AutoSize = true;
this.stLabel6.Location = new System.Drawing.Point(22, 80);
this.stLabel6.Location = new System.Drawing.Point(18, 88);
this.stLabel6.Name = "stLabel6";
this.stLabel6.Size = new System.Drawing.Size(42, 13);
this.stLabel6.TabIndex = 54;
@ -502,7 +764,7 @@
// stLabel5
//
this.stLabel5.AutoSize = true;
this.stLabel5.Location = new System.Drawing.Point(22, 47);
this.stLabel5.Location = new System.Drawing.Point(18, 55);
this.stLabel5.Name = "stLabel5";
this.stLabel5.Size = new System.Drawing.Size(37, 13);
this.stLabel5.TabIndex = 53;
@ -526,7 +788,7 @@
this.scaleYUD.IncrementAmount = 0.01F;
this.scaleYUD.InputName = "V";
this.scaleYUD.LargeChange = 5F;
this.scaleYUD.Location = new System.Drawing.Point(199, 42);
this.scaleYUD.Location = new System.Drawing.Point(195, 50);
this.scaleYUD.Maximum = 300000F;
this.scaleYUD.Minimum = -300000F;
this.scaleYUD.Name = "scaleYUD";
@ -569,7 +831,7 @@
this.scaleXUD.IncrementAmount = 0.01F;
this.scaleXUD.InputName = "U";
this.scaleXUD.LargeChange = 5F;
this.scaleXUD.Location = new System.Drawing.Point(86, 42);
this.scaleXUD.Location = new System.Drawing.Point(82, 50);
this.scaleXUD.Maximum = 300000F;
this.scaleXUD.Minimum = -300000F;
this.scaleXUD.Name = "scaleXUD";
@ -594,23 +856,6 @@
this.scaleXUD.Value = 30F;
this.scaleXUD.ValueChanged += new System.EventHandler(this.transformUV_ValueChanged);
//
// stLabel8
//
this.stLabel8.AutoSize = true;
this.stLabel8.Location = new System.Drawing.Point(183, 30);
this.stLabel8.Name = "stLabel8";
this.stLabel8.Size = new System.Drawing.Size(38, 13);
this.stLabel8.TabIndex = 15;
this.stLabel8.Text = "Name:";
//
// textureNameTB
//
this.textureNameTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textureNameTB.Location = new System.Drawing.Point(263, 28);
this.textureNameTB.Name = "textureNameTB";
this.textureNameTB.Size = new System.Drawing.Size(142, 20);
this.textureNameTB.TabIndex = 16;
//
// PaneMatTextureMapsEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -629,6 +874,8 @@
this.stDropDownPanel2.PerformLayout();
this.stDropDownPanel3.ResumeLayout(false);
this.stDropDownPanel3.PerformLayout();
this.projectionParamsPanel.ResumeLayout(false);
this.projectionParamsPanel.PerformLayout();
this.ResumeLayout(false);
}
@ -666,5 +913,15 @@
private BarSlider.BarSlider scaleXUD;
private Toolbox.Library.Forms.STTextBox textureNameTB;
private Toolbox.Library.Forms.STLabel stLabel8;
private Toolbox.Library.Forms.STPanel projectionParamsPanel;
private BarSlider.BarSlider barSlider5;
private BarSlider.BarSlider barSlider2;
private BarSlider.BarSlider barSlider4;
private BarSlider.BarSlider barSlider3;
private Toolbox.Library.Forms.STLabel stLabel12;
private Toolbox.Library.Forms.STLabel stLabel10;
private Toolbox.Library.Forms.STLabel stLabel9;
private Toolbox.Library.Forms.STComboBox transformTypeCB;
private Toolbox.Library.Forms.STLabel stLabel11;
}
}

View file

@ -21,6 +21,8 @@ namespace LayoutBXLYT
{
InitializeComponent();
projectionParamsPanel.Visible = false;
stDropDownPanel1.ResetColors();
stDropDownPanel2.ResetColors();
stDropDownPanel3.ResetColors();
@ -39,10 +41,12 @@ namespace LayoutBXLYT
private List<Bitmap> Images = new List<Bitmap>();
private int SelectedIndex = -1;
private bool Loaded = false;
private int TexCoordinateCount = 1;
public void LoadMaterial(BxlytMaterial material, PaneEditor paneEditor,
Dictionary<string, STGenericTexture> textures)
Dictionary<string, STGenericTexture> textures, int numTextureCoordinates = 1)
{
TexCoordinateCount = numTextureCoordinates;
textureList = textures;
ParentEditor = paneEditor;
ActiveMaterial = material;
@ -56,6 +60,8 @@ namespace LayoutBXLYT
ResetImagePanels();
Images.Clear();
transformTypeCB.Items.Clear();
textureNameTB.Text = "";
for (int i = 0; i < ActiveMaterial.TextureMaps?.Length; i++)
@ -73,6 +79,13 @@ namespace LayoutBXLYT
if (i == 2) SetPanel(stPanel3, bitmap);
}
for (int i = 0; i < TexCoordinateCount; i++)
transformTypeCB.Items.Add((TexGenType)i);
transformTypeCB.Items.Add(TexGenType.OrthographicProjection);
transformTypeCB.Items.Add(TexGenType.PaneBasedProjection);
transformTypeCB.Items.Add(TexGenType.PerspectiveProjection);
ReloadButtons();
Loaded = true;
@ -181,6 +194,12 @@ namespace LayoutBXLYT
else
ResetUVTransformUI();
if (ActiveMaterial.TexCoordGens?.Length > SelectedIndex)
{
var texGen = ActiveMaterial.TexCoordGens[SelectedIndex];
transformTypeCB.SelectedItem = texGen.Source;
}
texLoaded = true;
}
@ -416,6 +435,18 @@ namespace LayoutBXLYT
ParentEditor.PropertyChanged?.Invoke(sender, e);
}
private void transformTypeCB_SelectedIndexChanged(object sender, EventArgs e) {
if (transformTypeCB.SelectedIndex != -1)
{
var type = transformTypeCB.SelectedItem;
if (type.ToString().Contains("Projection")) {
projectionParamsPanel.Visible = true;
}
else
projectionParamsPanel.Visible = false;
}
}
}
public class ImagePanel : PictureBox

View file

@ -261,7 +261,11 @@ namespace LayoutBXLYT
{
UpdateTabIndex();
var textureEditor = GetActiveEditor<PaneMatTextureMapsEditor>();
textureEditor.LoadMaterial(ActiveMaterial, this, ParentEditor.GetTextures());
int numTexCoord = 1;
if (ActivePane is IPicturePane)
numTexCoord = ((IPicturePane)ActivePane).TexCoords.Length;
textureEditor.LoadMaterial(ActiveMaterial, this, ParentEditor.GetTextures(), numTexCoord);
}
private void LoadPartPane(object sender, EventArgs e)