Spine-Toolbox
Spine-Toolbox copied to clipboard
Graph view filtering with alternatives
Now that v0.8 implements entities with alternatives, then alternatives (and scenarios) can be used to filter the graph view directly. Naturally following the system discussed in https://github.com/spine-tools/Spine-Toolbox/issues/2134.
Here is where I'm at now:
- If many alternatives are selected, it is enough that the entity alternative is set as active on one of them, for the entity to be visible.
- If no selections are active in the EntityTree, active_by_default will not be used to determine the visibility and only the entities with entity alternative active explicitly set as true in the selected alternative will be shown.
- If EntityTree has selections along with alternative selections in alternative and/or scenario -tree, the active_by_default will be used to determine the visibility of the rest of the selected entities that don't have the entity alternatives explicitly set.
Things that should still be added:
- If only one scenario is selected, use the order of the alternatives to determine the activity
of each entity.
- For each individual entity, use the last alternative in the order that references the entity
Do these seem logical?
Great!
Yes, seems logical. We could later add more elaborate rendering - e.g. if entity is active in one selected alternative and inactive in another, it could show the 'conflict' by using e.g. different background color in the graph. But this should be separate issue and done later.
We could also postpone the interpreting the order of alternatives in a scenario if it feels like a big task. Removing entities is probably much less common than adding them.
@jkiviluo checking out both branches linked in this issue should work now with latest changes.
It looks really great and useful. Like this:
The issue I have is that when choosing something from the entity_tree (without ctrl-pressed), the alternative remains chosen. This should happen only if ctrl is pressed when left-clicking.
There may also be performance issues. Graph has always been bit slow, but maybe it's even slower when selecting alternatives. BTW, when no alternative is selected, is it still using just the old routines?
The issue I have is that when choosing something from the entity_tree (without ctrl-pressed), the alternative remains chosen. This should happen only if ctrl is pressed when left-clicking.
Will change back.
when no alternative is selected, is it still using just the old routines?
Yes, if no alternatives or scenarios are selected, the alternative and scenario filters just accept everything that comes their way and the decision falls on the old logic for the entity tree selections. Shouldn't be any slower for these kinds of situations.
I think this is ready to be merged after that. A review by @soininen?