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

timeline: Only draw InvisibleButton if size greater than zero #87

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

ThomasWilshaw
Copy link
Contributor

@ThomasWilshaw ThomasWilshaw commented Nov 14, 2024

InvisibleButton size must be greater than zero in both x and y so only draw Effect button if this is the case. As discussed in #85

I now notice there are several other InvisibleButtons in timeline, is it worth adding the same check to all of them or is there a more elegant approach?

timeline.cpp Outdated
// See definition of ImGui::InvisibleButton in imgui_widgets.cpp:
if (size.x <= 0.0 || size.y <= 0.0) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

This check could move up to line 380 next to label_visible

@jminor
Copy link
Member

jminor commented Nov 14, 2024

Do any of the other InvisibleButtons cause problems when they are too small? In your use case is it because the timeline is zoomed out so far, or is the clip with the effect actually zero duration?

@ThomasWilshaw
Copy link
Contributor Author

I think you're right actually yes. On line 362 we use item_duration.to_seconds() to set the width and that is where the 0 comes from in this case, so maybe it's better to go through and make sure any item with a duration of 0 is not drawn? Something in a timeline with length zero is essentially not there right?

@jminor
Copy link
Member

jminor commented Nov 14, 2024

In OTIO it is valid to have a clip with zero duration. Sometimes that's meaningful when it occurs before/after a transition. So that case will come up in practice. Does Raven need to draw it? No. But It would be nice if Raven did let you find those and inspect them. We don't yet have #73 so there isn't a way to select something with zero duration at the moment. I'm open to suggestions about how to do that - but your fix to avoid rendering something with zero pixel width seems totally fine.

InvisibleButton size must be greater than zero in both x and y so only
draw Effect button if this is the case.

Signed-off-by: Thomas Wilshaw <thomaswilshaw@gmail.com>
Only draw Items, Effects and Transitions if their durations are greater
than zero.

Signed-off-by: Thomas Wilshaw <thomaswilshaw@gmail.com>
@ThomasWilshaw
Copy link
Contributor Author

Updated based on your feedback, should I include markers too? I know they often have a duration of zero and their width is already based of off the track height

@jminor
Copy link
Member

jminor commented Nov 15, 2024

If the markers also cause a crash we should fix that too. The rest looks great.

@meshula
Copy link
Member

meshula commented Nov 16, 2024

i assume markers of zero length will be drawn as ??? a thick line ???, not skipped?

timeline.cpp Show resolved Hide resolved
@ThomasWilshaw
Copy link
Contributor Author

@meshula , I had misunderstood how typical markers are stored, I thought they would have a duration of one frame but I now realise they have a duration of zero

@ThomasWilshaw
Copy link
Contributor Author

Hi, sorry to bump this, I just wanted to check if you are waiting on changes from me with?

@meshula
Copy link
Member

meshula commented Dec 2, 2024

@ThomasWilshaw I was hoping the duration test would allow drawing items of zero length, and also that the width would be clamped to a minimum size to avoid drawing zero area markers (maybe that's already in place, I'm not sure).

@ThomasWilshaw
Copy link
Contributor Author

@meshula I possibly misunderstanding what you mean but how would you display something on the timeline if it's duration was zero? I've only come across it in one file so far but is it actually fairly common?

When you say a zero area marker do you mean one that only marks a single frame rather than a range of frames?

@meshula
Copy link
Member

meshula commented Dec 3, 2024

Markers have a duration, and a marked frame may have a duration of one frame as you say. That's not an issue, that works with the code already.

However, markers may be instantaneous with a zero duration, and appear at any time, not necessarily aligned on a frame.

A typical method of displaying zero length markers is to use a hair line of a certain number of pixels centered on the time. Typically a visual affordance can be provided, such as an inverted triangle or a circle filled with the marker's color, atop the hair line, giving the appearance of a traffic sign or lollipop in the time line, and also providing an easy handle for hovering, selection, and dragging.

Adding a "lollipop" and interaction affordances is extra candy though. I'm not proposing that you take that part on, just proposing that you draw a hair line with a small bounding box for hovering and selection.

@ThomasWilshaw
Copy link
Contributor Author

I think all that is already supported. Here we have a selected marker (the white one) that has a duration of zero and starts on an integer frame:
image

Here we have a multi frame marker that starts part way through a frame (again in white as it's selected):
image

Single marker that starts part way through a frame (although that's not reflected in the inspector so I'm displaying the JSON):
image

@meshula
Copy link
Member

meshula commented Dec 5, 2024

Got it, I thought this change was going to not render those because of the zero length.

@jminor jminor merged commit 36a8d08 into OpenTimelineIO:main Dec 5, 2024
6 checks passed
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