summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorBrennen Green <brennengreen@outlook.com>2022-01-03 23:05:39 -0500
committerBrennen Green <brennengreen@outlook.com>2022-01-04 17:18:26 -0500
commite5759b7ff92aec37f1cddca8865165e1ad6caea3 (patch)
tree9fe7919d6d0a69328bc1bad81ac40c9124bb3923 /editor
parentdcb1b8247fb633ca077f1e4be1090a3c1c758af4 (diff)
add bounds to next keying next
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_inspector.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index d01954a5f3..21fd3bb606 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"));