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

New TreeModel [WIP] #201

Merged
merged 113 commits into from
Sep 6, 2021
Merged

New TreeModel [WIP] #201

merged 113 commits into from
Sep 6, 2021

Conversation

JoshDreamland
Copy link
Member

@JoshDreamland JoshDreamland commented Jan 2, 2021

This commit breaks almost everything. Successor to #144.

Redoes the ProtoModel family of classes to not know about our specific protos. Disclaimer: some references may still exist, but are unnecessary for the resource tree to function. If I missed any references, they're used by, eg, one of the editor classes.

I am basically finished modifying the Model classes and need to start updating the editors to use zero-based field indexing rather than field numbers. I believe Robert has done this work already, so I decided to stop where I was and create this pull request.

I believe we should be able to consolidate this with Robert's PR and have something pretty close to the finished product.

Currently broken:

  • Most editors are broken in some way.
    • Paths crash
    • Sprites can't update BBox parameters
    • Rooms don't display anything
    • Objects display very little.
  • A lot of signals are now disconnected (resource renames, for example).
  • This system might allow models to be null under some circumstances.
    • Some messages can recursively contain messages to infinity, so we can't build out the entire model. Somewhere in there, something comes out null, and I can't remember what right now.

JoshDreamland and others added 30 commits November 30, 2020 16:27
Builds, but a bunch of signals and field ties are broken.
Each Data()/SetData() was individually tracing the FieldPath before. Now they delegate to GetSubModel(), which should allow simpler access to other helpers, like GetDisplayIcon(), as well.
Also extract some methods from PrimitiveModel.h into a new PrimitiveModel.cpp before it gets out of hand.
Apparently there's no convenient way to tell a list view not to display the text along with the image, so adds a boilerplate header with a delegate class to do just that.
if (node->IsRepeated()) {
//return node->mapFromSource(node->repeated_model->duplicate(mapToSource(index)));
}
Node *parent = IndexToNode(index.parent());
Copy link
Member Author

Choose a reason for hiding this comment

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

PLEASE check these; each one of these is capable of returning null, and the safety checks I added only work if you actually verify that I didn't return null.

return QModelIndex();
QModelIndex TreeModel::duplicateNode(const QModelIndex & index) {
Node *node = IndexToNode(index);
if (node->IsRepeated()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Like this change. But please just leave the if() commented if it's not being used.

@fundies fundies merged commit 7b5ef37 into master Sep 6, 2021
@fundies fundies deleted the NewTreeModel branch September 6, 2021 12:05
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.

3 participants