Skip to content

Commit

Permalink
Merge tag '6.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
leohilbert committed Dec 10, 2024
2 parents ca23fc2 + 4df48a5 commit 1c21b6b
Show file tree
Hide file tree
Showing 80 changed files with 23,963 additions and 11,446 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
- 2019.3.15f1
- 2019.4.40f1
- 2020.3.48f1
- 2021.3.37f1
- 2022.3.24f1
- 2023.2.18f1
- 2021.3.45f1
- 2022.3.43f1
- 6000.0.23f1

steps:
#Test Checkout
Expand All @@ -39,7 +39,7 @@ jobs:
Library-${{ matrix.unityVersion }}

#Test Runner
- uses: game-ci/unity-test-runner@v4.1.1
- uses: game-ci/unity-test-runner@v4.3.1
id: tests
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-runner_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
#- playmode
- editmode
unityVersion:
#this might need to be corrected in the future
- 2019.3.15f1
- 2019.4.40f1
- 2020.1.17f1
Expand All @@ -28,6 +29,7 @@ jobs:
- 2022.3.24f1
- 2023.1.7f1
- 2023.2.18f1
- 6000.0.23f1

steps:
#Test Checkout
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/unity-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
- 2019.3.15f1
- 2019.4.40f1
- 2020.3.48f1
- 2021.3.37f1
- 2022.3.24f1
- 2023.2.18f1
- 2021.3.45f1
- 2022.3.43f1
- 6000.0.23f1

include:
- targetPlatform: WebGL
unityVersion: 2019.3.15f1
- targetPlatform: WebGL
unityVersion: 2023.2.18f1
unityVersion: 6000.0.23f1


steps:
Expand All @@ -47,7 +47,7 @@ jobs:
Library-${{ matrix.unityVersion }}

#Build
- uses: game-ci/unity-builder@v4.2.3
- uses: game-ci/unity-builder@v4.3.0
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
Expand Down
37 changes: 36 additions & 1 deletion Assets/LDtkUnity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
## [6.4.5](https://github.com/Cammin/LDtkToUnity/compare/6.4.4...6.4.5) (2024-09-23)
# [6.6.0](https://github.com/Cammin/LDtkToUnity/compare/6.5.1...6.6.0) (2024-12-08)


### Bug Fixes

