Optimize displayMapEvents()
This commit is contained in:
parent
81cd43933b
commit
2f533a86b2
2 changed files with 5 additions and 2 deletions
|
@ -31,6 +31,7 @@ Event* Event::createNewEvent(QString event_type, QString map_name, Project *proj
|
|||
Event *event = new Event;
|
||||
if (event_type == EventType::Object) {
|
||||
event = createNewObjectEvent(project);
|
||||
event->setFrameFromMovement(event->get("movement_type"));
|
||||
} else if (event_type == EventType::Warp) {
|
||||
event = createNewWarpEvent(map_name);
|
||||
} else if (event_type == EventType::HealLocation) {
|
||||
|
|
|
@ -1332,6 +1332,9 @@ void Editor::displayMapEvents() {
|
|||
scene->addItem(events_group);
|
||||
|
||||
QList<Event *> events = map->getAllEvents();
|
||||
for (Event *event : events) {
|
||||
event->setFrameFromMovement(project->facingDirections.value(event->get("movement_type")));
|
||||
}
|
||||
project->loadEventPixmaps(events);
|
||||
for (Event *event : events) {
|
||||
addMapEvent(event);
|
||||
|
@ -1344,8 +1347,7 @@ void Editor::displayMapEvents() {
|
|||
|
||||
DraggablePixmapItem *Editor::addMapEvent(Event *event) {
|
||||
DraggablePixmapItem *object = new DraggablePixmapItem(event, this);
|
||||
event->setFrameFromMovement(project->facingDirections.value(event->get("movement_type")));
|
||||
object->updatePixmap();
|
||||
this->redrawObject(object);
|
||||
if (!event->usingSprite) {
|
||||
object->setOpacity(0.7);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue