-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Usability & Quality of life: Add shortcut widget to change brush size and opacity #470
Conversation
selector.brush_preview_color = widget_color | ||
|
||
_overlay_selector = selector | ||
_overlay_selector.position = active_viewport.get_global_mouse_position() |
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 wonder if it's not already possible to infer viewport-relative mouse position from parameters of _forward_3d_gui_input
. I'm a bit annoyed that Godot doesn't seem to expose enough things
Some additional thoughts:
|
I personally use "G" for 'translate transform' to move nodes. But it didn't give me any problems as the plugin consumes the input and it only affects it when the node is selected. But that's why the next step would be to allow changing the hotkeys. In another PR.
Oh yea, I intended to change the opacity color border to red but ended up forgetting about it.
That's an option. In that case, should there even be an overlay widget?
Oh, I didn't test that. I'll make it cancel the widget when Escape is pressed. |
I've made the changes. heighmap_demo_2.mp4 |
@@ -86,6 +88,10 @@ var _mouse_pressed := false | |||
#var _pending_paint_action = null | |||
var _pending_paint_commit := false | |||
|
|||
var _overlay_selector : HT_BrushEditorOverlay = null | |||
var _widget_action_name : String = "" | |||
var _editor_viewports : Array[Node] = [] |
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.
Shouldn't it be Array[SubViewportContainer]
?
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.
The find_children
used to get the nodes returns an Array[Node] so Godot doesn't let me.
Edit: I tried manually casting it, but Godot still complains for some reason
Made the changes. I'm using an exponential range as you suggested. From a hidden slider inside the overlay to convert it. I've also changed the overlay update from |
Removed some useless code while getting the It can even display the overlay on top of other panels. |
_exponential_slider.min_value = MIN_UI_CIRCLE_SIZE*_dpi_scale | ||
_exponential_slider.max_value = MAX_UI_CIRCLE_SIZE*_dpi_scale | ||
|
||
var reverse = (initial_value - min_value) / (max_value-min_value) |
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.
Untyped, is it float?
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.
Let me just comment once here.
Sorry for all the missing statics. My head was kinda floating after bumping my head against the wall trying to figure out how to make that math works. Specially making the start position offset work was more difficult than I was hoping.
HT_Brush.MAX_SIZE_FOR_SLIDERS, | ||
Color.LIGHT_GREEN, _terrain_painter.get_brush_size(), | ||
"Brush Size", | ||
func on_value_changed(value): |
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'm not used to the new lambda feature in GDScript, but I found out giving a name is optional
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.
You are right. The name is optional.
But I think having the name there is helpful to know at a glance what the callback does without checking the function declaration.
But I can remove it if you want to?
…updating size/opacity
Changes made. |
Thank you! |
A much needed quality of life feature.
This adds a simple widget to quickly change the size and opacity of the brush.
Press the hotkey and move the mouse the set the value.
heighmap_demo_1.mp4
Right now, the hotkeys are set to:
We can add an option to change the hotkeys later.
This PR also fixes a bug where changing the size/opacity in the brush settings dialogue would not change the bottom panel sliders
heighmap_fix_1.mp4
Based on TerraBrush's UI features