Skip to content

Structure view in Object Browser #90

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

Draft
wants to merge 50 commits into
base: master
Choose a base branch
from

Conversation

dgelessus
Copy link
Contributor

@dgelessus dgelessus commented Feb 28, 2025

Adds an alternative "Structure" view to the Object Browser, which organizes objects based on how they reference each other, rather than their types. It tries to figure out parent/child relationships and builds a hierarchical tree from that. I find it very helpful for understanding how objects relate to each other in more complicated PRPs. Example screenshot:

PrpShop's Object Browser view, now with two tabs: Types and Structure. The Structure tab is selected and shows a tree in which most objects are grouped under other objects that reference them.

The core logic for building the object hierarchy (pqGetReferencedKeys) is very manual. This is in part because libHSPlasma has no generic way to iterate over all plKeys in an arbitrary object. But I also wanted to manually tweak the iteration order, e. g. to prefer parent-to-child references over child-to-parent backreferences. If I consider all references equally, the resulting tree can look very confusing (e. g. the Scene Node would be nested somewhere under a random object that was arbitrarily chosen as the root).

This PR is not quite finished (I paused working on it a year ago - this is the last state from back then). It works quite well for viewing, but I haven't tested how well it reacts when editing PRPs. Many places in the PrpShop code assume that every age/page/object corresponds 1:1 to an item in the tree view, which breaks down when adding a second tree view with a completely different structure. Thus, this PR includes a bunch of refactoring work to separate more of PrpShop's state from the tree view. That should probably be extracted into its own PR and tested separately first.

Depends on #84 and H-uru/libhsplasma#286 (so CI failures are expected for now).

dgelessus added 30 commits March 1, 2025 14:23
This doesn't actually build a structure tree yet. This is just
infrastructure work to support multiple browser trees.
This gives all object names a consistent indentation, which is
especially helpful in the structure tree, where previously objects with
and without icons appeared right next to each other.

Enjoy the programmer art, lol
With special handling inside plDrawInterface to display materials and
such under the objects that use the associated icicles.
To avoid crashing on invalid drawable spans.
This makes things easier to debug if these variables are used after the
widgets have been deleted (or were never created).
This prevents the UI getting into an inconsistent state because of
currentItemChanged signals from the tree that isn't currently visible.
Most of these actually also appear somewhere under the scene objects.
This was much less complex than expected.
This points to the main scene object for the avatar being linked, which
we would rather not place primarily under the link animation.
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.

1 participant