Skip to content

Commit

Permalink
namings for assets determined from the importer instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammin committed Mar 9, 2024
1 parent 8a34b93 commit 7eaba51
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 17 deletions.
13 changes: 11 additions & 2 deletions Assets/LDtkUnity/Editor/ScriptedImporter/LDtkProjectImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,38 +187,47 @@ private void MakeDefObjects(LdtkJson json)

foreach (var obj in cache.Entities.Values)
{
obj.name = $"Entity_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadEntityIcon());
}
foreach (var obj in cache.EntityFields.Values)
{
obj.name = $"Field_Entity_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadEnumIcon());
}
foreach (var obj in cache.Enums.Values)
{
obj.name = $"Enum_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadEnumIcon());
}
foreach (var obj in cache.Layers.Values)
{
obj.name = $"Layer_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadLayerIcon());
}
foreach (var obj in cache.IntGridValueGroups.Values)
{
obj.name = $"IntGridValueGroup_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadIntGridIcon());
}
foreach (var obj in cache.RuleGroups.Values)
{
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadTilesetIcon());
obj.name = $"RuleGroup_{obj.Uid}_{obj.Name}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadAutoLayerIcon());
}
foreach (var obj in cache.Rules.Values)
{
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadTilesetIcon());
obj.name = $"Rule_{obj.Uid}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadAutoLayerIcon());
}
foreach (var obj in cache.LevelFields.Values)
{
obj.name = $"Field_Level_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadEnumIcon());
}
foreach (var obj in cache.Tilesets.Values)
{
obj.name = $"Tileset_{obj.Uid}_{obj.Identifier}";
ImportContext.AddObjectToAsset(obj.name, obj, LDtkIconUtility.LoadTilesetIcon());
}
foreach (var obj in cache.TilesetRects)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public class LDtkDefinitionObjectAutoLayerRule : ScriptableObject

internal void Populate(LDtkDefinitionObjectsCache cache, AutoLayerRuleDefinition def)
{
name = $"Rule_{def.Uid}";

Active = def.Active;
Alpha = def.Alpha;
BreakOnMatch = def.BreakOnMatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public class LDtkDefinitionObjectAutoLayerRuleGroup : ScriptableObject

internal void Populate(LDtkDefinitionObjectsCache cache, AutoLayerRuleGroup def)
{
name = $"RuleGroup_{def.Uid}_{def.Name}";

Active = def.Active;
BiomeRequirementMode = def.BiomeRequirementMode;
Color = def.UnityColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ public sealed class LDtkDefinitionObjectEntity : ScriptableObject

internal void Populate(LDtkDefinitionObjectsCache cache, EntityDefinition def)
{
name = $"Entity_{def.Identifier}";

Color = def.UnityColor;
Size = def.UnitySize;
Identifier = def.Identifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public sealed class LDtkDefinitionObjectEnum : ScriptableObject

internal void Populate(LDtkDefinitionObjectsCache cache, EnumDefinition def)
{
name = $"Enum_{def.Identifier}";

ExternalRelPath = def.ExternalRelPath;
IconTileset = cache.GetObject(cache.Tilesets, def.IconTilesetUid);
Identifier = def.Identifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ public sealed class LDtkDefinitionObjectField : ScriptableObject

public void Populate(LDtkDefinitionObjectsCache cache, FieldDefinition def)
{
name = $"Field_{def.Uid}_{def.Identifier}";

Type = def.Type;
AcceptFileTypes = def.AcceptFileTypes;
AllowedRefs = def.AllowedRefs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public sealed class LDtkDefinitionObjectIntGridValueGroup : ScriptableObject

internal void Populate(LDtkDefinitionObjectsCache cache, IntGridValueGroupDefinition def)
{
name = $"IntGridValueGroup_{def.Identifier}";

Color = def.UnityColor;
Identifier = def.Identifier;
Uid = def.Uid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ public sealed class LDtkDefinitionObjectLayer : ScriptableObject

internal void Populate(LDtkDefinitionObjectsCache cache, LayerDefinition def)
{
name = $"Layer_{def.Identifier}";

Type = def.Type;
AutoSourceLayerDef = cache.GetObject(cache.Layers, def.AutoSourceLayerDefUid);
DisplayOpacity = def.DisplayOpacity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public sealed class LDtkDefinitionObjectTilesetRectangle : ScriptableObject

public void Populate(LDtkDefinitionObjectsCache cache, TilesetRectangle def)
{
name = def.ToString();
Tileset = cache.GetObject(cache.Tilesets, def.TilesetUid);
Rectangle = def.UnityRectInt;
}
Expand Down

0 comments on commit 7eaba51

Please sign in to comment.