Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/UserSettings/
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/VisualPinball.Engine.csproj
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/VisualPinball.Engine.Test.csproj
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/VisualPinball.Unity.Editor.csproj
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/VisualPinball.Unity.Patcher.csproj
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/VisualPinball.Unity.Test.csproj
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/VisualPinball.Unity.csproj
VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/editmode-results.xml
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Built with Unity 6.5
- Move render pipelines into separate repos ([#259](https://github.com/freezy/VisualPinball.Engine/pull/259)).
- Put game-, mesh-, collision- animation data into separate components ([#227](https://github.com/freezy/VisualPinball.Engine/pull/227), [Documentation](https://docs.visualpinball.org/creators-guide/editor/unity-components.html)).

### Removed

- The legacy VPX table patcher and its import option, including `IPatcher`, `PatcherManager`, the render-pipeline material-adapter APIs, and the `applyPatch` import parameters.

### Fixed
- Disappearing objects due to wrong bounding box ([#441](https://github.com/freezy/VisualPinball.Engine/pull/441)).
- Default table import ([#434](https://github.com/freezy/VisualPinball.Engine/pull/434))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ Lastly, we can visualize the colliders of any object. This can be useful to debu

![Colliders](unity-colliders.jpg)

## Patching System

There are common patterns for VPX tables that are obsolete in VPE. For instance, VPE doesn't need a flipper shadow mesh, because it can do dynamic lighting out of the box. For that reason, we have a simple but sophisticated patcher system that allows us to apply changes to a table when imported.

Of course the changes don't apply to the table data itself but to how we convert it into the Unity scene. You can read more about it [here](https://github.com/freezy/VisualPinball.Engine/tree/master/VisualPinball.Unity/VisualPinball.Unity.Patcher#unity-patching-system).

## Display Support

VPE provides high-quality rendering of dot matrix and segment displays. Displays can be placed anywhere in the scene, multiple at once, and are easily linked to the game logic engine. For DMDs, dot size, shape and color can be customized, and for segment displays it's the segment weight, skew angle and color.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ Open the package manager by clicking on *Window -> Package Management -> Package

There, enter `org.visualpinball.engine.unity.hdrp` and click *Install*. This will take a moment as Unity downloads and compiles all of VPE's dependencies and parses all the assets that we ship in our library.

> [!WARNING]
> Our patcher, which is currently part of the main package, depends on the PinMAME package. Until we move the patcher into a separate package, you will have to install the PinMAME package as well. To do that, click on the plus button again and enter `org.visualpinball.engine.pinmame`, then click on *Add*.

When complete, you should now have a *Pinball* menu in the editor, and you should see the following new packages in the package manager (version numbers will vary):

<p><img alt="Unity Input System Warning" width="907" src="unity-packages-after-installation.png" /></p>
Expand Down
14 changes: 0 additions & 14 deletions VisualPinball.Unity/VisualPinball.Engine.Unity.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPinball.Resources", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPinball.Unity.Test", "VisualPinball.Unity.Test\VisualPinball.Unity.Test.csproj", "{B94E5F7B-C579-4C06-9242-B9A95529DE87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPinball.Unity.Patcher", "VisualPinball.Unity.Patcher\VisualPinball.Unity.Patcher.csproj", "{5134A0F7-387C-44AC-9850-55B0D6B564ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPinball.Unity.Editor", "VisualPinball.Unity.Editor\VisualPinball.Unity.Editor.csproj", "{1B54F9E3-119E-4148-8C47-EB7E2C1E562E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPinball.Engine.Test", "..\VisualPinball.Engine.Test\VisualPinball.Engine.Test.csproj", "{4CAA8C3D-7D51-4AF6-838C-10BC0C855AF8}"
Expand Down Expand Up @@ -80,18 +78,6 @@ Global
{B94E5F7B-C579-4C06-9242-B9A95529DE87}.Release|x86.Build.0 = Release|Any CPU
{B94E5F7B-C579-4C06-9242-B9A95529DE87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B94E5F7B-C579-4C06-9242-B9A95529DE87}.Release|Any CPU.Build.0 = Release|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Debug|x64.ActiveCfg = Debug|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Debug|x64.Build.0 = Debug|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Debug|x86.ActiveCfg = Debug|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Debug|x86.Build.0 = Debug|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Release|x64.ActiveCfg = Release|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Release|x64.Build.0 = Release|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Release|x86.ActiveCfg = Release|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Release|x86.Build.0 = Release|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5134A0F7-387C-44AC-9850-55B0D6B564ED}.Release|Any CPU.Build.0 = Release|Any CPU
{1B54F9E3-119E-4148-8C47-EB7E2C1E562E}.Debug|x64.ActiveCfg = Debug|Any CPU
{1B54F9E3-119E-4148-8C47-EB7E2C1E562E}.Debug|x64.Build.0 = Debug|Any CPU
{1B54F9E3-119E-4148-8C47-EB7E2C1E562E}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public void SetReferencedData(Table table, IMaterialProvider materialProvider, I

public void PersistData();

public void UpdateTransforms();

void FreeBinaryData();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public static class VpxImportEngine
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

public static GameObject ImportIntoScene(string path, GameObject parent = null, bool applyPatch = true, string tableName = null, ConvertOptions options = null)
public static GameObject ImportIntoScene(string path, GameObject parent = null, string tableName = null, ConvertOptions options = null)
{
var sw = Stopwatch.StartNew();
return ImportIntoScene(TableLoader.LoadTable(path), Path.GetFileName(path), parent, applyPatch, tableName, sw, options);
return ImportIntoScene(TableLoader.LoadTable(path), Path.GetFileName(path), parent, tableName, sw, options);
}

public static GameObject ImportIntoScene(FileTableContainer tableContainer, string filename = "", GameObject parent = null, bool applyPatch = true, string tableName = null, Stopwatch sw = null, ConvertOptions options = null)
public static GameObject ImportIntoScene(FileTableContainer tableContainer, string filename = "", GameObject parent = null, string tableName = null, Stopwatch sw = null, ConvertOptions options = null)
{
sw ??= Stopwatch.StartNew();
if (tableName == null && !string.IsNullOrEmpty(filename)) {
Expand All @@ -43,8 +43,8 @@ public static GameObject ImportIntoScene(FileTableContainer tableContainer, stri

// load table
var loadedIn = sw.ElapsedMilliseconds;
var converter = new VpxSceneConverter(tableContainer, filename, options);
var tableGameObject = converter.Convert(applyPatch, tableName);
var converter = new VpxSceneConverter(tableContainer, options);
var tableGameObject = converter.Convert(tableName);
var convertedIn = sw.ElapsedMilliseconds;

// if an object was selected in the editor, make it its parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ public void OnGUI()

GUILayout.Space(settingsMargin);

VpxImportWizardSettings.ApplyPatch = EditorGUILayout.Toggle("Apply Patch", VpxImportWizardSettings.ApplyPatch);

EditorGUILayout.LabelField("Allows you to disable the automatic patching of a table during the import", labelInfoStyle);

GUILayout.Space(settingsMargin);

VpxImportWizardSettings.TableName = EditorGUILayout.TextField("Table Name", VpxImportWizardSettings.TableName);

EditorGUILayout.LabelField("The name of the gameobject. Empty = default. Tags: %TABLENAME% = table name, %INFONAME% = Table's Info Name", labelInfoStyle);
Expand Down Expand Up @@ -217,10 +211,8 @@ public void OnGUI()
{
VpxImportEngine.ImportIntoScene(
VpxImportWizardSettings.VpxPath,
null,
VpxImportWizardSettings.ApplyPatch,
VpxImportWizardSettings.TableName,
VpxImportWizardSettings.BuildConvertOptions()
tableName: VpxImportWizardSettings.TableName,
options: VpxImportWizardSettings.BuildConvertOptions()
);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ namespace VisualPinball.Unity.Editor
{
public static class VpxImportWizardSettings
{
public static bool ApplyPatch
{
get => EditorPrefs.GetBool("ApplyPatch", true);
set => EditorPrefs.SetBool("ApplyPatch", value);
}

public static string VpxPath
{
get => EditorPrefs.GetString("VpxPath", "");
Expand Down Expand Up @@ -122,7 +116,6 @@ public static bool IsPathValid()
public static void Reset()
{
VpxPath = "";
ApplyPatch = true;
TableName = "%TABLENAME%";
ObjectImportFilter = VpxObjectImportFilter.All;
ImportTextures = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ public void PersistData()
PrefabUtility.RecordPrefabInstancePropertyModifications(comp);
}
}
public void UpdateTransforms()
{
}

public void FreeBinaryData() => _primitive.Data.FreeBinaryData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void SetReferencedData(Table table, IMaterialProvider materialProvider, I
UpdateTransforms();
}

public void UpdateTransforms()
private void UpdateTransforms()
{
if (_mainComponent && _mainComponent is IMainRenderableComponent renderComponent) {
renderComponent.UpdateTransforms();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,17 @@ public class VpxSceneConverter : ITextureProvider, IMaterialProvider, IMeshProvi
private readonly Dictionary<string, Material> _materials = new Dictionary<string, Material>();
private readonly Dictionary<string, PhysicsMaterialAsset> _physicalMaterials = new Dictionary<string, PhysicsMaterialAsset>();

private readonly IPatcher _patcher;
private bool _applyPatch = true;

private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

/// <summary>
/// Creates a new converter for a new table
/// </summary>
/// <param name="sourceContainer">Source table container</param>
/// <param name="fileName">File name of the file being imported</param>
/// <param name="options">Optional convert options</param>
public VpxSceneConverter(FileTableContainer sourceContainer, string fileName = "", ConvertOptions options = null)
public VpxSceneConverter(FileTableContainer sourceContainer, ConvertOptions options = null)
{
_sourceContainer = sourceContainer;
_sourceTable = sourceContainer.Table;
_patcher = PatcherManager.GetPatcher();
_patcher?.Set(sourceContainer, fileName, this, this);
_options = options ?? new ConvertOptions();
}

Expand Down Expand Up @@ -142,10 +136,8 @@ public VpxSceneConverter(TableComponent tableComponent)
CreateFileHierarchy();
}

public GameObject Convert(bool applyPatch = true, string tableName = null)
public GameObject Convert(string tableName = null)
{
_applyPatch = applyPatch;

CreateRootHierarchy(tableName);
CreateFileHierarchy();
DumpTableScript();
Expand Down Expand Up @@ -192,11 +184,6 @@ public GameObject Convert(bool applyPatch = true, string tableName = null)

SetUpAudio();

// patch
if (_applyPatch) {
_patcher?.PostPatch(_tableGo);
}

ApplyPlayfieldVisualMaterial();

return _tableGo;
Expand Down Expand Up @@ -389,14 +376,6 @@ private Dictionary<string, IMainComponent> UpdateGameItems(Dictionary<string, IV
mf.sharedMesh = AssetDatabase.LoadAssetAtPath<Mesh>(meshPath);
}

// patch
if (_applyPatch) {
_patcher?.ApplyPatches(prefab.GameObject, _tableGo);
if (prefab.GameObject) { // only if not destroyed..
prefab.UpdateTransforms();
}
}

// persist changes
if (prefab.GameObject) { // only if not destroyed..
prefab.PersistData();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public interface IRenderPipelineConverter
/// </summary>
RenderPipelineType Type { get; }

/// <summary>
/// Provides a bunch of helper methods for setting common attributes
/// in materials.
/// </summary>
IMaterialAdapter MaterialAdapter { get; }

/// <summary>
/// Provides access to VPE's game item prefabs.
/// </summary>
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading