diff --git a/VisualPinball.Engine/Math/DragPointData.cs b/VisualPinball.Engine/Math/DragPointData.cs index 51224ce18..35241a880 100644 --- a/VisualPinball.Engine/Math/DragPointData.cs +++ b/VisualPinball.Engine/Math/DragPointData.cs @@ -88,7 +88,6 @@ public DragPointData Lerp(DragPointData dp, float pos) IsSlingshot = dp.IsSlingshot, HasAutoTexture = dp.HasAutoTexture, TextureCoord = dp.TextureCoord, - IsLocked = dp.IsLocked, EditorLayer = dp.EditorLayer, EditorLayerName = dp.EditorLayerName, EditorLayerVisibility = EditorLayerVisibility @@ -109,7 +108,6 @@ public DragPointData Clone() IsSlingshot = IsSlingshot, HasAutoTexture = HasAutoTexture, TextureCoord = TextureCoord, - IsLocked = IsLocked, EditorLayer = EditorLayer, EditorLayerName = EditorLayerName, EditorLayerVisibility = EditorLayerVisibility, @@ -147,7 +145,6 @@ public DragPointData(DragPointData rf) : base(null) IsSlingshot = rf.IsSlingshot; HasAutoTexture = rf.HasAutoTexture; TextureCoord = rf.TextureCoord; - IsLocked = rf.IsLocked; EditorLayer = rf.EditorLayer; CalcHeight = rf.CalcHeight; } diff --git a/VisualPinball.Unity/Documentation~/creators-guide/editor/asset-library-styleguide.md b/VisualPinball.Unity/Documentation~/creators-guide/editor/asset-library-styleguide.md index 846653455..45ca3a137 100644 --- a/VisualPinball.Unity/Documentation~/creators-guide/editor/asset-library-styleguide.md +++ b/VisualPinball.Unity/Documentation~/creators-guide/editor/asset-library-styleguide.md @@ -100,7 +100,7 @@ All models must be [UV-mapped](https://en.wikipedia.org/wiki/UV_mapping). If your model contains art that varies from instance to instance, use a [decal mesh](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.2/manual/understand-decals.html). Decals should be used where you would find literal decals or imprints in the real world. Examples include spinners, aprons, targets, and bumpers. -On the right side you see two drop target meshes which their corresponding decal meshes in orange. +On the right side you see two drop target meshes with their corresponding decal meshes in orange. The decal geometry should be in a separate object parented to the main object. The UVs of the decal mesh should be laid out in a way that allows its textures to be created with non-specialized image editors. @@ -211,7 +211,7 @@ We're aiming for a resolution of about 6 pixels per millimeter (approximately 15 > [!note] > You can determine the resolution by looking at your UV map and the size of the asset. Let's take the gate from the previous section as an example. > -> 1. Take a large section of your mesh, and measure it. The larger, the more precise it will be. Here I'm measuring the top surface, from where the bevel starts:
+> 1. Take a large section of your mesh, and measure it. The larger, the more precise it will be. Here we're measuring the top surface, from where the bevel starts:
> > 2. Next, identify that section on your UV map, and note where in UV space they are:
>
@@ -220,9 +220,9 @@ We're aiming for a resolution of about 6 pixels per millimeter (approximately 15 > - Width in UV space: 0.955 - 0.36 = 0.595 > - Width in real world space: 29.2mm > 4. At 6px / mm, that makes 6px × 29.2mm = 175.2px for the 0.595 UVs -> 5. To get the resolution of the whole UV map: 175.2px / 0.592 = 296px +> 5. To get the resolution of the whole UV map: 175.2px / 0.592 = **296px** > -> So, a texture map at 296×296 would correspond to 6px / mm. Since we're at power of twos, we can go for either 512×512 or 256×256. +> So, a texture map at 296×296 would correspond to 6px / mm. Since we're at power of twos, we could go for either 512×512 or 256×256. ### File Format diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser.cs index be6b5f9ad..74c85f262 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser.cs @@ -50,7 +50,6 @@ public partial class AssetBrowser : EditorWindow, IDragHandler [NonSerialized] public AssetQuery Query; - public const string ThumbPath = "Packages/org.visualpinball.unity.assetlibrary/Editor/Thumbnails~"; public const int ThumbSize = 256; private AssetResult LastSelectedResult { diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser_Init.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser_Init.cs index 255fb7823..c6acdb4a9 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser_Init.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetBrowser_Init.cs @@ -166,7 +166,7 @@ private VisualElement NewItem(AssetResult result) private void LoadThumb(VisualElement el, Asset asset) { if (!_thumbCache.ContainsKey(asset.GUID)) { - var thumbPath = $"{ThumbPath}/{asset.GUID}.png"; + var thumbPath = $"{asset.Library.ThumbnailRoot}/{asset.GUID}.png"; if (File.Exists(thumbPath)) { var tex = new Texture2D(ThumbSize, ThumbSize); tex.LoadImage(File.ReadAllBytes(thumbPath)); diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetLibrary.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetLibrary.cs index 781c66758..cc49fd08c 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetLibrary.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetLibrary.cs @@ -42,6 +42,10 @@ public class AssetLibrary : ScriptableObject, ISerializationCallbackReceiver public string LibraryRoot; + public string ThumbnailRoot; + + public string DatabaseRoot; + public bool IsLocked; public Preset DefaultThumbCameraPreset; @@ -210,7 +214,7 @@ public void OnBeforeSerialize() if (string.IsNullOrEmpty(LibraryRoot)) { var path = AssetDatabase.GetAssetPath(this); if (!string.IsNullOrEmpty(path)) { - LibraryRoot = Path.GetDirectoryName(path); + LibraryRoot = Path.GetDirectoryName(path)?.Replace("\\", "/"); } } diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetDetails.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetDetails.cs index c2e57739f..2874f767e 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetDetails.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetDetails.cs @@ -446,7 +446,7 @@ private static (int, int, int, int, int, int) CountVertices(GameObject go) if (mesh != null) { meshes++; vertices += mesh.vertexCount; - triangles += mesh.triangles.Length; + triangles += mesh.triangles.Length / 3; uvs += mesh.uv.Length; subMeshes += mesh.subMeshCount; } diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombination.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombination.cs index b1ea4d9c6..c96617dd4 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombination.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombination.cs @@ -27,7 +27,7 @@ public class AssetMaterialCombination public string Name => string.Join(", ", _variations.Select(v => $"{v.Item2.Name} {v.Item1.Name}")); public string ThumbId => GenerateThumbID(); - public string ThumbPath => $"{AssetBrowser.ThumbPath}/{ThumbId}.png"; + public string ThumbPath => $"{Asset.Library.ThumbnailRoot}/{ThumbId}.png"; public bool IsOriginal => _variations.Length == 0; diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombinationElement.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombinationElement.cs index e02a3fb89..3fd7e88df 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombinationElement.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/AssetBrowser/AssetStructure/AssetMaterialCombinationElement.cs @@ -33,7 +33,7 @@ public class AssetMaterialCombinationElement: VisualElement public readonly AssetMaterialCombination Combination; - public AssetMaterialCombinationElement(AssetMaterialCombination combination) + public AssetMaterialCombinationElement(AssetMaterialCombination combination, Asset asset) { Combination = combination; @@ -49,7 +49,7 @@ public AssetMaterialCombinationElement(AssetMaterialCombination combination) ui.Q