Fixed bug with display entity indexes option in ProjectForm so as not to lose the current selection in the project explorer (but only for entities).

This commit is contained in:
dexy 2021-11-10 01:00:11 +11:00
parent 07fa8e6e86
commit c18b381115

View File

@ -9441,12 +9441,27 @@ namespace CodeWalker.Project
OptionsAutoCalcYmapExtentsMenu.Checked = !OptionsAutoCalcYmapExtentsMenu.Checked; OptionsAutoCalcYmapExtentsMenu.Checked = !OptionsAutoCalcYmapExtentsMenu.Checked;
autoymapextents = OptionsAutoCalcYmapExtentsMenu.Checked; autoymapextents = OptionsAutoCalcYmapExtentsMenu.Checked;
} }
private void OptionsDisplayEntityIndexesMenu_Click(object sender, EventArgs e) private void OptionsDisplayEntityIndexesMenu_Click(object sender, EventArgs e)
{ {
OptionsDisplayEntityIndexesMenu.Checked = !OptionsDisplayEntityIndexesMenu.Checked; OptionsDisplayEntityIndexesMenu.Checked = !OptionsDisplayEntityIndexesMenu.Checked;
displayentityindexes = OptionsDisplayEntityIndexesMenu.Checked; displayentityindexes = OptionsDisplayEntityIndexesMenu.Checked;
ProjectExplorer?.LoadProjectTree(CurrentProjectFile); ProjectExplorer?.LoadProjectTree(CurrentProjectFile);
//make sure the current item is selected in the project explorer, let's just assume it's an entity
//(for things other than entities, they will need to be re-selected manually by the user to sync project explorer again)
if (CurrentEntity != null)
{
MloInstanceData mloInstance = CurrentEntity.MloParent?.MloInstance;
if (mloInstance != null) //indexes aren't shown for MLO entities, but just in case one was selected
{
MCEntityDef entityDef = mloInstance.TryGetArchetypeEntity(CurrentEntity);
ProjectExplorer?.TrySelectMloEntityTreeNode(entityDef);
}
else
{
ProjectExplorer?.TrySelectEntityTreeNode(CurrentEntity);
}
}
} }
private void ToolbarNewButton_ButtonClick(object sender, EventArgs e) private void ToolbarNewButton_ButtonClick(object sender, EventArgs e)