allow numbers for gfx constants, code cleanup
This commit is contained in:
parent
00504817db
commit
d433641bee
4 changed files with 11 additions and 17 deletions
|
@ -215,7 +215,16 @@ QSet<QString> ObjectEvent::getExpectedFields() {
|
|||
}
|
||||
|
||||
void ObjectEvent::loadPixmap(Project *project) {
|
||||
EventGraphics *eventGfx = project->eventGraphicsMap.value(gfx, nullptr);
|
||||
EventGraphics *eventGfx = project->eventGraphicsMap.value(this->gfx, nullptr);
|
||||
if (!eventGfx) {
|
||||
// Invalid gfx constant.
|
||||
// If this is a number, try to use that instead.
|
||||
bool ok;
|
||||
int altGfx = this->gfx.toInt(&ok);
|
||||
if (ok && (altGfx < project->gfxDefines.count())) {
|
||||
eventGfx = project->eventGraphicsMap.value(project->gfxDefines.key(altGfx, "NULL"), nullptr);
|
||||
}
|
||||
}
|
||||
if (!eventGfx || eventGfx->spritesheet.isNull()) {
|
||||
// No sprite associated with this gfx constant.
|
||||
// Use default sprite instead.
|
||||
|
|
|
@ -1973,7 +1973,6 @@ Tileset* Editor::getCurrentMapPrimaryTileset()
|
|||
}
|
||||
|
||||
QList<DraggablePixmapItem *> Editor::getObjects() {
|
||||
// TODO: why using this instead of map->getAllEvents()?
|
||||
QList<DraggablePixmapItem *> list;
|
||||
for (QGraphicsItem *child : events_group->childItems()) {
|
||||
list.append(static_cast<DraggablePixmapItem *>(child));
|
||||
|
@ -2231,7 +2230,6 @@ void Editor::objectsView_onMousePress(QMouseEvent *event) {
|
|||
this->ui->toolButton_Select->setChecked(true);
|
||||
}
|
||||
|
||||
// TODO: why do the old objects not get cleared?
|
||||
bool multiSelect = event->modifiers() & Qt::ControlModifier;
|
||||
if (!selectingEvent && !multiSelect && selected_events->length() > 1) {
|
||||
DraggablePixmapItem *first = selected_events->first();
|
||||
|
|
|
@ -1946,10 +1946,6 @@ void MainWindow::updateObjects() {
|
|||
}
|
||||
|
||||
void MainWindow::updateSelectedObjects() {
|
||||
// TODO: make events and/or frames list static? don't want to clear and
|
||||
// re-add children frames if they are already there in a multi-select
|
||||
// because QVBoxLayout::addWidget() is taking a lot of time
|
||||
// TODO: frame->setActive(false) on old frames, (true) on active ones
|
||||
QList<DraggablePixmapItem *> all_events = editor->getObjects();
|
||||
QList<DraggablePixmapItem *> events;
|
||||
|
||||
|
@ -2057,7 +2053,6 @@ void MainWindow::updateSelectedObjects() {
|
|||
delete target->layout();
|
||||
}
|
||||
|
||||
// TODO: necessary? keep layout just remove widgets?
|
||||
if (!events.empty()) {
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
target->setLayout(layout);
|
||||
|
|
|
@ -110,9 +110,6 @@ void EventFrame::initCustomAttributesTable() {
|
|||
this->layout_contents->addWidget(customAttributes);
|
||||
}
|
||||
|
||||
// TODO: only do this when pixmap item is deleted (ie, when switching between maps or in displayMapEvents())
|
||||
// perhaps connect to object destroyed signal from draggablepixamapitem to signal need reconnect
|
||||
// ie, mark connections dirty and need redo
|
||||
void EventFrame::connectSignals() {
|
||||
this->connected = true;
|
||||
|
||||
|
@ -123,7 +120,7 @@ void EventFrame::connectSignals() {
|
|||
this->event->getMap()->editHistory.push(new EventMove(QList<Event *>() << this->event, delta, 0, this->spinner_x->getActionId()));
|
||||
}
|
||||
});
|
||||
// TODO: make sure item is always existing here!, will need to reconnect this when item is deleted? is item ever deleted?
|
||||
|
||||
connect(this->event->getPixmapItem(), &DraggablePixmapItem::xChanged, this->spinner_x, &NoScrollSpinBox::setValue);
|
||||
|
||||
this->spinner_y->disconnect();
|
||||
|
@ -332,8 +329,6 @@ void ObjectFrame::connectSignals() {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: how often do i really need to call findText() it seems slow
|
||||
// when the frame has already been initialized, shouldn't need to again
|
||||
void ObjectFrame::initialize() {
|
||||
if (this->initialized) return;
|
||||
|
||||
|
@ -461,7 +456,6 @@ void CloneObjectFrame::initialize() {
|
|||
|
||||
// sprite
|
||||
this->combo_sprite->setCurrentText(this->clone->getGfx());
|
||||
// TODO: update this with object gfx change?
|
||||
|
||||
// target id
|
||||
this->spinner_target_id->setMinimum(1);
|
||||
|
@ -655,7 +649,6 @@ void TriggerFrame::populate(Project *project) {
|
|||
// script
|
||||
QStringList scriptLabels = this->trigger->getMap()->eventScriptLabels() + project->getGlobalScriptLabels();
|
||||
scriptLabels.removeDuplicates();
|
||||
// TODO: are there any additional labels?
|
||||
|
||||
this->scriptCompleter = new QCompleter(scriptLabels, this);
|
||||
this->scriptCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
@ -799,7 +792,6 @@ void SignFrame::populate(Project *project) {
|
|||
// script
|
||||
QStringList scriptLabels = this->sign->getMap()->eventScriptLabels() + project->getGlobalScriptLabels();
|
||||
scriptLabels.removeDuplicates();
|
||||
// TODO: are there any additional labels?
|
||||
|
||||
this->scriptCompleter = new QCompleter(scriptLabels, this);
|
||||
this->scriptCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
|
Loading…
Reference in a new issue