-
Notifications
You must be signed in to change notification settings - Fork 549
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 cleanup and performance #1864
Conversation
Comment from Ferdnyc on #1859
nod Tho the question then becomes, in C++ or Python with what toolkit? Qt I guess is the obvious answer because it's what the rest of the code is built in, but TBH building the Timeline in traditional, QWidget-based Qt... does sound like kind of a chore. I definitely can see reasons for going down the Angular+jQuery JS path, rather than attempting a QWidget-based implementation. I can't imagine that'd be very enjoyable at all. One thing that I think might be really interesting to explore, though, is the idea of a Timeline built using a more modern Qt approach. Interface building in Qt today isn't just the QObject/QWidget-based toolkit, they also offer QML for markup-based interface design. Which I imagine might offer a fairly painless migration/conversion from the current Angular-based Timeline... in fact, like everything else this decade, QML also has a JavaScript API to access pretty much everything. I know you said you're not sure JavaScript is the right approach... but right now the Timeline implementation is external to the entire rest of the interface (and they're totally disconnected from each other, as a result) so both sides wind up jumping through a lot of hoops to achieve even the current (low) I know nothing about QML other than what I've read, but Qt seem to treat it as The Future™ most of the time... though how much of that is justified, and how much is just marketing telling people what they think they want to hear, I know too little about QML to even hazard a guess. Wikipedia says...
|
@ferdnyc - Makes more sense to continue the conversation here instead.
I did mean to say with Qt on this. So it would be C++ with Qt5 or PyQt5.
Yes, I was thinking of a GraphicsView widget and drawing QRects for the clips. The more I was thinking about it the more it sounded like a horrible task and something else would fare better.
Yeah I feel maybe QML is the best fit in terms of easy coding and reducing the code to support the bridge between Qt and JS. At the moment when I try to work on the timeline code it just seems overwhelming and I always feel like starting again from scratch but that would be even more work and probably a harder task. If I could draw out and document the requirements of everything the timeline has to support then maybe starting a new timeline implementation would be best. |
Yeah, I think the win there is that Angular+jQuery at least bring a scene graph and nice, highly advanced animation features. Reading more about But still, as much as some users may dislike them 😉 , I have to wonder if even something as simple as drawing the clips with rounded corners would be nearly as easy in QGraphicsView as it is in the current timeline code, where all it requires is the .clip_top {
display: -webkit-flex;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0.20)), color-stop(100%,rgba(255,255,255,0)));
border-radius: 8px;
overflow: hidden;
} There are also a lot of little animations we take for granted. (The snapline when Clips are in alignment, the scrolling of the Playhead when the user clicks the ruler, the scrolling of the snapline from one alignment point to another, etc...)
I hear that. I went hunting for #1454 (the clip-resizing display bug), and I came away utterly confused about everything that was going on in there, but without any fix for that bug. I know I found the code that must contain the bug, I just couldn't find the bug in the code, mostly because I didn't understand half of it. But that bug even shows up in the Timeline debug interface (opening I also went looking for my own #1383 (about the fact that Markers are draggable, and add their icon as an image clip when dragged to the Timeline), which should be a really elementary thing, but I'll be damned if I could figure out why the things are considered draggable, or how to make it stop. They're not draggable in the debug interface, so that makes it even weirder. Though, I do notice that the cursor changes to a hand when you attempt to drag them, which feels like a clue. P.S> QGraphicsView vs. QT Quick / QML on the QT Blog. (It's actually titled "Should you still be using QGraphicsView?", but having read it I feel like a more accurate title would be "In defense of QGraphicsView", since that's how it comes off.) |
Yeah I think for now on the whole a move to something else would be too much change too soon.
This makes it a bit more confusing as to which is better in this case. 😆 Soo.. just a quick update. I've updated Angular to the latest version and like before this has broken the dragging behavior. You can drag a clip after selecting it first but not if you just click and start dragging right away. I've seen this in my previous attempt to upgrade Angular. However, since we also include Jquery and Jquery UI it could possibly be something in there. I do suspect its more an Angular issue but my (fun) investigations will continue.. |
@ferdnyc - Fixing dragging wasn't bad and I feel like I've fixed this before. Next up is snapping (oh dear lord). Clip snapping seems to completely not work now but where there is a will there is a way. 🤣 |
@ferdnyc - Is there a chance you could test this if you have time? I want someone to test and maybe find something broken before I merge this PR. Seems to work fine inside Openshot and in Chrome from my testing so far. |
@DylanC Sure, I'll give it a spin in the next hour or two. |
@DylanC — LGTM! Very cool. I couldn't really detect any differences from 2.4.2 release, which I gather is the goal (at least so far)? All the same functionality, all the same bugs. 🤣 (And I just found another one, or at least it's new to me: When you have a locked track and you're dragging clips up and down between tracks, you don't have to try very hard to get a clip to "land" on the locked track and stay there — it's really still on the track it moved from, according to its Properties, it only appears to be on the locked track. But looks like the drag auto-reset on a refused drop sometimes doesn't fire, or can get interrupted by new drag activity before it has a chance to restore the original position.) But like I said, that's only new to me — exact same behavior as 2.4.2 release, so nothing to do with this PR at all. Everything here looks A-OK from where I'm sitting, in both the debug timeline and the OpenShot interface. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(LOL. I'm submitting a review, as if I can even really read Angular code. Don't believe the lies.)
// { | ||
// timeline.qt_log(layer); | ||
// } | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will we do without this function??
(Which reminds me, one of us should just delete src/timeline/media/js/debug.js
entirely, as it contains equally critical code.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdnyc - Yup, I considered deleting that multiple times already. Might as well just get rid of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdnyc - That debug file has been removed btw.
}, | ||
num : 24, | ||
den : 1 | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die, tabs, die!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(BTW, this still doesn't quite line up, since lines 36-39 start with a single tab and then switch to spaces, while 35 and 40-44 are indented entirely with spaces. But, honestly, this file's tabs-vs-spaces insanity is... clinical, so maybe that's a whole 'nother PR of its own.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdnyc - No worries, I will fix it before merging if possible.
|
||
}, | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I don't hate trailing commas on multi-line (multi-page) lists like this. It's not illegal, and it saves you when someone adds another member after the last one and forgets to append the comma. But removing it keeps 'em honest, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdnyc - I'd only leave it there if its very likely we will be adding something soon. IMHO.
@@ -421,8 +407,9 @@ App.directive('tlMultiSelectable', function(){ | |||
item = findElement(scope.project.effects, "id", id); | |||
} | |||
|
|||
if (scope.Qt) | |||
if (scope.Qt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, THANK YOU. Conditional blocks without enclosing braces are just bug magnets, they're practically taunting anyone who looks at the code. "Try to add another instruction to me, screw up the program logic!"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdnyc - Yep, its a personal preference of my own too. I HATE when people do single line if statements. Its just not consistent with the rest of them and yeah it can be a magnet for future bugs.
Good to hear. Tbh yeah I think that is all I'm aiming for with this one. Its to make important upgrades for the timeline and just remove some cruft. Should give us a more solid foundation for future changes. I'm planning to tackle some individual bugs with separate PR's. |
@ferdnyc - Getting this change in. I'm planning to tackle some timeline bugs in my next PR's. Do you know of any issue numbers worth getting attention? |
The two I mentioned, #1454 and #1383, are both definitely Timeline code bugs, so that's a start. There's also #1839, which raised an issue with the ruler that isn't present in the debugger, so that's something going on with OpenShot embedding the Timeline canvas... but it's still related. Oh, and also on the "straddling the Timeline JS and OpenShot's Python" front, in the course of discussing one issue the conversation got around to the Timeline's current keyboard-/multi-selection functionality which is, to put it mildly, a bit lacking and weird, so that could really use sanity-checking and standardizing. Oh, and the super-ambitious goal, of course: All those various situations where the Timeline should be autoscrolling to follow the Playhead, but instead just lets it wander out of view. I'd also throw in, though it wasn't the original focus of #1587, the things that could easily be simple clickable controls on the Timeline, but are currently accessible only from the context menu. The obvious low-hanging fruit on this front is the Locked Track control. When you lock a track, a padlock symbol gets added to the track label section, but the only way to actually perform the lock/unlock operation is via the menu. It seems like a no-brainer that the padlock should be clickable to unlock the track, at a minimum. Or, even better, always visible, and clickable to toggle between locked and unlocked states, so you don't need the context menu at all just to perform the simple act of flipping the state of a boolean property. ...That's just off the top of my head. 👼 |
Attempting to upgrade Angular safely and remove any dud code. Also hope to make some performance improvements.