-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Move UV editor to bottom dock, rename to Polygon editor #99439
base: master
Are you sure you want to change the base?
Conversation
Move UV editor to bottom panel to allow realtime preview of results. Also allow UV editor to be used with textureless polygons.
Remove "uv" prefixes and clarify some names. Reorder/regroup some members in header file.
Marked as draft because of that one failing check. Any help to solve it would be appreciated... |
@@ -50,50 +50,60 @@ class VScrollBar; | |||
class Polygon2DEditor : public AbstractPolygon2DEditor { | |||
GDCLASS(Polygon2DEditor, AbstractPolygon2DEditor); | |||
|
|||
enum Mode { | |||
MODE_EDIT_UV = MODE_CONT, |
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.
This enum is some kind of continuation from AbstractPolygon2DEditor, but the usage is totally unrelated (especially after removing the dialog opening "uv" button), so I changed the code to reflect that.
VBoxContainer *polygon_edit = nullptr; | ||
Mode current_mode; | ||
Button *mode_buttons[MODE_MAX]; | ||
Ref<ButtonGroup> mode_button_group; | ||
Action selected_action; | ||
Button *action_buttons[ACTION_MAX]; | ||
Button *b_snap_enable = nullptr; | ||
Button *b_snap_grid = nullptr; | ||
Panel *uv_edit_background = nullptr; | ||
MenuButton *edit_menu = nullptr; | ||
|
||
Control *canvas = nullptr; | ||
Panel *canvas_background = nullptr; |
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 new properties here, but some are renamed (eg. uv_edit_draw
-> canvas
) and rearranged for better grouping (eg. edit_menu
grouped with other toolbar objects instead of scrollbars).
} | ||
get_tree()->connect("process_frame", callable_mp(this, &Polygon2DEditor::_center_view), CONNECT_ONE_SHOT); | ||
// Whenever polygon gets redrawn, there's possible changes for the editor as well. | ||
node->connect("draw", callable_mp(draw, &CanvasItem::queue_redraw)); |
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.
Instead of adding redraw into undoredo actions, we should redraw whenever the target is redrawn. This solves the issue where uv editor doesn't update if the polygon is modified by other actors (like inspector).
bone_paint_radius_label->show(); | ||
_update_bone_list(); | ||
bone_paint_pos = Vector2(-100000, -100000); //send brush away when switching | ||
void Polygon2DEditor::_select_mode(int p_mode) { |
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.
Made this function more concise by hiding all toolbar elements and then reshowing them depending on mode. Old method was error prone, whenever new controls would be added to some mode there was the risk of forgetting to hide it in other modes. Now every mode simply enables the tools it needs.
I have no idea, so I ran the failed job again. Will investigate. |
Free the editor upon exiting. Robystify mode changing logic and use it to initialize the toolbar upon entering the editor.
8b64dbb
to
caf042b
Compare
Managed to fix the problem. Since the editor is outside the tree when it's not in the dock, it won't free itself upon closing. Added cleanup in the Now the pr is ready for review :) |
Implements godotengine/godot-proposals#8209 (with the exception of refactoring input function).
The pr is currently in multiple commits in case it's easier to review (for example, the functional change is just a few lines compared to refactoring). Or if some changes are deemed unwelcome, or better split to separate prs, we can cherry pick more easily. I will squash them eventually.