diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23dfd39a6..534089471 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
Built with Unity 2020.3.
### Added
+- Create insert meshes ([#320](https://github.com/freezy/VisualPinball.Engine/pull/320))
- Full support for custom playfield meshes.
- Remove Hybrid Renderer ([#316](https://github.com/freezy/VisualPinball.Engine/pull/316)).
- Create and use Unity assets when importing ([#320](https://github.com/freezy/VisualPinball.Engine/pull/302)).
diff --git a/VisualPinball.Engine/VPT/Light/LightData.cs b/VisualPinball.Engine/VPT/Light/LightData.cs
index 91d12aa55..adfcbd8ea 100644
--- a/VisualPinball.Engine/VPT/Light/LightData.cs
+++ b/VisualPinball.Engine/VPT/Light/LightData.cs
@@ -26,6 +26,7 @@
using System.IO;
using VisualPinball.Engine.IO;
using VisualPinball.Engine.Math;
+using VisualPinball.Engine.VPT.Surface;
using VisualPinball.Engine.VPT.Table;
namespace VisualPinball.Engine.VPT.Light
@@ -157,4 +158,18 @@ public override void Write(BinaryWriter writer, HashWriter hashWriter)
#endregion
}
+
+ public class LightInsertData : ISurfaceData
+ {
+ public float HeightBottom { get; }
+ public float HeightTop { get; }
+ public DragPointData[] DragPoints { get; }
+
+ public LightInsertData(DragPointData[] dragPoints, float height)
+ {
+ HeightBottom = -height;
+ HeightTop = 0f;
+ DragPoints = dragPoints;
+ }
+ }
}
diff --git a/VisualPinball.Engine/VPT/Surface/ISurfaceData.cs b/VisualPinball.Engine/VPT/Surface/ISurfaceData.cs
new file mode 100644
index 000000000..68a8303ff
--- /dev/null
+++ b/VisualPinball.Engine/VPT/Surface/ISurfaceData.cs
@@ -0,0 +1,29 @@
+// Visual Pinball Engine
+// Copyright (C) 2021 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using VisualPinball.Engine.Math;
+
+namespace VisualPinball.Engine.VPT.Surface
+{
+ public interface ISurfaceData
+ {
+ float HeightBottom { get; }
+
+ float HeightTop { get; }
+
+ DragPointData[] DragPoints { get; }
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/IDragPointsEditable.cs.meta b/VisualPinball.Engine/VPT/Surface/ISurfaceData.cs.meta
similarity index 83%
rename from VisualPinball.Unity/VisualPinball.Unity/VPT/IDragPointsEditable.cs.meta
rename to VisualPinball.Engine/VPT/Surface/ISurfaceData.cs.meta
index 2421253f8..24c857d32 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/IDragPointsEditable.cs.meta
+++ b/VisualPinball.Engine/VPT/Surface/ISurfaceData.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: d59d7481d338f354a9290af78a1ff975
+guid: 773f46c53f6f1304e8d96cbb1bd0a5e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/VisualPinball.Engine/VPT/Surface/Surface.cs b/VisualPinball.Engine/VPT/Surface/Surface.cs
index 7efb91282..519357c91 100644
--- a/VisualPinball.Engine/VPT/Surface/Surface.cs
+++ b/VisualPinball.Engine/VPT/Surface/Surface.cs
@@ -53,14 +53,10 @@ public static Surface GetDefault(Table.Table table)
Matrix3D IRenderable.TransformationMatrix(Table.Table table, Origin origin) => Matrix3D.Identity;
- public RenderObject GetRenderObject(Table.Table table, string id = null, Origin origin = Origin.Global, bool asRightHanded = true)
- {
- return _meshGenerator.GetRenderObject(table, id, table.TableHeight, asRightHanded);
- }
public RenderObjectGroup GetRenderObjects(Table.Table table, Origin origin = Origin.Global, bool asRightHanded = true)
{
- return _meshGenerator.GetRenderObjects(table, asRightHanded);
+ return _meshGenerator.GetRenderObjects(table, Data, asRightHanded);
}
#endregion
diff --git a/VisualPinball.Engine/VPT/Surface/SurfaceData.cs b/VisualPinball.Engine/VPT/Surface/SurfaceData.cs
index 4bd2bbacf..0da64cdee 100644
--- a/VisualPinball.Engine/VPT/Surface/SurfaceData.cs
+++ b/VisualPinball.Engine/VPT/Surface/SurfaceData.cs
@@ -31,7 +31,7 @@
namespace VisualPinball.Engine.VPT.Surface
{
[Serializable]
- public class SurfaceData : ItemData
+ public class SurfaceData : ItemData, ISurfaceData
{
public override string GetName() => Name;
public override void SetName(string name) { Name = name; }
@@ -76,10 +76,10 @@ public class SurfaceData : ItemData
public string SlingShotMaterial = string.Empty;
[BiffFloat("HTBT", Pos = 14)]
- public float HeightBottom = 0f;
+ public float HeightBottom { get; set; }
[BiffFloat("HTTP", Pos = 15)]
- public float HeightTop = 50f;
+ public float HeightTop { get; set; } = 50f;
[BiffBool("INNR", SkipWrite = true)]
public bool Inner = true;
@@ -127,7 +127,7 @@ public class SurfaceData : ItemData
public bool IsReflectionEnabled = true;
[BiffDragPoint("DPNT", TagAll = true, Pos = 2000)]
- public DragPointData[] DragPoints;
+ public DragPointData[] DragPoints { get; set; }
[BiffBool("TMON", Pos = 6)]
public bool IsTimerEnabled;
diff --git a/VisualPinball.Engine/VPT/Surface/SurfaceMeshGenerator.cs b/VisualPinball.Engine/VPT/Surface/SurfaceMeshGenerator.cs
index dfde129de..262f62762 100644
--- a/VisualPinball.Engine/VPT/Surface/SurfaceMeshGenerator.cs
+++ b/VisualPinball.Engine/VPT/Surface/SurfaceMeshGenerator.cs
@@ -27,14 +27,14 @@ public class SurfaceMeshGenerator
public const string Side = "Side";
public const string Top = "Top";
- private readonly SurfaceData _data;
+ private readonly ISurfaceData _data;
- public SurfaceMeshGenerator(SurfaceData data)
+ public SurfaceMeshGenerator(ISurfaceData data)
{
_data = data;
}
- public RenderObject GetRenderObject(Table.Table table, string id, float playfieldHeight, bool asRightHanded, Mesh preGeneratedMesh = null)
+ public RenderObject GetRenderObject(Table.Table table, SurfaceData data, string id, float playfieldHeight, bool asRightHanded, Mesh preGeneratedMesh = null)
{
var mesh = preGeneratedMesh ?? GenerateMesh(table.Width, table.Height, playfieldHeight, id);
switch (id) {
@@ -42,15 +42,15 @@ public RenderObject GetRenderObject(Table.Table table, string id, float playfiel
return new RenderObject(
id,
asRightHanded ? mesh.Transform(Matrix3D.RightHanded) : mesh,
- new PbrMaterial(table.GetMaterial(_data.SideMaterial), table.GetTexture(_data.SideImage)),
- _data.IsSideVisible
+ new PbrMaterial(table.GetMaterial(data.SideMaterial), table.GetTexture(data.SideImage)),
+ data.IsSideVisible
);
case Top:
return new RenderObject(
id,
asRightHanded ? mesh.Transform(Matrix3D.RightHanded) : mesh,
- new PbrMaterial(table.GetMaterial(_data.TopMaterial), table.GetTexture(_data.Image)),
- _data.IsTopBottomVisible
+ new PbrMaterial(table.GetMaterial(data.TopMaterial), table.GetTexture(data.Image)),
+ data.IsTopBottomVisible
);
default:
throw new ArgumentException($"Unknown mesh ID \"{id}\".");
@@ -62,19 +62,19 @@ public Mesh GetMesh(float tableWidth, float tableHeight, float playfieldHeight,
return GenerateMesh(tableWidth, tableHeight, playfieldHeight, id);
}
- public RenderObjectGroup GetRenderObjects(Table.Table table, bool asRightHanded = true)
+ public RenderObjectGroup GetRenderObjects(Table.Table table, SurfaceData data, bool asRightHanded = true)
{
var renderObjects = new List();
var sideMesh = GenerateSideMesh(table.TableHeight);
var topMesh = GenerateTopMesh(table.Width, table.Height, table.TableHeight);
if (sideMesh != null) {
- renderObjects.Add(GetRenderObject(table, Side, table.TableHeight, asRightHanded, sideMesh));
+ renderObjects.Add(GetRenderObject(table, data, Side, table.TableHeight, asRightHanded, sideMesh));
}
if (topMesh != null) {
- renderObjects.Add(GetRenderObject(table, Top, table.TableHeight, asRightHanded, topMesh));
+ renderObjects.Add(GetRenderObject(table, data, Top, table.TableHeight, asRightHanded, topMesh));
}
- return new RenderObjectGroup(_data.Name, "Surfaces", Matrix3D.Identity, renderObjects.ToArray());
+ return new RenderObjectGroup(data.Name, "Surfaces", Matrix3D.Identity, renderObjects.ToArray());
}
private Mesh GenerateMesh(float tableWidth, float tableHeight, float zHeight, string id)
@@ -250,19 +250,17 @@ private Mesh GenerateSideMesh(float playfieldHeight) {
sideMesh.Vertices[offset + 3].Y = pv2.Y;
sideMesh.Vertices[offset + 3].Z = bottom;
- if (_data.SideImage != null) {
- sideMesh.Vertices[offset].Tu = rgTexCoord[i];
- sideMesh.Vertices[offset].Tv = 1.0f;
+ sideMesh.Vertices[offset].Tu = rgTexCoord[i];
+ sideMesh.Vertices[offset].Tv = 1.0f;
- sideMesh.Vertices[offset + 1].Tu = rgTexCoord[i];
- sideMesh.Vertices[offset + 1].Tv = 0f;
+ sideMesh.Vertices[offset + 1].Tu = rgTexCoord[i];
+ sideMesh.Vertices[offset + 1].Tv = 0f;
- sideMesh.Vertices[offset + 2].Tu = rgTexCoord[c];
- sideMesh.Vertices[offset + 2].Tv = 0f;
+ sideMesh.Vertices[offset + 2].Tu = rgTexCoord[c];
+ sideMesh.Vertices[offset + 2].Tv = 0f;
- sideMesh.Vertices[offset + 3].Tu = rgTexCoord[c];
- sideMesh.Vertices[offset + 3].Tv = 1.0f;
- }
+ sideMesh.Vertices[offset + 3].Tu = rgTexCoord[c];
+ sideMesh.Vertices[offset + 3].Tv = 1.0f;
sideMesh.Vertices[offset].Nx = vNormal[0].X;
sideMesh.Vertices[offset].Ny = -vNormal[0].Y;
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_blue/light_insert.png b/VisualPinball.Unity/Assets/Editor/Icons/small_blue/light_insert.png
new file mode 100644
index 000000000..93b550845
Binary files /dev/null and b/VisualPinball.Unity/Assets/Editor/Icons/small_blue/light_insert.png differ
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_blue/light_insert.png.meta b/VisualPinball.Unity/Assets/Editor/Icons/small_blue/light_insert.png.meta
new file mode 100644
index 000000000..d61c76018
--- /dev/null
+++ b/VisualPinball.Unity/Assets/Editor/Icons/small_blue/light_insert.png.meta
@@ -0,0 +1,108 @@
+fileFormatVersion: 2
+guid: 8297ba45bbbe6ab448025d014fa7df8b
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 1
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 0
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 2
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_gray/light_insert.png b/VisualPinball.Unity/Assets/Editor/Icons/small_gray/light_insert.png
new file mode 100644
index 000000000..5b618bd02
Binary files /dev/null and b/VisualPinball.Unity/Assets/Editor/Icons/small_gray/light_insert.png differ
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_gray/light_insert.png.meta b/VisualPinball.Unity/Assets/Editor/Icons/small_gray/light_insert.png.meta
new file mode 100644
index 000000000..591706efa
--- /dev/null
+++ b/VisualPinball.Unity/Assets/Editor/Icons/small_gray/light_insert.png.meta
@@ -0,0 +1,108 @@
+fileFormatVersion: 2
+guid: 90d9c1185c44a114084119eb16f072ee
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 1
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 0
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 2
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_green/light_insert.png b/VisualPinball.Unity/Assets/Editor/Icons/small_green/light_insert.png
new file mode 100644
index 000000000..5b739b701
Binary files /dev/null and b/VisualPinball.Unity/Assets/Editor/Icons/small_green/light_insert.png differ
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_green/light_insert.png.meta b/VisualPinball.Unity/Assets/Editor/Icons/small_green/light_insert.png.meta
new file mode 100644
index 000000000..5eaccbcf3
--- /dev/null
+++ b/VisualPinball.Unity/Assets/Editor/Icons/small_green/light_insert.png.meta
@@ -0,0 +1,108 @@
+fileFormatVersion: 2
+guid: 981d6f1141a86b74ebbd6117c85083d5
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 1
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 0
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 2
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_orange/light_insert.png b/VisualPinball.Unity/Assets/Editor/Icons/small_orange/light_insert.png
new file mode 100644
index 000000000..5c8e50a4d
Binary files /dev/null and b/VisualPinball.Unity/Assets/Editor/Icons/small_orange/light_insert.png differ
diff --git a/VisualPinball.Unity/Assets/Editor/Icons/small_orange/light_insert.png.meta b/VisualPinball.Unity/Assets/Editor/Icons/small_orange/light_insert.png.meta
new file mode 100644
index 000000000..fab9f0971
--- /dev/null
+++ b/VisualPinball.Unity/Assets/Editor/Icons/small_orange/light_insert.png.meta
@@ -0,0 +1,108 @@
+fileFormatVersion: 2
+guid: 088f14fce3d29544da1412a257cbba0f
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 1
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 0
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 2
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 64
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/ControlPoint.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/ControlPoint.cs
index 92a9b7b64..76ac7e70d 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/ControlPoint.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/ControlPoint.cs
@@ -75,7 +75,7 @@ public ControlPoint(DragPointData dp, int controlId, int idx, float indexRatio)
IndexRatio = indexRatio;
}
- public void UpdateDragPoint(IDragPointsEditable editable, Transform transform)
+ public void UpdateDragPoint(IDragPointsInspector editable, Transform transform)
{
var dragpointPos = transform.worldToLocalMatrix.MultiplyPoint(WorldPos);
dragpointPos -= editable.EditableOffset;
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointMenuItems.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointMenuItems.cs
index 68486e342..b6a3936dd 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointMenuItems.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointMenuItems.cs
@@ -24,35 +24,35 @@ public static class DragPointMenuItems
public const string ControlPointsMenuPath = "CONTEXT/DragPointsItemInspector/ControlPoint";
public const string CurveTravellerMenuPath = "CONTEXT/DragPointsItemInspector/CurveTraveller";
- private static DragPointData RetrieveDragPoint(IDragPointsItemInspector inspector, int controlId)
+ private static DragPointData RetrieveDragPoint(IDragPointsInspector inspector, int controlId)
{
- return inspector?.GetDragPoint(controlId);
+ return inspector?.DragPointsHelper.GetDragPoint(controlId);
}
// Drag Points
[MenuItem(ControlPointsMenuPath + "/Is Slingshot", false, 1)]
private static void SlingShot(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
var dragPoint = RetrieveDragPoint(inspector, command.userData);
if (dragPoint != null) {
- inspector.PrepareUndo("Toggle Drag Point Slingshot");
+ inspector.DragPointsHelper.PrepareUndo("Toggle Drag Point Slingshot");
dragPoint.IsSlingshot = !dragPoint.IsSlingshot;
- inspector.RebuildMeshes();
+ inspector.DragPointsHelper.RebuildMeshes();
}
}
[MenuItem(ControlPointsMenuPath + "/Is Slingshot", true)]
private static bool SlingshotValidate(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector) || inspector.IsItemLocked()) {
+ if (!(command.context is IDragPointsInspector inspector) || inspector.DragPointsHelper.IsItemLocked()) {
return false;
}
- if (!inspector.HasDragPointExposure(DragPointExposure.SlingShot)) {
+ if (!inspector.DragPointsHelper.HasDragPointExposure(DragPointExposure.SlingShot)) {
Menu.SetChecked($"{ControlPointsMenuPath}/IsSlingshot", false);
return false;
}
@@ -68,27 +68,27 @@ private static bool SlingshotValidate(MenuCommand command)
[MenuItem(ControlPointsMenuPath + "/Is Smooth", false, 1)]
private static void Smooth(MenuCommand command)
{
- var inspector = command.context as IDragPointsItemInspector;
+ var inspector = command.context as IDragPointsInspector;
if (inspector == null) {
return;
}
var dragPoint = RetrieveDragPoint(inspector, command.userData);
if (dragPoint != null) {
- inspector.PrepareUndo("Toggle Drag Point Smooth");
+ inspector.DragPointsHelper.PrepareUndo("Toggle Drag Point Smooth");
dragPoint.IsSmooth = !dragPoint.IsSmooth;
- inspector.RebuildMeshes();
+ inspector.DragPointsHelper.RebuildMeshes();
}
}
[MenuItem(ControlPointsMenuPath + "/Is Smooth", true)]
private static bool SmoothValidate(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector) || inspector.IsItemLocked()) {
+ if (!(command.context is IDragPointsInspector inspector) || inspector.DragPointsHelper.IsItemLocked()) {
return false;
}
- if (!inspector.HasDragPointExposure(DragPointExposure.Smooth)) {
+ if (!inspector.DragPointsHelper.HasDragPointExposure(DragPointExposure.Smooth)) {
Menu.SetChecked($"{ControlPointsMenuPath}/IsSmooth", false);
return false;
}
@@ -104,23 +104,23 @@ private static bool SmoothValidate(MenuCommand command)
[MenuItem(ControlPointsMenuPath + "/Remove Point", false, 101)]
private static void Remove(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
if (EditorUtility.DisplayDialog("Drag point removal", "Are you sure you want to remove this drag point?", "Yes", "No")) {
- inspector.RemoveDragPoint(command.userData);
+ inspector.DragPointsHelper.RemoveDragPoint(command.userData);
}
}
[MenuItem(ControlPointsMenuPath + "/Remove Point", true)]
private static bool RemoveValidate(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector) || inspector.IsItemLocked()) {
+ if (!(command.context is IDragPointsInspector inspector) || inspector.DragPointsHelper.IsItemLocked()) {
return false;
}
- if (inspector.DragPointsHandler?.ControlPoints.Count <= 2) {
+ if (inspector.DragPointsHelper.DragPointsHandler?.ControlPoints.Count <= 2) {
Menu.SetChecked($"{ControlPointsMenuPath}/Remove Point", false);
return false;
}
@@ -131,71 +131,71 @@ private static bool RemoveValidate(MenuCommand command)
[MenuItem(ControlPointsMenuPath + "/Copy Point", false, 301)]
private static void Copy(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
- inspector.CopyDragPoint(command.userData);
+ inspector.DragPointsHelper.CopyDragPoint(command.userData);
}
[MenuItem(ControlPointsMenuPath + "/Paste Point", false, 302)]
private static void Paste(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
- inspector.PasteDragPoint(command.userData);
+ inspector.DragPointsHelper.PasteDragPoint(command.userData);
}
[MenuItem(ControlPointsMenuPath + "/Paste Point", true)]
private static bool PasteValidate(MenuCommand command)
{
- return command.context is IDragPointsItemInspector inspector && !inspector.IsItemLocked();
+ return command.context is IDragPointsInspector inspector && !inspector.DragPointsHelper.IsItemLocked();
}
//Curve Traveller
[MenuItem(CurveTravellerMenuPath + "/Add Point", false, 1)]
private static void Add(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
- inspector.AddDragPointOnTraveller();
+ inspector.DragPointsHelper.AddDragPointOnTraveller();
}
[MenuItem(CurveTravellerMenuPath + "/Flip Drag Points/X", false, 101)]
[MenuItem(ControlPointsMenuPath + "/Flip Drag Points/X", false, 201)]
private static void FlipX(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
- inspector.FlipDragPoints(FlipAxis.X);
+ inspector.DragPointsHelper.FlipDragPoints(FlipAxis.X);
}
[MenuItem(CurveTravellerMenuPath + "/Flip Drag Points/Y", false, 102)]
[MenuItem(ControlPointsMenuPath + "/Flip Drag Points/Y", false, 202)]
private static void FlipY(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
- inspector.FlipDragPoints(FlipAxis.Y);
+ inspector.DragPointsHelper.FlipDragPoints(FlipAxis.Y);
}
[MenuItem(CurveTravellerMenuPath + "/Flip Drag Points/Z", false, 103)]
[MenuItem(ControlPointsMenuPath + "/Flip Drag Points/Z", false, 203)]
private static void FlipZ(MenuCommand command)
{
- if (!(command.context is IDragPointsItemInspector inspector)) {
+ if (!(command.context is IDragPointsInspector inspector)) {
return;
}
- inspector.FlipDragPoints(FlipAxis.Z);
+ inspector.DragPointsHelper.FlipDragPoints(FlipAxis.Z);
}
}
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsHandler.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsHandler.cs
index 944f3b52c..a36e084e5 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsHandler.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsHandler.cs
@@ -31,12 +31,12 @@ public class DragPointsHandler
///
/// Component
///
- public IMainRenderableComponent Editable { get; private set; }
+ public IMainRenderableComponent MainComponent { get; private set; }
///
/// Component item as IDragPointsEditable
///
- public IDragPointsEditable DragPointEditable { get; private set; }
+ public IDragPointsInspector DragPointInspector { get; private set; }
///
/// Transform component of the game object
@@ -83,20 +83,15 @@ public class DragPointsHandler
///
/// Every DragPointsInspector instantiates this to manage its curve handling.
///
- ///
- ///
+ /// The renderable main component, to retrieve IsLocked.
+ ///
///
- public DragPointsHandler(Object target, IDragPointsEditable dragPointsEditable)
+ public DragPointsHandler(IMainRenderableComponent mainComponent, IDragPointsInspector dragPointsInspector)
{
- Editable = target as IMainRenderableComponent
- ?? throw new ArgumentException("Target must extend `IItemMainRenderableComponent`.");
+ MainComponent = mainComponent;
+ DragPointInspector = dragPointsInspector;
- DragPointEditable = dragPointsEditable;
-
- if (!(target is Behaviour)) {
- throw new ArgumentException("Target must extend `Behavior`.");
- }
- Transform = (target as Behaviour).transform;
+ Transform = mainComponent.gameObject.transform;
_sceneViewHandler = new DragPointsSceneViewHandler(this){
CurveWidth = 10.0f,
@@ -114,13 +109,13 @@ public DragPointsHandler(Object target, IDragPointsEditable dragPointsEditable)
public bool RemapControlPoints()
{
// if count differs, rebuild
- if (ControlPoints.Count != DragPointEditable.DragPoints.Length) {
+ if (ControlPoints.Count != DragPointInspector.DragPoints.Length) {
RebuildControlPoints();
return true;
}
- for (var i = 0; i < DragPointEditable.DragPoints.Length; ++i) {
- ControlPoints[i].DragPoint = DragPointEditable.DragPoints[i];
+ for (var i = 0; i < DragPointInspector.DragPoints.Length; ++i) {
+ ControlPoints[i].DragPoint = DragPointInspector.DragPoints[i];
}
return false;
@@ -140,23 +135,23 @@ public void AddDragPointOnTraveller()
return;
}
- var dragPoint = new DragPointData(DragPointEditable.DragPoints[CurveTravellerControlPointIdx]) {
+ var dragPoint = new DragPointData(DragPointInspector.DragPoints[CurveTravellerControlPointIdx]) {
IsLocked = false
};
var newIdx = CurveTravellerControlPointIdx + 1;
- float ratio = (float)newIdx / DragPointEditable.DragPoints.Length;
+ float ratio = (float)newIdx / DragPointInspector.DragPoints.Length;
var dragPointPosition = Transform.worldToLocalMatrix.MultiplyPoint(CurveTravellerPosition);
- dragPointPosition -= DragPointEditable.EditableOffset;
- dragPointPosition -= DragPointEditable.GetDragPointOffset(ratio);
+ dragPointPosition -= DragPointInspector.EditableOffset;
+ dragPointPosition -= DragPointInspector.GetDragPointOffset(ratio);
dragPoint.Center = dragPointPosition.ToVertex3D();
- var dragPoints = DragPointEditable.DragPoints.ToList();
+ var dragPoints = DragPointInspector.DragPoints.ToList();
dragPoints.Insert(newIdx, dragPoint);
- DragPointEditable.DragPoints = dragPoints.ToArray();
+ DragPointInspector.DragPoints = dragPoints.ToArray();
ControlPoints.Insert(newIdx,
new ControlPoint(
- DragPointEditable.DragPoints[newIdx],
+ DragPointInspector.DragPoints[newIdx],
GUIUtility.GetControlID(FocusType.Passive),
newIdx,
ratio
@@ -181,9 +176,9 @@ public void RemoveDragPoint(int controlId)
if (!removalOk) {
return;
}
- var dragPoints = DragPointEditable.DragPoints.ToList();
+ var dragPoints = DragPointInspector.DragPoints.ToList();
dragPoints.RemoveAt(idx);
- DragPointEditable.DragPoints = dragPoints.ToArray();
+ DragPointInspector.DragPoints = dragPoints.ToArray();
RebuildControlPoints();
}
@@ -198,7 +193,7 @@ public void FlipDragPoints(FlipAxis flipAxis)
? _flipAxis.x
: flipAxis == FlipAxis.Y ? _flipAxis.y : _flipAxis.z;
- var offset = DragPointEditable.EditableOffset;
+ var offset = DragPointInspector.EditableOffset;
var wlMat = Transform.worldToLocalMatrix;
foreach (var controlPoint in ControlPoints) {
@@ -222,7 +217,7 @@ public void FlipDragPoints(FlipAxis flipAxis)
default:
throw new ArgumentOutOfRangeException(nameof(flipAxis), flipAxis, null);
}
- controlPoint.UpdateDragPoint(DragPointEditable, Transform);
+ controlPoint.UpdateDragPoint(DragPointInspector, Transform);
}
}
@@ -250,7 +245,7 @@ public bool UpdateDragPointsLock(bool itemLock)
private void RebuildControlPoints()
{
ControlPoints.Clear();
- var dragPoints = DragPointEditable.DragPoints;
+ var dragPoints = DragPointInspector.DragPoints;
for (var i = 0; i < dragPoints.Length; ++i) {
var cp = new ControlPoint(
dragPoints[i],
@@ -309,13 +304,13 @@ public void OnSceneGUI(Event evt, OnDragPointPositionChange onChange = null)
parentRot = Transform.parent.transform.rotation;
}
EditorGUI.BeginChangeCheck();
- var newHandlePos = HandlesUtils.HandlePosition(_positionHandlePosition, DragPointEditable.HandleType, parentRot);
+ var newHandlePos = HandlesUtils.HandlePosition(_positionHandlePosition, DragPointInspector.HandleType, parentRot);
if (EditorGUI.EndChangeCheck()) {
onChange?.Invoke(newHandlePos);
var deltaPosition = newHandlePos - _positionHandlePosition;
foreach (var controlPoint in SelectedControlPoints) {
controlPoint.WorldPos += deltaPosition;
- controlPoint.UpdateDragPoint(DragPointEditable, Transform);
+ controlPoint.UpdateDragPoint(DragPointInspector, Transform);
}
}
}
@@ -332,8 +327,8 @@ private void InitSceneGui()
//Setup Screen positions & controlID for control points (in case of modification of drag points coordinates outside)
foreach (var controlPoint in ControlPoints) {
controlPoint.WorldPos = controlPoint.DragPoint.Center.ToUnityVector3();
- controlPoint.WorldPos += DragPointEditable.EditableOffset;
- controlPoint.WorldPos += DragPointEditable.GetDragPointOffset(controlPoint.IndexRatio);
+ controlPoint.WorldPos += DragPointInspector.EditableOffset;
+ controlPoint.WorldPos += DragPointInspector.GetDragPointOffset(controlPoint.IndexRatio);
controlPoint.WorldPos = Transform.localToWorldMatrix.MultiplyPoint(controlPoint.WorldPos);
_flipAxis += controlPoint.WorldPos;
controlPoint.LocalPos = Handles.matrix.MultiplyPoint(controlPoint.WorldPos);
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsItemInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsInspectorHelper.cs
similarity index 56%
rename from VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsItemInspector.cs
rename to VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsInspectorHelper.cs
index 7e52703ff..e9ef81723 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsItemInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsInspectorHelper.cs
@@ -14,28 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-using System.Collections.Generic;
+using System;
+using System.Collections;
using System.Linq;
using UnityEditor;
-using UnityEditor.SceneManagement;
using UnityEngine;
using VisualPinball.Engine.Math;
-using VisualPinball.Engine.VPT;
namespace VisualPinball.Unity.Editor
{
- public abstract class DragPointsInspector
- : MainInspector,
- IDragPointsItemInspector, IDragPointsEditable
- where TData : ItemData
- where TMainComponent : MainRenderableComponent
+ public class DragPointsInspectorHelper
{
///
/// Catmull Curve Handler
///
public DragPointsHandler DragPointsHandler { get; private set; }
- private bool EditingEnabled => _dragPointsComponent.DragPointsActive && Selection.count == 1 && target is MonoBehaviour mb && Selection.activeGameObject == mb.gameObject;
+ private bool EditingEnabled => _dragPointsInspector.DragPointsActive;
///
/// If true, a list of the drag points is displayed in the inspector.
@@ -51,27 +46,33 @@ public abstract class DragPointsInspector
///
private static Vector3 _storedControlPoint = Vector3.zero;
- private IMainRenderableComponent _renderable;
- private IDragPointsComponent _dragPointsComponent;
+ private readonly MonoBehaviour _mb;
+ private readonly IMainRenderableComponent _mainComponent;
+ private readonly IDragPointsInspector _dragPointsInspector;
+ private readonly PlayfieldComponent _playfieldComponent;
+
+ public DragPointsInspectorHelper(IMainRenderableComponent mainComponent, IDragPointsInspector dragPointsInspector)
+ {
+ _mb = mainComponent as MonoBehaviour;
+ _mainComponent = mainComponent;
+ _dragPointsInspector = dragPointsInspector;
+ _playfieldComponent = mainComponent.gameObject.GetComponentInParent();;
+ DragPointsHandler = new DragPointsHandler(mainComponent, _dragPointsInspector);
+ }
public void RebuildMeshes()
{
- _renderable.RebuildMeshes();
- WalkChildren(PlayfieldComponent.transform, UpdateSurfaceReferences);
+ _mainComponent.RebuildMeshes();
+ WalkChildren(_playfieldComponent.transform, UpdateSurfaceReferences);
}
- protected override void OnEnable()
+ public void OnEnable()
{
- base.OnEnable();
- _dragPointsComponent = MainComponent as IDragPointsComponent;
- _renderable = target as IMainRenderableComponent;
- DragPointsHandler = new DragPointsHandler(target, this);
Undo.undoRedoPerformed += OnUndoRedoPerformed;
}
- protected override void OnDisable()
+ public void OnDisable()
{
- base.OnDisable();
DragPointsHandler = null;
Undo.undoRedoPerformed -= OnUndoRedoPerformed;
}
@@ -117,7 +118,7 @@ public void PasteDragPoint(int controlId)
/// True if game item is locked, false otherwise.
public bool IsItemLocked()
{
- return !(target is IMainRenderableComponent editable) || editable.IsLocked;
+ return _mainComponent.IsLocked;
}
///
@@ -127,10 +128,7 @@ public bool IsItemLocked()
/// True if exposed, false otherwise.
public bool HasDragPointExposure(DragPointExposure exposure)
{
- if (!(target is IDragPointsEditable editable)) {
- return false;
- }
- return editable.DragPointExposition.Contains(exposure);
+ return _dragPointsInspector.DragPointExposition.Contains(exposure);
}
///
@@ -139,11 +137,7 @@ public bool HasDragPointExposure(DragPointExposure exposure)
/// Axis to flip on
public void FlipDragPoints(FlipAxis flipAxis)
{
- if (!(target is IDragPointsEditable editable)) {
- return;
- }
-
- if (editable.HandleType != ItemDataTransformType.ThreeD && flipAxis == FlipAxis.Z) {
+ if (_dragPointsInspector.HandleType != ItemDataTransformType.ThreeD && flipAxis == FlipAxis.Z) {
return;
}
@@ -189,63 +183,51 @@ public void RemoveDragPoint(int controlId)
/// Message to appear in the UNDO menu
public void PrepareUndo(string message)
{
- Undo.RecordObjects(new []{this, target}, message);
+ Undo.RecordObject(_mb, message);
}
- public override void OnInspectorGUI()
+ public void OnInspectorGUI(ItemInspector inspector)
{
- if (!(target is IMainRenderableComponent editable)) {
- base.OnInspectorGUI();
+ if (_mainComponent.IsLocked) {
+ EditorGUILayout.LabelField("Drag Points are Locked");
return;
}
- // var editButtonText = dragPointEditable.DragPointEditEnabled ? "Stop Editing Drag Points" : "Edit Drag Points";
- // if (GUILayout.Button(editButtonText)) {
- // dragPointEditable.DragPointEditEnabled = !dragPointEditable.DragPointEditEnabled;
- // SceneView.RepaintAll();
- // }
-
- if (editable.IsLocked) {
- EditorGUILayout.LabelField("Drag Points are Locked");
-
- } else {
- _foldoutControlPoints = EditorGUILayout.BeginFoldoutHeaderGroup(_foldoutControlPoints, "Drag Points");
- if (_foldoutControlPoints) {
+ _foldoutControlPoints = EditorGUILayout.BeginFoldoutHeaderGroup(_foldoutControlPoints, "Drag Points");
+ if (_foldoutControlPoints) {
+ EditorGUI.indentLevel++;
+ for (var i = 0; i < DragPointsHandler.ControlPoints.Count; ++i) {
+ var controlPoint = DragPointsHandler.ControlPoints[i];
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField($"#{i} ({controlPoint.DragPoint.Center.X},{controlPoint.DragPoint.Center.Y},{controlPoint.DragPoint.Center.Z})");
+ if (GUILayout.Button("Copy")) {
+ CopyDragPoint(controlPoint.ControlId);
+ }
+ else if (GUILayout.Button("Paste")) {
+ PasteDragPoint(controlPoint.ControlId);
+ }
+ EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel++;
- for (var i = 0; i < DragPointsHandler.ControlPoints.Count; ++i) {
- var controlPoint = DragPointsHandler.ControlPoints[i];
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.LabelField($"#{i} ({controlPoint.DragPoint.Center.X},{controlPoint.DragPoint.Center.Y},{controlPoint.DragPoint.Center.Z})");
- if (GUILayout.Button("Copy")) {
- CopyDragPoint(controlPoint.ControlId);
- }
- else if (GUILayout.Button("Paste")) {
- PasteDragPoint(controlPoint.ControlId);
- }
- EditorGUILayout.EndHorizontal();
- EditorGUI.indentLevel++;
- if (HasDragPointExposure(DragPointExposure.SlingShot)) {
- ItemDataField("Slingshot", ref controlPoint.DragPoint.IsSlingshot);
- }
- if (HasDragPointExposure(DragPointExposure.Smooth)) {
- ItemDataField("Smooth", ref controlPoint.DragPoint.IsSmooth);
- }
- if (HasDragPointExposure(DragPointExposure.Texture)) {
- ItemDataField("Has AutoTexture", ref controlPoint.DragPoint.HasAutoTexture);
- ItemDataSlider("Texture Coord", ref controlPoint.DragPoint.TextureCoord, 0.0f, 1.0f);
- }
- EditorGUI.indentLevel--;
+ if (HasDragPointExposure(DragPointExposure.SlingShot)) {
+ inspector.ItemDataField("Slingshot", ref controlPoint.DragPoint.IsSlingshot);
+ }
+ if (HasDragPointExposure(DragPointExposure.Smooth)) {
+ inspector.ItemDataField("Smooth", ref controlPoint.DragPoint.IsSmooth);
+ }
+ if (HasDragPointExposure(DragPointExposure.Texture)) {
+ inspector.ItemDataField("Has AutoTexture", ref controlPoint.DragPoint.HasAutoTexture);
+ inspector.ItemDataSlider("Texture Coord", ref controlPoint.DragPoint.TextureCoord, 0.0f, 1.0f);
}
EditorGUI.indentLevel--;
}
- EditorGUILayout.EndFoldoutHeaderGroup();
+ EditorGUI.indentLevel--;
}
- base.OnInspectorGUI();
+ EditorGUILayout.EndFoldoutHeaderGroup();
}
private void UpdateDragPointsLock()
{
- if (target is IMainRenderableComponent editable && DragPointsHandler.UpdateDragPointsLock(editable.IsLocked)) {
+ if (DragPointsHandler.UpdateDragPointsLock(_mainComponent.IsLocked)) {
HandleUtility.Repaint();
}
}
@@ -259,15 +241,12 @@ private void OnDragPointPositionChange(Vector3 newPos)
private void OnUndoRedoPerformed()
{
RemapControlPoints();
- WalkChildren(PlayfieldComponent.transform, UpdateSurfaceReferences);
+ WalkChildren(_playfieldComponent.transform, UpdateSurfaceReferences);
}
- protected virtual void OnSceneGUI()
+ public void OnSceneGUI(ItemInspector inspector)
{
- var editable = target as IMainRenderableComponent;
- var bh = target as Behaviour;
-
- if (editable == null || bh == null || !EditingEnabled) {
+ if (!EditingEnabled) {
return;
}
@@ -281,30 +260,32 @@ protected virtual void OnSceneGUI()
var nearestControlPoint = DragPointsHandler.ControlPoints.Find(cp => cp.ControlId == HandleUtility.nearestControl);
if (nearestControlPoint != null) {
- var command = new MenuCommand(this, nearestControlPoint.ControlId);
+ var command = new MenuCommand(inspector, nearestControlPoint.ControlId);
EditorUtility.DisplayPopupMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0), DragPointMenuItems.ControlPointsMenuPath, command);
Event.current.Use();
} else if (DragPointsHandler.CurveTravellerVisible && HandleUtility.nearestControl == DragPointsHandler.CurveTravellerControlId) {
- var command = new MenuCommand(this, 0);
+ var command = new MenuCommand(inspector, 0);
EditorUtility.DisplayPopupMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0), DragPointMenuItems.CurveTravellerMenuPath, command);
Event.current.Use();
}
}
}
- public DragPointData[] DragPoints {
- get => _dragPointsComponent.DragPoints;
- set {
- _dragPointsComponent.DragPoints = value;
- EditorUtility.SetDirty(MainComponent.gameObject);
- PrefabUtility.RecordPrefabInstancePropertyModifications(MainComponent);
- EditorSceneManager.MarkSceneDirty(MainComponent.gameObject.scene);
+ private static void WalkChildren(IEnumerable node, Action action)
+ {
+ foreach (Transform childTransform in node) {
+ action(childTransform);
+ WalkChildren(childTransform, action);
}
}
- public abstract Vector3 EditableOffset { get; }
- public abstract Vector3 GetDragPointOffset(float ratio);
- public abstract bool PointsAreLooping { get; }
- public abstract IEnumerable DragPointExposition { get; }
- public abstract ItemDataTransformType HandleType { get; }
+
+ private void UpdateSurfaceReferences(Transform obj)
+ {
+ var surfaceComponent = obj.gameObject.GetComponent();
+ if (surfaceComponent != null && surfaceComponent.Surface == _mainComponent) {
+ surfaceComponent.OnSurfaceUpdated();
+ }
+ }
+
}
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsItemInspector.cs.meta b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsInspectorHelper.cs.meta
similarity index 83%
rename from VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsItemInspector.cs.meta
rename to VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsInspectorHelper.cs.meta
index be17b5482..f2b666b5f 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsItemInspector.cs.meta
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsInspectorHelper.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 4411ffe564a0415498413d31bc69924d
+guid: 8f2c609845b713246b88a786eaf768dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsSceneViewHandler.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsSceneViewHandler.cs
index 84f54d929..3fa0fd818 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsSceneViewHandler.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/DragPointsSceneViewHandler.cs
@@ -89,7 +89,7 @@ private void DisplayCurve()
var accuracy = Mathf.Abs(vAccuracy.x * vAccuracy.y * vAccuracy.z);
accuracy *= HandleUtility.GetHandleSize(_handler.CurveTravellerPosition) * ControlPoint.ScreenRadius;
var vVertex = DragPoint.GetRgVertex(
- transformedDPoints.ToArray(), _handler.DragPointEditable.PointsAreLooping, accuracy
+ transformedDPoints.ToArray(), _handler.DragPointInspector.PointsAreLooping, accuracy
);
if (vVertex.Length > 0) {
@@ -108,7 +108,7 @@ private void DisplayCurve()
}
// close loop if needed
- if (_handler.DragPointEditable.PointsAreLooping) {
+ if (_handler.DragPointInspector.PointsAreLooping) {
controlPointsSegments[_handler.ControlPoints.Count - 1].Add(controlPointsSegments[0][0]);
}
@@ -149,7 +149,7 @@ private void DisplayCurve()
foreach (var controlPoint in _handler.ControlPoints) {
var segments = controlPointsSegments[controlPoint.Index].ToArray();
if (segments.Length > 1) {
- Handles.color = _handler.DragPointEditable.DragPointExposition.Contains(DragPointExposure.SlingShot) && controlPoint.DragPoint.IsSlingshot ? CurveSlingShotColor : CurveColor;
+ Handles.color = _handler.DragPointInspector.DragPointExposition.Contains(DragPointExposure.SlingShot) && controlPoint.DragPoint.IsSlingshot ? CurveSlingShotColor : CurveColor;
Handles.DrawAAPolyLine(CurveWidth, segments);
var closestToPath = HandleUtility.ClosestPointToPolyLine(segments);
var dist = (closestToPath - _handler.CurveTravellerPosition).magnitude;
@@ -195,7 +195,7 @@ private void DisplayControlPoints()
distToCPoint = Mathf.Min(distToCPoint, dist);
}
- if (!_handler.Editable.IsLocked) {
+ if (!_handler.MainComponent.IsLocked) {
// curve traveller is not overlapping a control point, we can draw it.
if (distToCPoint > HandleUtility.GetHandleSize(_handler.CurveTravellerPosition) * ControlPoint.ScreenRadius) {
Handles.color = Color.grey;
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/IDragPointsEditable.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsInspector.cs
similarity index 85%
rename from VisualPinball.Unity/VisualPinball.Unity/VPT/IDragPointsEditable.cs
rename to VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsInspector.cs
index 8809cbe66..37d7811b2 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/IDragPointsEditable.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsInspector.cs
@@ -17,6 +17,7 @@
using System.Collections.Generic;
using UnityEngine;
using VisualPinball.Engine.Math;
+using VisualPinball.Unity.Editor;
namespace VisualPinball.Unity
{
@@ -45,22 +46,21 @@ public enum DragPointExposure
Texture
}
- public interface IDragPointsComponent
- {
- bool DragPointsActive { get; }
- DragPointData[] DragPoints { get; set; }
- }
-
///
- /// Abstraction for components that support drag points.
+ /// Abstraction inspectors that support drag points.
///
- public interface IDragPointsEditable
+ public interface IDragPointsInspector
{
///
/// Access to the drag point data
///
DragPointData[] DragPoints { get; set; }
+ ///
+ /// Whether to render drag points at all. Because sometimes we don't want to, like for trigger buttons.
+ ///
+ bool DragPointsActive { get; }
+
///
/// Returns the global offset applied on all drag points.
///
@@ -88,5 +88,7 @@ public interface IDragPointsEditable
///
///
ItemDataTransformType HandleType { get; }
+
+ DragPointsInspectorHelper DragPointsHelper { get; }
}
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsItemInspector.cs.meta b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsInspector.cs.meta
similarity index 83%
rename from VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsItemInspector.cs.meta
rename to VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsInspector.cs.meta
index e0d27d079..618c27c7e 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsItemInspector.cs.meta
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsInspector.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 747d367bff8d4ce4e988bc6ba5503021
+guid: 6f0f2996dddc2e243b834359e370e51b
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsItemInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsItemInspector.cs
deleted file mode 100644
index 8228f819d..000000000
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/DragPoint/IDragPointsItemInspector.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// Visual Pinball Engine
-// Copyright (C) 2021 freezy and VPE Team
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-
-using VisualPinball.Engine.Math;
-
-namespace VisualPinball.Unity.Editor
-{
- ///
- /// A non-generic interface for DragPointsItemInspector we can use for all
- /// types of items.
- ///
- public interface IDragPointsItemInspector
- {
- ///
- /// Catmull Curve Handler
- ///
- DragPointsHandler DragPointsHandler { get; }
-
- ///
- /// Returns a reference to the drag point data for a given control ID.
- ///
- /// Control ID of the drag point
- /// Drag point data or null if no linked data.
- DragPointData GetDragPoint(int controlId);
-
- ///
- /// Sets an UNDO point before the next operation.
- ///
- /// Message to appear in the UNDO menu
- void PrepareUndo(string message);
-
- ///
- /// Returns true if the game item is locked.
- ///
- /// True if game item is locked, false otherwise.
- bool IsItemLocked();
-
- ///
- /// Returns whether this game item has a given drag point exposure.
- ///
- /// Exposure to check
- /// True if exposed, false otherwise.
- bool HasDragPointExposure(DragPointExposure exposure);
-
- ///
- /// Removes a drag point of a given control ID.
- ///
- /// Control ID of the drag point to remove.
- void RemoveDragPoint(int controlId);
-
- ///
- /// Copies the position of a drag point.
- ///
- /// Control ID of the drag point
- void CopyDragPoint(int controlId);
-
- ///
- /// Sets the position of a previously copied drag point to another drag point.
- ///
- /// Control ID of the drag point to which the new position is applied.
- void PasteDragPoint(int controlId);
-
- ///
- /// Adds a new drag point at the traveller's current position.
- ///
- void AddDragPointOnTraveller();
-
- ///
- /// Flips all drag points on a given axis.
- ///
- /// Axis to flip on
- void FlipDragPoints(FlipAxis flipAxis);
-
- void RebuildMeshes();
- }
-}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs
index 826da254a..9418e99b6 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs
@@ -260,7 +260,7 @@ public void ItemDataSlider(string label, ref float field, float leftVal, float r
}
}
- protected void ItemDataField(string label, ref bool field, bool dirtyMesh = true, Action onChanged = null)
+ public void ItemDataField(string label, ref bool field, bool dirtyMesh = true, Action onChanged = null)
{
EditorGUI.BeginChangeCheck();
var val = EditorGUILayout.Toggle(label, field);
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Light/LightInsertMeshInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Light/LightInsertMeshInspector.cs
new file mode 100644
index 000000000..04b2c6ba0
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Light/LightInsertMeshInspector.cs
@@ -0,0 +1,90 @@
+// Visual Pinball Engine
+// Copyright (C) 2021 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+// ReSharper disable AssignmentInConditionalExpression
+
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+using VisualPinball.Engine.Math;
+using VisualPinball.Engine.VPT.Light;
+
+namespace VisualPinball.Unity.Editor
+{
+ [CustomEditor(typeof(LightInsertMeshComponent)), CanEditMultipleObjects]
+ public class LightInsertMeshInspector : MeshInspector, IDragPointsInspector
+ {
+
+ private SerializedProperty _insertHeightProperty;
+ private SerializedProperty _positionZProperty;
+
+ public bool DragPointsActive => true;
+
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+
+ DragPointsHelper = new DragPointsInspectorHelper(MeshComponent.MainComponent, this);
+ DragPointsHelper.OnEnable();
+
+ _insertHeightProperty = serializedObject.FindProperty(nameof(LightInsertMeshComponent.InsertHeight));
+ _positionZProperty = serializedObject.FindProperty(nameof(LightInsertMeshComponent.PositionZ));
+ }
+
+ protected override void OnDisable()
+ {
+ base.OnDisable();
+ DragPointsHelper.OnDisable();
+ }
+
+ public override void OnInspectorGUI()
+ {
+ if (HasErrors()) {
+ return;
+ }
+
+ BeginEditing();
+
+ OnPreInspectorGUI();
+
+ PropertyField(_insertHeightProperty, rebuildMesh: true);
+ PropertyField(_positionZProperty, updateTransforms: true);
+
+ DragPointsHelper.OnInspectorGUI(this);
+
+ base.OnInspectorGUI();
+
+ EndEditing();
+ }
+
+ private void OnSceneGUI()
+ {
+ DragPointsHelper.OnSceneGUI(this);
+ }
+
+ #region Dragpoint Tooling
+
+ public DragPointData[] DragPoints { get => MeshComponent.DragPoints; set => MeshComponent.DragPoints = value; }
+ public Vector3 EditableOffset => new Vector3(-MeshComponent.MainComponent.Position.x, -MeshComponent.MainComponent.Position.y, MeshComponent.PositionZ);
+ public Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
+ public bool PointsAreLooping => true;
+ public IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth, DragPointExposure.Texture };
+ public ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public DragPointsInspectorHelper DragPointsHelper { get; private set; }
+
+ #endregion
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Light/LightInsertMeshInspector.cs.meta b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Light/LightInsertMeshInspector.cs.meta
new file mode 100644
index 000000000..ed94a7c81
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Light/LightInsertMeshInspector.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 49b9e1f6ce5e90e4f876450638683c97
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/MainInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/MainInspector.cs
index 592ca0da9..96036e902 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/MainInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/MainInspector.cs
@@ -62,7 +62,7 @@ protected void InvalidParentError()
protected void UpdateSurfaceReferences(Transform obj)
{
var surfaceComponent = obj.gameObject.GetComponent();
- if (surfaceComponent != null && surfaceComponent.Surface == MainComponent) {
+ if (surfaceComponent != null && (TMainComponent)surfaceComponent.Surface == MainComponent) {
surfaceComponent.OnSurfaceUpdated();
}
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Ramp/RampInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Ramp/RampInspector.cs
index 450c9e761..46d5f0c72 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Ramp/RampInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Ramp/RampInspector.cs
@@ -19,13 +19,14 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
+using VisualPinball.Engine.Math;
using VisualPinball.Engine.VPT;
using VisualPinball.Engine.VPT.Ramp;
namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(RampComponent)), CanEditMultipleObjects]
- public class RampInspector : DragPointsInspector
+ public class RampInspector : MainInspector, IDragPointsInspector
{
private bool _foldoutGeometry = true;
@@ -66,10 +67,14 @@ public class RampInspector : DragPointsInspector
private SerializedProperty _wireDistanceXProperty;
private SerializedProperty _wireDistanceYProperty;
+
protected override void OnEnable()
{
base.OnEnable();
+ DragPointsHelper = new DragPointsInspectorHelper(MainComponent, this);
+ DragPointsHelper.OnEnable();
+
_heightBottomProperty = serializedObject.FindProperty(nameof(RampComponent._heightBottom));
_heightTopProperty = serializedObject.FindProperty(nameof(RampComponent._heightTop));
_imageAlignmentProperty = serializedObject.FindProperty(nameof(RampComponent._imageAlignment));
@@ -83,6 +88,12 @@ protected override void OnEnable()
_wireDistanceYProperty = serializedObject.FindProperty(nameof(RampComponent._wireDistanceY));
}
+ protected override void OnDisable()
+ {
+ base.OnDisable();
+ DragPointsHelper.OnDisable();
+ }
+
public override void OnInspectorGUI()
{
if (HasErrors()) {
@@ -124,18 +135,28 @@ public override void OnInspectorGUI()
}
EditorGUILayout.EndFoldoutHeaderGroup();
+ DragPointsHelper.OnInspectorGUI(this);
+
base.OnInspectorGUI();
EndEditing();
}
+ private void OnSceneGUI()
+ {
+ DragPointsHelper.OnSceneGUI(this);
+ }
+
#region Dragpoint Tooling
- public override Vector3 EditableOffset => new Vector3(0.0f, 0.0f, 0f);
- public override Vector3 GetDragPointOffset(float ratio) => new Vector3(0.0f, 0.0f, (MainComponent.HeightTop - MainComponent.HeightBottom) * ratio);
- public override bool PointsAreLooping => false;
- public override IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth, DragPointExposure.SlingShot };
- public override ItemDataTransformType HandleType => ItemDataTransformType.ThreeD;
+ public bool DragPointsActive => true;
+ public DragPointData[] DragPoints { get => MainComponent.DragPoints; set => MainComponent.DragPoints = value; }
+ public Vector3 EditableOffset => new Vector3(0.0f, 0.0f, 0f);
+ public Vector3 GetDragPointOffset(float ratio) => new Vector3(0.0f, 0.0f, (MainComponent.HeightTop - MainComponent.HeightBottom) * ratio);
+ public bool PointsAreLooping => false;
+ public IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth, DragPointExposure.SlingShot };
+ public ItemDataTransformType HandleType => ItemDataTransformType.ThreeD;
+ public DragPointsInspectorHelper DragPointsHelper { get; private set; }
#endregion
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Rubber/RubberInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Rubber/RubberInspector.cs
index daacb9fc9..5d1ceafd2 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Rubber/RubberInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Rubber/RubberInspector.cs
@@ -19,13 +19,15 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
+using VisualPinball.Engine.Math;
using VisualPinball.Engine.VPT.Rubber;
namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(RubberComponent)), CanEditMultipleObjects]
- public class RubberInspector : DragPointsInspector
+ public class RubberInspector : MainInspector, IDragPointsInspector
{
+
private SerializedProperty _heightProperty;
private SerializedProperty _thicknessProperty;
private SerializedProperty _rotationProperty;
@@ -34,11 +36,21 @@ protected override void OnEnable()
{
base.OnEnable();
+
+ DragPointsHelper = new DragPointsInspectorHelper(MainComponent, this);
+ DragPointsHelper.OnEnable();
+
_heightProperty = serializedObject.FindProperty(nameof(RubberComponent._height));
_thicknessProperty = serializedObject.FindProperty(nameof(RubberComponent._thickness));
_rotationProperty = serializedObject.FindProperty(nameof(RubberComponent.Rotation));
}
+ protected override void OnDisable()
+ {
+ base.OnDisable();
+ DragPointsHelper.OnDisable();
+ }
+
public override void OnInspectorGUI()
{
if (HasErrors()) {
@@ -53,18 +65,28 @@ public override void OnInspectorGUI()
PropertyField(_heightProperty, rebuildMesh: true);
PropertyField(_thicknessProperty, rebuildMesh: true);
+ DragPointsHelper.OnInspectorGUI(this);
+
base.OnInspectorGUI();
EndEditing();
}
+ private void OnSceneGUI()
+ {
+ DragPointsHelper.OnSceneGUI(this);
+ }
+
#region Dragpoint Tooling
- public override Vector3 EditableOffset => new Vector3(0.0f, 0.0f, MainComponent._height);
- public override Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
- public override bool PointsAreLooping => true;
- public override IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth };
- public override ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public bool DragPointsActive => true;
+ public DragPointData[] DragPoints { get => MainComponent.DragPoints; set => MainComponent.DragPoints = value; }
+ public Vector3 EditableOffset => new Vector3(0.0f, 0.0f, MainComponent._height);
+ public Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
+ public bool PointsAreLooping => true;
+ public IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth };
+ public ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public DragPointsInspectorHelper DragPointsHelper { get; private set; }
#endregion
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Surface/SurfaceInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Surface/SurfaceInspector.cs
index 8ba2d77d0..e3a9f2386 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Surface/SurfaceInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Surface/SurfaceInspector.cs
@@ -19,24 +19,37 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
+using VisualPinball.Engine.Math;
using VisualPinball.Engine.VPT.Surface;
namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(SurfaceComponent)), CanEditMultipleObjects]
- public class SurfaceInspector : DragPointsInspector
+ public class SurfaceInspector : MainInspector, IDragPointsInspector
{
+
private SerializedProperty _heightTopProperty;
private SerializedProperty _heightBottomProperty;
+ public bool DragPointsActive => true;
+
protected override void OnEnable()
{
base.OnEnable();
+ DragPointsHelper = new DragPointsInspectorHelper(MainComponent, this);
+ DragPointsHelper.OnEnable();
+
_heightTopProperty = serializedObject.FindProperty(nameof(SurfaceComponent.HeightTop));
_heightBottomProperty = serializedObject.FindProperty(nameof(SurfaceComponent.HeightBottom));
}
+ protected override void OnDisable()
+ {
+ base.OnDisable();
+ DragPointsHelper.OnDisable();
+ }
+
public override void OnInspectorGUI()
{
if (HasErrors()) {
@@ -52,18 +65,27 @@ public override void OnInspectorGUI()
});
PropertyField(_heightBottomProperty, "Bottom Height", true);
+ DragPointsHelper.OnInspectorGUI(this);
+
base.OnInspectorGUI();
EndEditing();
}
+ private void OnSceneGUI()
+ {
+ DragPointsHelper.OnSceneGUI(this);
+ }
+
#region Dragpoint Tooling
- public override Vector3 EditableOffset => new Vector3(0.0f, 0.0f, MainComponent.HeightTop + MainComponent.PlayfieldHeight);
- public override Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
- public override bool PointsAreLooping => true;
- public override IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth , DragPointExposure.SlingShot , DragPointExposure.Texture };
- public override ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public DragPointData[] DragPoints { get => MainComponent.DragPoints; set => MainComponent.DragPoints = value; }
+ public Vector3 EditableOffset => new Vector3(0.0f, 0.0f, MainComponent.HeightTop + MainComponent.PlayfieldHeight);
+ public Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
+ public bool PointsAreLooping => true;
+ public IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth, DragPointExposure.SlingShot, DragPointExposure.Texture };
+ public ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public DragPointsInspectorHelper DragPointsHelper { get; private set; }
#endregion
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trigger/TriggerInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trigger/TriggerInspector.cs
index bbddbfe7e..7748e24ef 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trigger/TriggerInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trigger/TriggerInspector.cs
@@ -19,13 +19,15 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
+using VisualPinball.Engine.Math;
using VisualPinball.Engine.VPT.Trigger;
namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(TriggerComponent)), CanEditMultipleObjects]
- public class TriggerInspector : DragPointsInspector
+ public class TriggerInspector : MainInspector, IDragPointsInspector
{
+
private SerializedProperty _positionProperty;
private SerializedProperty _rotationProperty;
private SerializedProperty _surfaceProperty;
@@ -34,11 +36,20 @@ protected override void OnEnable()
{
base.OnEnable();
+ DragPointsHelper = new DragPointsInspectorHelper(MainComponent, this);
+ DragPointsHelper.OnEnable();
+
_positionProperty = serializedObject.FindProperty(nameof(TriggerComponent.Position));
_rotationProperty = serializedObject.FindProperty(nameof(TriggerComponent.Rotation));
_surfaceProperty = serializedObject.FindProperty(nameof(TriggerComponent._surface));
}
+ protected override void OnDisable()
+ {
+ base.OnDisable();
+ DragPointsHelper.OnDisable();
+ }
+
public override void OnInspectorGUI()
{
if (HasErrors()) {
@@ -53,18 +64,34 @@ public override void OnInspectorGUI()
PropertyField(_rotationProperty, updateTransforms: true);
PropertyField(_surfaceProperty, updateTransforms: true);
+ DragPointsHelper.OnInspectorGUI(this);
+
base.OnInspectorGUI();
EndEditing();
}
+ private void OnSceneGUI()
+ {
+ DragPointsHelper.OnSceneGUI(this);
+ }
+
#region Dragpoint Tooling
- public override Vector3 EditableOffset => new Vector3(-MainComponent.Position.x, -MainComponent.Position.y, 0.0f);
- public override Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
- public override bool PointsAreLooping => true;
- public override IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth, DragPointExposure.SlingShot };
- public override ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public bool DragPointsActive {
+ get {
+ var meshComp = MainComponent.GetComponent();
+ return !meshComp || !meshComp.IsCircle;
+ }
+ }
+
+ public DragPointData[] DragPoints { get => MainComponent.DragPoints; set => MainComponent.DragPoints = value; }
+ public Vector3 EditableOffset => new Vector3(-MainComponent.Position.x, -MainComponent.Position.y, 0.0f);
+ public Vector3 GetDragPointOffset(float ratio) => Vector3.zero;
+ public bool PointsAreLooping => true;
+ public IEnumerable DragPointExposition => new[] { DragPointExposure.Smooth, DragPointExposure.SlingShot };
+ public ItemDataTransformType HandleType => ItemDataTransformType.TwoD;
+ public DragPointsInspectorHelper DragPointsHelper { get; private set; }
#endregion
}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs
index 9fb6582e4..a7c1d587c 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs
@@ -106,6 +106,9 @@ public override void UpdateTransforms()
// bulb size
foreach (var mf in GetComponentsInChildren(true)) {
+ if (!mf.sharedMesh) {
+ continue;
+ }
switch (mf.sharedMesh.name) {
case BulbMeshName:
case SocketMeshName:
@@ -113,6 +116,14 @@ public override void UpdateTransforms()
break;
}
}
+
+ // insert mesh position
+ var insertMeshComponent = GetComponentInChildren();
+ if (insertMeshComponent) {
+ var t = insertMeshComponent.transform;
+ var pos = t.localPosition;
+ t.localPosition = new Vector3(-Position.x, -Position.y, insertMeshComponent.PositionZ);
+ }
}
#endregion
@@ -220,9 +231,26 @@ public override IEnumerable SetData(LightData data)
RenderPipeline.Current.LightConverter.UpdateLight(unityLight, data);
}
+ // insert mesh
+ var insertMeshComponent = GetComponentInChildren();
+ if (insertMeshComponent) {
+ insertMeshComponent.DragPoints = data.DragPoints;
+ }
+
+ return updatedComponents;
+ }
+
+
+ public override IEnumerable SetReferencedData(LightData data, Table table, IMaterialProvider materialProvider, ITextureProvider textureProvider, Dictionary components)
+ {
+ Surface = FindComponent(components, data.Surface);
+
// visibility
if (!data.ShowBulbMesh) {
foreach (var mf in GetComponentsInChildren()) {
+ if (!mf.sharedMesh) {
+ continue;
+ }
switch (mf.sharedMesh.name) {
case BulbMeshName:
case SocketMeshName:
@@ -232,13 +260,16 @@ public override IEnumerable SetData(LightData data)
}
}
- return updatedComponents;
- }
-
+ // insert mesh
+ var insertMeshComponent = GetComponentInChildren();
+ if (insertMeshComponent) {
+ if (!data.ShowBulbMesh && string.Equals(data.OffImage, table.Data.Image, StringComparison.OrdinalIgnoreCase)) {
+ insertMeshComponent.CreateMesh(data, table, textureProvider, materialProvider);
+ } else {
+ insertMeshComponent.gameObject.SetActive(false);
+ }
+ }
- public override IEnumerable SetReferencedData(LightData data, Table table, IMaterialProvider materialProvider, ITextureProvider textureProvider, Dictionary components)
- {
- Surface = FindComponent(components, data.Surface);
return Array.Empty();
}
@@ -257,6 +288,12 @@ public override LightData CopyDataTo(LightData data, string[] materialNames, str
data.FadeSpeedUp = FadeSpeedUp;
data.FadeSpeedDown = FadeSpeedDown;
+ // insert mesh
+ var insertMeshComponent = GetComponentInChildren();
+ if (insertMeshComponent) {
+ data.DragPoints = insertMeshComponent.DragPoints;
+ }
+
// visibility
data.ShowBulbMesh = false;
foreach (var mf in GetComponentsInChildren(true)) {
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightInsertMeshComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightInsertMeshComponent.cs
new file mode 100644
index 000000000..5346c8c35
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightInsertMeshComponent.cs
@@ -0,0 +1,71 @@
+// Visual Pinball Engine
+// Copyright (C) 2021 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+// ReSharper disable InconsistentNaming
+
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using VisualPinball.Engine.Game;
+using VisualPinball.Engine.Math;
+using VisualPinball.Engine.VPT;
+using VisualPinball.Engine.VPT.Light;
+using VisualPinball.Engine.VPT.Surface;
+using VisualPinball.Engine.VPT.Table;
+using Mesh = VisualPinball.Engine.VPT.Mesh;
+
+namespace VisualPinball.Unity
+{
+ public class LightInsertMeshComponent : MeshComponent
+ {
+ #region Data
+
+ public float InsertHeight = 20f;
+
+ public float PositionZ = 0.1f;
+
+ [SerializeField]
+ private DragPointData[] _dragPoints;
+ public DragPointData[] DragPoints { get => _dragPoints; set => _dragPoints = value; }
+
+ #endregion
+
+ public bool DragPointsActive => true;
+
+ public const string InsertObjectName = "Insert";
+
+ public override IEnumerable ValidParents => Type.EmptyTypes;
+
+ protected override RenderObject GetRenderObject(LightData data, Table table)
+ {
+ return new RenderObject(
+ InsertObjectName,
+ GetMesh(data),
+ new PbrMaterial(table.GetMaterial(table.Data.PlayfieldMaterial), table.GetTexture(table.Data.Image)),
+ false
+ );
+ }
+
+ protected override Mesh GetMesh(LightData data)
+ {
+ var playfieldComponent = GetComponentInParent();
+ var meshGen = new SurfaceMeshGenerator(new LightInsertData(_dragPoints, InsertHeight));
+ var topMesh = meshGen.GetMesh(playfieldComponent.Width, playfieldComponent.Height, playfieldComponent.PlayfieldHeight, SurfaceMeshGenerator.Top);
+ var sideMesh = meshGen.GetMesh(playfieldComponent.Width, playfieldComponent.Height, playfieldComponent.PlayfieldHeight, SurfaceMeshGenerator.Side);
+ return topMesh.Merge(sideMesh);
+ }
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightInsertMeshComponent.cs.meta b/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightInsertMeshComponent.cs.meta
new file mode 100644
index 000000000..e5d917a8b
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightInsertMeshComponent.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e2a11a120b7da4b4db6fd330516311db
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: 088f14fce3d29544da1412a257cbba0f, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampComponent.cs
index 571d1b482..31c9a3e61 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampComponent.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampComponent.cs
@@ -36,7 +36,7 @@ namespace VisualPinball.Unity
{
[AddComponentMenu("Visual Pinball/Game Item/Ramp")]
public class RampComponent : MainRenderableComponent,
- IRampData, ISurfaceComponent, IDragPointsComponent, IConvertGameObjectToEntity
+ IRampData, ISurfaceComponent, IConvertGameObjectToEntity
{
#region Data
@@ -121,8 +121,6 @@ public class RampComponent : MainRenderableComponent,
public override void OnPlayfieldHeightUpdated() => RebuildMeshes();
- public bool DragPointsActive => true;
-
#endregion
#region Transformation
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Rubber/RubberComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Rubber/RubberComponent.cs
index d15b8ece1..04715d069 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Rubber/RubberComponent.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Rubber/RubberComponent.cs
@@ -35,7 +35,7 @@ namespace VisualPinball.Unity
{
[AddComponentMenu("Visual Pinball/Game Item/Rubber")]
public class RubberComponent : MainRenderableComponent,
- IRubberData, IDragPointsComponent, IConvertGameObjectToEntity
+ IRubberData, IConvertGameObjectToEntity
{
#region Data
@@ -79,8 +79,6 @@ public class RubberComponent : MainRenderableComponent,
protected override Type MeshComponentType { get; } = typeof(MeshComponent);
protected override Type ColliderComponentType { get; } = typeof(ColliderComponent);
- public bool DragPointsActive => true;
-
#endregion
#region Transformation
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceComponent.cs
index 56ea47956..9066b1446 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceComponent.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceComponent.cs
@@ -35,7 +35,7 @@ namespace VisualPinball.Unity
{
[AddComponentMenu("Visual Pinball/Game Item/Surface")]
public class SurfaceComponent : MainRenderableComponent,
- IConvertGameObjectToEntity, ISurfaceComponent, IDragPointsComponent
+ IConvertGameObjectToEntity, ISurfaceComponent
{
#region Data
@@ -67,8 +67,6 @@ public class SurfaceComponent : MainRenderableComponent,
protected override Type MeshComponentType { get; } = typeof(MeshComponent);
protected override Type ColliderComponentType { get; } = typeof(ColliderComponent);
- public bool DragPointsActive => true;
-
#endregion
#region Transformation
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceSideMeshComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceSideMeshComponent.cs
index 732eb5b1c..e747f627d 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceSideMeshComponent.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Surface/SurfaceSideMeshComponent.cs
@@ -34,7 +34,7 @@ public class SurfaceSideMeshComponent : MeshComponent,
- ITriggerComponent, IDragPointsComponent, IOnSurfaceComponent, IConvertGameObjectToEntity
+ ITriggerComponent, IOnSurfaceComponent, IConvertGameObjectToEntity
{
#region Data
@@ -74,13 +74,6 @@ public class TriggerComponent : MainRenderableComponent,
protected override Type MeshComponentType { get; } = typeof(MeshComponent);
protected override Type ColliderComponentType { get; } = typeof(ColliderComponent);
- public bool DragPointsActive {
- get {
- var meshComp = GetComponent();
- return !meshComp || !meshComp.IsCircle;
- }
- }
-
public const string SwitchItem = "trigger_switch";
#endregion