Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object Editor Events #153

Merged
merged 34 commits into from
Sep 2, 2020
Merged

Object Editor Events #153

merged 34 commits into from
Sep 2, 2020

Conversation

fundies
Copy link
Contributor

@fundies fundies commented Aug 17, 2020

image

@RobertBColton RobertBColton changed the title idk wtf im doing Object Editor Events Aug 18, 2020
std::unique_ptr<EventData> _event_data;

static std::unique_ptr<EventData> _event_data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a static MainWindow::_instance with a getter somewhere that I added. You can use it to refer to the main window and stuff for now. Please use it as it makes it easier to refactor the static access of the main window later on if we ever need to.

#include <QSpinBox>
#include <QToolButton>

EventArgumentsDialog::EventArgumentsDialog(QWidget *parent, const QStringList &arguments) : QDialog(parent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the arguments string and not QVariant or something. Why aren't we using real reflection over the event proto here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because they're strings... Arguments are "object", "integer" or "string"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what's in event data? Strings is what the shared event stuff gives you to work with? I don't know why Josh would do it that way and not give an enum or some other typed way of doing it.


bool EventTypesListSortFilterProxyModel::lessThan(const QModelIndex& source_left,
const QModelIndex& source_right) const {
//Try to sort alpha but keep grouped events together
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sourceModel()->data(source_right, Qt::DisplayRole).toString();
}

return leftGroup < rightGroup;
Copy link
Contributor

@RobertBColton RobertBColton Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an alphanumeric sort, GM and LGM used sorted by the main id, which is why you have alarms and other events appearing before the create event.
Alphanumeric Event Sort Alarms Before Create
GM8 Create Before Alarms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not store integer ids for events anymore so if you want a specific ordering you will need to hard code it in the sort

Copy link
Contributor

@RobertBColton RobertBColton Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, I just wanted to document it, I don't really care. The only thing I might say to do is we should just always put create first, that's the only part of the order that's stuck in my head, that the create is at the top, like a constructor usually is in a class.

My other issue with it is it's not sorted until you close and reopen the frame too.

Copy link
Contributor

@RobertBColton RobertBColton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start to the object editor! Still 2-3 small issues that can be fixed after merge.

  • Change event doesn't repaint for some reason. Change create to destroy doesn't repaint, and changing destroy to create fails.
  • The events aren't sorted until you close and reopen the editor.
  • Feature: Delete multiple/ExtendedSelection events.

@RobertBColton RobertBColton merged commit 97df14f into master Sep 2, 2020
@RobertBColton RobertBColton deleted the objectEvents branch September 2, 2020 02:33
@RobertBColton RobertBColton mentioned this pull request Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants