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

Tree View: Color, animations, click-to-find #648

Merged
merged 26 commits into from
Oct 17, 2023
Merged

Conversation

falko17
Copy link
Collaborator

@falko17 falko17 commented Oct 13, 2023

This improves the TreeView, which was introduced in #641, and refactors some operator-related code.

TreeView changes

  • The color of an item is set based on the color of the underlying graph elements. For edges, this means that the item gets a gradient.
  • Clicking on a node or an edge causes the corresponding element to be highlighted (blink and glow).
  • Expanding or collapsing a tree item now animates the rotation of the icon as well as the expansion of the children.

Operator and related changes

  • A field ConflictingOperations has been added to AbstractOperation. If an operation conflicts with another, it will be killed before the other operation is started. This is a bidirectional relationship.
  • Operator callbacks have been made chainable.
  • Highlighting nodes, previously available from the search menu, has been refactored to be a NodeOperator operation.
    • Highlighting now also makes the target node glow.
    • Highlighting has also been implemented for the EdgeOperator.
  • Several operations common between nodes and edges have been moved into a non-generic GraphElementOperator superclass, which can be used to operate on graph elements in general.
  • Blinking and highlighting can now be done for an indefinite amount of time.
  • Utility methods to retrieve operators have been implemented and substituted in fitting places within the code.
    • For game objects, extension methods like gameObject.NodeOperator() can be used.
    • For graph elements, extension methods like node.Operator() can be used.
  • Extension method MustGetComponent now returns the component directly rather than using an out parameter, since it had a void return type before.
  • Whether a game object represents a node or an edge (IsNode(), IsEdge()) is now determined by the presence of a corresponding tag, rather than by trying to get a reference component.
  • Text rendering has been slightly improved on lighter backgrounds.
  • The obsolete GameObjectFlasher class has been removed. In InteractableObject, GraphElementOperator.Blink is used instead.

This makes it possible to specify operations that shall be stopped
when this operation is started.
They have also been renamed such that
the `Set` prefix is removed, since this
is a common pattern for chainable
method calls like these.
This refactors GraphElementOperator
to a major extent:
It splits it off into a non-generic
class, which handles all non-color
operations, and one generic part
which handles the rest.
This makes it possible for callers
to access GraphElementOperator
without needing to know of what type
the underlying element is.

Additionally, this allows the following
previously node-exclusive operations
to be used on edges as well:
* Blink()
* Highlight()
Previously, these were only available
on GraphElements – now they were
made available for GameObjects too.
This also fixes a bug in which scrolling
no longer worked.
This way, if we decide to change how we
would like to retrieve operators in the future,
we can simply change the extension method
rather than having to change every instance in the code.
Previously, the component was stored in an out variable.
The new approach has the advantage that
calls can be chained on the return value –
returning the component in an out variable
mainly makes sense when the method itself
has a different return value, which was not
the case here.
@falko17 falko17 added the Improvement Improvement of existing features label Oct 13, 2023
@falko17 falko17 requested a review from koschke October 13, 2023 14:26
@falko17 falko17 self-assigned this Oct 13, 2023
@falko17 falko17 force-pushed the expand-tree-view branch 2 times, most recently from 1fb69e6 to 2133f08 Compare October 13, 2023 14:30
@falko17 falko17 added this to the Qt World Summit milestone Oct 15, 2023
Copy link
Collaborator

@koschke koschke left a comment

Choose a reason for hiding this comment

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

All fine. I just fixed three uses of a literal name, which I replaced by function nameof.

Assets/SEE/GameObjects/GameObjectExtensions.cs Outdated Show resolved Hide resolved
Assets/SEE/GameObjects/GameObjectExtensions.cs Outdated Show resolved Hide resolved
Assets/SEE/GameObjects/GameObjectExtensions.cs Outdated Show resolved Hide resolved
Copy link
Collaborator

@koschke koschke left a comment

Choose a reason for hiding this comment

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

All fine. I just fixed three uses of a literal name, which I replaced by function nameof.

@koschke koschke merged commit 7aa6d27 into master Oct 17, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Improvement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants