-
Notifications
You must be signed in to change notification settings - Fork 205
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
StandardConnectionGadget : allow Ctrl-Click to add Dots #2072
Conversation
@@ -92,6 +92,11 @@ class StandardConnectionGadget : public ConnectionGadget | |||
|
|||
bool updateUserColor(); | |||
|
|||
bool __dropDot( Imath::V2f position ); | |||
void __updateDotPreviewBounds( const ButtonEvent &event ); | |||
bool __keyPressed( const KeyEvent &event ); |
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.
I wasn't sure whether to consider these private to the DotAdderThingy implementation or proper class methods without the double underscores.
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.
There's no need for the "__" prefix in C++ - in fact I don't think it's even allowed. In C++ we have proper access control via private :
and protected :
, and use that instead. It's only in Python that we're in the wild west and have to use a naming convention to denote protected/private.
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.
Urg, let's never talk of this again... -.- Updated.
1725648
to
38ca1b6
Compare
I think my intuitive expectation is that the "dot preview thingy" would be snapped to the connection anyway, so moving away from the connection would naturally lead to a leave signal. Does that make sense? This leads me to a related topic - I think curvy noodles are bad. It makes it really hard to distinguish between long criss-crossed connections because the tangents all tend to be flattened together in the middle. I wish I'd made the connections straight, possible with little stubs so they jutted out from the nodes before going on their way. That would simplify the "snap to curve" part of the above. Too much for now though?
Definitely. Could you experiment with that? We manage it for "click to select and then drag to move" in the NodeGraph, so maybe that could give you some clues? If it turns out to be tricky then drop me an email and we can go from there... |
I don't like the curvy noodles either. If you feel like it's worth changing, I'm happy to look at making them straight as part of this ticket. We could make this a "make noodle interaction nicer" ticket that runs a bit longer - I don't think I've heard anyone screaming for that dotAdder feature. On that note - I talked to Ivan today and he made a good suggestion. Currently when selection a node, the noodles are highlighted and it's easy to determine the inputs to the node. Putting a Dot between two nodes breaks that a little because only the second part of that connection is highlighted. He suggested promoting the state of being highlighted across Dots - if that explanation makes sense. I could look at that as part of this ticket as well. As for the click-dragging - I'll have a look at the implementation in the NodeGraph, thanks! :) |
I don't disagree necessarily, but that sounds like a big UI change visually, so I think we'd do best to survey some users first. I imagine they'll come back saying "sometimes straight, sometimes curvy, give me a user pref for it" which won't make anything easier... |
I was wondering if this should be across Switches too (e.g. highlight all the way to the |
I think we already had users request to highlight which input to a switch node is actually used. IF we decide to change the noodles drawing, another option would be doing this. I think I've seen that somewhere and liked it at the time. Was that nuke and they've removed it by now? Maybe there was a good reason to not keep it.
|
Hey Matti, |
Hey John, if this commit makes this PR too busy, I'm happy to break it off into a new PR. Maybe that would make sense if you anticipate major changes. Will run this on a bigger graph now and report back. We could get rid of some std::vectors being constructed even though it's not necessary - I just kept it that way because it made the code more compact. Generally, this should not really slow down big graphs if they don't contain dots and switches, right? Those two ifs and the cast shouldn't be a huge problem? Or would you consider the casting a big bottleneck already, even if the body of the if is never executed? Do you see a better way for this feature or would you rather not put in that feature at all? Thanks :) |
Thanks Matti - I think it would be good to keep this PR a bit more focussed if we can. I suspect any large graph will contain a fair number of dots and switches, so it'll be interesting to see what you find. Might be no problem at all, but worth checking I think. The other problem is that the call to |
f97a6bd
to
38ca1b6
Compare
Dropped that commit here and moved it to #2075 |
b0905d4
to
a1661fe
Compare
Hey John, I finally got around to looking at this one again. Could you take a butchers? The code that I've pushed now takes care of the two issues I had flagged before. We don't have the problem with the leave signal anymore (thanks to snapping powered by @danieldresser-ie's new noodles) and I've got the click'n'drag to work. Thanks! Toodle pip, Matti. |
When looking at this it might be worth keeping in mind that we might also want to add a shift-click option to the connections that allows dragging a new connection with the same source to another nodule as a quick way to connect distant inputs to multiple outputs. I had a quick look and thought about adding a I'll hold off on this for now as other tickets are given higher priority and I'd rather talk to you about the approach here first. Thanks :) |
Thanks Matti! This made me chuckle!
Yep, makes total sense. The
Good point. Since you mentioned dragging, I guess another possibility is that we handle the dragging of the Dot entirely within the StandardConnectionGadget. This might not be as good as letting the GraphGadget do it, but I think it might be better than the
That does make sense, but again it feels like we'd be leaking the implementation of StandardConnectionGadget features out into the other components. I think arguably we're already doing this with the existing ConnectionGadget handling that's happening in
I think there's a bit of experimenting to do to see if we can get this a little bit cleaner, and it definitely makes sense to add the "second connection dragging" feature at the same time. Could you maybe give a few of the ideas above a try, and see if they're feasible? Cheers... |
I'm trying some of the slang Don has taught me ;)
That's what I tried initially as it seemed a whole lot cleaner, but then I ran into the problem that the
When I tried this one yesterday, I think I ran into the problem of not getting calls to
Replacing this bit, I guess? I can look into that the next time I'm touching this :) Thanks for your response :) |
I just gave this a bash and it seemed to actually work - I think maybe the difference was that my implementation selects the Dot in the connection gadget?
To get
Yes, I think so. I do wonder if there's some long-forgotten reason I'm not doing that though.... |
Yeah, I guess that's why. Just tested your version and it seems to work fine, indeed :) Are you ok with making the
Mh, I see. Dragging it to the ScriptEditor during the creation of the |
Yep.
Not necessarily - was just mentioning it as an option. We can just get this tidied up with the graph gadget doing the dragging and then make a separate PR for the extra-connection dragging if that works for you... |
52ca79e
to
1d9ba75
Compare
Tests failed (2 timeouts, 1 error). Will restart, error below.
|
Yeah, everything is failing or timing out recently. Nothing to do with the PRs themselves unfortunately. I've tried to reproduce the Catalogue problem locally but without success so far. Will try again... |
I got the same failure in #2135. I'm not restarting for now in case there's anything you can get out of that log that helps. |
Thanks Matti! This is a really nice feature. When I was just testing this I did very occasionally manage to end up dragging the nodule from the new Dot, rather than the Dot itself. I think it happens most often when zoomed out, and when dragging in the direction of the connection (making it more likely the mouse has moved onto the nodule before the dragBegin event happens). I've merged anyway as it's a great feature and I don't think the problem is in the new code. I'm investigating now... |
For reference, this is the code that causes the unwanted second button press - we have two event filters connected when there's a QAbstractScrollArea in play. I don't know why we don't just connect to one or the other like we do in the mouse tracking code in the function below, and I couldn't find anything in the git log to provide context, except that it was added to support the MultiLineTextWidget in 8ca86ff. |
Ha, thanks for catching that and tracking down what's happening! I'm happy to look into handling the dragging on the |
Yeah, I was leaning towards that being the best solution. But I forgot that the GraphGadget has niceties like snapping to the vertical/horizontal that we wouldn't want to miss out on, and we certainly wouldn't want to have to reimplement again. Do you want to have a quick play with the "make the dot under the mouse" approach and see how it feels, since it's now our only easy option? |
Hey John,
here's a first version of what that DotAdderThingy could look like.
Some things are not ideal yet: