Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Jun 29, 2022
1 parent 48b191d commit d5bbe01
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
28 changes: 13 additions & 15 deletions IndustrialPark/ArchiveEditor/ArchiveEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ private void closeToolStripMenuItem_Click(object sender, EventArgs e)
CloseArchiveEditor();
}

public event Action EditorClosed;
public event Action EditorUpdate;

protected virtual void OnEditorClosed()
protected virtual void OnEditorUpdate()
{
EditorClosed?.Invoke();
EditorUpdate?.Invoke();
}

public void CloseArchiveEditor()
Expand All @@ -327,7 +327,7 @@ public void CloseArchiveEditor()
Program.MainForm.UpdateTitleBar();
}
Close();
OnEditorClosed();
OnEditorUpdate();
}

private bool programIsChangingStuff = false;
Expand Down Expand Up @@ -599,6 +599,9 @@ private ListViewItem ListViewItemFromAsset(Asset asset, bool selected)
Tag = asset.assetID
};

if (asset.AssetInfo == null)
MessageBox.Show(asset.ToString());

item.SubItems.AddRange(new ListViewItem.ListViewSubItem[]
{
new ListViewItem.ListViewSubItem(item, asset.assetID.ToString("X8")),
Expand Down Expand Up @@ -721,9 +724,8 @@ private void importMultipleAssetsToolStripMenuItem_Click(object sender, EventArg
{
List<uint> assetIDs = archive.ImportMultipleAssets(comboBoxLayers.SelectedIndex, AHDRs, overwrite);
comboBoxLayers.Items[comboBoxLayers.SelectedIndex] = archive.LayerToString(comboBoxLayers.SelectedIndex);
Program.MainForm.RefreshTexturesAndModels();
OnEditorUpdate();
SetSelectedIndices(assetIDs, true);
SetupAssetVisibilityButtons();
}
}

Expand All @@ -739,8 +741,7 @@ private void importModelsToolStripMenuItem_Click(object sender, EventArgs e)
if (makeSimps)
assetIDs.AddRange(archive.MakeSimps(assetIDs, solidSimps, ledgeGrabSimps));
PopulateLayerComboBox();
Program.MainForm.RefreshTexturesAndModels();
SetupAssetVisibilityButtons();
OnEditorUpdate();
SetSelectedIndices(assetIDs, true);
}
}
Expand All @@ -753,8 +754,7 @@ private void ImportTexturesToolStripMenuItem_Click(object sender, EventArgs e)
{
List<uint> assetIDs = archive.ImportMultipleAssets(comboBoxLayers.SelectedIndex, AHDRs, overwrite);
comboBoxLayers.Items[comboBoxLayers.SelectedIndex] = archive.LayerToString(comboBoxLayers.SelectedIndex);
Program.MainForm.RefreshTexturesAndModels();
SetupAssetVisibilityButtons();
OnEditorUpdate();
SetSelectedIndices(assetIDs, true);
}
}
Expand Down Expand Up @@ -1116,8 +1116,7 @@ private void EditPACKToolStripMenuItem_Click(object sender, EventArgs e)
PopulateLayerTypeComboBox();
PopulateLayerComboBox();
PopulateAssetList();
archive.SetupTextureDisplay();
SetupAssetVisibilityButtons();
OnEditorUpdate();
}
}

Expand Down Expand Up @@ -1186,7 +1185,7 @@ private void importHIPArchiveToolStripMenuItem_Click(object sender, EventArgs e)
if (openFile.ShowDialog() == DialogResult.OK)
{
archive.ImportHip(openFile.FileNames, false);
SetupAssetVisibilityButtons();
OnEditorUpdate();
}
PopulateLayerComboBox();
}
Expand Down Expand Up @@ -1370,9 +1369,8 @@ private void ImportTXD(bool RW3)
if (openTXD.ShowDialog() == DialogResult.OK)
{
archive.ImportTextureDictionary(openTXD.FileName, RW3);
Program.MainForm.RefreshTexturesAndModels();
PopulateLayerComboBox();
SetupAssetVisibilityButtons();
OnEditorUpdate();
}
}

