-
Notifications
You must be signed in to change notification settings - Fork 27
Block: Allow deleting with Delete button #170
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
Conversation
@dylanmccall I'd appreciate if you could take a look at the mouse focusing since I'm not totally confident about how it interacts with the Another thing that would be super useful (but I didn't attempt to tackle) is if the block could be drawn to show that it's focused. See the docs for a description. However, it's a bit difficult in our case since the thing we want to alter is the background node within the Block. |
I don't think a confirmation is needed, since it's a bit cumbersome and its already easy to undo. For referece, MS Arcade has none. Maybe deleting a block should not delete the ones stacked to its bottom? Regarding focus, something is wrong in both main and this branch: when I scroll in the Output dock the Block Code canvas is zoomed in and out. As you can see in this video: |
I guess I followed the scene editor where it asks for confirmation when deleting a node. Personally I find it helpful but I'm mostly indifferent.
I also was following the scene editor where it will delete the whole branch. Although the dialog does say "Delete ... and all it's children" in that case. Reparenting the lower blocks might be a little tricky. I'm also not sure if that could leave you with an invalid node tree. I'm inclined to delete the whole branch like the scene editor and leave any fancier work for a followup.
Oh, interesting. I also noticed that my block canvas was way zoomed in at some point but hadn't made the connection. I guess I need to explicitly [[ https://docs.godotengine.org/en/stable/classes/class_control.html#class-control-method-release-focus | release focus ]] when the canvas is no longer active. |
Ok! I checked visual shader nodes and also don't have a confirmation. But I think we need learners feedback. So feel free to merge with the confirmation. Or maybe @cassidyjames or @jbourqueendless can tell us.
Fair! I wasn't thinking them as children but as "stacked below". Like removing a line of code should not remove the ones below.
👍 |
I played with this a bunch today, and created #179 adding focus indicators. Feel free to merge it into this branch if it's easier to deal with :) It comes with the bonus that we almost have working keyboard navigation, although I'm very fed up with Godot's theming system at the moment. Need to sit down and try to understand it. Right now I'm doing a weird thing where I call |
I can't reproduce this anymore either in main, the branch here (based on an older main), or a rebased version of this branch. What I started looking at was disabling input event handling for the block canvas when the main panel is hidden:
Since I couldn't reproduce it anymore, I decided to leave that out. |
49cdcb2
to
2e1ecc4
Compare
Ready for review again. It still has the confirmation dialog and still deletes the entire tree of blocks below it. What's changed:
|
Set the focus mode on Blocks so they can process input events. When dragged on the canvas, set the dropped block to be focused. Note the subtle interaction between FocusMode.FOCUS_ALL, which allows focusing by mouse click, and MouseFilter.MOUSE_FILTER_IGNORE, which filters out mouse click events. The combination means that the mouse click will be handled in Godot for focusing the block, but the mouse click can't be processed in _gui_input().
Allow a Block to be deleted with a confirmation dialog when the Delete key is pressed. However, when the Block is in the picker (rather than the canvas), it shouldn't be deleted. Add a flag to disable deleting and restore it when a drag completes. Furthermore, when it shouldn't be deleted, stop propagating the Delete key so it doesn't try to delete the whole BlockCode node. Fixes: #162
2e1ecc4
to
4f98996
Compare
I gave this another look and I'm happy with where it is. I was able to reproduce that issue with scrolling in other bottom panel tabs, but since it isn't a regression in this branch, I reported it separately in #184. I rebased this branch against main, and I'll merge it in a moment :) |
Allow a Block to be deleted with a confirmation dialog when the Delete
key is pressed. However, when the Block is in the picker (rather than
the canvas), it shouldn't be deleted. Add a flag to disable deleting and
restore it when a drag completes. Furthermore, when it shouldn't be
deleted, stop propagating the Delete key so it doesn't try to delete the
whole BlockCode node.
Fixes: #162