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

TimeLineCells rewrite part 1 #1880

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

MrStevns
Copy link
Member

@MrStevns MrStevns commented Sep 26, 2024

This PR consists of a rewrite of the timeline cells part where:

  • TimeLineCells has been split into numerous components:
    • TimeLineLayerHeaderWidget
      This component currently consist of a single button which is the layer visibility dot but has been built so it can be extended trivially
      • LayerVisibilityButton
        A shared component that can either be used to control the local visibility state or the global, depending on the context it's created with.
    • TimeLineLayerList
      a full rewrite of the layer logic of TimeLineLayerCells, now built using these widgets.
      The layer list also takes care of delegating information back to the track list and handles the dragging functionality of each cell.
      • TimeLineBaseCell
        A base call for the different potential cell types, although right now it's only used for TimeLineLayerCell.
      • TimeLineLayerCell
        A derivetive of TimeLineBaseCell that is mostly a container for the TimeLineLayerCellEditorWidget. It sets the base geometry for the editor widget when created and takes care of cleaning it up when removed
      • TimeLineLayerCellEditorWidget
        The component that actually draws the layer cell. Now a QWidget with a simple QHBoxLayout. The editor widget also contains a new widget, namely LineEditWidget.
        • LineEditWidget
          A generic component that can be used to edit a line of text, exists because Qt's own QLineEdit does not auto select the entire text when used...
          For the timeline layer component, this widget can be used to edit the name of the layer, by double-clicking.
      • TimeLineLayerCellGutterWidget
        The component that draws the layer gutter, which is either shown or hidden but always exist as a overlay widget on top of the list.
    • TimeLineTrackHeaderWidget
      The header component consists of drawing of track numbers, small scrubber and the onion skin logic.
      The logic has been left mostly intact.
    • TimeLineTrackList
      TimelineTrackList is mostly a refactoring of the existing logic in TimeLineCells that handled the track, frame visualization and selection logic.

Here's what the timeline look like now:
image

A bunch of other changes and improvements made along the way:

  • The vertical scrollbar has been moved so it's next to the track cells rather than the entire timeline.
  • The visibility dot and the layer type icon are now drawn in higher resolution for HDPI displays.
  • The header visual has been made gray across both lists, separating the track numbers from the track cells a bit more.
  • The visibility dot has been made a tad bigger, 10 pixels instead of nine, which aligns better when the widgets are placed on whole pixels. Before it looked slightly offset
  • The layer gutter has been improved in a few aspects, both visually and functionally. The gutter will only be displayed now when you can move the layer to a different position. It has also been made slightly larger and easier to detect.
  • The camera layer at the bottom can no longer be dragged.
  • The input dialog no longer appears when creating a new layer, instead you have to double-click on the layer label to change it. For the camera, you can still double-click on the camera icon to change its camera settings and name.

You can see the improvements in action here:
timeline-rewrite

TLDR

The left part of the timeline, namely the layer cells has been rewritten to use widgets, are now easier to maintain and extend.
The right part of the timeline, namely the track cells have been left mostly untouched and in large parts have just been moved into it's own component but still uses QPainter and contain the same logic as before.

fixes #1849

This simplifies the painting of layers by moving the layer header into its own widget.

The list is no longer based on our own scrolling logic but has instead been put into a QScrollArea.
Because the map we're iterating on has been detached and erased in the meantime.
and re-implement vertical scrolling
So that we can easily extend this interface in the future
- Gutter now only appears when the layer will move to a different position
- Bottom layer (camera layer) cannot be dragged anymore
- Made the gutter visual more clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Idea - Improvement for working with Layers (naming and creating a new layer)
1 participant