You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-26 15:46:23 +00:00
Merge pull request #102317 from ryevdokimov/gizmo-commit-handle-spam-fix
Do not commit gizmo handles if no changes were made
This commit is contained in:
@@ -54,6 +54,10 @@ bool SoftBody3DGizmoPlugin::is_selectable_when_hidden() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SoftBody3DGizmoPlugin::can_commit_handle_on_click() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void SoftBody3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
void SoftBody3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||||
SoftBody3D *soft_body = Object::cast_to<SoftBody3D>(p_gizmo->get_node_3d());
|
SoftBody3D *soft_body = Object::cast_to<SoftBody3D>(p_gizmo->get_node_3d());
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public:
|
|||||||
String get_gizmo_name() const override;
|
String get_gizmo_name() const override;
|
||||||
int get_priority() const override;
|
int get_priority() const override;
|
||||||
bool is_selectable_when_hidden() const override;
|
bool is_selectable_when_hidden() const override;
|
||||||
|
bool can_commit_handle_on_click() const override;
|
||||||
void redraw(EditorNode3DGizmo *p_gizmo) override;
|
void redraw(EditorNode3DGizmo *p_gizmo) override;
|
||||||
|
|
||||||
String get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const override;
|
String get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const override;
|
||||||
|
|||||||
@@ -1138,6 +1138,10 @@ bool EditorNode3DGizmoPlugin::is_selectable_when_hidden() const {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EditorNode3DGizmoPlugin::can_commit_handle_on_click() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
void EditorNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||||
GDVIRTUAL_CALL(_redraw, p_gizmo);
|
GDVIRTUAL_CALL(_redraw, p_gizmo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ public:
|
|||||||
virtual int get_priority() const;
|
virtual int get_priority() const;
|
||||||
virtual bool can_be_hidden() const;
|
virtual bool can_be_hidden() const;
|
||||||
virtual bool is_selectable_when_hidden() const;
|
virtual bool is_selectable_when_hidden() const;
|
||||||
|
virtual bool can_commit_handle_on_click() const;
|
||||||
|
|
||||||
virtual void redraw(EditorNode3DGizmo *p_gizmo);
|
virtual void redraw(EditorNode3DGizmo *p_gizmo);
|
||||||
virtual bool is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const;
|
virtual bool is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const;
|
||||||
|
|||||||
@@ -2029,7 +2029,11 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_edit.gizmo.is_valid()) {
|
if (_edit.gizmo.is_valid()) {
|
||||||
_edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_handle_secondary, _edit.gizmo_initial_value, false);
|
// Certain gizmo plugins should be able to commit handles without dragging them.
|
||||||
|
if (_edit.original_mouse_pos != _edit.mouse_pos || _edit.gizmo->get_plugin()->can_commit_handle_on_click()) {
|
||||||
|
_edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_handle_secondary, _edit.gizmo_initial_value, false);
|
||||||
|
}
|
||||||
|
|
||||||
spatial_editor->get_single_selected_node()->update_gizmos();
|
spatial_editor->get_single_selected_node()->update_gizmos();
|
||||||
_edit.gizmo = Ref<EditorNode3DGizmo>();
|
_edit.gizmo = Ref<EditorNode3DGizmo>();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user