Skip to content

Commit

Permalink
hide individual assets
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Nov 30, 2018
1 parent 74e273d commit 1c4ecc8
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 158 deletions.
111 changes: 56 additions & 55 deletions IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs

Large diffs are not rendered by default.

210 changes: 136 additions & 74 deletions IndustrialPark/ArchiveEditor/ArchiveEditor.cs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ private void AddAssetToDictionary(Section_AHDR AHDR)
throw new Exception("Unknown asset type: " + AHDR.assetType);
}

if (hiddenAssets.Contains(AHDR.assetID))
assetDictionary[AHDR.assetID].isInvisible = true;

allowRender = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ namespace IndustrialPark
{
public partial class ArchiveEditorFunctions
{
public static List<uint> hiddenAssets = new List<uint>();

public List<uint> GetHiddenAssets()
{
List<uint> hiddenAssets = new List<uint>();
foreach (Asset a in assetDictionary.Values)
if (a.isInvisible)
hiddenAssets.Add(a.AHDR.assetID);

return hiddenAssets;
}

private List<IInternalEditor> internalEditors = new List<IInternalEditor>();

public void CloseInternalEditor(IInternalEditor i)
Expand All @@ -31,8 +43,10 @@ public void OpenInternalEditor(List<uint> list, bool openAnyway)
{
bool willOpen = true;
if (list.Count > 15 && !openAnyway)
{
willOpen = MessageBox.Show($"Warning: you're going to open {list.Count} Asset Data Editor windows. Are you sure you want to do that?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes;

}

if (willOpen)
foreach (uint u in list)
if (assetDictionary.ContainsKey(u))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected void CreateBoundingBox()

public float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

if (ray.Intersects(ref boundingBox, out float distance))
Expand Down Expand Up @@ -84,7 +84,7 @@ protected void CreateBoundingBox()

public void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

renderer.DrawCube(world, isSelected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void CreateBoundingBox()

public float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

if (ray.Intersects(ref boundingBox, out float distance))
Expand Down Expand Up @@ -82,7 +82,7 @@ protected void CreateBoundingBox()

public void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

renderer.DrawPyramid(world, isSelected, 1f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void CreateBoundingBox()

public float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

if (ray.Intersects(ref boundingSphere))
Expand Down Expand Up @@ -114,7 +114,7 @@ protected void CreateBoundingBox()

public void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

if (_distanceICanSeeYou == -1f)
renderer.DrawPyramid(world, isSelected, 1f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected void CreateBoundingBox()

public float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

if (ray.Intersects(ref boundingSphere))
Expand Down Expand Up @@ -92,7 +92,7 @@ protected void CreateBoundingBox()

public void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

renderer.DrawSphere(world, isSelected, renderer.sfxColor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override bool HasReference(uint assetID)

protected override float? TriangleIntersection(Ray r, float initialDistance)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

uint _modelAssetId;
Expand Down Expand Up @@ -78,7 +78,7 @@ public override bool HasReference(uint assetID)

public override void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;
if (AssetPICK.pickEntries.ContainsKey(_pickEntryID))
if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(AssetPICK.pickEntries[_pickEntryID]))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected override void CreateBoundingBox()

public override void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

renderer.DrawPyramid(world, isSelected, 1f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected override void CreateBoundingBox()

public override void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

if (Shape == TriggerShape.Box)
renderer.DrawCube(world, isSelected, 1f);
Expand All @@ -96,7 +96,7 @@ public override void Draw(SharpRenderer renderer)

public override float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

if (Shape == TriggerShape.Box)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override void CreateBoundingBox()

public override void Draw(SharpRenderer renderer)
{
if (DontRender)
if (DontRender || isInvisible)
return;

if (_textureAssetID == 0)
Expand Down
4 changes: 2 additions & 2 deletions IndustrialPark/Assets/ObjectAssets/DYNA/AssetDYNA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public DynaBase DynaBase

public float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

return _dynaSpecific.IntersectsWith(ray);
Expand All @@ -181,7 +181,7 @@ public void CreateTransformMatrix()

public void Draw(SharpRenderer renderer)
{
if (dontRender)
if (dontRender || isInvisible)
return;

_dynaSpecific.Draw(renderer, isSelected);
Expand Down
4 changes: 2 additions & 2 deletions IndustrialPark/Assets/Renderable/AssetJSP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public float GetDistance(Vector3 cameraPosition)

public void Draw(SharpRenderer renderer)
{
if (dontRender) return;
if (dontRender || isInvisible) return;

model.Render(renderer, Matrix.Identity, isSelected ? renderer.selectedObjectColor : Vector4.One);
}

public float? IntersectsWith(Ray ray)
{
if (dontRender)
if (dontRender || isInvisible)
return null;

return TriangleIntersection(ray);
Expand Down
1 change: 1 addition & 0 deletions IndustrialPark/Assets/Shared/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Asset

public Section_AHDR AHDR;
public bool isSelected;
public bool isInvisible = false;

public Asset(Section_AHDR AHDR)
{
Expand Down
4 changes: 2 additions & 2 deletions IndustrialPark/Assets/Shared/PlaceableAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected void CreateBoundingBox(List<Vector3> vertexList, float multiplier = 1f

public virtual void Draw(SharpRenderer renderer)
{
if (DontRender) return;
if (DontRender || isInvisible) return;

if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(_modelAssetID))
ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, world, isSelected ? renderer.selectedObjectColor * _color : _color);
Expand All @@ -94,7 +94,7 @@ public virtual void Draw(SharpRenderer renderer)

public virtual float? IntersectsWith(Ray ray)
{
if (DontRender)
if (DontRender || isInvisible)
return null;

if (ray.Intersects(ref boundingBox, out float distance))
Expand Down
2 changes: 1 addition & 1 deletion IndustrialPark/MainForm/AboutBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions IndustrialPark/MainForm/Json/ProjectJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class ProjectJson
{
public List<string> hipPaths;
public List<string> TextureFolderPaths;
public List<uint> hiddenAssets;

public Vector3 CamPos;
public float Yaw;
Expand Down Expand Up @@ -54,6 +55,7 @@ public ProjectJson()
{
hipPaths = new List<string>();
TextureFolderPaths = new List<string>();
hiddenAssets = new List<uint>();

CamPos = new Vector3();
Yaw = 0;
Expand Down Expand Up @@ -101,10 +103,10 @@ public ProjectJson()

public ProjectJson(List<string> hipPaths, List<string> textureFolderPaths, Vector3 camPos, float yaw, float pitch, float speed, float speedRot,
float fieldOfView, float farPlane, bool noCulling, bool wireframe, Color4 backgroundColor, Vector4 widgetColor, Vector4 trigColor,
Vector4 mvptColor, Vector4 sfxColor, bool useLegacyAssetIDFormat, bool alternateNameDisplayMode, bool isDrawingUI, bool dontRenderLevelModel,
bool dontRenderBOUL, bool dontRenderBUTN, bool dontRenderCAM, bool dontRenderDSTR, bool dontRenderDYNA, bool dontRenderEGEN, bool dontRenderHANG,
bool dontRenderMRKR, bool dontRenderMVPT, bool dontRenderPEND, bool dontRenderPKUP, bool dontRenderPLAT, bool dontRenderPLYR, bool dontRenderSFX,
bool dontRenderSIMP, bool dontRenderTRIG, bool dontRenderUI, bool dontRenderUIFT, bool dontRenderVIL)
Vector4 mvptColor, Vector4 sfxColor, bool useLegacyAssetIDFormat, bool alternateNameDisplayMode, List<uint> hiddenAssets, bool isDrawingUI,
bool dontRenderLevelModel, bool dontRenderBOUL, bool dontRenderBUTN, bool dontRenderCAM, bool dontRenderDSTR, bool dontRenderDYNA, bool dontRenderEGEN,
bool dontRenderHANG, bool dontRenderMRKR, bool dontRenderMVPT, bool dontRenderPEND, bool dontRenderPKUP, bool dontRenderPLAT, bool dontRenderPLYR,
bool dontRenderSFX, bool dontRenderSIMP, bool dontRenderTRIG, bool dontRenderUI, bool dontRenderUIFT, bool dontRenderVIL)
{
this.hipPaths = hipPaths;
TextureFolderPaths = textureFolderPaths;
Expand All @@ -124,6 +126,7 @@ public ProjectJson(List<string> hipPaths, List<string> textureFolderPaths, Vecto
SfxColor = sfxColor;
UseLegacyAssetIDFormat = useLegacyAssetIDFormat;
AlternateNameDisplayMode = alternateNameDisplayMode;
this.hiddenAssets = hiddenAssets;
this.isDrawingUI = isDrawingUI;
this.dontRenderLevelModel = dontRenderLevelModel;
this.dontRenderBOUL = dontRenderBOUL;
Expand Down
Loading

0 comments on commit 1c4ecc8

Please sign in to comment.