proper command interface was implemented
This commit is contained in:
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
entries=[ {
|
entries=[ {
|
||||||
"children": [ 3 ],
|
"children": [ 3 ],
|
||||||
"command": -1,
|
"commands": [ [ 1, [ ] ], [ 2, [ ] ], [ 1, [ ] ], [ 2, [ ] ] ],
|
||||||
"index": 0,
|
"index": 0,
|
||||||
"name": "v2",
|
"name": "v2",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "layout"
|
"type": "layout"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 4, 5, 6 ],
|
"children": [ 4, 5, 6 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"floor_index": 0,
|
"floor_index": 0,
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"name": "v1",
|
"name": "v1",
|
||||||
@@ -17,7 +17,7 @@ entries=[ {
|
|||||||
"type": "layout"
|
"type": "layout"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 7, 8, 9, 10, 11 ],
|
"children": [ 7, 8, 9, 10, 11 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"floor_index": 0,
|
"floor_index": 0,
|
||||||
"index": 2,
|
"index": 2,
|
||||||
"name": "v3",
|
"name": "v3",
|
||||||
@@ -25,7 +25,7 @@ entries=[ {
|
|||||||
"type": "layout"
|
"type": "layout"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 12 ],
|
"children": [ 12 ],
|
||||||
"command": -1,
|
"commands": [ [ 1, [ ] ], [ 2, [ ] ], [ 1, [ ] ], [ 2, [ ] ] ],
|
||||||
"index": 3,
|
"index": 3,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -33,7 +33,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 13, 14, 15, 16 ],
|
"children": [ 13, 14, 15, 16 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 4,
|
"index": 4,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -41,7 +41,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 17, 18, 19 ],
|
"children": [ 17, 18, 19 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 5,
|
"index": 5,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 1,
|
"order": 1,
|
||||||
@@ -49,14 +49,14 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 20, 21 ],
|
"children": [ 20, 21 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 6,
|
"index": 6,
|
||||||
"name": "unit_0",
|
"name": "unit_0",
|
||||||
"order": 3,
|
"order": 3,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 22, 23 ],
|
"children": [ 22, 23 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 7,
|
"index": 7,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -64,35 +64,35 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 24, 25 ],
|
"children": [ 24, 25 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 8,
|
"index": 8,
|
||||||
"name": "unit_0",
|
"name": "unit_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 26, 27 ],
|
"children": [ 26, 27 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 9,
|
"index": 9,
|
||||||
"name": "unit_1",
|
"name": "unit_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 28, 29 ],
|
"children": [ 28, 29 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 10,
|
"index": 10,
|
||||||
"name": "unit_2",
|
"name": "unit_2",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 30, 31 ],
|
"children": [ 30, 31 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 11,
|
"index": 11,
|
||||||
"name": "unit_3",
|
"name": "unit_3",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 32 ],
|
"children": [ 32 ],
|
||||||
"command": -1,
|
"commands": [ [ 1, [ ] ], [ 2, [ ] ], [ 1, [ ] ] ],
|
||||||
"index": 12,
|
"index": 12,
|
||||||
"name": "stair_0",
|
"name": "stair_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -102,7 +102,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 13,
|
"index": 13,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -112,7 +112,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 14,
|
"index": 14,
|
||||||
"name": "kitchen_0",
|
"name": "kitchen_0",
|
||||||
"order": 1,
|
"order": 1,
|
||||||
@@ -122,7 +122,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 15,
|
"index": 15,
|
||||||
"name": "storage_room_0",
|
"name": "storage_room_0",
|
||||||
"order": 2,
|
"order": 2,
|
||||||
@@ -132,7 +132,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 16,
|
"index": 16,
|
||||||
"name": "enterance_0",
|
"name": "enterance_0",
|
||||||
"order": 3,
|
"order": 3,
|
||||||
@@ -142,7 +142,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 17,
|
"index": 17,
|
||||||
"name": "wc_0",
|
"name": "wc_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -152,7 +152,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 18,
|
"index": 18,
|
||||||
"name": "bathroom_0",
|
"name": "bathroom_0",
|
||||||
"order": 1,
|
"order": 1,
|
||||||
@@ -162,7 +162,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 19,
|
"index": 19,
|
||||||
"name": "bedroom_0",
|
"name": "bedroom_0",
|
||||||
"order": 2,
|
"order": 2,
|
||||||
@@ -172,7 +172,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ 33, 34, 35 ],
|
"children": [ 33, 34, 35 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 20,
|
"index": 20,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -180,7 +180,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 36, 37 ],
|
"children": [ 36, 37 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 21,
|
"index": 21,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -188,7 +188,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 22,
|
"index": 22,
|
||||||
"name": "enterance_0",
|
"name": "enterance_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -198,7 +198,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ 38 ],
|
"children": [ 38 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 23,
|
"index": 23,
|
||||||
"name": "stair_0",
|
"name": "stair_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -208,7 +208,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ 39, 40, 41 ],
|
"children": [ 39, 40, 41 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 24,
|
"index": 24,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -216,7 +216,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 42, 43 ],
|
"children": [ 42, 43 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 25,
|
"index": 25,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -224,7 +224,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 44 ],
|
"children": [ 44 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 26,
|
"index": 26,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -232,7 +232,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 45, 46 ],
|
"children": [ 45, 46 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 27,
|
"index": 27,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -240,7 +240,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 47 ],
|
"children": [ 47 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 28,
|
"index": 28,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -248,7 +248,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 48 ],
|
"children": [ 48 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 29,
|
"index": 29,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -256,7 +256,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 49 ],
|
"children": [ 49 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 30,
|
"index": 30,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -264,7 +264,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 50 ],
|
"children": [ 50 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 31,
|
"index": 31,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -272,7 +272,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 51 ],
|
"children": [ 51 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"floor_index": 0,
|
"floor_index": 0,
|
||||||
"index": 32,
|
"index": 32,
|
||||||
"name": "floor_0",
|
"name": "floor_0",
|
||||||
@@ -280,7 +280,7 @@ entries=[ {
|
|||||||
"type": "floor"
|
"type": "floor"
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 33,
|
"index": 33,
|
||||||
"name": "bathroom_0",
|
"name": "bathroom_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -290,7 +290,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 34,
|
"index": 34,
|
||||||
"name": "wc_0",
|
"name": "wc_0",
|
||||||
"order": 1,
|
"order": 1,
|
||||||
@@ -300,7 +300,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 35,
|
"index": 35,
|
||||||
"name": "bedroom_0",
|
"name": "bedroom_0",
|
||||||
"order": 2,
|
"order": 2,
|
||||||
@@ -310,7 +310,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 36,
|
"index": 36,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -320,7 +320,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": 1,
|
"commands": [ ],
|
||||||
"index": 37,
|
"index": 37,
|
||||||
"name": "kitchen_0",
|
"name": "kitchen_0",
|
||||||
"order": 1,
|
"order": 1,
|
||||||
@@ -330,7 +330,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ 52, 53 ],
|
"children": [ 52, 53 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"floor_index": 1,
|
"floor_index": 1,
|
||||||
"index": 38,
|
"index": 38,
|
||||||
"name": "floor_0",
|
"name": "floor_0",
|
||||||
@@ -338,7 +338,7 @@ entries=[ {
|
|||||||
"type": "floor"
|
"type": "floor"
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 39,
|
"index": 39,
|
||||||
"name": "bathroom_0",
|
"name": "bathroom_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -348,7 +348,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 40,
|
"index": 40,
|
||||||
"name": "bedroom_0",
|
"name": "bedroom_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -358,7 +358,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 41,
|
"index": 41,
|
||||||
"name": "wc_0",
|
"name": "wc_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -368,7 +368,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 42,
|
"index": 42,
|
||||||
"name": "kitchen_0",
|
"name": "kitchen_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -378,7 +378,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 43,
|
"index": 43,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -388,7 +388,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 44,
|
"index": 44,
|
||||||
"name": "bathroom_0",
|
"name": "bathroom_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -398,7 +398,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 45,
|
"index": 45,
|
||||||
"name": "kitchen_0",
|
"name": "kitchen_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -408,7 +408,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 46,
|
"index": 46,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -418,7 +418,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 47,
|
"index": 47,
|
||||||
"name": "wc_0",
|
"name": "wc_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -428,7 +428,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 48,
|
"index": 48,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -438,7 +438,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 49,
|
"index": 49,
|
||||||
"name": "bathroom_0",
|
"name": "bathroom_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -448,7 +448,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 50,
|
"index": 50,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -458,14 +458,14 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ 54, 55 ],
|
"children": [ 54, 55 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 51,
|
"index": 51,
|
||||||
"name": "unit_0",
|
"name": "unit_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ 56 ],
|
"children": [ 56 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 52,
|
"index": 52,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -473,14 +473,14 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ 57, 58 ],
|
"children": [ 57, 58 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 53,
|
"index": 53,
|
||||||
"name": "unit_0",
|
"name": "unit_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
"type": "unit"
|
"type": "unit"
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 54,
|
"index": 54,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -488,7 +488,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 55,
|
"index": 55,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -496,7 +496,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 56,
|
"index": 56,
|
||||||
"name": "storage_room_0",
|
"name": "storage_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -506,7 +506,7 @@ entries=[ {
|
|||||||
"window": true
|
"window": true
|
||||||
}, {
|
}, {
|
||||||
"children": [ 59 ],
|
"children": [ 59 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 57,
|
"index": 57,
|
||||||
"name": "zone_0",
|
"name": "zone_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -514,7 +514,7 @@ entries=[ {
|
|||||||
"zone_type": 0
|
"zone_type": 0
|
||||||
}, {
|
}, {
|
||||||
"children": [ 60 ],
|
"children": [ 60 ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 58,
|
"index": 58,
|
||||||
"name": "zone_1",
|
"name": "zone_1",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -522,7 +522,7 @@ entries=[ {
|
|||||||
"zone_type": 1
|
"zone_type": 1
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 59,
|
"index": 59,
|
||||||
"name": "wc_0",
|
"name": "wc_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
@@ -532,7 +532,7 @@ entries=[ {
|
|||||||
"window": false
|
"window": false
|
||||||
}, {
|
}, {
|
||||||
"children": [ ],
|
"children": [ ],
|
||||||
"command": -1,
|
"commands": [ ],
|
||||||
"index": 60,
|
"index": 60,
|
||||||
"name": "living_room_0",
|
"name": "living_room_0",
|
||||||
"order": 0,
|
"order": 0,
|
||||||
|
|||||||
Submodule src/flecs updated: 9605ca3b90...3a546e66a1
@@ -369,12 +369,12 @@ void BuildingLayoutGraph::save_layouts()
|
|||||||
buildings_layout_order>()
|
buildings_layout_order>()
|
||||||
->index;
|
->index;
|
||||||
entry["order"] = order;
|
entry["order"] = order;
|
||||||
int command = -1;
|
Array commands;
|
||||||
if (e.has<WorldEditor::components::buildings_layout_command>())
|
if (e.has<WorldEditor::components::buildings_layout_commands>())
|
||||||
command = e.get<WorldEditor::components::
|
commands = e.get<WorldEditor::components::
|
||||||
buildings_layout_command>()
|
buildings_layout_commands>()
|
||||||
->command;
|
->to_array();
|
||||||
entry["command"] = command;
|
entry["commands"] = commands;
|
||||||
if (e.has<WorldEditor::components::buildings_layout_graph>()) {
|
if (e.has<WorldEditor::components::buildings_layout_graph>()) {
|
||||||
entry["type"] = "layout";
|
entry["type"] = "layout";
|
||||||
/* remember it has floor component too */
|
/* remember it has floor component too */
|
||||||
@@ -470,7 +470,7 @@ void BuildingLayoutGraph::load_layouts()
|
|||||||
String name = entry["name"];
|
String name = entry["name"];
|
||||||
String type = entry["type"];
|
String type = entry["type"];
|
||||||
int order = entry.get("order", 0);
|
int order = entry.get("order", 0);
|
||||||
int command = entry.get("command", -1);
|
Array commands = entry.get("commands", Array());
|
||||||
print_line("name: " + name + " type: " + type);
|
print_line("name: " + name + " type: " + type);
|
||||||
int parent = entry.get("parent", -1);
|
int parent = entry.get("parent", -1);
|
||||||
flecs::entity parent_e = base;
|
flecs::entity parent_e = base;
|
||||||
@@ -483,8 +483,10 @@ void BuildingLayoutGraph::load_layouts()
|
|||||||
print_line(String(e.path()));
|
print_line(String(e.path()));
|
||||||
e.set<WorldEditor::components::buildings_layout_order>(
|
e.set<WorldEditor::components::buildings_layout_order>(
|
||||||
{ order });
|
{ order });
|
||||||
e.set<WorldEditor::components::buildings_layout_command>(
|
e.add<WorldEditor::components::buildings_layout_commands>();
|
||||||
{ command });
|
e.get_mut<WorldEditor::components::buildings_layout_commands>()
|
||||||
|
->from_array(commands);
|
||||||
|
e.modified<WorldEditor::components::buildings_layout_commands>();
|
||||||
if (type == "layout") {
|
if (type == "layout") {
|
||||||
e.add<WorldEditor::components::buildings_layout_graph>();
|
e.add<WorldEditor::components::buildings_layout_graph>();
|
||||||
if (entry.has("floor_index")) {
|
if (entry.has("floor_index")) {
|
||||||
@@ -586,7 +588,12 @@ int BuildingLayoutGraph::get_layout_count() const
|
|||||||
|
|
||||||
int BuildingLayoutGraph::get_children_count(flecs::entity base_e) const
|
int BuildingLayoutGraph::get_children_count(flecs::entity base_e) const
|
||||||
{
|
{
|
||||||
|
ecs_iter_t it = ecs_children(base_e.world().c_ptr(), base_e.id());
|
||||||
|
int32_t cnt = ecs_iter_count(&it);
|
||||||
|
return (int)cnt;
|
||||||
|
#if 0
|
||||||
int count = 0;
|
int count = 0;
|
||||||
base_e.children([&count](flecs::entity e) { count++; });
|
base_e.children([&count](flecs::entity e) { count++; });
|
||||||
return count;
|
return count;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,43 +245,106 @@ void BuildingLayoutGraphUI::update_buttons(ColorRect *canvas)
|
|||||||
args.size());
|
args.size());
|
||||||
}
|
}
|
||||||
if (e.has<WorldEditor::components::
|
if (e.has<WorldEditor::components::
|
||||||
buildings_layout_command>()) {
|
buildings_layout_commands>()) {
|
||||||
std::vector<Variant> args = {
|
std::vector<Variant> args = {
|
||||||
/* clang-format off */
|
"Commands...", "display_commands_button"
|
||||||
|
};
|
||||||
|
HashMap<String, Object *> save_data;
|
||||||
|
ui_field::ui_field_builder(canvas, box, "b#$",
|
||||||
|
args.data(),
|
||||||
|
args.size(),
|
||||||
|
&save_data);
|
||||||
|
assert(save_data.has(
|
||||||
|
"display_commands_button"));
|
||||||
|
Button *cmd_button = Object::cast_to<Button>(
|
||||||
|
save_data["display_commands_button"]);
|
||||||
|
cmd_button->connect(
|
||||||
|
"pressed", this, "show_command_editor",
|
||||||
|
varray(canvas, String(e.path())));
|
||||||
|
#if 0
|
||||||
|
int cmd,
|
||||||
|
cmd_count =
|
||||||
|
e.get<WorldEditor::components::
|
||||||
|
buildings_layout_commands>()
|
||||||
|
->commands.size();
|
||||||
|
for (cmd = 0; cmd < cmd_count; cmd++) {
|
||||||
|
std::vector<Variant> args = {
|
||||||
|
/* clang-format off */
|
||||||
"Command:",
|
"Command:",
|
||||||
"None", 3,
|
"None", 3,
|
||||||
-1, "None",
|
-1, "None",
|
||||||
1, "Arrach1",
|
1, "Arrach1",
|
||||||
2, "Attach2",
|
2, "Attach2",
|
||||||
"command",
|
"command",
|
||||||
/* clang-format on */
|
"Delete"
|
||||||
};
|
/* clang-format on */
|
||||||
HashMap<String, Object *> save_data;
|
};
|
||||||
ui_field::ui_field_builder(
|
HashMap<String, Object *> save_data;
|
||||||
canvas, box, "p{h{lo#$}}", args.data(),
|
ui_field::ui_field_builder(
|
||||||
args.size(), &save_data);
|
canvas, box, "p{h{lo#$b}}",
|
||||||
assert(!save_data.empty());
|
args.data(), args.size(),
|
||||||
List<String> keys;
|
&save_data);
|
||||||
save_data.get_key_list(&keys);
|
assert(!save_data.empty());
|
||||||
print_line(keys.front()->get());
|
List<String> keys;
|
||||||
assert(save_data["command"]);
|
save_data.get_key_list(&keys);
|
||||||
OptionButton *ob =
|
print_line(keys.front()->get());
|
||||||
Object::cast_to<OptionButton>(
|
assert(save_data["command"]);
|
||||||
save_data["command"]);
|
OptionButton *ob =
|
||||||
int command =
|
Object::cast_to<OptionButton>(
|
||||||
e.get<WorldEditor::components::
|
save_data["command"]);
|
||||||
buildings_layout_command>()
|
int command =
|
||||||
->command;
|
e.get<WorldEditor::components::
|
||||||
int selected = -1;
|
buildings_layout_commands>()
|
||||||
selected = ob->get_popup()->get_item_index(
|
->commands[cmd]
|
||||||
command);
|
.command;
|
||||||
print_line("selected: " + itos(command) + " " +
|
int selected = -1;
|
||||||
itos(selected));
|
selected =
|
||||||
ob->select(selected);
|
ob->get_popup()->get_item_index(
|
||||||
ob->connect("item_selected", this,
|
command);
|
||||||
"command_entered",
|
print_line(
|
||||||
varray(save_data["command"],
|
"selected: " + itos(command) +
|
||||||
String(e.path())));
|
" " + itos(selected));
|
||||||
|
ob->set_meta("cmd", cmd);
|
||||||
|
ob->select(selected);
|
||||||
|
ob->connect("item_selected", this,
|
||||||
|
"command_entered",
|
||||||
|
varray(save_data["command"],
|
||||||
|
String(e.path())));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::vector<Variant> args = {
|
||||||
|
/* clang-format off */
|
||||||
|
"Command:",
|
||||||
|
"None", 3,
|
||||||
|
-1, "None",
|
||||||
|
1, "Arrach1",
|
||||||
|
2, "Attach2",
|
||||||
|
"command",
|
||||||
|
"New"
|
||||||
|
/* clang-format on */
|
||||||
|
};
|
||||||
|
HashMap<String, Object *> save_data;
|
||||||
|
ui_field::ui_field_builder(
|
||||||
|
canvas, box, "p{h{lo#$b}}",
|
||||||
|
args.data(), args.size(),
|
||||||
|
&save_data);
|
||||||
|
assert(!save_data.empty());
|
||||||
|
List<String> keys;
|
||||||
|
save_data.get_key_list(&keys);
|
||||||
|
print_line(keys.front()->get());
|
||||||
|
assert(save_data["command"]);
|
||||||
|
OptionButton *ob =
|
||||||
|
Object::cast_to<OptionButton>(
|
||||||
|
save_data["command"]);
|
||||||
|
int selected = -1;
|
||||||
|
ob->select(selected);
|
||||||
|
ob->set_meta("cmd", -1);
|
||||||
|
ob->connect("item_selected", this,
|
||||||
|
"command_entered",
|
||||||
|
varray(save_data["command"],
|
||||||
|
String(e.path())));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
button->get_popup()->connect(
|
button->get_popup()->connect(
|
||||||
"id_pressed", this, "menu_pressed",
|
"id_pressed", this, "menu_pressed",
|
||||||
@@ -377,6 +440,7 @@ void BuildingLayoutGraphUI::order_entered(float value, Control *item,
|
|||||||
e.modified<WorldEditor::components::buildings_layout_order>();
|
e.modified<WorldEditor::components::buildings_layout_order>();
|
||||||
print_line("data set order");
|
print_line("data set order");
|
||||||
}
|
}
|
||||||
|
static PopupPanel *command_editor = nullptr;
|
||||||
void BuildingLayoutGraphUI::command_entered(int index, Control *item,
|
void BuildingLayoutGraphUI::command_entered(int index, Control *item,
|
||||||
const String &path)
|
const String &path)
|
||||||
{
|
{
|
||||||
@@ -384,10 +448,115 @@ void BuildingLayoutGraphUI::command_entered(int index, Control *item,
|
|||||||
flecs::world ecs = BaseData::get_singleton()->get();
|
flecs::world ecs = BaseData::get_singleton()->get();
|
||||||
flecs::entity e = ecs.lookup(path.ascii().ptr());
|
flecs::entity e = ecs.lookup(path.ascii().ptr());
|
||||||
assert(e.is_valid());
|
assert(e.is_valid());
|
||||||
e.get_mut<WorldEditor::components::buildings_layout_command>()->command =
|
int cmd = item->get_meta("cmd");
|
||||||
index;
|
if (cmd >= 0) {
|
||||||
e.modified<WorldEditor::components::buildings_layout_command>();
|
int command = index;
|
||||||
|
Vector<Variant> args;
|
||||||
|
WorldEditor::components::buildings_layout_commands *c = e.get_mut<
|
||||||
|
WorldEditor::components::buildings_layout_commands>();
|
||||||
|
c->commands.write[cmd].command = index;
|
||||||
|
c->commands.write[cmd].args = args;
|
||||||
|
} else {
|
||||||
|
int command = index;
|
||||||
|
Vector<Variant> args;
|
||||||
|
WorldEditor::components::buildings_layout_commands *c = e.get_mut<
|
||||||
|
WorldEditor::components::buildings_layout_commands>();
|
||||||
|
c->commands.push_back({ command, args });
|
||||||
|
}
|
||||||
|
e.modified<WorldEditor::components::buildings_layout_commands>();
|
||||||
print_line("data set command");
|
print_line("data set command");
|
||||||
|
command_editor->hide();
|
||||||
|
command_editor->queue_delete();
|
||||||
|
command_editor = nullptr;
|
||||||
|
update_graph();
|
||||||
|
}
|
||||||
|
void BuildingLayoutGraphUI::show_command_editor(Control *item,
|
||||||
|
const String &path)
|
||||||
|
{
|
||||||
|
if (!command_editor) {
|
||||||
|
command_editor = memnew(PopupPanel);
|
||||||
|
item->add_child(command_editor);
|
||||||
|
} else {
|
||||||
|
command_editor->queue_delete();
|
||||||
|
command_editor = memnew(PopupPanel);
|
||||||
|
item->add_child(command_editor);
|
||||||
|
}
|
||||||
|
command_editor->set_anchor(Margin::MARGIN_LEFT, 0.2f);
|
||||||
|
command_editor->set_anchor(Margin::MARGIN_TOP, 0.2f);
|
||||||
|
command_editor->set_anchor(Margin::MARGIN_RIGHT, 0.8f);
|
||||||
|
command_editor->set_anchor(Margin::MARGIN_BOTTOM, 0.8f);
|
||||||
|
command_editor->set_custom_minimum_size(Vector2(400, 300));
|
||||||
|
flecs::world ecs = BaseData::get_singleton()->get();
|
||||||
|
flecs::entity e = ecs.lookup(path.ascii().ptr());
|
||||||
|
int cmd,
|
||||||
|
cmd_count =
|
||||||
|
e.get<WorldEditor::components::buildings_layout_commands>()
|
||||||
|
->commands.size();
|
||||||
|
VBoxContainer *vb = memnew(VBoxContainer);
|
||||||
|
command_editor->add_child(vb);
|
||||||
|
for (cmd = 0; cmd < cmd_count; cmd++) {
|
||||||
|
std::vector<Variant> args = {
|
||||||
|
/* clang-format off */
|
||||||
|
"Command:",
|
||||||
|
"None", 3,
|
||||||
|
-1, "None",
|
||||||
|
1, "Arrach1",
|
||||||
|
2, "Attach2",
|
||||||
|
"command",
|
||||||
|
"Delete"
|
||||||
|
/* clang-format on */
|
||||||
|
};
|
||||||
|
HashMap<String, Object *> save_data;
|
||||||
|
ui_field::ui_field_builder(item, vb, "p{h{lo#$b}}", args.data(),
|
||||||
|
args.size(), &save_data);
|
||||||
|
assert(!save_data.empty());
|
||||||
|
List<String> keys;
|
||||||
|
save_data.get_key_list(&keys);
|
||||||
|
print_line(keys.front()->get());
|
||||||
|
assert(save_data["command"]);
|
||||||
|
OptionButton *ob =
|
||||||
|
Object::cast_to<OptionButton>(save_data["command"]);
|
||||||
|
int command =
|
||||||
|
e.get<WorldEditor::components::buildings_layout_commands>()
|
||||||
|
->commands[cmd]
|
||||||
|
.command;
|
||||||
|
int selected = -1;
|
||||||
|
selected = ob->get_popup()->get_item_index(command);
|
||||||
|
print_line("selected: " + itos(command) + " " + itos(selected));
|
||||||
|
ob->set_meta("cmd", cmd);
|
||||||
|
ob->select(selected);
|
||||||
|
ob->connect("item_selected", this, "command_entered",
|
||||||
|
varray(save_data["command"], String(e.path())));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::vector<Variant> args = {
|
||||||
|
/* clang-format off */
|
||||||
|
"Command:",
|
||||||
|
"None", 3,
|
||||||
|
-1, "None",
|
||||||
|
1, "Arrach1",
|
||||||
|
2, "Attach2",
|
||||||
|
"command",
|
||||||
|
"New"
|
||||||
|
/* clang-format on */
|
||||||
|
};
|
||||||
|
HashMap<String, Object *> save_data;
|
||||||
|
ui_field::ui_field_builder(item, vb, "p{h{lo#$b}}", args.data(),
|
||||||
|
args.size(), &save_data);
|
||||||
|
assert(!save_data.empty());
|
||||||
|
List<String> keys;
|
||||||
|
save_data.get_key_list(&keys);
|
||||||
|
print_line(keys.front()->get());
|
||||||
|
assert(save_data["command"]);
|
||||||
|
OptionButton *ob =
|
||||||
|
Object::cast_to<OptionButton>(save_data["command"]);
|
||||||
|
int selected = -1;
|
||||||
|
ob->select(selected);
|
||||||
|
ob->set_meta("cmd", -1);
|
||||||
|
ob->connect("item_selected", this, "command_entered",
|
||||||
|
varray(save_data["command"], String(e.path())));
|
||||||
|
}
|
||||||
|
command_editor->popup_centered();
|
||||||
}
|
}
|
||||||
void BuildingLayoutGraphUI::_bind_methods()
|
void BuildingLayoutGraphUI::_bind_methods()
|
||||||
{
|
{
|
||||||
@@ -415,4 +584,6 @@ void BuildingLayoutGraphUI::_bind_methods()
|
|||||||
"item"
|
"item"
|
||||||
"path"),
|
"path"),
|
||||||
&BuildingLayoutGraphUI::command_entered);
|
&BuildingLayoutGraphUI::command_entered);
|
||||||
|
ClassDB::bind_method(D_METHOD("show_command_editor", "item", "path"),
|
||||||
|
&BuildingLayoutGraphUI::show_command_editor);
|
||||||
}
|
}
|
||||||
@@ -165,6 +165,7 @@ public:
|
|||||||
const String &path);
|
const String &path);
|
||||||
void order_entered(float value, Control *item, const String &path);
|
void order_entered(float value, Control *item, const String &path);
|
||||||
void command_entered(int index, Control *item, const String &path);
|
void command_entered(int index, Control *item, const String &path);
|
||||||
|
void show_command_editor(Control *item, const String &path);
|
||||||
Vector<Vector2> buttons;
|
Vector<Vector2> buttons;
|
||||||
#define DEPTH_MUL 160
|
#define DEPTH_MUL 160
|
||||||
#define Y_MUL 220
|
#define Y_MUL 220
|
||||||
|
|||||||
@@ -6,6 +6,65 @@
|
|||||||
|
|
||||||
#define MIN_ROOM_SIZE 16 /* 4 * 4 tiles */
|
#define MIN_ROOM_SIZE 16 /* 4 * 4 tiles */
|
||||||
|
|
||||||
|
struct state {
|
||||||
|
Rect2i main_rect;
|
||||||
|
Rect2i last_rect;
|
||||||
|
bool first;
|
||||||
|
int count;
|
||||||
|
List<Rect2i> rectangles;
|
||||||
|
List<bool> windows;
|
||||||
|
struct room_data {
|
||||||
|
float area;
|
||||||
|
bool wall;
|
||||||
|
};
|
||||||
|
List<struct room_data> rooms;
|
||||||
|
Vector2i get_new_position(int way)
|
||||||
|
{
|
||||||
|
Vector2i ret;
|
||||||
|
if (way == 0) {
|
||||||
|
ret.x = last_rect.position.x + last_rect.size.x;
|
||||||
|
ret.y = last_rect.position.y;
|
||||||
|
} else {
|
||||||
|
ret.x = last_rect.position.x;
|
||||||
|
ret.y = last_rect.position.y + last_rect.size.y;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
Vector2i get_new_size(int way, float area)
|
||||||
|
{
|
||||||
|
Vector2i ret;
|
||||||
|
if (way == 0) {
|
||||||
|
ret.y = last_rect.size.y;
|
||||||
|
ret.x = area / last_rect.size.y;
|
||||||
|
} else {
|
||||||
|
ret.x = last_rect.size.x;
|
||||||
|
ret.y = area / last_rect.size.x;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
void add_rect(const Rect2i &rect, bool window)
|
||||||
|
{
|
||||||
|
rectangles.push_back(rect);
|
||||||
|
windows.push_back(window);
|
||||||
|
}
|
||||||
|
void pack_room(float area, bool wall)
|
||||||
|
{
|
||||||
|
rooms.push_back({ area, wall });
|
||||||
|
}
|
||||||
|
void next()
|
||||||
|
{
|
||||||
|
last_rect = main_rect;
|
||||||
|
}
|
||||||
|
void dump()
|
||||||
|
{
|
||||||
|
List<Rect2i>::Element *e = rectangles.front();
|
||||||
|
while (e) {
|
||||||
|
print_line(e->get().operator String());
|
||||||
|
e = e->next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||||
{
|
{
|
||||||
ecs.module<BuildingLayoutGraph::graph_module>();
|
ecs.module<BuildingLayoutGraph::graph_module>();
|
||||||
@@ -279,6 +338,94 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
|||||||
print_line("grid size: " +
|
print_line("grid size: " +
|
||||||
itos((int)Math::ceil(grid_size)));
|
itos((int)Math::ceil(grid_size)));
|
||||||
});
|
});
|
||||||
|
ecs.system<WorldEditor::components::buildings_layout_zone>(
|
||||||
|
"AssembleZones")
|
||||||
|
.kind(0)
|
||||||
|
.each([module_name](
|
||||||
|
flecs::iter &it, size_t count,
|
||||||
|
WorldEditor::components::buildings_layout_zone &f) {
|
||||||
|
flecs::entity zone_e = it.entity(count);
|
||||||
|
flecs::query<const WorldEditor::components::
|
||||||
|
buildings_layout_order,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_room,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_area,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_commands>
|
||||||
|
q = zone_e.world()
|
||||||
|
.query_builder<
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_order,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_room,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_area,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_commands>()
|
||||||
|
.with(flecs::ChildOf, zone_e)
|
||||||
|
.order_by<
|
||||||
|
WorldEditor::components::
|
||||||
|
buildings_layout_order>(
|
||||||
|
[](flecs::entity_t e1,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_order
|
||||||
|
*d1,
|
||||||
|
flecs::entity_t e2,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_order
|
||||||
|
*d2) {
|
||||||
|
return (d1->index >
|
||||||
|
d2->index) -
|
||||||
|
(d1->index <
|
||||||
|
d2->index);
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
int c = 0;
|
||||||
|
struct state state;
|
||||||
|
state.first = true;
|
||||||
|
state.count = 0;
|
||||||
|
q.each([&c, &state](
|
||||||
|
flecs::entity e,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_order &order,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_room &r,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_area &area,
|
||||||
|
const WorldEditor::components::
|
||||||
|
buildings_layout_commands &cmd) {
|
||||||
|
int i, j;
|
||||||
|
String output = String(e.path()) + "\n";
|
||||||
|
output +=
|
||||||
|
"\torder: " + itos(order.index) + "\n";
|
||||||
|
output += "\troom_type: " + itos(r.room_type) +
|
||||||
|
"\n";
|
||||||
|
output += "\twindow: " + itos(r.window) + "\n";
|
||||||
|
output += "\tarea: " + String::num(area.area) +
|
||||||
|
"\n";
|
||||||
|
output += "\tcommands: " +
|
||||||
|
itos(cmd.commands.size()) + "\n";
|
||||||
|
for (i = 0; i < cmd.commands.size(); i++) {
|
||||||
|
output +=
|
||||||
|
"\t\t" +
|
||||||
|
itos(cmd.commands[i].command) +
|
||||||
|
"\n";
|
||||||
|
for (j = 0;
|
||||||
|
j < cmd.commands[i].args.size();
|
||||||
|
j++)
|
||||||
|
output +=
|
||||||
|
"\t\t\t" +
|
||||||
|
(cmd.commands[i].args[j].
|
||||||
|
operator String()) +
|
||||||
|
"\n";
|
||||||
|
}
|
||||||
|
print_line(output);
|
||||||
|
state.pack_room(area.area, r.window);
|
||||||
|
c++;
|
||||||
|
});
|
||||||
|
state.dump();
|
||||||
|
});
|
||||||
ecs.system<WorldEditor::components::buildings_layout_floor>(
|
ecs.system<WorldEditor::components::buildings_layout_floor>(
|
||||||
"FloorCompleteArea")
|
"FloorCompleteArea")
|
||||||
.kind(0)
|
.kind(0)
|
||||||
@@ -289,9 +436,11 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
|||||||
flecs::entity floor_e = it.entity(count);
|
flecs::entity floor_e = it.entity(count);
|
||||||
flecs::world w = floor_e.world();
|
flecs::world w = floor_e.world();
|
||||||
std::vector<String> systems = {
|
std::vector<String> systems = {
|
||||||
"RoomArea", "ZoneArea", "UnitArea",
|
"RoomArea", "ZoneArea",
|
||||||
"FloorArea", "ZoneAreaSum", "UnitAreaSum",
|
"UnitArea", "FloorArea",
|
||||||
"FloorAreaSum", "CreateFloorData"
|
"ZoneAreaSum", "UnitAreaSum",
|
||||||
|
"FloorAreaSum", "CreateFloorData",
|
||||||
|
"AssembleZones"
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < (int)systems.size(); i++) {
|
for (i = 0; i < (int)systems.size(); i++) {
|
||||||
@@ -1017,6 +1166,7 @@ void BuildingLayoutGraph::create_zone(const String &base_path, int zone_type)
|
|||||||
{ 0, 0, 0 });
|
{ 0, 0, 0 });
|
||||||
int count = get_children_count(new_e.parent());
|
int count = get_children_count(new_e.parent());
|
||||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||||
|
new_e.add<WorldEditor::components::buildings_layout_commands>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildingLayoutGraph::create_unit(const String &base_path)
|
void BuildingLayoutGraph::create_unit(const String &base_path)
|
||||||
@@ -1027,6 +1177,7 @@ void BuildingLayoutGraph::create_unit(const String &base_path)
|
|||||||
{ 0, 0, 0 });
|
{ 0, 0, 0 });
|
||||||
int count = get_children_count(new_e.parent());
|
int count = get_children_count(new_e.parent());
|
||||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||||
|
new_e.add<WorldEditor::components::buildings_layout_commands>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildingLayoutGraph::create_floor(const String &base_path)
|
void BuildingLayoutGraph::create_floor(const String &base_path)
|
||||||
@@ -1057,7 +1208,7 @@ void BuildingLayoutGraph::create_room(const String &base_path, int id)
|
|||||||
assert(new_e.has<WorldEditor::components::buildings_layout_graph_node>());
|
assert(new_e.has<WorldEditor::components::buildings_layout_graph_node>());
|
||||||
int count = get_children_count(new_e.parent());
|
int count = get_children_count(new_e.parent());
|
||||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||||
new_e.set<WorldEditor::components::buildings_layout_command>({ -1 });
|
new_e.add<WorldEditor::components::buildings_layout_commands>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildingLayoutGraph::create_new_layout(const String &layout_name)
|
void BuildingLayoutGraph::create_new_layout(const String &layout_name)
|
||||||
|
|||||||
@@ -104,8 +104,37 @@ public:
|
|||||||
struct buildings_layout_order {
|
struct buildings_layout_order {
|
||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
struct buildings_layout_command {
|
struct buildings_layout_commands {
|
||||||
int command;
|
struct command {
|
||||||
|
int command;
|
||||||
|
Vector<Variant> args;
|
||||||
|
};
|
||||||
|
Vector<struct command> commands;
|
||||||
|
void from_array(const Array &data)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
commands.clear();
|
||||||
|
for (i = 0; i < data.size(); i++) {
|
||||||
|
Array entry = data[i];
|
||||||
|
int command = entry[0];
|
||||||
|
Vector<Variant> args = entry[1];
|
||||||
|
commands.push_back({ command, args });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Array to_array() const
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Array ret;
|
||||||
|
ret.resize(commands.size());
|
||||||
|
for (i = 0; i < commands.size(); i++) {
|
||||||
|
Array entry;
|
||||||
|
entry.resize(2);
|
||||||
|
entry[0] = commands[i].command;
|
||||||
|
entry[1] = commands[i].args;
|
||||||
|
ret[i] = entry;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user