Building skeleton generation done
This commit is contained in:
@@ -27,6 +27,8 @@ commands = [
|
||||
[2, "Attach2"],
|
||||
[3, "Left90"],
|
||||
[4, "Right90"],
|
||||
[5, "Forward", {"amount": "float"}]
|
||||
[5, "Motion", {"amount": "float"}],
|
||||
[6, "PushPosition"],
|
||||
[7, "PopPosition"]
|
||||
]
|
||||
|
||||
|
||||
@@ -1,149 +1,128 @@
|
||||
[layouts]
|
||||
|
||||
entries=[ {
|
||||
"children": [ 3 ],
|
||||
"commands": [ [ 1, [ ] ], [ 2, [ ] ], [ 1, [ ] ], [ 2, [ ] ] ],
|
||||
"children": [ 3, 4 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"floor_index": 0,
|
||||
"index": 0,
|
||||
"name": "v2",
|
||||
"order": 0,
|
||||
"type": "layout"
|
||||
}, {
|
||||
"children": [ 4, 5, 6 ],
|
||||
"commands": [ ],
|
||||
"children": [ 5, 6, 7 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"floor_index": 0,
|
||||
"index": 1,
|
||||
"name": "v1",
|
||||
"order": 0,
|
||||
"type": "layout"
|
||||
}, {
|
||||
"children": [ 7, 8, 9, 10, 11 ],
|
||||
"commands": [ ],
|
||||
"children": [ 8, 9, 10, 11, 12 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"floor_index": 0,
|
||||
"index": 2,
|
||||
"name": "v3",
|
||||
"order": 0,
|
||||
"type": "layout"
|
||||
}, {
|
||||
"children": [ 12 ],
|
||||
"commands": [ [ 1, [ ] ], [ 2, [ ] ], [ 1, [ ] ], [ 2, [ ] ] ],
|
||||
"children": [ 13, 14 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 3,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 13, 14, 15, 16 ],
|
||||
"commands": [ ],
|
||||
"children": [ 15, 16, 17 ],
|
||||
"commands": [ [ 4, [ ] ] ],
|
||||
"index": 4,
|
||||
"name": "zone_1",
|
||||
"order": 1,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 18, 19, 20, 21 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 5,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 17, 18, 19 ],
|
||||
"commands": [ ],
|
||||
"index": 5,
|
||||
"children": [ 22, 23, 24 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 6,
|
||||
"name": "zone_0",
|
||||
"order": 1,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 20, 21 ],
|
||||
"commands": [ ],
|
||||
"index": 6,
|
||||
"children": [ 25, 26 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 7,
|
||||
"name": "unit_0",
|
||||
"order": 3,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ 22, 23 ],
|
||||
"commands": [ ],
|
||||
"index": 7,
|
||||
"children": [ 27, 28 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 8,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 24, 25 ],
|
||||
"commands": [ ],
|
||||
"index": 8,
|
||||
"children": [ 29, 30 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 9,
|
||||
"name": "unit_0",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ 26, 27 ],
|
||||
"commands": [ ],
|
||||
"index": 9,
|
||||
"children": [ 31, 32 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 10,
|
||||
"name": "unit_1",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ 28, 29 ],
|
||||
"commands": [ ],
|
||||
"index": 10,
|
||||
"children": [ 33, 34 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 11,
|
||||
"name": "unit_2",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ 30, 31 ],
|
||||
"commands": [ ],
|
||||
"index": 11,
|
||||
"children": [ 35, 36 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 12,
|
||||
"name": "unit_3",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ 32 ],
|
||||
"commands": [ [ 1, [ ] ], [ 2, [ ] ], [ 1, [ ] ] ],
|
||||
"index": 12,
|
||||
"name": "stair_0",
|
||||
"order": 0,
|
||||
"room_area": 0.0,
|
||||
"room_type": 305,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 13,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"order": 1,
|
||||
"room_area": 144.0,
|
||||
"room_type": 300,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 14,
|
||||
"name": "kitchen_0",
|
||||
"order": 1,
|
||||
"room_area": 64.0,
|
||||
"order": 2,
|
||||
"room_area": 16.0,
|
||||
"room_type": 302,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 15,
|
||||
"name": "storage_room_0",
|
||||
"order": 2,
|
||||
"room_area": 16.0,
|
||||
"room_type": 307,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 16,
|
||||
"name": "enterance_0",
|
||||
"order": 3,
|
||||
"room_area": 16.0,
|
||||
"room_type": 304,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 17,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -152,8 +131,8 @@ entries=[ {
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 18,
|
||||
"commands": [ [ 5, [ ] ], [ 3, [ ] ] ],
|
||||
"index": 16,
|
||||
"name": "bathroom_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
@@ -162,8 +141,8 @@ entries=[ {
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 19,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 17,
|
||||
"name": "bedroom_0",
|
||||
"order": 2,
|
||||
"room_area": 64.0,
|
||||
@@ -171,25 +150,95 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 33, 34, 35 ],
|
||||
"commands": [ ],
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 18,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 144.0,
|
||||
"room_type": 300,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 19,
|
||||
"name": "kitchen_0",
|
||||
"order": 1,
|
||||
"room_area": 64.0,
|
||||
"room_type": 302,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 20,
|
||||
"name": "storage_room_0",
|
||||
"order": 2,
|
||||
"room_area": 16.0,
|
||||
"room_type": 307,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 21,
|
||||
"name": "enterance_0",
|
||||
"order": 3,
|
||||
"room_area": 16.0,
|
||||
"room_type": 304,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 22,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
"room_type": 200,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 23,
|
||||
"name": "bathroom_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
"room_type": 201,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 24,
|
||||
"name": "bedroom_0",
|
||||
"order": 2,
|
||||
"room_area": 64.0,
|
||||
"room_type": 202,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 37, 38, 39 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 25,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 36, 37 ],
|
||||
"commands": [ ],
|
||||
"index": 21,
|
||||
"children": [ 40, 41 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 26,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 22,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 27,
|
||||
"name": "enterance_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -197,9 +246,9 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 38 ],
|
||||
"commands": [ ],
|
||||
"index": 23,
|
||||
"children": [ 42 ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 28,
|
||||
"name": "stair_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -207,81 +256,73 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 39, 40, 41 ],
|
||||
"commands": [ ],
|
||||
"index": 24,
|
||||
"children": [ 43, 44, 45 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 29,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 42, 43 ],
|
||||
"commands": [ ],
|
||||
"index": 25,
|
||||
"children": [ 46, 47 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 30,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 44 ],
|
||||
"commands": [ ],
|
||||
"index": 26,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 45, 46 ],
|
||||
"commands": [ ],
|
||||
"index": 27,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 47 ],
|
||||
"commands": [ ],
|
||||
"index": 28,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 48 ],
|
||||
"commands": [ ],
|
||||
"index": 29,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 49 ],
|
||||
"commands": [ ],
|
||||
"index": 30,
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 31,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 50 ],
|
||||
"commands": [ ],
|
||||
"index": 31,
|
||||
"children": [ 49, 50 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 32,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 51 ],
|
||||
"commands": [ ],
|
||||
"floor_index": 0,
|
||||
"index": 32,
|
||||
"name": "floor_0",
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 33,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "floor"
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 52 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 34,
|
||||
"name": "zone_1",
|
||||
"order": 1,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 53 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 35,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 54 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 36,
|
||||
"name": "zone_1",
|
||||
"order": 1,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 33,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 37,
|
||||
"name": "bathroom_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -290,18 +331,18 @@ entries=[ {
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 34,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 38,
|
||||
"name": "wc_0",
|
||||
"order": 1,
|
||||
"room_area": 4.0,
|
||||
"room_area": 16.0,
|
||||
"room_type": 200,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 35,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 39,
|
||||
"name": "bedroom_0",
|
||||
"order": 2,
|
||||
"room_area": 36.0,
|
||||
@@ -310,8 +351,8 @@ entries=[ {
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 36,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 40,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 36.0,
|
||||
@@ -320,8 +361,8 @@ entries=[ {
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 37,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 41,
|
||||
"name": "kitchen_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
@@ -329,47 +370,47 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 52, 53 ],
|
||||
"children": [ 55, 56 ],
|
||||
"commands": [ ],
|
||||
"floor_index": 1,
|
||||
"index": 38,
|
||||
"index": 42,
|
||||
"name": "floor_0",
|
||||
"order": 0,
|
||||
"type": "floor"
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 39,
|
||||
"name": "bathroom_0",
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 43,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
"room_type": 200,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 44,
|
||||
"name": "bathroom_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
"room_type": 201,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 40,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 45,
|
||||
"name": "bedroom_0",
|
||||
"order": 0,
|
||||
"order": 2,
|
||||
"room_area": 64.0,
|
||||
"room_type": 202,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 41,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
"room_type": 200,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 42,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 46,
|
||||
"name": "kitchen_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -378,18 +419,18 @@ entries=[ {
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 43,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 47,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"order": 1,
|
||||
"room_area": 144.0,
|
||||
"room_type": 300,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 44,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 48,
|
||||
"name": "bathroom_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -398,8 +439,8 @@ entries=[ {
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 45,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 49,
|
||||
"name": "kitchen_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -408,18 +449,18 @@ entries=[ {
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 46,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 50,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"order": 1,
|
||||
"room_area": 64.0,
|
||||
"room_type": 300,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 47,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 51,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -428,8 +469,8 @@ entries=[ {
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 48,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 52,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -438,8 +479,8 @@ entries=[ {
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 49,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 53,
|
||||
"name": "bathroom_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -448,8 +489,8 @@ entries=[ {
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 50,
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 54,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -457,47 +498,24 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 54, 55 ],
|
||||
"commands": [ ],
|
||||
"index": 51,
|
||||
"name": "unit_0",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ 56 ],
|
||||
"commands": [ ],
|
||||
"index": 52,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 57, 58 ],
|
||||
"commands": [ ],
|
||||
"index": 53,
|
||||
"name": "unit_0",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 54,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ ],
|
||||
"children": [ 57 ],
|
||||
"commands": [ ],
|
||||
"index": 55,
|
||||
"name": "zone_1",
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ ],
|
||||
"children": [ 58, 59 ],
|
||||
"commands": [ ],
|
||||
"index": 56,
|
||||
"name": "unit_0",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 57,
|
||||
"name": "storage_room_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -505,17 +523,17 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 59 ],
|
||||
"children": [ 60 ],
|
||||
"commands": [ ],
|
||||
"index": 57,
|
||||
"index": 58,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 60 ],
|
||||
"children": [ 61 ],
|
||||
"commands": [ ],
|
||||
"index": 58,
|
||||
"index": 59,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
@@ -523,20 +541,20 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 59,
|
||||
"index": 60,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 0.0,
|
||||
"room_area": 16.0,
|
||||
"room_type": 200,
|
||||
"type": "room",
|
||||
"window": false
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 60,
|
||||
"index": 61,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 0.0,
|
||||
"room_area": 16.0,
|
||||
"room_type": 300,
|
||||
"type": "room",
|
||||
"window": true
|
||||
|
||||
@@ -440,7 +440,9 @@ void BuildingLayoutGraphUI::order_entered(float value, Control *item,
|
||||
e.modified<WorldEditor::components::buildings_layout_order>();
|
||||
print_line("data set order");
|
||||
}
|
||||
static void *__PPP_ptr1 = nullptr;
|
||||
static PopupPanel *command_editor = nullptr;
|
||||
static void *__PPP_ptr2 = nullptr;
|
||||
void BuildingLayoutGraphUI::command_entered(int index, Control *item,
|
||||
const String &path)
|
||||
{
|
||||
@@ -465,6 +467,34 @@ void BuildingLayoutGraphUI::command_entered(int index, Control *item,
|
||||
}
|
||||
e.modified<WorldEditor::components::buildings_layout_commands>();
|
||||
print_line("data set command");
|
||||
assert(__PPP_ptr1 == nullptr);
|
||||
assert(__PPP_ptr2 == nullptr);
|
||||
assert(Object::cast_to<Node>(command_editor) != nullptr);
|
||||
assert(Object::cast_to<Control>(command_editor) != nullptr);
|
||||
assert(Object::cast_to<PopupPanel>(command_editor) != nullptr);
|
||||
command_editor->hide();
|
||||
command_editor->queue_delete();
|
||||
command_editor = nullptr;
|
||||
update_graph();
|
||||
}
|
||||
void BuildingLayoutGraphUI::delete_command(Control *item, const String &path)
|
||||
{
|
||||
flecs::world ecs = BaseData::get_singleton()->get();
|
||||
flecs::entity e = ecs.lookup(path.ascii().ptr());
|
||||
assert(e.is_valid());
|
||||
int cmd = item->get_meta("cmd");
|
||||
if (cmd >= 0) {
|
||||
WorldEditor::components::buildings_layout_commands *c = e.get_mut<
|
||||
WorldEditor::components::buildings_layout_commands>();
|
||||
c->commands.remove(cmd);
|
||||
e.modified<WorldEditor::components::buildings_layout_commands>();
|
||||
print_line("data delete command");
|
||||
}
|
||||
assert(__PPP_ptr1 == nullptr);
|
||||
assert(__PPP_ptr2 == nullptr);
|
||||
assert(Object::cast_to<Node>(command_editor) != nullptr);
|
||||
assert(Object::cast_to<Control>(command_editor) != nullptr);
|
||||
assert(Object::cast_to<PopupPanel>(command_editor) != nullptr);
|
||||
command_editor->hide();
|
||||
command_editor->queue_delete();
|
||||
command_editor = nullptr;
|
||||
@@ -473,10 +503,33 @@ void BuildingLayoutGraphUI::command_entered(int index, Control *item,
|
||||
void BuildingLayoutGraphUI::show_command_editor(Control *item,
|
||||
const String &path)
|
||||
{
|
||||
/* TODO: command arguments */
|
||||
ConfigFile config;
|
||||
config.load("res://astream/building_layout.conf");
|
||||
Array menu_array = config.get_value("commands", "commands", Array());
|
||||
std::vector<Variant> menu_data;
|
||||
int menu_count = 0;
|
||||
int i;
|
||||
std::vector<Dictionary> command_arguments;
|
||||
for (i = 0; i < menu_array.size(); i++) {
|
||||
Array entry = menu_array[i];
|
||||
menu_data.push_back(entry[0]);
|
||||
menu_data.push_back(entry[1]);
|
||||
if (entry.size() == 2)
|
||||
command_arguments.push_back(Dictionary());
|
||||
else if (entry.size() == 3)
|
||||
command_arguments.push_back(entry[2]);
|
||||
menu_count++;
|
||||
}
|
||||
if (!command_editor) {
|
||||
command_editor = memnew(PopupPanel);
|
||||
item->add_child(command_editor);
|
||||
} else {
|
||||
assert(__PPP_ptr1 == nullptr);
|
||||
assert(__PPP_ptr2 == nullptr);
|
||||
assert(Object::cast_to<Node>(command_editor) != nullptr);
|
||||
assert(Object::cast_to<Control>(command_editor) != nullptr);
|
||||
assert(Object::cast_to<PopupPanel>(command_editor) != nullptr);
|
||||
command_editor->queue_delete();
|
||||
command_editor = memnew(PopupPanel);
|
||||
item->add_child(command_editor);
|
||||
@@ -498,17 +551,21 @@ void BuildingLayoutGraphUI::show_command_editor(Control *item,
|
||||
std::vector<Variant> args = {
|
||||
/* clang-format off */
|
||||
"Command:",
|
||||
"None", 3,
|
||||
-1, "None",
|
||||
1, "Arrach1",
|
||||
2, "Attach2",
|
||||
"command",
|
||||
"Delete"
|
||||
"None", menu_count,
|
||||
/* clang-format on */
|
||||
};
|
||||
std::vector<Variant> args_append = {
|
||||
/* clang-format off */
|
||||
"command",
|
||||
"Delete", "delete_button"
|
||||
/* clang-format on */
|
||||
};
|
||||
args.insert(args.end(), menu_data.begin(), menu_data.end());
|
||||
args.insert(args.end(), args_append.begin(), args_append.end());
|
||||
HashMap<String, Object *> save_data;
|
||||
ui_field::ui_field_builder(item, vb, "p{h{lo#$b}}", args.data(),
|
||||
args.size(), &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);
|
||||
@@ -527,19 +584,26 @@ void BuildingLayoutGraphUI::show_command_editor(Control *item,
|
||||
ob->select(selected);
|
||||
ob->connect("item_selected", this, "command_entered",
|
||||
varray(save_data["command"], String(e.path())));
|
||||
Button *delete_button =
|
||||
Object::cast_to<Button>(save_data["delete_button"]);
|
||||
assert(delete_button);
|
||||
delete_button->set_meta("cmd", cmd);
|
||||
delete_button->connect("pressed", this, "delete_command",
|
||||
varray(delete_button, String(e.path())));
|
||||
}
|
||||
{
|
||||
std::vector<Variant> args = {
|
||||
/* clang-format off */
|
||||
"Command:",
|
||||
"None", 3,
|
||||
-1, "None",
|
||||
1, "Arrach1",
|
||||
2, "Attach2",
|
||||
"None", menu_count,
|
||||
};
|
||||
std::vector<Variant> args_append = {
|
||||
"command",
|
||||
"New"
|
||||
/* clang-format on */
|
||||
};
|
||||
args.insert(args.end(), menu_data.begin(), menu_data.end());
|
||||
args.insert(args.end(), args_append.begin(), args_append.end());
|
||||
HashMap<String, Object *> save_data;
|
||||
ui_field::ui_field_builder(item, vb, "p{h{lo#$b}}", args.data(),
|
||||
args.size(), &save_data);
|
||||
@@ -556,8 +620,112 @@ void BuildingLayoutGraphUI::show_command_editor(Control *item,
|
||||
ob->connect("item_selected", this, "command_entered",
|
||||
varray(save_data["command"], String(e.path())));
|
||||
}
|
||||
assert(__PPP_ptr1 == nullptr);
|
||||
assert(__PPP_ptr2 == nullptr);
|
||||
command_editor->popup_centered();
|
||||
}
|
||||
static List<Control *> update_controls;
|
||||
void BuildingLayoutGraphUI::handle_event(const String &event,
|
||||
const Vector<Variant> &args)
|
||||
{
|
||||
int i;
|
||||
if (event == "button:building_layouts_create_new") {
|
||||
LineEdit *line_edit = gui->get_as_node<LineEdit>(
|
||||
"%building_layouts_create_text");
|
||||
ItemList *item_list =
|
||||
gui->get_as_node<ItemList>("%building_layout_list");
|
||||
if (item_list->is_connected("item_selected", this,
|
||||
"select_layout"))
|
||||
item_list->disconnect("item_selected", this,
|
||||
"select_layout");
|
||||
String new_name = line_edit->get_text().strip_edges();
|
||||
BuildingLayoutGraph::get_singleton()->create_new_layout(
|
||||
new_name);
|
||||
update_layout_item_list();
|
||||
int selected = -1;
|
||||
for (i = 0; i < item_list->get_item_count(); i++)
|
||||
if (item_list->get_item_text(i) == new_name) {
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
if (selected >= 0) {
|
||||
item_list->select(selected);
|
||||
select_layout(selected);
|
||||
update_graph();
|
||||
}
|
||||
if (!item_list->is_connected("item_selected", this,
|
||||
"select_layout"))
|
||||
item_list->connect("item_selected", this,
|
||||
"select_layout");
|
||||
} else if (event == "button:building_layouts_save")
|
||||
BuildingLayoutGraph::get_singleton()->save_layouts();
|
||||
else if (event == "button:building_layouts_create_grid")
|
||||
BuildingLayoutGraph::get_singleton()->create_interior_tilemap(
|
||||
current_layout);
|
||||
else if (event == "update_layout_view" ||
|
||||
event == "building_layouts_layout_selected") {
|
||||
update_graph();
|
||||
dlg->update();
|
||||
List<Control *>::Element *e = update_controls.front();
|
||||
while (e) {
|
||||
e->get()->update();
|
||||
e = e->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
void BuildingLayoutGraphUI::setup_layout_tab(Control *tab, const String &header)
|
||||
{
|
||||
assert(gui);
|
||||
assert(tab);
|
||||
std::vector<Variant> args_data = {
|
||||
/* clang-format off */
|
||||
header,
|
||||
"Layouts:",
|
||||
0, Vector2(0, 80), "building_layout_list",
|
||||
"Create new layout",
|
||||
"", "building_layouts_create_text", Control::SIZE_EXPAND_FILL,
|
||||
"Create", "building_layouts_create_button",
|
||||
"building_layouts_create_new", varray(),
|
||||
"Save", "building_layouts_save_button",
|
||||
"building_layouts_save", varray(),
|
||||
"Build", "building_layouts_create_grid",
|
||||
"building_layouts_create_grid", varray(),
|
||||
Color(0.6f, 0.8f, 1.0f, 1.0f), "building_gen_display", Vector2(120, 180),
|
||||
/* clang-format on */
|
||||
};
|
||||
HashMap<String, Object *> save_data;
|
||||
ui_field::ui_field_builder(gui, tab,
|
||||
"l_p{v{li.#!lh{e#+!b#!Q}b#!Qb#!Qc#.$}}",
|
||||
args_data.data(), args_data.size(),
|
||||
&save_data);
|
||||
ColorRect *r =
|
||||
Object::cast_to<ColorRect>(save_data["building_gen_display"]);
|
||||
r->connect("draw", this, "draw_building_gen_display", varray(r));
|
||||
update_controls.push_back(r);
|
||||
}
|
||||
void BuildingLayoutGraphUI::draw_building_gen_display(Control *draw)
|
||||
{
|
||||
print_line("draw gen display");
|
||||
flecs::entity e = get_current_layout();
|
||||
if (!e.is_valid())
|
||||
return;
|
||||
if (e.has<WorldEditor::components::buildings_layout_skeleton>()) {
|
||||
const List<Pair<Vector2i, Vector2i> > &edges =
|
||||
e.get<WorldEditor::components::buildings_layout_skeleton>()
|
||||
->edges;
|
||||
const List<Pair<Vector2i, Vector2i> >::Element *e =
|
||||
edges.front();
|
||||
Vector2i p(10, 10);
|
||||
while (e) {
|
||||
Pair<Vector2i, Vector2i> edge = e->get();
|
||||
draw->draw_line(edge.first + p, edge.second + p,
|
||||
Color(0, 0, 0, 1));
|
||||
print_line((e->get().first.operator String()) + "->" +
|
||||
(e->get().second.operator String()));
|
||||
e = e->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
void BuildingLayoutGraphUI::_bind_methods()
|
||||
{
|
||||
ClassDB::bind_method(D_METHOD("menu_pressed", "id", "button", "path"),
|
||||
@@ -584,6 +752,11 @@ void BuildingLayoutGraphUI::_bind_methods()
|
||||
"item"
|
||||
"path"),
|
||||
&BuildingLayoutGraphUI::command_entered);
|
||||
ClassDB::bind_method(D_METHOD("delete_command", "item"
|
||||
"path"),
|
||||
&BuildingLayoutGraphUI::delete_command);
|
||||
ClassDB::bind_method(D_METHOD("show_command_editor", "item", "path"),
|
||||
&BuildingLayoutGraphUI::show_command_editor);
|
||||
ClassDB::bind_method(D_METHOD("draw_building_gen_display", "draw"),
|
||||
&BuildingLayoutGraphUI::draw_building_gen_display);
|
||||
}
|
||||
@@ -65,50 +65,7 @@ public:
|
||||
varray(current_layout));
|
||||
print_line("select_layout: " + itos(id));
|
||||
}
|
||||
void handle_event(const String &event, const Vector<Variant> &args)
|
||||
{
|
||||
int i;
|
||||
if (event == "button:building_layouts_create_new") {
|
||||
LineEdit *line_edit = gui->get_as_node<LineEdit>(
|
||||
"%building_layouts_create_text");
|
||||
ItemList *item_list = gui->get_as_node<ItemList>(
|
||||
"%building_layout_list");
|
||||
if (item_list->is_connected("item_selected", this,
|
||||
"select_layout"))
|
||||
item_list->disconnect("item_selected", this,
|
||||
"select_layout");
|
||||
String new_name = line_edit->get_text().strip_edges();
|
||||
BuildingLayoutGraph::get_singleton()->create_new_layout(
|
||||
new_name);
|
||||
update_layout_item_list();
|
||||
int selected = -1;
|
||||
for (i = 0; i < item_list->get_item_count(); i++)
|
||||
if (item_list->get_item_text(i) == new_name) {
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
if (selected >= 0) {
|
||||
item_list->select(selected);
|
||||
select_layout(selected);
|
||||
update_graph();
|
||||
}
|
||||
if (!item_list->is_connected("item_selected", this,
|
||||
"select_layout"))
|
||||
item_list->connect("item_selected", this,
|
||||
"select_layout");
|
||||
} else if (event == "button:building_layouts_save")
|
||||
BuildingLayoutGraph::get_singleton()->save_layouts();
|
||||
else if (event == "button:building_layouts_create_grid")
|
||||
BuildingLayoutGraph::get_singleton()
|
||||
->create_interior_tilemap(current_layout);
|
||||
else if (event == "building_layouts_layout_selected") {
|
||||
update_graph();
|
||||
dlg->update();
|
||||
} else if (event == "update_layout_view") {
|
||||
update_graph();
|
||||
dlg->update();
|
||||
}
|
||||
}
|
||||
void handle_event(const String &event, const Vector<Variant> &args);
|
||||
void tree_entered()
|
||||
{
|
||||
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||
@@ -165,6 +122,7 @@ public:
|
||||
const String &path);
|
||||
void order_entered(float value, Control *item, const String &path);
|
||||
void command_entered(int index, Control *item, const String &path);
|
||||
void delete_command(Control *item, const String &path);
|
||||
void show_command_editor(Control *item, const String &path);
|
||||
Vector<Vector2> buttons;
|
||||
#define DEPTH_MUL 160
|
||||
@@ -237,30 +195,8 @@ public:
|
||||
});
|
||||
}
|
||||
}
|
||||
void setup_layout_tab(Control *tab, const String &header)
|
||||
{
|
||||
assert(gui);
|
||||
assert(tab);
|
||||
std::vector<Variant> args_data = {
|
||||
/* clang-format off */
|
||||
header,
|
||||
"Layouts:",
|
||||
0, Vector2(0, 80), "building_layout_list",
|
||||
"Create new layout",
|
||||
"", "building_layouts_create_text", Control::SIZE_EXPAND_FILL,
|
||||
"Create", "building_layouts_create_button",
|
||||
"building_layouts_create_new", varray(),
|
||||
"Save", "building_layouts_save_button",
|
||||
"building_layouts_save", varray(),
|
||||
"Build", "building_layouts_create_grid",
|
||||
"building_layouts_create_grid", varray(),
|
||||
Color(0.6f, 0.8f, 1.0f, 1.0f), "building_gen_display", Vector2(120, 180),
|
||||
/* clang-format on */
|
||||
};
|
||||
ui_field::ui_field_builder(
|
||||
gui, tab, "l_p{v{li.#!lh{e#+!b#!Q}b#!Qb#!Qc#.}}",
|
||||
args_data.data(), args_data.size());
|
||||
}
|
||||
void setup_layout_tab(Control *tab, const String &header);
|
||||
void draw_building_gen_display(Control *draw);
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
|
||||
@@ -7,59 +7,92 @@
|
||||
#define MIN_ROOM_SIZE 16 /* 4 * 4 tiles */
|
||||
|
||||
struct state {
|
||||
Rect2i main_rect;
|
||||
Rect2i last_rect;
|
||||
bool first;
|
||||
Vector2i start_position;
|
||||
Vector2i current_position;
|
||||
List<Pair<Vector2i, Vector2i> > edges;
|
||||
int direction;
|
||||
std::vector<Vector2i> directions;
|
||||
List<Vector2i> positions_stack;
|
||||
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)
|
||||
void left()
|
||||
{
|
||||
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;
|
||||
direction =
|
||||
(direction - 1 + directions.size()) % directions.size();
|
||||
}
|
||||
void right()
|
||||
{
|
||||
direction = (direction + 1) % directions.size();
|
||||
}
|
||||
void left90()
|
||||
{
|
||||
left();
|
||||
left();
|
||||
}
|
||||
void right90()
|
||||
{
|
||||
right();
|
||||
right();
|
||||
}
|
||||
void push_position()
|
||||
{
|
||||
positions_stack.push_back(current_position);
|
||||
}
|
||||
void pop_position()
|
||||
{
|
||||
if (!positions_stack.empty()) {
|
||||
current_position = positions_stack.back()->get();
|
||||
positions_stack.pop_back();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
Vector2i get_new_size(int way, float area)
|
||||
void motion(int amount)
|
||||
{
|
||||
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;
|
||||
assert(amount > 0);
|
||||
Vector2i p1 = current_position;
|
||||
Vector2i p2 = p1 + directions[direction] * amount;
|
||||
assert(p1 != p2);
|
||||
edges.push_back(Pair<Vector2i, Vector2i>(p1, p2));
|
||||
current_position = p2;
|
||||
}
|
||||
void run_command(int command, Vector<Variant> args)
|
||||
{
|
||||
switch (command) {
|
||||
case 3:
|
||||
left90();
|
||||
break;
|
||||
case 4:
|
||||
right90();
|
||||
break;
|
||||
case 5: {
|
||||
assert(args.size() > 0);
|
||||
int amount = args[0];
|
||||
assert(amount > 0);
|
||||
motion(amount);
|
||||
} break;
|
||||
default:
|
||||
print_error("unknown command: " + itos(command));
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
count++;
|
||||
}
|
||||
void add_rect(const Rect2i &rect, bool window)
|
||||
state(const Vector2i &start)
|
||||
: start_position(start)
|
||||
, current_position(start)
|
||||
, direction(0)
|
||||
, count(0)
|
||||
{
|
||||
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;
|
||||
directions = {
|
||||
Vector2i(0, 1), Vector2i(1, 1), Vector2i(1, 0),
|
||||
Vector2i(1, -1), Vector2i(0, -1), Vector2i(-1, -1),
|
||||
Vector2i(-1, 0), Vector2i(-1, 1),
|
||||
};
|
||||
}
|
||||
void dump()
|
||||
{
|
||||
List<Rect2i>::Element *e = rectangles.front();
|
||||
List<Pair<Vector2i, Vector2i> >::Element *e = edges.front();
|
||||
while (e) {
|
||||
print_line(e->get().operator String());
|
||||
print_line(
|
||||
"edge: " + (e->get().first.operator String()) +
|
||||
" -> " + (e->get().second.operator String()));
|
||||
e = e->next();
|
||||
}
|
||||
}
|
||||
@@ -77,11 +110,33 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
ecs.component<WorldEditor::components::buildings_layout_floor>();
|
||||
ecs.component<WorldEditor::components::buildings_layout_floor_index>();
|
||||
const String &module_name = "::BuildingLayoutGraph::graph_module";
|
||||
flecs::entity GraphSolveZones = ecs.entity("GraphSolveZones")
|
||||
.add(flecs::Phase)
|
||||
.depends_on(flecs::OnUpdate);
|
||||
GraphSolveZones.disable();
|
||||
flecs::entity GraphSolveUnits = ecs.entity("GraphSolveUnits")
|
||||
.add(flecs::Phase)
|
||||
.depends_on(GraphSolveZones);
|
||||
flecs::entity GraphSolveFloors = ecs.entity("GraphSolveFloors")
|
||||
.add(flecs::Phase)
|
||||
.depends_on(GraphSolveUnits);
|
||||
flecs::entity GraphSolve = ecs.entity("GraphSolve")
|
||||
.add(flecs::Phase)
|
||||
.depends_on(GraphSolveFloors);
|
||||
flecs::entity GraphPostSolve = ecs.entity("GraphPostSolve")
|
||||
.add(flecs::Phase)
|
||||
.depends_on(flecs::PostUpdate);
|
||||
GraphPostSolve.disable();
|
||||
|
||||
ecs.system("ZonesStart")
|
||||
.kind(GraphSolveZones)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
print_line("Processing zones...");
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_floor_index,
|
||||
const WorldEditor::components::buildings_layout_floor>(
|
||||
"FloorIndex")
|
||||
.kind(0)
|
||||
.kind(GraphSolveZones)
|
||||
.write<WorldEditor::components::buildings_layout_floor_index>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_floor_index
|
||||
@@ -103,57 +158,43 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
qe.set<WorldEditor::components::
|
||||
buildings_layout_floor_index>(
|
||||
{ index.index });
|
||||
print_line(String(qe.path()) +
|
||||
" index set");
|
||||
qe.children([&queue](flecs::entity ec) {
|
||||
queue.push_back(ec);
|
||||
});
|
||||
}
|
||||
}
|
||||
print_line("floor index done");
|
||||
});
|
||||
|
||||
ecs.system<WorldEditor::components::buildings_layout_room>("RoomArea")
|
||||
.kind(0)
|
||||
.kind(GraphSolveZones)
|
||||
.without<WorldEditor::components::buildings_layout_area>()
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_room &f) {
|
||||
flecs::entity floor_e = it.entity(count);
|
||||
floor_e.set<
|
||||
flecs::entity room_e = it.entity(count);
|
||||
room_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ MIN_ROOM_SIZE });
|
||||
});
|
||||
ecs.system<const WorldEditor::components::buildings_layout_room,
|
||||
WorldEditor::components::buildings_layout_area>("RoomArea2")
|
||||
.kind(GraphSolveZones)
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
const WorldEditor::components::buildings_layout_room &f,
|
||||
WorldEditor::components::buildings_layout_area &area) {
|
||||
flecs::entity room_e = it.entity(count);
|
||||
if (area.area < MIN_ROOM_SIZE)
|
||||
area.area = MIN_ROOM_SIZE;
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_zone>("ZoneArea")
|
||||
.kind(0)
|
||||
.kind(GraphSolveZones)
|
||||
.without<WorldEditor::components::buildings_layout_area>()
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_zone &f) {
|
||||
flecs::entity floor_e = it.entity(count);
|
||||
floor_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ 0.0f });
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_unit>("UnitArea")
|
||||
.kind(0)
|
||||
.without<WorldEditor::components::buildings_layout_area>()
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_unit &f) {
|
||||
flecs::entity floor_e = it.entity(count);
|
||||
floor_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ 0.0f });
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_floor>("FloorArea")
|
||||
.kind(0)
|
||||
.without<WorldEditor::components::buildings_layout_area>()
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_floor &f) {
|
||||
flecs::entity floor_e = it.entity(count);
|
||||
floor_e.set<
|
||||
flecs::entity zone_e = it.entity(count);
|
||||
zone_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ 0.0f });
|
||||
});
|
||||
@@ -161,7 +202,7 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
WorldEditor::components::buildings_layout_area,
|
||||
WorldEditor::components::buildings_layout_floor_index>(
|
||||
"ZoneAreaSum")
|
||||
.kind(0)
|
||||
.kind(GraphSolveZones)
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_zone &f,
|
||||
@@ -186,8 +227,9 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
.with(flecs::ChildOf, zone_e)
|
||||
.build();
|
||||
float sum = 0.0f;
|
||||
q.each([&sum,
|
||||
index](flecs::entity e,
|
||||
int count_rooms = 0;
|
||||
q.each([&sum, index, &count_rooms](
|
||||
flecs::entity e,
|
||||
WorldEditor::components::
|
||||
buildings_layout_room &r,
|
||||
const WorldEditor::components::
|
||||
@@ -195,20 +237,86 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
const WorldEditor::components::
|
||||
buildings_layout_floor_index
|
||||
&rindex) {
|
||||
if (index.index == rindex.index)
|
||||
if (index.index == rindex.index) {
|
||||
sum += MAX(rarea.area, MIN_ROOM_SIZE);
|
||||
assert(sum >= 0.0f);
|
||||
count_rooms++;
|
||||
}
|
||||
});
|
||||
// because all room sizes > 0.0f
|
||||
assert(count_rooms == 0 || sum >= 0.0f);
|
||||
zone_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ sum });
|
||||
print_line("area: " + String(zone_e.path()) + ": " +
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_zone,
|
||||
WorldEditor::components::buildings_layout_area,
|
||||
WorldEditor::components::buildings_layout_floor_index>(
|
||||
"ZoneAreaDisplay")
|
||||
.kind(GraphSolveZones)
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_zone &f,
|
||||
WorldEditor::components::buildings_layout_area &area,
|
||||
WorldEditor::components::buildings_layout_floor_index
|
||||
&index) {
|
||||
flecs::entity zone_e = it.entity(count);
|
||||
float sum = area.area;
|
||||
print_line("area: " + itos(count) + " " +
|
||||
itos(it.field_count()) + " " +
|
||||
String(zone_e.path()) + ": " +
|
||||
String::num(sum));
|
||||
if (count + 1 == (size_t)it.count())
|
||||
print_line("end");
|
||||
});
|
||||
ecs.system("ZonesCheckpoint")
|
||||
.kind(GraphSolveZones)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
flecs::query<const WorldEditor::components::
|
||||
buildings_layout_zone,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area>
|
||||
q = it.world()
|
||||
.query_builder<
|
||||
const WorldEditor::components::
|
||||
buildings_layout_zone,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area>()
|
||||
.build();
|
||||
int badness = 0;
|
||||
q.each([&badness](flecs::entity e,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_zone &zone,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area &area) {
|
||||
if (area.area < MIN_ROOM_SIZE) {
|
||||
badness++;
|
||||
assert(false);
|
||||
}
|
||||
});
|
||||
print_line("Zones processing done...");
|
||||
});
|
||||
ecs.system("UnitsStart")
|
||||
.kind(GraphSolveZones)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
print_line("Processing units...");
|
||||
});
|
||||
|
||||
ecs.system<WorldEditor::components::buildings_layout_unit>("UnitArea")
|
||||
.kind(GraphSolveUnits)
|
||||
.without<WorldEditor::components::buildings_layout_area>()
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_unit &f) {
|
||||
flecs::entity floor_e = it.entity(count);
|
||||
floor_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ 0.0f });
|
||||
});
|
||||
ecs.system<const WorldEditor::components::buildings_layout_unit,
|
||||
WorldEditor::components::buildings_layout_area,
|
||||
WorldEditor::components::buildings_layout_floor_index>(
|
||||
"UnitAreaSum")
|
||||
.kind(0)
|
||||
.kind(GraphSolveUnits)
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
const WorldEditor::components::buildings_layout_unit &f,
|
||||
@@ -251,11 +359,73 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
print_line("area: " + String(unit_e.path()) + ": " +
|
||||
String::num(sum));
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_unit,
|
||||
WorldEditor::components::buildings_layout_area,
|
||||
WorldEditor::components::buildings_layout_floor_index>(
|
||||
"UnitAreaDisplay")
|
||||
.kind(GraphSolveUnits)
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_unit &f,
|
||||
WorldEditor::components::buildings_layout_area &area,
|
||||
WorldEditor::components::buildings_layout_floor_index
|
||||
&index) {
|
||||
flecs::entity zone_e = it.entity(count);
|
||||
float sum = area.area;
|
||||
print_line("area: " + itos(count) + " " +
|
||||
itos(it.field_count()) + " " +
|
||||
String(zone_e.path()) + ": " +
|
||||
String::num(sum));
|
||||
if (count + 1 == (size_t)it.count())
|
||||
print_line("end");
|
||||
});
|
||||
ecs.system("UnitCheckpoint")
|
||||
.kind(GraphSolveUnits)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
flecs::query<const WorldEditor::components::
|
||||
buildings_layout_unit,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area>
|
||||
q = it.world()
|
||||
.query_builder<
|
||||
const WorldEditor::components::
|
||||
buildings_layout_unit,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area>()
|
||||
.build();
|
||||
int badness = 0;
|
||||
q.each([&badness](flecs::entity e,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_unit &zone,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area &area) {
|
||||
if (area.area < MIN_ROOM_SIZE) {
|
||||
badness++;
|
||||
assert(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
ecs.system("FloorsStart")
|
||||
.kind(GraphSolveFloors)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
print_line("Processing floors...");
|
||||
});
|
||||
|
||||
ecs.system<WorldEditor::components::buildings_layout_floor>("FloorArea")
|
||||
.kind(GraphSolveFloors)
|
||||
.without<WorldEditor::components::buildings_layout_area>()
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_floor &f) {
|
||||
flecs::entity floor_e = it.entity(count);
|
||||
floor_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ 0.0f });
|
||||
});
|
||||
ecs.system<const WorldEditor::components::buildings_layout_floor,
|
||||
WorldEditor::components::buildings_layout_area,
|
||||
WorldEditor::components::buildings_layout_floor_index>(
|
||||
"FloorAreaSum")
|
||||
.kind(0)
|
||||
.kind(GraphSolveFloors)
|
||||
.write<WorldEditor::components::buildings_layout_area>()
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
const WorldEditor::components::buildings_layout_floor
|
||||
@@ -297,9 +467,54 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
floor_e.set<
|
||||
WorldEditor::components::buildings_layout_area>(
|
||||
{ sum });
|
||||
print_line("area: " + String(floor_e.path()) + ": " +
|
||||
String::num(sum));
|
||||
});
|
||||
ecs.system<WorldEditor::components::buildings_layout_floor,
|
||||
WorldEditor::components::buildings_layout_area,
|
||||
WorldEditor::components::buildings_layout_floor_index>(
|
||||
"FloorAreaDisplay")
|
||||
.kind(GraphSolveFloors)
|
||||
.each([](flecs::iter &it, size_t count,
|
||||
WorldEditor::components::buildings_layout_floor &f,
|
||||
WorldEditor::components::buildings_layout_area &area,
|
||||
WorldEditor::components::buildings_layout_floor_index
|
||||
&index) {
|
||||
flecs::entity zone_e = it.entity(count);
|
||||
float sum = area.area;
|
||||
print_line("area: " + itos(count) + " " +
|
||||
itos(it.field_count()) + " " +
|
||||
String(zone_e.path()) + ": " +
|
||||
String::num(sum));
|
||||
if (count + 1 == (size_t)it.count())
|
||||
print_line("end");
|
||||
});
|
||||
ecs.system("FloorCheckpoint")
|
||||
.kind(GraphSolveFloors)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
flecs::query<const WorldEditor::components::
|
||||
buildings_layout_floor,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area>
|
||||
q = it.world()
|
||||
.query_builder<
|
||||
const WorldEditor::components::
|
||||
buildings_layout_floor,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area>()
|
||||
.build();
|
||||
int badness = 0;
|
||||
q.each([&badness](flecs::entity e,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_floor &fl,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area &area) {
|
||||
if (area.area < MIN_ROOM_SIZE) {
|
||||
badness++;
|
||||
assert(false);
|
||||
}
|
||||
});
|
||||
print_line("Floor processing done...");
|
||||
});
|
||||
#if 0
|
||||
ecs.system<const WorldEditor::components::buildings_layout_graph,
|
||||
const WorldEditor::components::buildings_layout_floor_index,
|
||||
const WorldEditor::components::buildings_layout_area>(
|
||||
@@ -338,94 +553,149 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
print_line("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();
|
||||
#endif
|
||||
ecs.system("AssembleSkeletonStart")
|
||||
.kind(GraphSolve)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
print_line("Assembling skeleton...");
|
||||
});
|
||||
|
||||
ecs.system<const WorldEditor::components::buildings_layout_graph>(
|
||||
"AssembleSkeleton")
|
||||
.kind(GraphSolve)
|
||||
.read<WorldEditor::components::buildings_layout_order>()
|
||||
.read<WorldEditor::components::buildings_layout_area>()
|
||||
.read<WorldEditor::components::buildings_layout_commands>()
|
||||
.read<WorldEditor::components::buildings_layout_zone>()
|
||||
.read<WorldEditor::components::buildings_layout_unit>()
|
||||
.write<WorldEditor::components::buildings_layout_skeleton>()
|
||||
.each([module_name](flecs::iter &it, size_t count,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_graph &f) {
|
||||
flecs::entity graph_e = it.entity(count);
|
||||
List<flecs::entity> queue;
|
||||
queue.push_back(graph_e);
|
||||
struct state state(Vector2i(0, 0));
|
||||
int badness = 0;
|
||||
while (!queue.empty()) {
|
||||
flecs::entity e = queue.front()->get();
|
||||
queue.pop_front();
|
||||
flecs::query<const WorldEditor::components::
|
||||
buildings_layout_order,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_commands>
|
||||
q = e.world()
|
||||
.query_builder<
|
||||
const WorldEditor::components::
|
||||
buildings_layout_order,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_commands>()
|
||||
.with(flecs::ChildOf, 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();
|
||||
q.each([&state, &queue, &badness](
|
||||
flecs::entity ec,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_order
|
||||
&order,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_area
|
||||
&area,
|
||||
const WorldEditor::components::
|
||||
buildings_layout_commands
|
||||
&cmd) {
|
||||
int m;
|
||||
for (m = 0; m < cmd.commands.size();
|
||||
m++) {
|
||||
int command =
|
||||
cmd.commands[m].command;
|
||||
switch (command) {
|
||||
case 5:
|
||||
if (area.area > 0) {
|
||||
Vector<Variant>
|
||||
args;
|
||||
int motion = (int)Math::
|
||||
ceil(Math::sqrt(
|
||||
area.area));
|
||||
print_line(
|
||||
"motion command: " +
|
||||
itos(motion));
|
||||
args.push_back(
|
||||
motion);
|
||||
state.run_command(
|
||||
command,
|
||||
args);
|
||||
} else {
|
||||
print_error(
|
||||
"motion command requires amount > 0 area = " +
|
||||
String::num(
|
||||
area.area) +
|
||||
" " +
|
||||
String(ec.path()));
|
||||
badness++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
state.run_command(
|
||||
cmd.commands[m]
|
||||
.command,
|
||||
cmd.commands[m]
|
||||
.args);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ec.has<WorldEditor::components::
|
||||
buildings_layout_zone>() ||
|
||||
ec.has<WorldEditor::components::
|
||||
buildings_layout_unit>())
|
||||
queue.push_back(ec);
|
||||
});
|
||||
if (badness > 0)
|
||||
break;
|
||||
}
|
||||
if (badness == 0)
|
||||
graph_e.set<WorldEditor::components::
|
||||
buildings_layout_skeleton>(
|
||||
{ state.edges });
|
||||
print_line(String(graph_e.path()));
|
||||
state.dump();
|
||||
if (badness > 0)
|
||||
print_line("BAD!");
|
||||
});
|
||||
ecs.system("AssembleSkeletonEnd")
|
||||
.kind(GraphSolve)
|
||||
.run([module_name](flecs::iter &it) {
|
||||
print_line("Assembling skeleton done...");
|
||||
it.world()
|
||||
.lookup((module_name + "::GraphSolveZones")
|
||||
.ascii()
|
||||
.ptr())
|
||||
.disable();
|
||||
EditorEvent::get_singleton()->event.emit(
|
||||
"update_layout_view", varray());
|
||||
});
|
||||
|
||||
ecs.system<WorldEditor::components::buildings_layout_floor>(
|
||||
"FloorCompleteArea")
|
||||
.kind(0)
|
||||
@@ -440,7 +710,6 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
"UnitArea", "FloorArea",
|
||||
"ZoneAreaSum", "UnitAreaSum",
|
||||
"FloorAreaSum", "CreateFloorData",
|
||||
"AssembleZones"
|
||||
};
|
||||
int i;
|
||||
for (i = 0; i < (int)systems.size(); i++) {
|
||||
@@ -1052,16 +1321,16 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
&r) {
|
||||
flecs::world w = e.world();
|
||||
// create indices
|
||||
w.system(w.lookup((module_name + "::FloorIndex")
|
||||
.ascii()
|
||||
.ptr()))
|
||||
.run();
|
||||
w.system(w.lookup((module_name + "::FloorCompleteArea")
|
||||
.ascii()
|
||||
.ptr()))
|
||||
.run();
|
||||
EditorEvent::get_singleton()->event.emit(
|
||||
"update_layout_view", varray());
|
||||
w.lookup((module_name + "::GraphSolveZones")
|
||||
.ascii()
|
||||
.ptr())
|
||||
.enable();
|
||||
w.lookup((module_name + "::GraphSolve").ascii().ptr())
|
||||
.enable();
|
||||
w.lookup((module_name + "::GraphPostSolve")
|
||||
.ascii()
|
||||
.ptr())
|
||||
.enable();
|
||||
#if 0
|
||||
/* if set for room make zone dirty */
|
||||
flecs::entity parent_e = e.parent();
|
||||
@@ -1105,16 +1374,16 @@ BuildingLayoutGraph::graph_module::graph_module(flecs::world &ecs)
|
||||
buildings_layout_floor_index &r) {
|
||||
flecs::world w = e.world();
|
||||
// create indices
|
||||
w.system(w.lookup((module_name + "::FloorIndex")
|
||||
.ascii()
|
||||
.ptr()))
|
||||
.run();
|
||||
w.system(w.lookup((module_name + "::FloorCompleteArea")
|
||||
.ascii()
|
||||
.ptr()))
|
||||
.run();
|
||||
EditorEvent::get_singleton()->event.emit(
|
||||
"update_layout_view", varray());
|
||||
w.lookup((module_name + "::GraphSolveZones")
|
||||
.ascii()
|
||||
.ptr())
|
||||
.enable();
|
||||
w.lookup((module_name + "::GraphSolve").ascii().ptr())
|
||||
.enable();
|
||||
w.lookup((module_name + "::GraphPostSolve")
|
||||
.ascii()
|
||||
.ptr())
|
||||
.enable();
|
||||
print_line(String(e.path()) + ": set floor");
|
||||
#if 0
|
||||
List<flecs::entity> queue;
|
||||
|
||||
@@ -104,6 +104,9 @@ public:
|
||||
struct buildings_layout_order {
|
||||
int index;
|
||||
};
|
||||
struct buildings_layout_skeleton {
|
||||
List<Pair<Vector2i, Vector2i> > edges;
|
||||
};
|
||||
struct buildings_layout_commands {
|
||||
struct command {
|
||||
int command;
|
||||
|
||||
Reference in New Issue
Block a user