Added Edit Archetype button on Entity Editor, improved Archetype editing hash parsing

This commit is contained in:
dexy 2018-12-17 01:26:23 +11:00
parent 439d10e23a
commit 34a29a5faa
5 changed files with 146 additions and 92 deletions

View File

@ -81,16 +81,17 @@
this.label94 = new System.Windows.Forms.Label(); this.label94 = new System.Windows.Forms.Label();
this.EntityPivotRotationTextBox = new System.Windows.Forms.TextBox(); this.EntityPivotRotationTextBox = new System.Windows.Forms.TextBox();
this.EntityMiloTabPage = new System.Windows.Forms.TabPage(); this.EntityMiloTabPage = new System.Windows.Forms.TabPage();
this.MiloEntitySetsListBox = new System.Windows.Forms.CheckedListBox(); this.MiloFlagsTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.MiloNumExitPortalsTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.MiloGroupIDTextBox = new System.Windows.Forms.TextBox(); this.MiloGroupIDTextBox = new System.Windows.Forms.TextBox();
this.MiloFloorIDTextBox = new System.Windows.Forms.TextBox(); this.MiloFloorIDTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.MiloNumExitPortalsTextBox = new System.Windows.Forms.TextBox(); this.MiloEntitySetsListBox = new System.Windows.Forms.CheckedListBox();
this.label5 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.MiloFlagsTextBox = new System.Windows.Forms.TextBox(); this.EntityEditArchetypeButton = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.EntityTabControl.SuspendLayout(); this.EntityTabControl.SuspendLayout();
this.EntityGeneralTabPage.SuspendLayout(); this.EntityGeneralTabPage.SuspendLayout();
this.EntityLodTabPage.SuspendLayout(); this.EntityLodTabPage.SuspendLayout();
@ -117,6 +118,7 @@
// //
// EntityGeneralTabPage // EntityGeneralTabPage
// //
this.EntityGeneralTabPage.Controls.Add(this.EntityEditArchetypeButton);
this.EntityGeneralTabPage.Controls.Add(this.EntityFlagsCheckedListBox); this.EntityGeneralTabPage.Controls.Add(this.EntityFlagsCheckedListBox);
this.EntityGeneralTabPage.Controls.Add(this.label13); this.EntityGeneralTabPage.Controls.Add(this.label13);
this.EntityGeneralTabPage.Controls.Add(this.label28); this.EntityGeneralTabPage.Controls.Add(this.label28);
@ -701,27 +703,39 @@
this.EntityMiloTabPage.Text = "MLO Instance"; this.EntityMiloTabPage.Text = "MLO Instance";
this.EntityMiloTabPage.UseVisualStyleBackColor = true; this.EntityMiloTabPage.UseVisualStyleBackColor = true;
// //
// MiloEntitySetsListBox // MiloFlagsTextBox
// //
this.MiloEntitySetsListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.MiloFlagsTextBox.Location = new System.Drawing.Point(101, 93);
| System.Windows.Forms.AnchorStyles.Left) this.MiloFlagsTextBox.Name = "MiloFlagsTextBox";
| System.Windows.Forms.AnchorStyles.Right))); this.MiloFlagsTextBox.Size = new System.Drawing.Size(154, 20);
this.MiloEntitySetsListBox.CheckOnClick = true; this.MiloFlagsTextBox.TabIndex = 43;
this.MiloEntitySetsListBox.FormattingEnabled = true; this.MiloFlagsTextBox.TextChanged += new System.EventHandler(this.MiloFlagsTextBox_TextChanged);
this.MiloEntitySetsListBox.Location = new System.Drawing.Point(103, 128);
this.MiloEntitySetsListBox.Name = "MiloEntitySetsListBox";
this.MiloEntitySetsListBox.Size = new System.Drawing.Size(434, 319);
this.MiloEntitySetsListBox.TabIndex = 4;
this.MiloEntitySetsListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.MiloEntitySetsListBox_ItemCheck);
// //
// label2 // label6
// //
this.label2.AutoSize = true; this.label6.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 129); this.label6.Location = new System.Drawing.Point(5, 96);
this.label2.Name = "label2"; this.label6.Name = "label6";
this.label2.Size = new System.Drawing.Size(91, 13); this.label6.Size = new System.Drawing.Size(75, 13);
this.label2.TabIndex = 3; this.label6.TabIndex = 42;
this.label2.Text = "DefaultEntitySets:"; this.label6.Text = "MLOInstFlags:";
//
// MiloNumExitPortalsTextBox
//
this.MiloNumExitPortalsTextBox.Location = new System.Drawing.Point(101, 67);
this.MiloNumExitPortalsTextBox.Name = "MiloNumExitPortalsTextBox";
this.MiloNumExitPortalsTextBox.Size = new System.Drawing.Size(154, 20);
this.MiloNumExitPortalsTextBox.TabIndex = 41;
this.MiloNumExitPortalsTextBox.TextChanged += new System.EventHandler(this.MiloNumExitPortalsTextBox_TextChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(5, 70);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(81, 13);
this.label5.TabIndex = 40;
this.label5.Text = "NumExitPortals:";
// //
// label3 // label3
// //
@ -757,39 +771,38 @@
this.label4.TabIndex = 38; this.label4.TabIndex = 38;
this.label4.Text = "FloorID:"; this.label4.Text = "FloorID:";
// //
// MiloNumExitPortalsTextBox // MiloEntitySetsListBox
// //
this.MiloNumExitPortalsTextBox.Location = new System.Drawing.Point(101, 67); this.MiloEntitySetsListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.MiloNumExitPortalsTextBox.Name = "MiloNumExitPortalsTextBox"; | System.Windows.Forms.AnchorStyles.Left)
this.MiloNumExitPortalsTextBox.Size = new System.Drawing.Size(154, 20); | System.Windows.Forms.AnchorStyles.Right)));
this.MiloNumExitPortalsTextBox.TabIndex = 41; this.MiloEntitySetsListBox.CheckOnClick = true;
this.MiloNumExitPortalsTextBox.TextChanged += new System.EventHandler(this.MiloNumExitPortalsTextBox_TextChanged); this.MiloEntitySetsListBox.FormattingEnabled = true;
this.MiloEntitySetsListBox.Location = new System.Drawing.Point(103, 128);
this.MiloEntitySetsListBox.Name = "MiloEntitySetsListBox";
this.MiloEntitySetsListBox.Size = new System.Drawing.Size(434, 319);
this.MiloEntitySetsListBox.TabIndex = 4;
this.MiloEntitySetsListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.MiloEntitySetsListBox_ItemCheck);
// //
// label5 // label2
// //
this.label5.AutoSize = true; this.label2.AutoSize = true;
this.label5.Location = new System.Drawing.Point(5, 70); this.label2.Location = new System.Drawing.Point(3, 129);
this.label5.Name = "label5"; this.label2.Name = "label2";
this.label5.Size = new System.Drawing.Size(81, 13); this.label2.Size = new System.Drawing.Size(91, 13);
this.label5.TabIndex = 40; this.label2.TabIndex = 3;
this.label5.Text = "NumExitPortals:"; this.label2.Text = "DefaultEntitySets:";
// //
// MiloFlagsTextBox // EntityEditArchetypeButton
// //
this.MiloFlagsTextBox.Location = new System.Drawing.Point(101, 93); this.EntityEditArchetypeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.MiloFlagsTextBox.Name = "MiloFlagsTextBox"; this.EntityEditArchetypeButton.Location = new System.Drawing.Point(454, 59);
this.MiloFlagsTextBox.Size = new System.Drawing.Size(154, 20); this.EntityEditArchetypeButton.Name = "EntityEditArchetypeButton";
this.MiloFlagsTextBox.TabIndex = 43; this.EntityEditArchetypeButton.Size = new System.Drawing.Size(95, 23);
this.MiloFlagsTextBox.TextChanged += new System.EventHandler(this.MiloFlagsTextBox_TextChanged); this.EntityEditArchetypeButton.TabIndex = 35;
// this.EntityEditArchetypeButton.Text = "Edit Archetype...";
// label6 this.EntityEditArchetypeButton.UseVisualStyleBackColor = true;
// this.EntityEditArchetypeButton.Click += new System.EventHandler(this.EntityEditArchetypeButton_Click);
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(5, 96);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(75, 13);
this.label6.TabIndex = 42;
this.label6.Text = "MLOInstFlags:";
// //
// EditYmapEntityPanel // EditYmapEntityPanel
// //
@ -879,5 +892,6 @@
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox MiloFlagsTextBox; private System.Windows.Forms.TextBox MiloFlagsTextBox;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button EntityEditArchetypeButton;
} }
} }

