Added QuaternionBox to allow editing of quaternions as Euler angles as well as quaternions

This commit is contained in:
dexy
2021-11-08 09:57:29 +11:00
Unverified
parent 432b42504e
commit 8ac37258c3
12 changed files with 635 additions and 194 deletions
+15 -14
View File
@@ -31,12 +31,12 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditMultiPanel));
this.ScaleTextBox = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.RotationTextBox = new System.Windows.Forms.TextBox();
this.PositionTextBox = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.ItemsListBox = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.RotationQuatBox = new CodeWalker.WinForms.QuaternionBox();
this.SuspendLayout();
//
// ScaleTextBox
@@ -58,16 +58,6 @@
this.label23.TabIndex = 17;
this.label23.Text = "Scale:";
//
// RotationTextBox
//
this.RotationTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RotationTextBox.Location = new System.Drawing.Point(75, 38);
this.RotationTextBox.Name = "RotationTextBox";
this.RotationTextBox.Size = new System.Drawing.Size(478, 20);
this.RotationTextBox.TabIndex = 16;
this.RotationTextBox.TextChanged += new System.EventHandler(this.RotationTextBox_TextChanged);
//
// PositionTextBox
//
this.PositionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -104,7 +94,7 @@
this.ItemsListBox.Location = new System.Drawing.Point(75, 108);
this.ItemsListBox.Name = "ItemsListBox";
this.ItemsListBox.Size = new System.Drawing.Size(202, 355);
this.ItemsListBox.TabIndex = 19;
this.ItemsListBox.TabIndex = 21;
this.ItemsListBox.SelectedIndexChanged += new System.EventHandler(this.ItemsListBox_SelectedIndexChanged);
//
// label1
@@ -116,16 +106,27 @@
this.label1.TabIndex = 20;
this.label1.Text = "Items:";
//
// RotationQuatBox
//
this.RotationQuatBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RotationQuatBox.Location = new System.Drawing.Point(75, 36);
this.RotationQuatBox.Margin = new System.Windows.Forms.Padding(0);
this.RotationQuatBox.Name = "RotationQuatBox";
this.RotationQuatBox.Size = new System.Drawing.Size(478, 24);
this.RotationQuatBox.TabIndex = 16;
this.RotationQuatBox.ValueChanged += new System.EventHandler(this.RotationQuatBox_ValueChanged);
//
// EditMultiPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(565, 505);
this.Controls.Add(this.RotationQuatBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.ItemsListBox);
this.Controls.Add(this.ScaleTextBox);
this.Controls.Add(this.label23);
this.Controls.Add(this.RotationTextBox);
this.Controls.Add(this.PositionTextBox);
this.Controls.Add(this.label24);
this.Controls.Add(this.label25);
@@ -141,11 +142,11 @@
private System.Windows.Forms.TextBox ScaleTextBox;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.TextBox RotationTextBox;
private System.Windows.Forms.TextBox PositionTextBox;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.ListBox ItemsListBox;
private System.Windows.Forms.Label label1;
private WinForms.QuaternionBox RotationQuatBox;
}
}
+7 -7
View File
@@ -1,4 +1,5 @@
using System;
using SharpDX;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -47,7 +48,7 @@ namespace CodeWalker.Project.Panels
if (Items == null)
{
PositionTextBox.Text = string.Empty;
RotationTextBox.Text = string.Empty;
RotationQuatBox.Value = Quaternion.Identity;
ScaleTextBox.Text = string.Empty;
ItemsListBox.Items.Clear();
}
@@ -57,7 +58,7 @@ namespace CodeWalker.Project.Panels
PositionTextBox.Text = FloatUtil.GetVector3String(MultiItem.MultipleSelectionCenter);
RotationTextBox.Text = FloatUtil.GetVector4String(MultiItem.MultipleSelectionRotation.ToVector4());
RotationQuatBox.Value = MultiItem.MultipleSelectionRotation;
ScaleTextBox.Text = FloatUtil.GetVector3String(MultiItem.MultipleSelectionScale);
ItemsListBox.Items.Clear();
foreach (var item in Items)
@@ -90,21 +91,20 @@ namespace CodeWalker.Project.Panels
}
private void RotationTextBox_TextChanged(object sender, EventArgs e)
private void RotationQuatBox_ValueChanged(object sender, EventArgs e)
{
if (Items == null) return;
if (populatingui) return;
var v = FloatUtil.ParseVector4String(RotationTextBox.Text);
var q = RotationQuatBox.Value;
var wf = ProjectForm.WorldForm;
if (wf != null)
{
wf.BeginInvoke(new Action(() =>
{
wf.ChangeMultiRotation(Items, v.ToQuaternion(), false);
wf.ChangeMultiRotation(Items, q, false);
}));
}
}
private void ScaleTextBox_TextChanged(object sender, EventArgs e)
+14 -13
View File
@@ -126,7 +126,6 @@
this.ScenarioEntityPointSpawnTypeHashLabel = new System.Windows.Forms.Label();
this.ScenarioEntityPointSpawnTypeTextBox = new System.Windows.Forms.TextBox();
this.label120 = new System.Windows.Forms.Label();
this.ScenarioEntityPointRotationTextBox = new System.Windows.Forms.TextBox();
this.label118 = new System.Windows.Forms.Label();
this.ScenarioEntityPointGoToButton = new System.Windows.Forms.Button();
this.ScenarioEntityPointPositionTextBox = new System.Windows.Forms.TextBox();
@@ -224,6 +223,7 @@
this.label154 = new System.Windows.Forms.Label();
this.ScenarioClusterPointTypeComboBox = new System.Windows.Forms.ComboBox();
this.label155 = new System.Windows.Forms.Label();
this.ScenarioEntityPointRotationQuatBox = new CodeWalker.WinForms.QuaternionBox();
this.ScenarioTabControl.SuspendLayout();
this.ScenarioPointTabPage.SuspendLayout();
this.ScenarioPointOuterPanel.SuspendLayout();
@@ -1012,6 +1012,7 @@
this.ScenarioEntityPointPanel.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.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointRotationQuatBox);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointNameHashLabel);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointNameTextBox);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointFlagsCheckedListBox);
@@ -1047,7 +1048,6 @@
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointSpawnTypeHashLabel);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointSpawnTypeTextBox);
this.ScenarioEntityPointPanel.Controls.Add(this.label120);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointRotationTextBox);
this.ScenarioEntityPointPanel.Controls.Add(this.label118);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointGoToButton);
this.ScenarioEntityPointPanel.Controls.Add(this.ScenarioEntityPointPositionTextBox);
@@ -1437,16 +1437,6 @@
this.label120.TabIndex = 13;
this.label120.Text = "Spawn type:";
//
// ScenarioEntityPointRotationTextBox
//
this.ScenarioEntityPointRotationTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ScenarioEntityPointRotationTextBox.Location = new System.Drawing.Point(109, 27);
this.ScenarioEntityPointRotationTextBox.Name = "ScenarioEntityPointRotationTextBox";
this.ScenarioEntityPointRotationTextBox.Size = new System.Drawing.Size(313, 20);
this.ScenarioEntityPointRotationTextBox.TabIndex = 9;
this.ScenarioEntityPointRotationTextBox.TextChanged += new System.EventHandler(this.ScenarioEntityPointRotationTextBox_TextChanged);
//
// label118
//
this.label118.AutoSize = true;
@@ -2584,6 +2574,17 @@
this.label155.TabIndex = 10;
this.label155.Text = "Type:";
//
// ScenarioEntityPointRotationQuatBox
//
this.ScenarioEntityPointRotationQuatBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ScenarioEntityPointRotationQuatBox.Location = new System.Drawing.Point(109, 25);
this.ScenarioEntityPointRotationQuatBox.Margin = new System.Windows.Forms.Padding(0);
this.ScenarioEntityPointRotationQuatBox.Name = "ScenarioEntityPointRotationQuatBox";
this.ScenarioEntityPointRotationQuatBox.Size = new System.Drawing.Size(387, 24);
this.ScenarioEntityPointRotationQuatBox.TabIndex = 9;
this.ScenarioEntityPointRotationQuatBox.ValueChanged += new System.EventHandler(this.ScenarioEntityPointRotationQuatBox_ValueChanged);
//
// EditScenarioNodePanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -2746,7 +2747,6 @@
private System.Windows.Forms.Label ScenarioEntityPointSpawnTypeHashLabel;
private System.Windows.Forms.TextBox ScenarioEntityPointSpawnTypeTextBox;
private System.Windows.Forms.Label label120;
private System.Windows.Forms.TextBox ScenarioEntityPointRotationTextBox;
private System.Windows.Forms.Label label118;
private System.Windows.Forms.Button ScenarioEntityPointGoToButton;
private System.Windows.Forms.TextBox ScenarioEntityPointPositionTextBox;
@@ -2844,5 +2844,6 @@
private System.Windows.Forms.Label label154;
private System.Windows.Forms.ComboBox ScenarioClusterPointTypeComboBox;
private System.Windows.Forms.Label label155;
private WinForms.QuaternionBox ScenarioEntityPointRotationQuatBox;
}
}
@@ -327,7 +327,7 @@ namespace CodeWalker.Project.Panels
ScenarioEntityPointNameTextBox.Text = "";
ScenarioEntityPointNameHashLabel.Text = "Hash: 0";
ScenarioEntityPointPositionTextBox.Text = "";
ScenarioEntityPointRotationTextBox.Text = "";
ScenarioEntityPointRotationQuatBox.Value = Quaternion.Identity;
ScenarioEntityPointSpawnTypeTextBox.Text = "";
ScenarioEntityPointSpawnTypeHashLabel.Text = "Hash: 0";
ScenarioEntityPointPedTypeTextBox.Text = "";
@@ -362,7 +362,7 @@ namespace CodeWalker.Project.Panels
ScenarioEntityPointNameTextBox.Text = p.NameHash.ToString();
ScenarioEntityPointNameHashLabel.Text = "Hash: " + p.NameHash.Hash.ToString();
ScenarioEntityPointPositionTextBox.Text = FloatUtil.GetVector3String(p.OffsetPosition);
ScenarioEntityPointRotationTextBox.Text = FloatUtil.GetVector4String(p.OffsetRotation);
ScenarioEntityPointRotationQuatBox.Value = p.OffsetRotation.ToQuaternion();
ScenarioEntityPointSpawnTypeTextBox.Text = p.SpawnType.ToString();
ScenarioEntityPointSpawnTypeHashLabel.Text = "Hash: " + p.SpawnType.Hash.ToString();
ScenarioEntityPointPedTypeTextBox.Text = p.PedType.ToString();
@@ -1266,19 +1266,20 @@ namespace CodeWalker.Project.Panels
}
}
private void ScenarioEntityPointRotationTextBox_TextChanged(object sender, EventArgs e)
private void ScenarioEntityPointRotationQuatBox_ValueChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentScenarioNode == null) return;
if (CurrentScenarioNode.EntityPoint == null) return;
Vector4 v = FloatUtil.ParseVector4String(ScenarioEntityPointRotationTextBox.Text);
Quaternion q = ScenarioEntityPointRotationQuatBox.Value;
Vector4 v = q.ToVector4();
bool change = false;
lock (ProjectForm.ProjectSyncRoot)
{
if (CurrentScenarioNode.EntityPoint.OffsetRotation != v)
{
CurrentScenarioNode.EntityPoint.OffsetRotation = v;
CurrentScenarioNode.Orientation = new Quaternion(v);
CurrentScenarioNode.Orientation = q;
ProjectForm.SetScenarioHasChanged(true);
change = true;
}
@@ -2394,8 +2395,5 @@ namespace CodeWalker.Project.Panels
}
}
}
}
}
+70 -69
View File
@@ -77,17 +77,17 @@
this.CenterGeomTextBox = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.CompositeFlagsTabPage = new System.Windows.Forms.TabPage();
this.CompFlags1CheckedListBox = new System.Windows.Forms.CheckedListBox();
this.label21 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.CompFlags2CheckedListBox = new System.Windows.Forms.CheckedListBox();
this.label21 = new System.Windows.Forms.Label();
this.CompFlags1CheckedListBox = new System.Windows.Forms.CheckedListBox();
this.CompositeXformTabPage = new System.Windows.Forms.TabPage();
this.CompScaleTextBox = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.CompRotationTextBox = new System.Windows.Forms.TextBox();
this.CompPositionTextBox = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.CompRotationQuatBox = new CodeWalker.WinForms.QuaternionBox();
this.BoundsTabControl.SuspendLayout();
this.BoundsTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.UnkTypeUpDown)).BeginInit();
@@ -632,60 +632,6 @@
this.CompositeFlagsTabPage.Text = "Composite Flags";
this.CompositeFlagsTabPage.UseVisualStyleBackColor = true;
//
// CompFlags1CheckedListBox
//
this.CompFlags1CheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.CompFlags1CheckedListBox.CheckOnClick = true;
this.CompFlags1CheckedListBox.FormattingEnabled = true;
this.CompFlags1CheckedListBox.Items.AddRange(new object[] {
"0 - Unknown",
"1 - Map Weapon",
"2 - Map Dynamic",
"3 - Map Animal",
"4 - Map Cover",
"5 - Map Vehicle",
"6 - Vehicle Not BVH",
"7 - Vehicle BVH",
"8 - Vehicle Box",
"9 - Ped",
"10 - Ragdoll",
"11 - Animal",
"12 - Animal Ragdoll",
"13 - Object",
"14 - Object Env Cloth",
"15 - Plant",
"16 - Projectile",
"17 - Explosion",
"18 - Pickup",
"19 - Foliage",
"20 - Forklift Forks",
"21 - Test Weapon",
"22 - Test Camera",
"23 - Test AI",
"24 - Test Script",
"25 - Test Vehicle Wheel",
"26 - Glass",
"27 - Map River",
"28 - Smoke",
"29 - Unsmashed",
"30 - Map Stairs",
"31 - Map Deep Surface"});
this.CompFlags1CheckedListBox.Location = new System.Drawing.Point(53, 3);
this.CompFlags1CheckedListBox.Name = "CompFlags1CheckedListBox";
this.CompFlags1CheckedListBox.Size = new System.Drawing.Size(174, 484);
this.CompFlags1CheckedListBox.TabIndex = 32;
this.CompFlags1CheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.CompFlags1CheckedListBox_ItemCheck);
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(3, 3);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(44, 13);
this.label21.TabIndex = 33;
this.label21.Text = "Flags 1:";
//
// label22
//
this.label22.AutoSize = true;
@@ -740,11 +686,65 @@
this.CompFlags2CheckedListBox.TabIndex = 34;
this.CompFlags2CheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.CompFlags2CheckedListBox_ItemCheck);
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(3, 3);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(44, 13);
this.label21.TabIndex = 33;
this.label21.Text = "Flags 1:";
//
// CompFlags1CheckedListBox
//
this.CompFlags1CheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.CompFlags1CheckedListBox.CheckOnClick = true;
this.CompFlags1CheckedListBox.FormattingEnabled = true;
this.CompFlags1CheckedListBox.Items.AddRange(new object[] {
"0 - Unknown",
"1 - Map Weapon",
"2 - Map Dynamic",
"3 - Map Animal",
"4 - Map Cover",
"5 - Map Vehicle",
"6 - Vehicle Not BVH",
"7 - Vehicle BVH",
"8 - Vehicle Box",
"9 - Ped",
"10 - Ragdoll",
"11 - Animal",
"12 - Animal Ragdoll",
"13 - Object",
"14 - Object Env Cloth",
"15 - Plant",
"16 - Projectile",
"17 - Explosion",
"18 - Pickup",
"19 - Foliage",
"20 - Forklift Forks",
"21 - Test Weapon",
"22 - Test Camera",
"23 - Test AI",
"24 - Test Script",
"25 - Test Vehicle Wheel",
"26 - Glass",
"27 - Map River",
"28 - Smoke",
"29 - Unsmashed",
"30 - Map Stairs",
"31 - Map Deep Surface"});
this.CompFlags1CheckedListBox.Location = new System.Drawing.Point(53, 3);
this.CompFlags1CheckedListBox.Name = "CompFlags1CheckedListBox";
this.CompFlags1CheckedListBox.Size = new System.Drawing.Size(174, 484);
this.CompFlags1CheckedListBox.TabIndex = 32;
this.CompFlags1CheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.CompFlags1CheckedListBox_ItemCheck);
//
// CompositeXformTabPage
//
this.CompositeXformTabPage.Controls.Add(this.CompRotationQuatBox);
this.CompositeXformTabPage.Controls.Add(this.CompScaleTextBox);
this.CompositeXformTabPage.Controls.Add(this.label23);
this.CompositeXformTabPage.Controls.Add(this.CompRotationTextBox);
this.CompositeXformTabPage.Controls.Add(this.CompPositionTextBox);
this.CompositeXformTabPage.Controls.Add(this.label24);
this.CompositeXformTabPage.Controls.Add(this.label25);
@@ -774,16 +774,6 @@
this.label23.TabIndex = 11;
this.label23.Text = "Scale:";
//
// CompRotationTextBox
//
this.CompRotationTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompRotationTextBox.Location = new System.Drawing.Point(72, 38);
this.CompRotationTextBox.Name = "CompRotationTextBox";
this.CompRotationTextBox.Size = new System.Drawing.Size(500, 20);
this.CompRotationTextBox.TabIndex = 10;
this.CompRotationTextBox.TextChanged += new System.EventHandler(this.CompRotationTextBox_TextChanged);
//
// CompPositionTextBox
//
this.CompPositionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -812,6 +802,17 @@
this.label25.TabIndex = 7;
this.label25.Text = "Position:";
//
// CompRotationQuatBox
//
this.CompRotationQuatBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompRotationQuatBox.Location = new System.Drawing.Point(72, 36);
this.CompRotationQuatBox.Margin = new System.Windows.Forms.Padding(0);
this.CompRotationQuatBox.Name = "CompRotationQuatBox";
this.CompRotationQuatBox.Size = new System.Drawing.Size(500, 24);
this.CompRotationQuatBox.TabIndex = 10;
this.CompRotationQuatBox.ValueChanged += new System.EventHandler(this.CompRotationQuatBox_ValueChanged);
//
// EditYbnBoundsPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -898,9 +899,9 @@
private System.Windows.Forms.TabPage CompositeXformTabPage;
private System.Windows.Forms.TextBox CompScaleTextBox;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.TextBox CompRotationTextBox;
private System.Windows.Forms.TextBox CompPositionTextBox;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private WinForms.QuaternionBox CompRotationQuatBox;
}
}
@@ -1,4 +1,5 @@
using CodeWalker.GameFiles;
using SharpDX;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -102,7 +103,7 @@ namespace CodeWalker.Project.Panels
SetCheckedListBoxValues(CompFlags1CheckedListBox, 0);
SetCheckedListBoxValues(CompFlags2CheckedListBox, 0);
CompPositionTextBox.Text = string.Empty;
CompRotationTextBox.Text = string.Empty;
CompRotationQuatBox.Value = Quaternion.Identity;
CompScaleTextBox.Text = string.Empty;
VertexCountLabel.Text = "0 vertices";
PolyCountLabel.Text = "0 polygons";
@@ -167,7 +168,7 @@ namespace CodeWalker.Project.Panels
SetCheckedListBoxValues(CompFlags1CheckedListBox, (uint)b.CompositeFlags1.Flags1);
SetCheckedListBoxValues(CompFlags2CheckedListBox, (uint)b.CompositeFlags1.Flags2);
CompPositionTextBox.Text = FloatUtil.GetVector3String(b.Position);
CompRotationTextBox.Text = FloatUtil.GetVector4String(b.Orientation.ToVector4());
CompRotationQuatBox.Value = b.Orientation;
CompScaleTextBox.Text = FloatUtil.GetVector3String(b.Scale);
}
else
@@ -177,7 +178,7 @@ namespace CodeWalker.Project.Panels
SetCheckedListBoxValues(CompFlags1CheckedListBox, 0);
SetCheckedListBoxValues(CompFlags2CheckedListBox, 0);
CompPositionTextBox.Text = string.Empty;
CompRotationTextBox.Text = string.Empty;
CompRotationQuatBox.Value = Quaternion.Identity;
CompScaleTextBox.Text = string.Empty;
}
@@ -571,11 +572,11 @@ namespace CodeWalker.Project.Panels
}
}
private void CompRotationTextBox_TextChanged(object sender, EventArgs e)
private void CompRotationQuatBox_ValueChanged(object sender, EventArgs e)
{
if (CollisionBounds == null) return;
if (populatingui) return;
var q = FloatUtil.ParseVector4String(CompRotationTextBox.Text).ToQuaternion();
var q = CompRotationQuatBox.Value;
lock (ProjectForm.ProjectSyncRoot)
{
if (CollisionBounds.Orientation != q)
+29 -55
View File
@@ -31,6 +31,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditYmapEntityPanel));
this.EntityTabControl = new System.Windows.Forms.TabControl();
this.EntityGeneralTabPage = new System.Windows.Forms.TabPage();
this.EntityRotationQuatBox = new CodeWalker.WinForms.QuaternionBox();
this.EntityEditArchetypeButton = new System.Windows.Forms.Button();
this.EntityFlagsCheckedListBox = new System.Windows.Forms.CheckedListBox();
this.label13 = new System.Windows.Forms.Label();
@@ -62,10 +63,8 @@
this.EntityArchetypeTextBox = new System.Windows.Forms.TextBox();
this.label16 = new System.Windows.Forms.Label();
this.EntityPositionTextBox = new System.Windows.Forms.TextBox();
this.EntityNormalizeRotationButton = new System.Windows.Forms.Button();
this.EntityGoToButton = new System.Windows.Forms.Button();
this.label17 = new System.Windows.Forms.Label();
this.EntityRotationTextBox = new System.Windows.Forms.TextBox();
this.EntityLodTabPage = new System.Windows.Forms.TabPage();
this.label20 = new System.Windows.Forms.Label();
this.EntityParentIndexTextBox = new System.Windows.Forms.TextBox();
@@ -74,13 +73,12 @@
this.EntityExtensionsTabPage = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.EntityPivotTabPage = new System.Windows.Forms.TabPage();
this.EntityPivotRotationQuatBox = new CodeWalker.WinForms.QuaternionBox();
this.label95 = new System.Windows.Forms.Label();
this.EntityPivotEditCheckBox = new System.Windows.Forms.CheckBox();
this.label93 = new System.Windows.Forms.Label();
this.EntityPivotPositionTextBox = new System.Windows.Forms.TextBox();
this.EntityPivotRotationNormalizeButton = new System.Windows.Forms.Button();
this.label94 = new System.Windows.Forms.Label();
this.EntityPivotRotationTextBox = new System.Windows.Forms.TextBox();
this.EntityMiloTabPage = new System.Windows.Forms.TabPage();
this.MiloFlagsTextBox = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
@@ -118,6 +116,7 @@
//
// EntityGeneralTabPage
//
this.EntityGeneralTabPage.Controls.Add(this.EntityRotationQuatBox);
this.EntityGeneralTabPage.Controls.Add(this.EntityEditArchetypeButton);
this.EntityGeneralTabPage.Controls.Add(this.EntityFlagsCheckedListBox);
this.EntityGeneralTabPage.Controls.Add(this.label13);
@@ -149,10 +148,8 @@
this.EntityGeneralTabPage.Controls.Add(this.EntityArchetypeTextBox);
this.EntityGeneralTabPage.Controls.Add(this.label16);
this.EntityGeneralTabPage.Controls.Add(this.EntityPositionTextBox);
this.EntityGeneralTabPage.Controls.Add(this.EntityNormalizeRotationButton);
this.EntityGeneralTabPage.Controls.Add(this.EntityGoToButton);
this.EntityGeneralTabPage.Controls.Add(this.label17);
this.EntityGeneralTabPage.Controls.Add(this.EntityRotationTextBox);
this.EntityGeneralTabPage.Location = new System.Drawing.Point(4, 22);
this.EntityGeneralTabPage.Name = "EntityGeneralTabPage";
this.EntityGeneralTabPage.Padding = new System.Windows.Forms.Padding(3);
@@ -161,6 +158,17 @@
this.EntityGeneralTabPage.Text = "General";
this.EntityGeneralTabPage.UseVisualStyleBackColor = true;
//
// EntityRotationQuatBox
//
this.EntityRotationQuatBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.EntityRotationQuatBox.Location = new System.Drawing.Point(93, 33);
this.EntityRotationQuatBox.Margin = new System.Windows.Forms.Padding(0);
this.EntityRotationQuatBox.Name = "EntityRotationQuatBox";
this.EntityRotationQuatBox.Size = new System.Drawing.Size(456, 24);
this.EntityRotationQuatBox.TabIndex = 5;
this.EntityRotationQuatBox.ValueChanged += new System.EventHandler(this.EntityRotationQuatBox_ValueChanged);
//
// EntityEditArchetypeButton
//
this.EntityEditArchetypeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -185,7 +193,7 @@
"8 - Unk04",
"16 - Unk05",
"32 - Static entity",
"64 - Object isn't dark at night",
"64 - Object isn\'t dark at night",
"128 - Unk08",
"256 - Unk09",
"512 - Disable embedded light source",
@@ -498,17 +506,6 @@
this.EntityPositionTextBox.TabIndex = 2;
this.EntityPositionTextBox.TextChanged += new System.EventHandler(this.EntityPositionTextBox_TextChanged);
//
// EntityNormalizeRotationButton
//
this.EntityNormalizeRotationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.EntityNormalizeRotationButton.Location = new System.Drawing.Point(481, 33);
this.EntityNormalizeRotationButton.Name = "EntityNormalizeRotationButton";
this.EntityNormalizeRotationButton.Size = new System.Drawing.Size(68, 23);
this.EntityNormalizeRotationButton.TabIndex = 6;
this.EntityNormalizeRotationButton.Text = "Normalize";
this.EntityNormalizeRotationButton.UseVisualStyleBackColor = true;
this.EntityNormalizeRotationButton.Click += new System.EventHandler(this.EntityNormalizeRotationButton_Click);
//
// EntityGoToButton
//
this.EntityGoToButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -529,16 +526,6 @@
this.label17.TabIndex = 4;
this.label17.Text = "Rotation:";
//
// EntityRotationTextBox
//
this.EntityRotationTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.EntityRotationTextBox.Location = new System.Drawing.Point(93, 35);
this.EntityRotationTextBox.Name = "EntityRotationTextBox";
this.EntityRotationTextBox.Size = new System.Drawing.Size(382, 20);
this.EntityRotationTextBox.TabIndex = 5;
this.EntityRotationTextBox.TextChanged += new System.EventHandler(this.EntityRotationTextBox_TextChanged);
//
// EntityLodTabPage
//
this.EntityLodTabPage.Controls.Add(this.label20);
@@ -612,13 +599,12 @@
//
// EntityPivotTabPage
//
this.EntityPivotTabPage.Controls.Add(this.EntityPivotRotationQuatBox);
this.EntityPivotTabPage.Controls.Add(this.label95);
this.EntityPivotTabPage.Controls.Add(this.EntityPivotEditCheckBox);
this.EntityPivotTabPage.Controls.Add(this.label93);
this.EntityPivotTabPage.Controls.Add(this.EntityPivotPositionTextBox);
this.EntityPivotTabPage.Controls.Add(this.EntityPivotRotationNormalizeButton);
this.EntityPivotTabPage.Controls.Add(this.label94);
this.EntityPivotTabPage.Controls.Add(this.EntityPivotRotationTextBox);
this.EntityPivotTabPage.Location = new System.Drawing.Point(4, 22);
this.EntityPivotTabPage.Name = "EntityPivotTabPage";
this.EntityPivotTabPage.Size = new System.Drawing.Size(555, 476);
@@ -626,6 +612,17 @@
this.EntityPivotTabPage.Text = "Pivot";
this.EntityPivotTabPage.UseVisualStyleBackColor = true;
//
// EntityPivotRotationQuatBox
//
this.EntityPivotRotationQuatBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.EntityPivotRotationQuatBox.Location = new System.Drawing.Point(93, 94);
this.EntityPivotRotationQuatBox.Margin = new System.Windows.Forms.Padding(0);
this.EntityPivotRotationQuatBox.Name = "EntityPivotRotationQuatBox";
this.EntityPivotRotationQuatBox.Size = new System.Drawing.Size(456, 24);
this.EntityPivotRotationQuatBox.TabIndex = 25;
this.EntityPivotRotationQuatBox.ValueChanged += new System.EventHandler(this.EntityPivotRotationQuatBox_ValueChanged);
//
// label95
//
this.label95.Location = new System.Drawing.Point(90, 152);
@@ -665,17 +662,6 @@
this.EntityPivotPositionTextBox.TabIndex = 22;
this.EntityPivotPositionTextBox.TextChanged += new System.EventHandler(this.EntityPivotPositionTextBox_TextChanged);
//
// EntityPivotRotationNormalizeButton
//
this.EntityPivotRotationNormalizeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.EntityPivotRotationNormalizeButton.Location = new System.Drawing.Point(481, 94);
this.EntityPivotRotationNormalizeButton.Name = "EntityPivotRotationNormalizeButton";
this.EntityPivotRotationNormalizeButton.Size = new System.Drawing.Size(68, 23);
this.EntityPivotRotationNormalizeButton.TabIndex = 26;
this.EntityPivotRotationNormalizeButton.Text = "Normalize";
this.EntityPivotRotationNormalizeButton.UseVisualStyleBackColor = true;
this.EntityPivotRotationNormalizeButton.Click += new System.EventHandler(this.EntityPivotRotationNormalizeButton_Click);
//
// label94
//
this.label94.AutoSize = true;
@@ -685,16 +671,6 @@
this.label94.TabIndex = 24;
this.label94.Text = "Rotation:";
//
// EntityPivotRotationTextBox
//
this.EntityPivotRotationTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.EntityPivotRotationTextBox.Location = new System.Drawing.Point(93, 96);
this.EntityPivotRotationTextBox.Name = "EntityPivotRotationTextBox";
this.EntityPivotRotationTextBox.Size = new System.Drawing.Size(382, 20);
this.EntityPivotRotationTextBox.TabIndex = 25;
this.EntityPivotRotationTextBox.TextChanged += new System.EventHandler(this.EntityPivotRotationTextBox_TextChanged);
//
// EntityMiloTabPage
//
this.EntityMiloTabPage.Controls.Add(this.MiloFlagsTextBox);
@@ -862,10 +838,8 @@
private System.Windows.Forms.TextBox EntityArchetypeTextBox;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox EntityPositionTextBox;
private System.Windows.Forms.Button EntityNormalizeRotationButton;
private System.Windows.Forms.Button EntityGoToButton;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox EntityRotationTextBox;
private System.Windows.Forms.TabPage EntityLodTabPage;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.TextBox EntityParentIndexTextBox;
@@ -877,9 +851,7 @@
private System.Windows.Forms.CheckBox EntityPivotEditCheckBox;
private System.Windows.Forms.Label label93;
private System.Windows.Forms.TextBox EntityPivotPositionTextBox;
private System.Windows.Forms.Button EntityPivotRotationNormalizeButton;
private System.Windows.Forms.Label label94;
private System.Windows.Forms.TextBox EntityPivotRotationTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TabPage EntityMiloTabPage;
private System.Windows.Forms.CheckedListBox MiloEntitySetsListBox;
@@ -893,5 +865,7 @@
private System.Windows.Forms.TextBox MiloFlagsTextBox;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button EntityEditArchetypeButton;
private WinForms.QuaternionBox EntityRotationQuatBox;
private WinForms.QuaternionBox EntityPivotRotationQuatBox;
}
}
@@ -67,7 +67,7 @@ namespace CodeWalker.Project.Panels
EntityFlagsTextBox.Text = string.Empty;
EntityGuidTextBox.Text = string.Empty;
EntityPositionTextBox.Text = string.Empty;
EntityRotationTextBox.Text = string.Empty;
EntityRotationQuatBox.Value = Quaternion.Identity;
EntityScaleXYTextBox.Text = string.Empty;
EntityScaleZTextBox.Text = string.Empty;
EntityParentIndexTextBox.Text = string.Empty;
@@ -81,7 +81,7 @@ namespace CodeWalker.Project.Panels
EntityTintValueTextBox.Text = string.Empty;
EntityPivotEditCheckBox.Checked = false;
EntityPivotPositionTextBox.Text = string.Empty;
EntityPivotRotationTextBox.Text = string.Empty;
EntityPivotRotationQuatBox.Value = Quaternion.Identity;
foreach (int i in EntityFlagsCheckedListBox.CheckedIndices)
{
EntityFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
@@ -100,7 +100,7 @@ namespace CodeWalker.Project.Panels
EntityFlagsTextBox.Text = e.flags.ToString();
EntityGuidTextBox.Text = e.guid.ToString();
EntityPositionTextBox.Text = FloatUtil.GetVector3String(e.position);
EntityRotationTextBox.Text = FloatUtil.GetVector4String(e.rotation);
EntityRotationQuatBox.Value = new Quaternion(e.rotation);
EntityScaleXYTextBox.Text = FloatUtil.ToString(e.scaleXY);
EntityScaleZTextBox.Text = FloatUtil.ToString(e.scaleZ);
EntityParentIndexTextBox.Text = e.parentIndex.ToString();
@@ -113,7 +113,7 @@ namespace CodeWalker.Project.Panels
EntityArtificialAOTextBox.Text = e.artificialAmbientOcclusion.ToString();
EntityTintValueTextBox.Text = e.tintValue.ToString();
EntityPivotPositionTextBox.Text = FloatUtil.GetVector3String(CurrentEntity.PivotPosition);
EntityPivotRotationTextBox.Text = FloatUtil.GetVector4String(new Vector4(po.X, po.Y, po.Z, po.W));
EntityPivotRotationQuatBox.Value = po;
for (int i = 0; i < EntityFlagsCheckedListBox.Items.Count; i++)
{
var cv = ((e.flags & (1u << i)) > 0);
@@ -394,16 +394,16 @@ namespace CodeWalker.Project.Panels
}
}
private void EntityRotationTextBox_TextChanged(object sender, EventArgs e)
private void EntityRotationQuatBox_ValueChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentEntity == null) return;
Vector4 v = FloatUtil.ParseVector4String(EntityRotationTextBox.Text);
Quaternion q = EntityRotationQuatBox.Value;
Vector4 v = q.ToVector4();
lock (ProjectForm.ProjectSyncRoot)
{
if (CurrentEntity._CEntityDef.rotation != v)
{
Quaternion q = v.ToQuaternion();
var wf = ProjectForm.WorldForm;
if (CurrentEntity.MloParent != null)
@@ -643,13 +643,6 @@ namespace CodeWalker.Project.Panels
ProjectForm.WorldForm.GoToPosition(CurrentEntity.Position, Vector3.One * CurrentEntity.BSRadius);
}
private void EntityNormalizeRotationButton_Click(object sender, EventArgs e)
{
Vector4 v = FloatUtil.ParseVector4String(EntityRotationTextBox.Text);
Quaternion q = Quaternion.Normalize(new Quaternion(v));
EntityRotationTextBox.Text = FloatUtil.GetVector4String(new Vector4(q.X, q.Y, q.Z, q.W));
}
private void EntityAddToProjectButton_Click(object sender, EventArgs e)
{
ProjectForm.SetProjectItem(CurrentEntity);
@@ -696,12 +689,11 @@ namespace CodeWalker.Project.Panels
}
}
private void EntityPivotRotationTextBox_TextChanged(object sender, EventArgs e)
private void EntityPivotRotationQuatBox_ValueChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (CurrentEntity == null) return;
Vector4 v = FloatUtil.ParseVector4String(EntityPivotRotationTextBox.Text);
Quaternion q = new Quaternion(v);
Quaternion q = EntityPivotRotationQuatBox.Value;
lock (ProjectForm.ProjectSyncRoot)
{
if (CurrentEntity.PivotOrientation != q)
@@ -721,13 +713,7 @@ namespace CodeWalker.Project.Panels
}
}
}
}
private void EntityPivotRotationNormalizeButton_Click(object sender, EventArgs e)
{
Vector4 v = FloatUtil.ParseVector4String(EntityPivotRotationTextBox.Text);
Quaternion q = Quaternion.Normalize(new Quaternion(v));
EntityPivotRotationTextBox.Text = FloatUtil.GetVector4String(new Vector4(q.X, q.Y, q.Z, q.W));
}
private void MiloGroupIDTextBox_TextChanged(object sender, EventArgs e)