* All samples now have collision setup. Most have intgrid value tile collision, but some others use tileset file collision. ([808db33](https://github.com/Cammin/LDtkToUnity/commit/808db3328835cfa1f5a81587f3fb2e6ee7fb64c2))
* Fixed separate levels not reimporting when the configured fields in the project importer inspector was changed. This was fixed by introducing a new config file that gets generated by the project importer (.ldtkc) ([a7be947](https://github.com/Cammin/LDtkToUnity/commit/a7be9471a1874761ddf963857803954fbda980c8))


### Features

* Importer dependency section now additonally shows an icon for each depended asset ([9ddc70a](https://github.com/Cammin/LDtkToUnity/commit/9ddc70aaf684aa043a1a02adf09b8cd88dd8043a))

## [6.5.1](https://github.com/Cammin/LDtkToUnity/compare/6.5.0...6.5.1) (2024-12-01)


### Bug Fixes

* Mac/Linux: Fixed a command-related error message in the importer inspector even when the command is correct ([5796eae](https://github.com/Cammin/LDtkToUnity/commit/5796eae5659a465ceaaca44c988fbf298f8d7ee3))
* Verbose log will properly log when tilemaps are refreshed even if the scene window doesn't exist ([9ada5d4](https://github.com/Cammin/LDtkToUnity/commit/9ada5d4ec2e14365173bd3447ff80b6745f4852a))

# [6.5.0](https://github.com/Cammin/LDtkToUnity/compare/6.4.6...6.5.0) (2024-11-21)


### Features

* Enabling verbose logging will log the tilemap refresh notification that occurs after importing a tileset file ([1e6960c](https://github.com/Cammin/LDtkToUnity/commit/1e6960ccfeee2f88b05e8bc2a2fa95c27039e9d1))

## [6.4.6](https://github.com/Cammin/LDtkToUnity/compare/6.4.5...6.4.6) (2024-11-04)


### Bug Fixes

* Fix a compile error for linux editors ([50247c4](https://github.com/Cammin/LDtkToUnity/commit/50247c4ff6697fcea0a4eabeaac561e002b7bd12))

## [6.4.5](https://github.com/Cammin/LDtkToUnity/compare/6.4.4...6.4.5) (2024-09-23)


### Performance Improvements
Expand Down
1 change: 1 addition & 0 deletions Assets/LDtkUnity/Editor/Builders/LDtkBuilderProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace LDtkUnity.Editor
{
//todo: add support for runtime building startting from here. use the LDtkConfig object instead of the importers
internal sealed class LDtkProjectBuilder
{
private readonly LDtkProjectImporter _project;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using UnityEditor;

#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
using UnityEditor.Experimental.AssetImporters;
#endif

namespace LDtkUnity.Editor
{
[CanEditMultipleObjects]
[CustomEditor(typeof(LDtkConfigImporter))]
internal sealed class LDtkConfigImporterEditor : ScriptedImporterEditor
{
public override void OnInspectorGUI()
{
const string msg = "This file is generated by the project importer.\n" +
"It contains the configuration data from the project inspector.\n" +
"It is only used for telling the levels to reimport when this is changed.";
EditorGUILayout.HelpBox(msg, MessageType.Info);
ApplyRevertGUI();
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,6 @@ public bool HasCustomCommand(LdtkJson data, out string reason)
return false;
}

//ensure that there is a 2nd arg.
string[] split = Regex.Matches(command.Command, @"[\""].+?[\""]|[^ ]+")
.Cast<Match>()
.Select(m => m.Value)
.ToArray();

if (split.Length != 2 || split[1] != $"\"{ProjectName}\"")
{
reason = $"The command exists, but doesn't have a single parameter of the project name." +
$"\n" +
$"The command was this:\n{command.Command}";
return false;
}

reason = null;
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Linq;
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;

namespace LDtkUnity.Editor
{
Expand All @@ -9,6 +11,7 @@ internal sealed class LDtkSectionDependencies : LDtkSectionDrawer
private readonly SerializedObject _serializedObject;
private string[] _dependencies;
private Object[] _dependencyAssets;
private GUIContent[] _dependencyContent;

protected override string GuiText => "Dependencies";
protected override string GuiTooltip => "Dependencies that were defined since the last import.\n" +
Expand Down Expand Up @@ -40,15 +43,35 @@ public LDtkSectionDependencies(LDtkImporterEditor editor, SerializedObject seria

_dependencies = LDtkDependencyCache.Load(importerPath);
_dependencyAssets = new Object[_dependencies.Length];
_dependencyContent = new GUIContent[_dependencies.Length];

for (int i = 0; i < _dependencies.Length; i++)
{
_dependencyAssets[i] = AssetDatabase.LoadAssetAtPath<Object>(_dependencies[i]);
_dependencyContent[i] = new GUIContent
{
text = _dependencyAssets[i].name,
tooltip = _dependencies[i],
image = GetIconForDependency(_dependencyAssets[i].GetType(), _dependencies[i])
};
}

Texture2D GetIconForDependency(Type type, string assetPath)
{
AssetImporter importer = AssetImporter.GetAtPath(assetPath);

if (importer != null && importer is LDtkTilesetImporter)
{
return LDtkIconUtility.LoadTilesetFileIcon();
}

return AssetPreview.GetMiniTypeThumbnail(type);
}
}

public override void Draw()
{
//don't draw this section at all if there are no dependencies
if (_dependencyAssets.All(p => p == null))
{
return;
Expand All @@ -60,21 +83,19 @@ public override void Draw()

protected override void DrawDropdownContent()
{
EditorGUIUtility.SetIconSize(Vector2.one * 16f);
for (int i = 0; i < _dependencies.Length; i++)
{
string dependency = _dependencies[i];
Object dependencyAsset = _dependencyAssets[i];

if (dependencyAsset == null)
{
continue;
}

GUIContent content = new GUIContent(dependencyAsset.name, dependency);

using (new LDtkGUIEnabledScope(false))
{
EditorGUILayout.ObjectField(content, dependencyAsset, typeof(Object), false);
EditorGUILayout.ObjectField(_dependencyContent[i], dependencyAsset, typeof(Object), false);
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions Assets/LDtkUnity/Editor/ScriptedImporter/LDtkConfigImporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using UnityEngine;

#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
using UnityEditor.Experimental.AssetImporters;
#endif

namespace LDtkUnity.Editor
{
[ScriptedImporter(LDtkImporterConsts.CONFIG_VERSION, LDtkImporterConsts.CONFIG_EXT, LDtkImporterConsts.CONFIG_ORDER)]
internal sealed class LDtkConfigImporter : ScriptedImporter
{
public override void OnImportAsset(AssetImportContext ctx)
{
LDtkConfigData data = LDtkConfigData.ReadJson(assetPath);

LDtkConfig obj = ScriptableObject.CreateInstance<LDtkConfig>();
obj._data = data;

ctx.AddObjectToAsset("main", obj, LDtkIconUtility.LoadListIcon());
ctx.SetMainObject(obj);
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
{
internal static class LDtkImporterConsts
{
public const int PROJECT_VERSION = 31;
public const int LEVEL_VERSION = 15;
public const int PROJECT_VERSION = 32;
public const int LEVEL_VERSION = 16;
public const int TILESET_VERSION = 8;
public const int CONFIG_VERSION = 0;

public const string MINIMUM_JSON_VERSION = "1.5.0";
public const string EXPORT_APP_VERSION_REQUIRED = "1.5.3.1";

public const string PROJECT_EXT = "ldtk";
public const string LEVEL_EXT = "ldtkl";
public const string TILESET_EXT = "ldtkt";
public const string CONFIG_EXT = "ldtkc";

public const int DEFAULT_PPU = 16;
private const int SCRIPTED_IMPORTER_ORDER = 1000;
Expand All @@ -21,6 +24,7 @@ internal static class LDtkImporterConsts
//Import order https://forum.unity.com/threads/understanding-import-order-of-native-unity-asset-types.1187845/#post-9171509
//Important to reimport before prefabs (1500)
//99 is the secret parallel import value, but doesnt appear to work. maybe in a future update
public const int CONFIG_ORDER = 1093 - SCRIPTED_IMPORTER_ORDER;
public const int TILESET_ORDER = 1094 - SCRIPTED_IMPORTER_ORDER;
public const int PROJECT_ORDER = 1095 - SCRIPTED_IMPORTER_ORDER;
public const int LEVEL_ORDER = 1099 - SCRIPTED_IMPORTER_ORDER;
Expand Down
30 changes: 29 additions & 1 deletion Assets/LDtkUnity/Editor/ScriptedImporter/LDtkProjectImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ protected override void Import()
TryGenerateEnums(json);
LDtkProfiler.EndSample();

LDtkProfiler.BeginSample("CreateConfigurationFile");
GenerateConfigurationFile(json);
LDtkProfiler.EndSample();

LDtkProfiler.BeginSample("BufferEditorCache");
BufferEditorCache();
LDtkProfiler.EndSample();
Expand Down Expand Up @@ -242,10 +246,34 @@ private void TryCreateTableOfContents(LdtkJson json)
}

Toc = ScriptableObject.CreateInstance<LDtkTableOfContents>();
Toc.name += Path.GetFileNameWithoutExtension(assetPath) + "_Toc";
Toc.name += AssetName + "_Toc";
Toc.Initialize(json);
ImportContext.AddObjectToAsset("toc", Toc, LDtkIconUtility.LoadListIcon());
}

private void GenerateConfigurationFile(LdtkJson json)
{
//only generate the file if separate levels is used
if (!json.ExternalLevels) return;

LDtkConfigData config = new LDtkConfigData()
{
PixelsPerUnit = _pixelsPerUnit,
CustomLevelPrefab = _customLevelPrefab,
IntGridValueColorsVisible = _intGridValueColorsVisible,
UseCompositeCollider = _useCompositeCollider,
GeometryType = _geometryType,
CreateBackgroundColor = _createBackgroundColor,
CreateLevelBoundsTrigger = _createLevelBoundsTrigger,
UseParallax = _useParallax,
IntGridValues = _intGridValues,
Entities = _entities,
};
string writePath = config.WriteJson(assetPath);

//importing the asset if it doesn't exist due to the asset database not refreshing this automatically
AssetDatabase.ImportAsset(writePath);
}

private void BufferEditorCache()
{
Expand Down
12 changes: 12 additions & 0 deletions Assets/LDtkUnity/Editor/Utility/Artifacts/LDtkConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UnityEngine;

namespace LDtkUnity.Editor
{
/// <summary>
/// Purely a class to hold the LDtkConfigData as an import artifact
/// </summary>
internal sealed class LDtkConfig : ScriptableObject
{
public LDtkConfigData _data;
}
}
11 changes: 11 additions & 0 deletions Assets/LDtkUnity/Editor/Utility/Artifacts/LDtkConfig.cs.meta

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

Loading

0 comments on commit 1c21b6b

Please sign in to comment.