mirror of
https://github.com/godotengine/godot.git
synced 2024-11-26 06:03:38 +00:00
Merge pull request #32992 from KoBeWi/AUTOVECTORZ
Auto-increment frame_coords when keying
This commit is contained in:
commit
19fa163d9a
@ -644,7 +644,19 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
emit_signal("property_keyed", property, use_keying_next());
|
emit_signal("property_keyed", property, use_keying_next());
|
||||||
|
|
||||||
if (use_keying_next()) {
|
if (use_keying_next()) {
|
||||||
call_deferred("emit_changed", property, object->get(property).operator int64_t() + 1, "", false);
|
if (property == "frame_coords" && (object->is_class("Sprite") || object->is_class("Sprite3D"))) {
|
||||||
|
Vector2 new_coords = object->get(property);
|
||||||
|
new_coords.x++;
|
||||||
|
if (new_coords.x >= object->get("hframes").operator int64_t()) {
|
||||||
|
new_coords.x = 0;
|
||||||
|
new_coords.y++;
|
||||||
|
}
|
||||||
|
|
||||||
|
call_deferred("emit_changed", property, new_coords, "", false);
|
||||||
|
} else {
|
||||||
|
call_deferred("emit_changed", property, object->get(property).operator int64_t() + 1, "", false);
|
||||||
|
}
|
||||||
|
|
||||||
call_deferred("update_property");
|
call_deferred("update_property");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,6 +387,10 @@ void Sprite::_validate_property(PropertyInfo &property) const {
|
|||||||
property.hint_string = "0," + itos(vframes * hframes - 1) + ",1";
|
property.hint_string = "0," + itos(vframes * hframes - 1) + ",1";
|
||||||
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property.name == "frame_coords") {
|
||||||
|
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::_texture_changed() {
|
void Sprite::_texture_changed() {
|
||||||
|
@ -662,6 +662,10 @@ void Sprite3D::_validate_property(PropertyInfo &property) const {
|
|||||||
property.hint_string = "0," + itos(vframes * hframes - 1) + ",1";
|
property.hint_string = "0," + itos(vframes * hframes - 1) + ",1";
|
||||||
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property.name == "frame_coords") {
|
||||||
|
property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite3D::_bind_methods() {
|
void Sprite3D::_bind_methods() {
|
||||||
|
Loading…
Reference in New Issue
Block a user