Expand Down
12 changes: 6 additions & 6 deletions IndustrialPark/Assets/ObjectAssets/AssetCOND.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,33 +327,33 @@ public override string AssetInfo
}
}

[Category(catName), DisplayName(catName)]
[Category(catName), DisplayName("Conditional (Hash)")]
public AssetID ConditionalVariable_Hash { get; set; }
[Category(catName), DisplayName(catName)]
[Category(catName), DisplayName("Conditional (Scooby)")]
public ConditionalVariableScooby Conditional_Scooby
{
get => (ConditionalVariableScooby)(uint)ConditionalVariable_Hash;
set => ConditionalVariable_Hash = (uint)value;
}
[Category(catName), DisplayName(catName)]
[Category(catName), DisplayName("Conditional (BFBB)")]
public ConditionalVariableBFBB Conditional_BFBB
{
get => (ConditionalVariableBFBB)(uint)ConditionalVariable_Hash;
set => ConditionalVariable_Hash = (uint)value;
}
[Category(catName), DisplayName(catName)]
[Category(catName), DisplayName("Conditional (TSSM)")]
public ConditionalVariableTSSM Conditional_TSSM
{
get => (ConditionalVariableTSSM)(uint)ConditionalVariable_Hash;
set => ConditionalVariable_Hash = (uint)value;
}
[Category(catName), DisplayName(catName)]
[Category(catName), DisplayName("Conditional (Incredibles)")]
public ConditionalVariableIncredibles Conditional_Incredibles
{
get => (ConditionalVariableIncredibles)(uint)ConditionalVariable_Hash;
set => ConditionalVariable_Hash = (uint)value;
}
[Category(catName), DisplayName(catName)]
[Category(catName), DisplayName("Conditional (ROTU)")]
public ConditionalVariableROTU Conditional_ROTU
{
get => (ConditionalVariableROTU)(uint)ConditionalVariable_Hash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace IndustrialPark
{
public class AssetDUPC : BaseAsset, IRenderableAsset, IClickableAsset, IRotatableAsset, IScalableAsset
{
public override string AssetInfo => VIL.assetName;
public override string AssetInfo => VIL.AssetInfo;

private const string categoryName = "Duplicator";
private const string categoryName2 = "Duplicator VIL";
Expand Down Expand Up @@ -42,6 +42,13 @@ public class AssetDUPC : BaseAsset, IRenderableAsset, IClickableAsset, IRotatabl
[Category(categoryName2), TypeConverter(typeof(ExpandableObjectConverter))]
public AssetVIL VIL { get; set; }

public AssetDUPC(string assetName, Vector3 position) : base(assetName, AssetType.Duplicator, BaseAssetType.Duplicator)
{
VIL = new AssetVIL(assetName, position, AssetTemplate.VIL, 0);
renderableAssets.Remove(VIL);
AddToRenderableAssets(this);
}

public AssetDUPC(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
Expand All @@ -62,10 +69,10 @@ public AssetDUPC(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHD
NavMesh1 = reader.ReadUInt32();
UnknownInt_30 = reader.ReadInt32();
VIL = new AssetVIL(reader);

CreateTransformMatrix();
AddToRenderableAssets(this);
}

CreateTransformMatrix();
AddToRenderableAssets(this);
}

public override byte[] Serialize(Game game, Endianness endianness)
Expand Down
5 changes: 3 additions & 2 deletions IndustrialPark/MainForm/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -755,15 +755,16 @@ public void AddArchiveEditor(string filePath = null, Platform scoobyPlatform = P
archiveEditorToolStripMenuItem.DropDownItems.Add(tempMenuItem);

ae.archive.ChangesMade += UpdateTitleBar;
ae.EditorClosed += UpdateCloseAllArchiveMenuItem;
ae.EditorUpdate += EditorUpdate;
UpdateTitleBar();
SetupAssetVisibilityButtons();
closeAllEditorsToolStripMenuItem.Enabled = true;
}

public void UpdateCloseAllArchiveMenuItem()
public void EditorUpdate()
{
closeAllEditorsToolStripMenuItem.Enabled = archiveEditors.Count > 0;
RefreshTexturesAndModels();
SetupAssetVisibilityButtons();
}

Expand Down

0 comments on commit d5bbe01

Please sign in to comment.