|
@@ -47,8 +47,8 @@ void Editor::setEditingMap() {
|
47
|
47
|
if (collision_item) {
|
48
|
48
|
collision_item->setVisible(false);
|
49
|
49
|
}
|
50
|
|
- if (objects_group) {
|
51
|
|
- objects_group->setVisible(false);
|
|
50
|
+ if (events_group) {
|
|
51
|
+ events_group->setVisible(false);
|
52
|
52
|
}
|
53
|
53
|
setBorderItemsVisible(true);
|
54
|
54
|
setConnectionItemsVisible(false);
|
|
@@ -64,8 +64,8 @@ void Editor::setEditingCollision() {
|
64
|
64
|
if (map_item) {
|
65
|
65
|
map_item->setVisible(false);
|
66
|
66
|
}
|
67
|
|
- if (objects_group) {
|
68
|
|
- objects_group->setVisible(false);
|
|
67
|
+ if (events_group) {
|
|
68
|
+ events_group->setVisible(false);
|
69
|
69
|
}
|
70
|
70
|
setBorderItemsVisible(true);
|
71
|
71
|
setConnectionItemsVisible(false);
|
|
@@ -73,8 +73,8 @@ void Editor::setEditingCollision() {
|
73
|
73
|
|
74
|
74
|
void Editor::setEditingObjects() {
|
75
|
75
|
current_view = map_item;
|
76
|
|
- if (objects_group) {
|
77
|
|
- objects_group->setVisible(true);
|
|
76
|
+ if (events_group) {
|
|
77
|
+ events_group->setVisible(true);
|
78
|
78
|
}
|
79
|
79
|
if (map_item) {
|
80
|
80
|
map_item->setVisible(true);
|
|
@@ -108,8 +108,8 @@ void Editor::setEditingConnections() {
|
108
|
108
|
if (collision_item) {
|
109
|
109
|
collision_item->setVisible(false);
|
110
|
110
|
}
|
111
|
|
- if (objects_group) {
|
112
|
|
- objects_group->setVisible(false);
|
|
111
|
+ if (events_group) {
|
|
112
|
+ events_group->setVisible(false);
|
113
|
113
|
}
|
114
|
114
|
setBorderItemsVisible(true, 0.4);
|
115
|
115
|
setConnectionItemsVisible(true);
|
|
@@ -315,7 +315,7 @@ void Editor::setMap(QString map_name) {
|
315
|
315
|
map = project->loadMap(map_name);
|
316
|
316
|
displayMap();
|
317
|
317
|
selected_events->clear();
|
318
|
|
- updateSelectedObjects();
|
|
318
|
+ updateSelectedEvents();
|
319
|
319
|
}
|
320
|
320
|
}
|
321
|
321
|
|
|
@@ -359,8 +359,8 @@ void Editor::displayMap() {
|
359
|
359
|
collision_item->draw();
|
360
|
360
|
scene->addItem(collision_item);
|
361
|
361
|
|
362
|
|
- objects_group = new EventGroup;
|
363
|
|
- scene->addItem(objects_group);
|
|
362
|
+ events_group = new EventGroup;
|
|
363
|
+ scene->addItem(events_group);
|
364
|
364
|
|
365
|
365
|
if (map_item) {
|
366
|
366
|
map_item->setVisible(false);
|
|
@@ -368,8 +368,8 @@ void Editor::displayMap() {
|
368
|
368
|
if (collision_item) {
|
369
|
369
|
collision_item->setVisible(false);
|
370
|
370
|
}
|
371
|
|
- if (objects_group) {
|
372
|
|
- objects_group->setVisible(false);
|
|
371
|
+ if (events_group) {
|
|
372
|
+ events_group->setVisible(false);
|
373
|
373
|
}
|
374
|
374
|
|
375
|
375
|
int tw = 16;
|
|
@@ -384,7 +384,7 @@ void Editor::displayMap() {
|
384
|
384
|
displayMetatiles();
|
385
|
385
|
displayCollisionMetatiles();
|
386
|
386
|
displayElevationMetatiles();
|
387
|
|
- displayMapObjects();
|
|
387
|
+ displayMapEvents();
|
388
|
388
|
displayMapConnections();
|
389
|
389
|
displayMapBorder();
|
390
|
390
|
displayMapGrid();
|
|
@@ -411,26 +411,26 @@ void Editor::displayElevationMetatiles() {
|
411
|
411
|
scene_elevation_metatiles->addItem(elevation_metatiles_item);
|
412
|
412
|
}
|
413
|
413
|
|
414
|
|
-void Editor::displayMapObjects() {
|
415
|
|
- for (QGraphicsItem *child : objects_group->childItems()) {
|
416
|
|
- objects_group->removeFromGroup(child);
|
|
414
|
+void Editor::displayMapEvents() {
|
|
415
|
+ for (QGraphicsItem *child : events_group->childItems()) {
|
|
416
|
+ events_group->removeFromGroup(child);
|
417
|
417
|
}
|
418
|
418
|
|
419
|
419
|
QList<Event *> events = map->getAllEvents();
|
420
|
|
- project->loadObjectPixmaps(events);
|
|
420
|
+ project->loadEventPixmaps(events);
|
421
|
421
|
for (Event *event : events) {
|
422
|
|
- addMapObject(event);
|
|
422
|
+ addMapEvent(event);
|
423
|
423
|
}
|
424
|
424
|
//objects_group->setFiltersChildEvents(false);
|
425
|
|
- objects_group->setHandlesChildEvents(false);
|
|
425
|
+ events_group->setHandlesChildEvents(false);
|
426
|
426
|
|
427
|
427
|
emit objectsChanged();
|
428
|
428
|
}
|
429
|
429
|
|
430
|
|
-DraggablePixmapItem *Editor::addMapObject(Event *event) {
|
|
430
|
+DraggablePixmapItem *Editor::addMapEvent(Event *event) {
|
431
|
431
|
DraggablePixmapItem *object = new DraggablePixmapItem(event);
|
432
|
432
|
object->editor = this;
|
433
|
|
- objects_group->addToGroup(object);
|
|
433
|
+ events_group->addToGroup(object);
|
434
|
434
|
return object;
|
435
|
435
|
}
|
436
|
436
|
|
|
@@ -1236,8 +1236,8 @@ void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) {
|
1236
|
1236
|
|
1237
|
1237
|
void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
|
1238
|
1238
|
if (clicking) {
|
1239
|
|
- this->editor->selectMapObject(this, mouse->modifiers() & Qt::ControlModifier);
|
1240
|
|
- this->editor->updateSelectedObjects();
|
|
1239
|
+ this->editor->selectMapEvent(this, mouse->modifiers() & Qt::ControlModifier);
|
|
1240
|
+ this->editor->updateSelectedEvents();
|
1241
|
1241
|
}
|
1242
|
1242
|
active = false;
|
1243
|
1243
|
}
|
|
@@ -1245,7 +1245,7 @@ void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
|
1245
|
1245
|
QList<DraggablePixmapItem *> *Editor::getObjects() {
|
1246
|
1246
|
QList<DraggablePixmapItem *> *list = new QList<DraggablePixmapItem *>;
|
1247
|
1247
|
for (Event *event : map->getAllEvents()) {
|
1248
|
|
- for (QGraphicsItem *child : objects_group->childItems()) {
|
|
1248
|
+ for (QGraphicsItem *child : events_group->childItems()) {
|
1249
|
1249
|
DraggablePixmapItem *item = (DraggablePixmapItem *)child;
|
1250
|
1250
|
if (item->event == event) {
|
1251
|
1251
|
list->append(item);
|
|
@@ -1270,18 +1270,18 @@ void Editor::redrawObject(DraggablePixmapItem *item) {
|
1270
|
1270
|
}
|
1271
|
1271
|
}
|
1272
|
1272
|
|
1273
|
|
-void Editor::updateSelectedObjects() {
|
|
1273
|
+void Editor::updateSelectedEvents() {
|
1274
|
1274
|
for (DraggablePixmapItem *item : *(getObjects())) {
|
1275
|
1275
|
redrawObject(item);
|
1276
|
1276
|
}
|
1277
|
1277
|
emit selectedObjectsChanged();
|
1278
|
1278
|
}
|
1279
|
1279
|
|
1280
|
|
-void Editor::selectMapObject(DraggablePixmapItem *object) {
|
1281
|
|
- selectMapObject(object, false);
|
|
1280
|
+void Editor::selectMapEvent(DraggablePixmapItem *object) {
|
|
1281
|
+ selectMapEvent(object, false);
|
1282
|
1282
|
}
|
1283
|
1283
|
|
1284
|
|
-void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) {
|
|
1284
|
+void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) {
|
1285
|
1285
|
if (selected_events && object) {
|
1286
|
1286
|
if (selected_events->contains(object)) {
|
1287
|
1287
|
if (toggle) {
|
|
@@ -1293,7 +1293,7 @@ void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) {
|
1293
|
1293
|
}
|
1294
|
1294
|
selected_events->append(object);
|
1295
|
1295
|
}
|
1296
|
|
- updateSelectedObjects();
|
|
1296
|
+ updateSelectedEvents();
|
1297
|
1297
|
}
|
1298
|
1298
|
}
|
1299
|
1299
|
|
|
@@ -1307,8 +1307,8 @@ DraggablePixmapItem* Editor::addNewEvent(QString event_type) {
|
1307
|
1307
|
event->put("map_name", map->name);
|
1308
|
1308
|
event->put("event_type", event_type);
|
1309
|
1309
|
map->addEvent(event);
|
1310
|
|
- project->loadObjectPixmaps(map->getAllEvents());
|
1311
|
|
- DraggablePixmapItem *object = addMapObject(event);
|
|
1310
|
+ project->loadEventPixmaps(map->getAllEvents());
|
|
1311
|
+ DraggablePixmapItem *object = addMapEvent(event);
|
1312
|
1312
|
|
1313
|
1313
|
return object;
|
1314
|
1314
|
}
|
|
@@ -1354,7 +1354,7 @@ void Editor::objectsView_onMouseRelease(QMouseEvent *event) {
|
1354
|
1354
|
}
|
1355
|
1355
|
if (deselect) {
|
1356
|
1356
|
selected_events->clear();
|
1357
|
|
- updateSelectedObjects();
|
|
1357
|
+ updateSelectedEvents();
|
1358
|
1358
|
}
|
1359
|
1359
|
}
|
1360
|
1360
|
}
|