diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-23 00:33:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 00:33:28 +0100 |
commit | 5e26a275bbf38db357df6103768f42038f54cc71 (patch) | |
tree | d43e3bd857233748e0e5170200810cbeef0d4ab2 | |
parent | 00f8b56f1f84ec109bf8d13695b11dce533f2072 (diff) | |
parent | e5759b7ff92aec37f1cddca8865165e1ad6caea3 (diff) |
Merge pull request #56474 from brennengreen/keying-bounds
-rw-r--r-- | editor/editor_inspector.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 2d591bc434..a3538d3381 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -623,14 +623,17 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) { if (property == "frame_coords" && (object->is_class("Sprite2D") || object->is_class("Sprite3D"))) { Vector2i new_coords = object->get(property); new_coords.x++; - if (new_coords.x >= object->get("hframes").operator int64_t()) { + if (new_coords.x >= int64_t(object->get("hframes"))) { new_coords.x = 0; new_coords.y++; } - - call_deferred(SNAME("emit_changed"), property, new_coords, "", false); + if (new_coords.x < int64_t(object->get("hframes")) && new_coords.y < int64_t(object->get("vframes"))) { + call_deferred(SNAME("emit_changed"), property, new_coords, "", false); + } } else { - call_deferred(SNAME("emit_changed"), property, object->get(property).operator int64_t() + 1, "", false); + if (int64_t(object->get(property)) + 1 < (int64_t(object->get("hframes")) * int64_t(object->get("vframes")))) { + call_deferred(SNAME("emit_changed"), property, object->get(property).operator int64_t() + 1, "", false); + } } call_deferred(SNAME("update_property")); |