View File

@ -801,5 +801,14 @@ namespace CodeWalker.Project.Panels
} }
e.NewValue = CheckState.Unchecked; e.NewValue = CheckState.Unchecked;
} }
private void EntityEditArchetypeButton_Click(object sender, EventArgs e)
{
if (ProjectForm != null)
{
ProjectForm.SetCurrentArchetype(CurrentEntity?.Archetype);
ProjectForm.ShowEditArchetypePanel(true);
}
}
} }
} }

View File

@ -338,9 +338,9 @@
"536870912 - Unk30", "536870912 - Unk30",
"1073741824 - Unk31", "1073741824 - Unk31",
"2147483648 - Unk32"}); "2147483648 - Unk32"});
this.EntityFlagsCheckedListBox.Location = new System.Drawing.Point(422, 38); this.EntityFlagsCheckedListBox.Location = new System.Drawing.Point(441, 38);
this.EntityFlagsCheckedListBox.Name = "EntityFlagsCheckedListBox"; this.EntityFlagsCheckedListBox.Name = "EntityFlagsCheckedListBox";
this.EntityFlagsCheckedListBox.Size = new System.Drawing.Size(201, 274); this.EntityFlagsCheckedListBox.Size = new System.Drawing.Size(182, 274);
this.EntityFlagsCheckedListBox.TabIndex = 67; this.EntityFlagsCheckedListBox.TabIndex = 67;
this.EntityFlagsCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.ArchetypeFlagsCheckedListBox_ItemCheck); this.EntityFlagsCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.ArchetypeFlagsCheckedListBox_ItemCheck);
// //

