Skip to content

Commit 32d6456

Browse files
committed
ADD merging meta-fields
1 parent 22d7ee2 commit 32d6456

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/ldtk/Json.hx

+29-1
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ A `ldtkl` file is just a JSON file containing exactly what is described below.
289289
typedef LevelJson = {
290290

291291
/** Unique Int identifier **/
292+
@uidRoot("level")
292293
var uid: Int;
293294

294295
/**
@@ -460,9 +461,11 @@ typedef LayerInstanceJson = {
460461
var iid : String;
461462

462463
/** Reference to the UID of the level containing this layer instance **/
464+
@uidRef("level")
463465
var levelId: Int;
464466

465467
/** Reference the Layer definition UID **/
468+
@uidRef("layer")
466469
var layerDefUid: Int;
467470

468471
/** Layer instance visibility **/
@@ -505,6 +508,7 @@ typedef LayerInstanceJson = {
505508

506509
/** This layer can use another tileset by overriding the tileset UID here. **/
507510
@only("Tile layers")
511+
@uidRef("tileset")
508512
var overrideTilesetUid: Null<Int>;
509513

510514
/**
@@ -523,6 +527,7 @@ typedef LayerInstanceJson = {
523527
/** An Array containing the UIDs of optional rules that were enabled in this specific layer instance. **/
524528
@internal
525529
@added("0.9.0")
530+
@uidRef("rule")
526531
var optionalRules: Array<Int>;
527532
}
528533

@@ -581,6 +586,7 @@ typedef Tile = {
581586
typedef TilesetRect = {
582587
/** UID of the tileset **/
583588
@added("1.0.0")
589+
@uidRef("tileset")
584590
var tilesetUid : Int;
585591

586592
/** X pixels coordinate of the top-left corner in the Tileset image **/
@@ -657,6 +663,7 @@ typedef EntityInstanceJson = {
657663
var iid : String;
658664

659665
/** Reference of the **Entity definition** UID **/
666+
@uidRef("entity")
660667
var defUid: Int;
661668

662669
/** Pixel coordinates (`[x,y]` format) in current level coordinate space. Don't forget optional layer offsets, if they exist! **/
@@ -704,6 +711,7 @@ typedef FieldInstanceJson = {
704711
/**
705712
Reference of the **Field definition** UID
706713
**/
714+
@uidRef("field")
707715
var defUid: Int;
708716

709717
/**
@@ -759,6 +767,7 @@ typedef LayerDefJson = {
759767
var type: LayerType;
760768

761769
/** Unique Int identifier **/
770+
@uidRoot("layer")
762771
var uid: Int;
763772

764773
/** User defined documentation for this element to provide help/tips to level designers. **/
@@ -860,13 +869,15 @@ typedef LayerDefJson = {
860869
**/
861870
@deprecation("1.0.0", "1.2.0", "tilesetDefUid")
862871
@only("Auto-layers")
872+
@uidRef("tileset")
863873
var ?autoTilesetDefUid: Null<Int>;
864874

865875
/** Contains all the auto-layer rule definitions. **/
866876
@only("Auto-layers")
867877
@internal
868878
var autoRuleGroups: Array<AutoLayerRuleGroupJson>;
869879
@only("Auto-layers")
880+
@uidRef("layer")
870881
var autoSourceLayerDefUid: Null<Int>;
871882

872883
/** An array of tags to filter Entities that can be added to this layer **/
@@ -888,6 +899,7 @@ typedef LayerDefJson = {
888899
**/
889900
@changed("1.0.0")
890901
@only("Tile layers, Auto-layers")
902+
@uidRef("tileset")
891903
var tilesetDefUid: Null<Int>;
892904

893905
/** If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell. **/
@@ -902,11 +914,13 @@ typedef LayerDefJson = {
902914

903915
@added("1.5.0")
904916
@internal
917+
@uidRef("field")
905918
var biomeFieldUid: Null<Int>;
906919

907920
@only("Auto layers")
908921
@internal
909922
@added("1.5.0")
923+
@uidRef("layer")
910924
var autoTilesKilledByOtherLayerUid: Null<Int>;
911925

912926
/** Asynchronous rendering option for large/complex layers **/
@@ -919,7 +933,9 @@ typedef LayerDefJson = {
919933
@inline
920934
@display("Auto-layer rule group")
921935
typedef AutoLayerRuleGroupJson = {
936+
@uidRoot("ruleGroup")
922937
var uid: Int;
938+
923939
var name: String;
924940

925941
@added("1.4.0")
@@ -956,6 +972,7 @@ typedef AutoLayerRuleGroupJson = {
956972
@display("Auto-layer rule definition")
957973
typedef AutoRuleDef = {
958974
/** Unique Int identifier **/
975+
@uidRoot("rule")
959976
var uid: Int;
960977

961978
/** Pattern width & height. Should only be 1,3,5 or 7. **/
@@ -1065,6 +1082,7 @@ typedef EntityDefJson = {
10651082
var identifier: String;
10661083

10671084
/** Unique Int identifier **/
1085+
@uidRoot("entity")
10681086
var uid: Int;
10691087

10701088
/** User defined documentation for this element to provide help/tips to level designers. **/
@@ -1232,6 +1250,7 @@ typedef FieldDefJson = {
12321250
var doc: Null<String>;
12331251

12341252
/** Unique Int identifier **/
1253+
@uidRoot("field")
12351254
var uid: Int;
12361255

12371256
/**
@@ -1339,6 +1358,7 @@ typedef FieldDefJson = {
13391358

13401359
@internal
13411360
@added("1.3.0")
1361+
@uidRef("entity")
13421362
var allowedRefsEntityUid: Null<Int>;
13431363

13441364
@internal
@@ -1351,6 +1371,7 @@ typedef FieldDefJson = {
13511371
@only("Tile")
13521372
@internal
13531373
@added("1.0.0")
1374+
@uidRef("tileset")
13541375
var tilesetUid: Null<Int>;
13551376

13561377

@@ -1389,6 +1410,7 @@ typedef TilesetDefJson = {
13891410
var identifier: String;
13901411

13911412
/** Unique Intidentifier **/
1413+
@uidRoot("tileset")
13921414
var uid: Int;
13931415

13941416
/**
@@ -1423,6 +1445,7 @@ typedef TilesetDefJson = {
14231445

14241446
/** Optional Enum definition UID used for this tileset meta-data **/
14251447
@added("0.9.0")
1448+
@uidRef("enum")
14261449
var tagsSourceEnumUid: Null<Int>;
14271450

14281451
/** Tileset tags using Enum values specified by `tagsSourceEnumId`. This array contains 1 element per Enum value, which contains an array of all Tile IDs that are tagged with it. **/
@@ -1457,6 +1480,7 @@ typedef TilesetDefJson = {
14571480
@display("Enum definition")
14581481
typedef EnumDefJson = {
14591482
/** Unique Int identifier **/
1483+
@uidRoot("enum")
14601484
var uid: Int;
14611485

14621486
/** User defined unique identifier **/
@@ -1466,6 +1490,7 @@ typedef EnumDefJson = {
14661490
var values: Array<EnumDefValues>;
14671491

14681492
/** Tileset UID if provided **/
1493+
@uidRef("tileset")
14691494
var iconTilesetUid: Null<Int>;
14701495

14711496
/** Relative path to the external file providing this Enum **/
@@ -1516,6 +1541,7 @@ typedef NeighbourLevel = {
15161541
var levelIid : String;
15171542

15181543
@deprecation("1.0.0", "1.2.0", "levelIid")
1544+
@uidRef("level")
15191545
var ?levelUid: Int;
15201546

15211547
/**
@@ -1573,6 +1599,7 @@ typedef IntGridValueDef = {
15731599

15741600
/** Parent group identifier (0 if none)**/
15751601
@added("1.4.0")
1602+
@uidRef("intGroup")
15761603
var groupUid: Int;
15771604
}
15781605

@@ -1583,6 +1610,7 @@ typedef IntGridValueDef = {
15831610
@added("1.4.0")
15841611
typedef IntGridValueGroupDef = {
15851612
/** Group unique ID **/
1613+
@uidRoot("intGroup")
15861614
var uid: Int;
15871615

15881616
/** User defined string identifier **/
@@ -1729,7 +1757,7 @@ enum FieldType {
17291757
F_Text;
17301758
F_Bool;
17311759
F_Color;
1732-
F_Enum(enumDefUid:Int);
1760+
F_Enum(enumDefUid:Int); // @uidRef("enum")
17331761
F_Point;
17341762
F_Path;
17351763

0 commit comments

Comments
 (0)