View File

@ -162,7 +162,11 @@ namespace CodeWalker.Project.Panels
return; return;
} }
var hash = JenkHash.GenHash(TextureDictTextBox.Text); var hash = 0u;
if (!uint.TryParse(TextureDictTextBox.Text, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(TextureDictTextBox.Text);
}
if (CurrentArchetype._BaseArchetypeDef.textureDictionary != hash) if (CurrentArchetype._BaseArchetypeDef.textureDictionary != hash)
{ {
@ -173,10 +177,10 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetYtypHasChanged(true); ProjectForm.SetYtypHasChanged(true);
return; return;
} }
TextureDictHashLabel.Text = "Hash: " + hash.ToString();
CurrentArchetype._BaseArchetypeDef.textureDictionary = hash; CurrentArchetype._BaseArchetypeDef.textureDictionary = hash;
ProjectForm.SetYtypHasChanged(true); ProjectForm.SetYtypHasChanged(true);
} }
TextureDictHashLabel.Text = "Hash: " + hash.ToString();
} }
} }
@ -197,7 +201,11 @@ namespace CodeWalker.Project.Panels
return; return;
} }
var hash = JenkHash.GenHash(PhysicsDictionaryTextBox.Text); var hash = 0u;
if (!uint.TryParse(PhysicsDictionaryTextBox.Text, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(PhysicsDictionaryTextBox.Text);
}
if (CurrentArchetype._BaseArchetypeDef.physicsDictionary != hash) if (CurrentArchetype._BaseArchetypeDef.physicsDictionary != hash)
{ {
@ -208,17 +216,20 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetYtypHasChanged(true); ProjectForm.SetYtypHasChanged(true);
return; return;
} }
PhysicsDictHashLabel.Text = "Hash: " + hash.ToString();
CurrentArchetype._BaseArchetypeDef.physicsDictionary = hash; CurrentArchetype._BaseArchetypeDef.physicsDictionary = hash;
ProjectForm.SetYtypHasChanged(true); ProjectForm.SetYtypHasChanged(true);
} }
PhysicsDictHashLabel.Text = "Hash: " + hash.ToString();
} }
} }
private void ArchetypeNameTextBox_TextChanged(object sender, EventArgs e) private void ArchetypeNameTextBox_TextChanged(object sender, EventArgs e)
{ {
var hash = JenkHash.GenHash(ArchetypeNameTextBox.Text); var hash = 0u;
if (!uint.TryParse(ArchetypeNameTextBox.Text, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(ArchetypeNameTextBox.Text);
}
if (CurrentArchetype._BaseArchetypeDef.name != hash) if (CurrentArchetype._BaseArchetypeDef.name != hash)
{ {
@ -235,7 +246,11 @@ namespace CodeWalker.Project.Panels
private void AssetNameTextBox_TextChanged(object sender, EventArgs e) private void AssetNameTextBox_TextChanged(object sender, EventArgs e)
{ {
var hash = JenkHash.GenHash(AssetNameTextBox.Text); var hash = 0u;
if (!uint.TryParse(AssetNameTextBox.Text, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(AssetNameTextBox.Text);
}
if (CurrentArchetype._BaseArchetypeDef.assetName != hash) if (CurrentArchetype._BaseArchetypeDef.assetName != hash)
{ {
@ -246,7 +261,11 @@ namespace CodeWalker.Project.Panels
private void ClipDictionaryTextBox_TextChanged(object sender, EventArgs e) private void ClipDictionaryTextBox_TextChanged(object sender, EventArgs e)
{ {
var hash = JenkHash.GenHash(ClipDictionaryTextBox.Text); var hash = 0u;
if (!uint.TryParse(ClipDictionaryTextBox.Text, out hash))//don't re-hash hashes
{
hash = JenkHash.GenHash(ClipDictionaryTextBox.Text);
}
if (CurrentArchetype._BaseArchetypeDef.clipDictionary != hash) if (CurrentArchetype._BaseArchetypeDef.clipDictionary != hash)
{ {

View File

@ -231,12 +231,12 @@ namespace CodeWalker.Project
} }
return null; return null;
} }
private void ShowDefaultPanels() public void ShowDefaultPanels()
{ {
ShowProjectExplorer(); ShowProjectExplorer();
ShowWelcomePanel(); ShowWelcomePanel();
} }
private void ShowProjectExplorer() public void ShowProjectExplorer()
{ {
if ((ProjectExplorer == null) || (ProjectExplorer.IsDisposed) || (ProjectExplorer.Disposing)) if ((ProjectExplorer == null) || (ProjectExplorer.IsDisposed) || (ProjectExplorer.Disposing))
{ {
@ -251,11 +251,11 @@ namespace CodeWalker.Project
ProjectExplorer.Show(); ProjectExplorer.Show();
} }
} }
private void ShowWelcomePanel() public void ShowWelcomePanel()
{ {
ShowPreviewPanel(() => { return new WelcomePanel(); }); ShowPreviewPanel(() => { return new WelcomePanel(); });
} }
private void ShowPreviewPanel<T>(Func<T> createFunc, Action<T> updateAction = null) where T : ProjectPanel public void ShowPreviewPanel<T>(Func<T> createFunc, Action<T> updateAction = null) where T : ProjectPanel
{ {
if ((PreviewPanel != null) && (PreviewPanel is T)) if ((PreviewPanel != null) && (PreviewPanel is T))
{ {
@ -276,11 +276,15 @@ namespace CodeWalker.Project
PreviewPanel = panel; PreviewPanel = panel;
} }
} }
private void ShowPanel<T>(bool promote, Func<T> createFunc, Action<T> updateAction, Func<T,bool> findFunc) where T : ProjectPanel public void ShowPanel<T>(bool promote, Func<T> createFunc, Action<T> updateAction, Func<T,bool> findFunc) where T : ProjectPanel
{ {
T found = FindPanel(findFunc); T found = FindPanel(findFunc);
if ((found != null) && (found != PreviewPanel)) if ((found != null) && (found != PreviewPanel))
{ {
if (found.IsHidden)
{
found.Show();
}
found.BringToFront();//.Show(); found.BringToFront();//.Show();
updateAction?.Invoke(found); updateAction?.Invoke(found);
} }
@ -306,159 +310,159 @@ namespace CodeWalker.Project
} }
} }
} }
private void ShowEditProjectPanel(bool promote) public void ShowEditProjectPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditProjectPanel(this); }, //createFunc () => { return new EditProjectPanel(this); }, //createFunc
(panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc (panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc
(panel) => { return true; }); //findFunc (panel) => { return true; }); //findFunc
} }
private void ShowEditProjectManifestPanel(bool promote) public void ShowEditProjectManifestPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditProjectManifestPanel(this); }, //createFunc () => { return new EditProjectManifestPanel(this); }, //createFunc
(panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc (panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc
(panel) => { return true; }); //findFunc (panel) => { return true; }); //findFunc
} }
private void ShowGenerateNavMeshPanel(bool promote) public void ShowGenerateNavMeshPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new GenerateNavMeshPanel(this); }, //createFunc () => { return new GenerateNavMeshPanel(this); }, //createFunc
(panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc (panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc
(panel) => { return true; }); //findFunc (panel) => { return true; }); //findFunc
} }
private void ShowEditYmapPanel(bool promote) public void ShowEditYmapPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYmapPanel(this); }, //createFunc () => { return new EditYmapPanel(this); }, //createFunc
(panel) => { panel.SetYmap(CurrentYmapFile); }, //updateFunc (panel) => { panel.SetYmap(CurrentYmapFile); }, //updateFunc
(panel) => { return panel.Ymap == CurrentYmapFile; }); //findFunc (panel) => { return panel.Ymap == CurrentYmapFile; }); //findFunc
} }
private void ShowEditYmapEntityPanel(bool promote) public void ShowEditYmapEntityPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYmapEntityPanel(this); }, //createFunc () => { return new EditYmapEntityPanel(this); }, //createFunc
(panel) => { panel.SetEntity(CurrentEntity); }, //updateFunc (panel) => { panel.SetEntity(CurrentEntity); }, //updateFunc
(panel) => { return panel.CurrentEntity == CurrentEntity; }); //findFunc (panel) => { return panel.CurrentEntity == CurrentEntity; }); //findFunc
} }
private void ShowEditYmapCarGenPanel(bool promote) public void ShowEditYmapCarGenPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYmapCarGenPanel(this); }, //createFunc () => { return new EditYmapCarGenPanel(this); }, //createFunc
(panel) => { panel.SetCarGen(CurrentCarGen); }, //updateFunc (panel) => { panel.SetCarGen(CurrentCarGen); }, //updateFunc
(panel) => { return panel.CurrentCarGen == CurrentCarGen; }); //findFunc (panel) => { return panel.CurrentCarGen == CurrentCarGen; }); //findFunc
} }
private void ShowEditYmapGrassBatchPanel(bool promote) public void ShowEditYmapGrassBatchPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYmapGrassPanel(this); }, //createFunc () => { return new EditYmapGrassPanel(this); }, //createFunc
(panel) => { panel.SetBatch(CurrentGrassBatch); }, //updateFunc (panel) => { panel.SetBatch(CurrentGrassBatch); }, //updateFunc
(panel) => { return panel.CurrentBatch == CurrentGrassBatch; }); //findFunc (panel) => { return panel.CurrentBatch == CurrentGrassBatch; }); //findFunc
} }
private void ShowEditYtypPanel(bool promote) public void ShowEditYtypPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYtypPanel(this); }, //createFunc () => { return new EditYtypPanel(this); }, //createFunc
(panel) => { panel.SetYtyp(CurrentYtypFile); }, //updateFunc (panel) => { panel.SetYtyp(CurrentYtypFile); }, //updateFunc
(panel) => { return panel.Ytyp == CurrentYtypFile; }); //findFunc (panel) => { return panel.Ytyp == CurrentYtypFile; }); //findFunc
} }
private void ShowEditArchetypePanel(bool promote) public void ShowEditArchetypePanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYtypArchetypePanel(this); }, //createFunc () => { return new EditYtypArchetypePanel(this); }, //createFunc
(panel) => { panel.SetArchetype(CurrentArchetype); }, //updateFunc (panel) => { panel.SetArchetype(CurrentArchetype); }, //updateFunc
(panel) => { return panel.CurrentArchetype == CurrentArchetype; }); //findFunc (panel) => { return panel.CurrentArchetype == CurrentArchetype; }); //findFunc
} }
private void ShowEditYndPanel(bool promote) public void ShowEditYndPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYndPanel(this); }, //createFunc () => { return new EditYndPanel(this); }, //createFunc
(panel) => { panel.SetYnd(CurrentYndFile); }, //updateFunc (panel) => { panel.SetYnd(CurrentYndFile); }, //updateFunc
(panel) => { return panel.Ynd == CurrentYndFile; }); //findFunc (panel) => { return panel.Ynd == CurrentYndFile; }); //findFunc
} }
private void ShowEditYndNodePanel(bool promote) public void ShowEditYndNodePanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYndNodePanel(this); }, //createFunc () => { return new EditYndNodePanel(this); }, //createFunc
(panel) => { panel.SetPathNode(CurrentPathNode); }, //updateFunc (panel) => { panel.SetPathNode(CurrentPathNode); }, //updateFunc
(panel) => { return panel.CurrentPathNode == CurrentPathNode; }); //findFunc (panel) => { return panel.CurrentPathNode == CurrentPathNode; }); //findFunc
} }
private void ShowEditYnvPanel(bool promote) public void ShowEditYnvPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYnvPanel(this); }, //createFunc () => { return new EditYnvPanel(this); }, //createFunc
(panel) => { panel.SetYnv(CurrentYnvFile); }, //updateFunc (panel) => { panel.SetYnv(CurrentYnvFile); }, //updateFunc
(panel) => { return panel.Ynv == CurrentYnvFile; }); //findFunc (panel) => { return panel.Ynv == CurrentYnvFile; }); //findFunc
} }
private void ShowEditYnvPolyPanel(bool promote) public void ShowEditYnvPolyPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYnvPolyPanel(this); }, //createFunc () => { return new EditYnvPolyPanel(this); }, //createFunc
(panel) => { panel.SetYnvPoly(CurrentNavPoly); }, //updateFunc (panel) => { panel.SetYnvPoly(CurrentNavPoly); }, //updateFunc
(panel) => { return panel.YnvPoly == CurrentNavPoly; }); //findFunc (panel) => { return panel.YnvPoly == CurrentNavPoly; }); //findFunc
} }
private void ShowEditYnvPointPanel(bool promote) public void ShowEditYnvPointPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYnvPointPanel(this); }, //createFunc () => { return new EditYnvPointPanel(this); }, //createFunc
(panel) => { panel.SetYnvPoint(CurrentNavPoint); }, //updateFunc (panel) => { panel.SetYnvPoint(CurrentNavPoint); }, //updateFunc
(panel) => { return panel.YnvPoint == CurrentNavPoint; }); //findFunc (panel) => { return panel.YnvPoint == CurrentNavPoint; }); //findFunc
} }
private void ShowEditYnvPortalPanel(bool promote) public void ShowEditYnvPortalPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYnvPortalPanel(this); }, //createFunc () => { return new EditYnvPortalPanel(this); }, //createFunc
(panel) => { panel.SetYnvPortal(CurrentNavPortal); }, //updateFunc (panel) => { panel.SetYnvPortal(CurrentNavPortal); }, //updateFunc
(panel) => { return panel.YnvPortal == CurrentNavPortal; }); //findFunc (panel) => { return panel.YnvPortal == CurrentNavPortal; }); //findFunc
} }
private void ShowEditTrainTrackPanel(bool promote) public void ShowEditTrainTrackPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditTrainTrackPanel(this); }, //createFunc () => { return new EditTrainTrackPanel(this); }, //createFunc
(panel) => { panel.SetTrainTrack(CurrentTrainTrack); }, //updateFunc (panel) => { panel.SetTrainTrack(CurrentTrainTrack); }, //updateFunc
(panel) => { return panel.Track == CurrentTrainTrack; }); //findFunc (panel) => { return panel.Track == CurrentTrainTrack; }); //findFunc
} }
private void ShowEditTrainNodePanel(bool promote) public void ShowEditTrainNodePanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditTrainNodePanel(this); }, //createFunc () => { return new EditTrainNodePanel(this); }, //createFunc
(panel) => { panel.SetTrainNode(CurrentTrainNode); }, //updateFunc (panel) => { panel.SetTrainNode(CurrentTrainNode); }, //updateFunc
(panel) => { return panel.TrainNode == CurrentTrainNode; }); //findFunc (panel) => { return panel.TrainNode == CurrentTrainNode; }); //findFunc
} }
private void ShowEditScenarioYmtPanel(bool promote) public void ShowEditScenarioYmtPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditScenarioYmtPanel(this); }, //createFunc () => { return new EditScenarioYmtPanel(this); }, //createFunc
(panel) => { panel.SetScenarioYmt(CurrentScenario); }, //updateFunc (panel) => { panel.SetScenarioYmt(CurrentScenario); }, //updateFunc
(panel) => { return panel.CurrentScenario == CurrentScenario; }); //findFunc (panel) => { return panel.CurrentScenario == CurrentScenario; }); //findFunc
} }
private void ShowEditScenarioNodePanel(bool promote) public void ShowEditScenarioNodePanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditScenarioNodePanel(this); }, //createFunc () => { return new EditScenarioNodePanel(this); }, //createFunc
(panel) => { panel.SetScenarioNode(CurrentScenarioNode); }, //updateFunc (panel) => { panel.SetScenarioNode(CurrentScenarioNode); }, //updateFunc
(panel) => { return panel.CurrentScenarioNode == CurrentScenarioNode; }); //findFunc (panel) => { return panel.CurrentScenarioNode == CurrentScenarioNode; }); //findFunc
} }
private void ShowEditYtypArchetypeMloRoomPanel(bool promote) public void ShowEditYtypArchetypeMloRoomPanel(bool promote)
{ {
ShowPanel(promote, ShowPanel(promote,
() => { return new EditYtypArchetypeMloRoomPanel(this); }, //createFunc () => { return new EditYtypArchetypeMloRoomPanel(this); }, //createFunc
(panel) => { panel.SetRoom(CurrentMloRoom); }, //updateFunc (panel) => { panel.SetRoom(CurrentMloRoom); }, //updateFunc
(panel) => { return panel.CurrentRoom == CurrentMloRoom; }); //findFunc (panel) => { return panel.CurrentRoom == CurrentMloRoom; }); //findFunc
} }
private void ShowEditAudioFilePanel(bool promote) //TODO public void ShowEditAudioFilePanel(bool promote) //TODO
{ {
} }
private void ShowEditAudioZonePanel(bool promote) //TODO public void ShowEditAudioZonePanel(bool promote) //TODO
{ {
} }
private void ShowEditAudioEmitterPanel(bool promote) //TODO public void ShowEditAudioEmitterPanel(bool promote) //TODO
{ {
} }
private void ShowEditAudioZoneListPanel(bool promote) //TODO public void ShowEditAudioZoneListPanel(bool promote) //TODO
{ {
} }
private void ShowEditAudioEmitterListPanel(bool promote) //TODO public void ShowEditAudioEmitterListPanel(bool promote) //TODO
{ {
} }
@ -692,6 +696,14 @@ namespace CodeWalker.Project
RefreshUI(); RefreshUI();
} }
public void SetCurrentArchetype(Archetype arch)
{
CurrentArchetype = arch;
if (CurrentArchetype != null)
{
CurrentYtypFile = CurrentEntity?.MloParent?.Archetype?.Ytyp ?? CurrentArchetype?.Ytyp;
}
}
private void ClosePanel<T>(Func<T,bool> findFunc) where T : ProjectPanel private void ClosePanel<T>(Func<T,bool> findFunc) where T : ProjectPanel
{ {