diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/camera_2d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 2 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.h | 2 | ||||
-rw-r--r-- | scene/3d/collision_shape.cpp | 8 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 1 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 202 | ||||
-rw-r--r-- | scene/animation/tween.h | 40 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 22 | ||||
-rw-r--r-- | scene/gui/file_dialog.h | 2 | ||||
-rw-r--r-- | scene/gui/gradient_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 8 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 8 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 2 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 100 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 2 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 12 |
18 files changed, 214 insertions, 207 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 1419fb561e..a8860c3d81 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -128,9 +128,9 @@ Transform2D Camera2D::get_camera_transform() { } else { if (v_ofs < 0) { - camera_pos.y = new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_TOP] * v_ofs; - } else { camera_pos.y = new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_BOTTOM] * v_ofs; + } else { + camera_pos.y = new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_TOP] * v_ofs; } v_offset_changed = false; diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index bf85a8bd53..d23e5ffa08 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -300,7 +300,7 @@ int ARVRController::get_joystick_id() const { return tracker->get_joy_id(); }; -int ARVRController::is_button_pressed(int p_button) const { +bool ARVRController::is_button_pressed(int p_button) const { int joy_id = get_joystick_id(); if (joy_id == -1) { return false; diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index 44dfda15a6..e968e33c9d 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -88,7 +88,7 @@ public: String get_controller_name(void) const; int get_joystick_id() const; - int is_button_pressed(int p_button) const; + bool is_button_pressed(int p_button) const; float get_joystick_axis(int p_axis) const; real_t get_rumble() const; diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index 35e4a61cd6..d825c8daf7 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -123,6 +123,14 @@ String CollisionShape::get_configuration_warning() const { return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it."); } + if (Object::cast_to<RigidBody>(get_parent())) { + if (Object::cast_to<ConcavePolygonShape>(*shape)) { + if (Object::cast_to<RigidBody>(get_parent())->get_mode() != RigidBody::MODE_STATIC) { + return TTR("ConcavePolygonShape doesn't support RigidBody in another mode than static."); + } + } + } + return String(); } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index eba45a5604..2f8dc31cb6 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -518,6 +518,7 @@ void RigidBody::set_mode(Mode p_mode) { PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_KINEMATIC); } break; } + update_configuration_warning(); } RigidBody::Mode RigidBody::get_mode() const { diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 4b8b537d43..628568afbb 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -838,23 +838,22 @@ float Tween::get_speed_scale() const { return speed_scale; } -bool Tween::start() { +void Tween::start() { - ERR_FAIL_COND_V_MSG(!is_inside_tree(), false, "Tween was not added to the SceneTree!"); + ERR_FAIL_COND_MSG(!is_inside_tree(), "Tween was not added to the SceneTree!"); // Are there any pending updates? if (pending_update != 0) { // Start the tweens after deferring call_deferred("start"); - return true; + return; } // We want to be activated set_active(true); - return true; } -bool Tween::reset(Object *p_object, StringName p_key) { +void Tween::reset(Object *p_object, StringName p_key) { // Find all interpolations that use the same object and target string pending_update++; for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { @@ -876,10 +875,9 @@ bool Tween::reset(Object *p_object, StringName p_key) { } } pending_update--; - return true; } -bool Tween::reset_all() { +void Tween::reset_all() { // Go through all interpolations pending_update++; for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { @@ -893,10 +891,9 @@ bool Tween::reset_all() { _apply_tween_value(data, data.initial_val); } pending_update--; - return true; } -bool Tween::stop(Object *p_object, StringName p_key) { +void Tween::stop(Object *p_object, StringName p_key) { // Find the tween that has the given target object and string key pending_update++; for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { @@ -913,10 +910,9 @@ bool Tween::stop(Object *p_object, StringName p_key) { data.active = false; } pending_update--; - return true; } -bool Tween::stop_all() { +void Tween::stop_all() { // We no longer need to be active since all tweens have been stopped set_active(false); @@ -928,10 +924,9 @@ bool Tween::stop_all() { data.active = false; } pending_update--; - return true; } -bool Tween::resume(Object *p_object, StringName p_key) { +void Tween::resume(Object *p_object, StringName p_key) { // We need to be activated // TODO: What if no tween is found?? set_active(true); @@ -950,10 +945,9 @@ bool Tween::resume(Object *p_object, StringName p_key) { data.active = true; } pending_update--; - return true; } -bool Tween::resume_all() { +void Tween::resume_all() { // Set ourselves active so we can process tweens // TODO: What if there are no tweens? We get set to active for no reason! set_active(true); @@ -966,14 +960,13 @@ bool Tween::resume_all() { data.active = true; } pending_update--; - return true; } -bool Tween::remove(Object *p_object, StringName p_key) { +void Tween::remove(Object *p_object, StringName p_key) { // If we are still updating, call this function again later if (pending_update != 0) { call_deferred("remove", p_object, p_key); - return true; + return; } // For each interpolation... @@ -996,7 +989,6 @@ bool Tween::remove(Object *p_object, StringName p_key) { // Erase it interpolates.erase(E->get()); } - return true; } void Tween::_remove_by_uid(int uid) { @@ -1026,11 +1018,11 @@ void Tween::_push_interpolate_data(InterpolateData &p_data) { pending_update--; } -bool Tween::remove_all() { +void Tween::remove_all() { // If we are still updating, call this function again later if (pending_update != 0) { call_deferred("remove_all"); - return true; + return; } // We no longer need to be active set_active(false); @@ -1038,11 +1030,9 @@ bool Tween::remove_all() { // Clear out all interpolations and reset the uid interpolates.clear(); uid = 0; - - return true; } -bool Tween::seek(real_t p_time) { +void Tween::seek(real_t p_time) { // Go through each interpolation... pending_update++; for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { @@ -1076,7 +1066,6 @@ bool Tween::seek(real_t p_time) { _apply_tween_value(data, result); } pending_update--; - return true; } real_t Tween::tell() const { @@ -1260,7 +1249,7 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final return true; } -bool Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p_object, NodePath *p_property, StringName *p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p_object, NodePath *p_property, StringName *p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // TODO: Add initialization+implementation for remaining interpolation types // TODO: Fix this method's organization to take advantage of the type @@ -1275,28 +1264,28 @@ bool Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p // Validate and apply interpolation data // Give it the object - ERR_FAIL_COND_V_MSG(p_object == NULL, false, "Invalid object provided to Tween."); + ERR_FAIL_COND_MSG(p_object == NULL, "Invalid object provided to Tween."); data.id = p_object->get_instance_id(); // Validate the initial and final values - ERR_FAIL_COND_V_MSG(p_initial_val.get_type() != p_final_val.get_type(), false, "Initial value type '" + Variant::get_type_name(p_initial_val.get_type()) + "' does not match final value type '" + Variant::get_type_name(p_final_val.get_type()) + "'."); + ERR_FAIL_COND_MSG(p_initial_val.get_type() != p_final_val.get_type(), "Initial value type '" + Variant::get_type_name(p_initial_val.get_type()) + "' does not match final value type '" + Variant::get_type_name(p_final_val.get_type()) + "'."); data.initial_val = p_initial_val; data.final_val = p_final_val; // Check the Duration - ERR_FAIL_COND_V_MSG(p_duration < 0, false, "Only non-negative duration values allowed in Tweens."); + ERR_FAIL_COND_MSG(p_duration < 0, "Only non-negative duration values allowed in Tweens."); data.duration = p_duration; // Tween Delay - ERR_FAIL_COND_V_MSG(p_delay < 0, false, "Only non-negative delay values allowed in Tweens."); + ERR_FAIL_COND_MSG(p_delay < 0, "Only non-negative delay values allowed in Tweens."); data.delay = p_delay; // Transition type - ERR_FAIL_COND_V_MSG(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false, "Invalid transition type provided to Tween."); + ERR_FAIL_COND_MSG(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, "Invalid transition type provided to Tween."); data.trans_type = p_trans_type; // Easing type - ERR_FAIL_COND_V_MSG(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false, "Invalid easing type provided to Tween."); + ERR_FAIL_COND_MSG(p_ease_type < 0 || p_ease_type >= EASE_COUNT, "Invalid easing type provided to Tween."); data.ease_type = p_ease_type; // Is the property defined? @@ -1304,7 +1293,7 @@ bool Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p // Check that the object actually contains the given property bool prop_valid = false; p_object->get_indexed(p_property->get_subnames(), &prop_valid); - ERR_FAIL_COND_V_MSG(!prop_valid, false, "Tween target object has no property named: " + p_property->get_concatenated_subnames() + "."); + ERR_FAIL_COND_MSG(!prop_valid, "Tween target object has no property named: " + p_property->get_concatenated_subnames() + "."); data.key = p_property->get_subnames(); data.concatenated_key = p_property->get_concatenated_subnames(); @@ -1313,7 +1302,7 @@ bool Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p // Is the method defined? if (p_method) { // Does the object even have the requested method? - ERR_FAIL_COND_V_MSG(!p_object->has_method(*p_method), false, "Tween target object has no method named: " + *p_method + "."); + ERR_FAIL_COND_MSG(!p_object->has_method(*p_method), "Tween target object has no method named: " + *p_method + "."); data.key.push_back(*p_method); data.concatenated_key = *p_method; @@ -1321,18 +1310,17 @@ bool Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p // Is there not a valid delta? if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) - return false; + return; // Add this interpolation to the total _push_interpolate_data(data); - return true; } -bool Tween::interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // If we are busy updating, call this function again later if (pending_update != 0) { _add_pending_command("interpolate_property", p_object, p_property, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); - return true; + return; } // Get the property from the node path @@ -1347,15 +1335,14 @@ bool Tween::interpolate_property(Object *p_object, NodePath p_property, Variant if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Build the interpolation data - bool result = _build_interpolation(INTER_PROPERTY, p_object, &p_property, NULL, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); - return result; + _build_interpolation(INTER_PROPERTY, p_object, &p_property, NULL, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); } -bool Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // If we are busy updating, call this function again later if (pending_update != 0) { _add_pending_command("interpolate_method", p_object, p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); - return true; + return; } // Convert any integers into REALs as they are better for interpolation @@ -1363,25 +1350,24 @@ bool Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_ if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Build the interpolation data - bool result = _build_interpolation(INTER_METHOD, p_object, NULL, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); - return result; + _build_interpolation(INTER_METHOD, p_object, NULL, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); } -bool Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE) { +void Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE) { // If we are already updating, call this function again later if (pending_update != 0) { _add_pending_command("interpolate_callback", p_object, p_duration, p_callback, p_arg1, p_arg2, p_arg3, p_arg4, p_arg5); - return true; + return; } // Check that the target object is valid - ERR_FAIL_COND_V(p_object == NULL, false); + ERR_FAIL_COND(p_object == NULL); // Duration cannot be negative - ERR_FAIL_COND_V(p_duration < 0, false); + ERR_FAIL_COND(p_duration < 0); // Check whether the object even has the callback - ERR_FAIL_COND_V_MSG(!p_object->has_method(p_callback), false, "Object has no callback named: " + p_callback + "."); + ERR_FAIL_COND_MSG(!p_object->has_method(p_callback), "Object has no callback named: " + p_callback + "."); // Build a new InterpolationData InterpolateData data; @@ -1422,24 +1408,23 @@ bool Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_c // Add the new interpolation _push_interpolate_data(data); - return true; } -bool Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE) { +void Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE) { // If we are already updating, call this function again later if (pending_update != 0) { _add_pending_command("interpolate_deferred_callback", p_object, p_duration, p_callback, p_arg1, p_arg2, p_arg3, p_arg4, p_arg5); - return true; + return; } // Check that the target object is valid - ERR_FAIL_COND_V(p_object == NULL, false); + ERR_FAIL_COND(p_object == NULL); // No negative durations allowed - ERR_FAIL_COND_V(p_duration < 0, false); + ERR_FAIL_COND(p_duration < 0); // Confirm the callback exists on the object - ERR_FAIL_COND_V_MSG(!p_object->has_method(p_callback), false, "Object has no callback named: " + p_callback + "."); + ERR_FAIL_COND_MSG(!p_object->has_method(p_callback), "Object has no callback named: " + p_callback + "."); // Create a new InterpolateData for the callback InterpolateData data; @@ -1480,14 +1465,13 @@ bool Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, S // Add the new interpolation _push_interpolate_data(data); - return true; } -bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // If we are already updating, call this function again later if (pending_update != 0) { _add_pending_command("follow_property", p_object, p_property, p_initial_val, p_target, p_target_property, p_duration, p_trans_type, p_ease_type, p_delay); - return true; + return; } // Get the two properties from their paths @@ -1502,33 +1486,33 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); // Confirm the source and target objects are valid - ERR_FAIL_COND_V(p_object == NULL, false); - ERR_FAIL_COND_V(p_target == NULL, false); + ERR_FAIL_COND(p_object == NULL); + ERR_FAIL_COND(p_target == NULL); // No negative durations - ERR_FAIL_COND_V(p_duration < 0, false); + ERR_FAIL_COND(p_duration < 0); // Ensure transition and easing types are valid - ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); - ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); + ERR_FAIL_COND(p_trans_type < 0 || p_trans_type >= TRANS_COUNT); + ERR_FAIL_COND(p_ease_type < 0 || p_ease_type >= EASE_COUNT); // No negative delays - ERR_FAIL_COND_V(p_delay < 0, false); + ERR_FAIL_COND(p_delay < 0); // Confirm the source and target objects have the desired properties bool prop_valid = false; p_object->get_indexed(p_property.get_subnames(), &prop_valid); - ERR_FAIL_COND_V(!prop_valid, false); + ERR_FAIL_COND(!prop_valid); bool target_prop_valid = false; Variant target_val = p_target->get_indexed(p_target_property.get_subnames(), &target_prop_valid); - ERR_FAIL_COND_V(!target_prop_valid, false); + ERR_FAIL_COND(!target_prop_valid); // Convert target INT to FLOAT since it is better for interpolation if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t(); // Verify that the target value and initial value are the same type - ERR_FAIL_COND_V(target_val.get_type() != p_initial_val.get_type(), false); + ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type()); // Create a new InterpolateData InterpolateData data; @@ -1551,44 +1535,43 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini // Add the interpolation _push_interpolate_data(data); - return true; } -bool Tween::follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // If we are currently updating, call this function again later if (pending_update != 0) { _add_pending_command("follow_method", p_object, p_method, p_initial_val, p_target, p_target_method, p_duration, p_trans_type, p_ease_type, p_delay); - return true; + return; } // Convert initial INT values to FLOAT as they are better for interpolation if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); // Verify the source and target objects are valid - ERR_FAIL_COND_V(p_object == NULL, false); - ERR_FAIL_COND_V(p_target == NULL, false); + ERR_FAIL_COND(p_object == NULL); + ERR_FAIL_COND(p_target == NULL); // No negative durations - ERR_FAIL_COND_V(p_duration < 0, false); + ERR_FAIL_COND(p_duration < 0); // Ensure that the transition and ease types are valid - ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); - ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); + ERR_FAIL_COND(p_trans_type < 0 || p_trans_type >= TRANS_COUNT); + ERR_FAIL_COND(p_ease_type < 0 || p_ease_type >= EASE_COUNT); // No negative delays - ERR_FAIL_COND_V(p_delay < 0, false); + ERR_FAIL_COND(p_delay < 0); // Confirm both objects have the target methods - ERR_FAIL_COND_V_MSG(!p_object->has_method(p_method), false, "Object has no method named: " + p_method + "."); - ERR_FAIL_COND_V_MSG(!p_target->has_method(p_target_method), false, "Target has no method named: " + p_target_method + "."); + ERR_FAIL_COND_MSG(!p_object->has_method(p_method), "Object has no method named: " + p_method + "."); + ERR_FAIL_COND_MSG(!p_target->has_method(p_target_method), "Target has no method named: " + p_target_method + "."); // Call the method to get the target value Callable::CallError error; Variant target_val = p_target->call(p_target_method, NULL, 0, error); - ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, false); + ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK); // Convert target INT values to FLOAT as they are better for interpolation if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t(); - ERR_FAIL_COND_V(target_val.get_type() != p_initial_val.get_type(), false); + ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type()); // Make the new InterpolateData for the method follow InterpolateData data; @@ -1611,14 +1594,13 @@ bool Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi // Add the new interpolation _push_interpolate_data(data); - return true; } -bool Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // If we are currently updating, call this function again later if (pending_update != 0) { _add_pending_command("targeting_property", p_object, p_property, p_initial, p_initial_property, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); - return true; + return; } // Grab the target property and the target property p_property = p_property.get_as_property_path(); @@ -1628,31 +1610,31 @@ bool Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_ if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Verify both objects are valid - ERR_FAIL_COND_V(p_object == NULL, false); - ERR_FAIL_COND_V(p_initial == NULL, false); + ERR_FAIL_COND(p_object == NULL); + ERR_FAIL_COND(p_initial == NULL); // No negative durations - ERR_FAIL_COND_V(p_duration < 0, false); + ERR_FAIL_COND(p_duration < 0); // Ensure transition and easing types are valid - ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); - ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); + ERR_FAIL_COND(p_trans_type < 0 || p_trans_type >= TRANS_COUNT); + ERR_FAIL_COND(p_ease_type < 0 || p_ease_type >= EASE_COUNT); // No negative delays - ERR_FAIL_COND_V(p_delay < 0, false); + ERR_FAIL_COND(p_delay < 0); // Ensure the initial and target properties exist on their objects bool prop_valid = false; p_object->get_indexed(p_property.get_subnames(), &prop_valid); - ERR_FAIL_COND_V(!prop_valid, false); + ERR_FAIL_COND(!prop_valid); bool initial_prop_valid = false; Variant initial_val = p_initial->get_indexed(p_initial_property.get_subnames(), &initial_prop_valid); - ERR_FAIL_COND_V(!initial_prop_valid, false); + ERR_FAIL_COND(!initial_prop_valid); // Convert the initial INT value to FLOAT as it is better for interpolation if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t(); - ERR_FAIL_COND_V(initial_val.get_type() != p_final_val.get_type(), false); + ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type()); // Build the InterpolateData object InterpolateData data; @@ -1675,50 +1657,50 @@ bool Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_ data.delay = p_delay; // Ensure there is a valid delta - if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) - return false; + if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) { + return; + } // Add the interpolation _push_interpolate_data(data); - return true; } -bool Tween::targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { +void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) { // If we are currently updating, call this function again later if (pending_update != 0) { _add_pending_command("targeting_method", p_object, p_method, p_initial, p_initial_method, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); - return true; + return; } // Convert final INT values to FLOAT as they are better for interpolation if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); // Make sure the given objects are valid - ERR_FAIL_COND_V(p_object == NULL, false); - ERR_FAIL_COND_V(p_initial == NULL, false); + ERR_FAIL_COND(p_object == NULL); + ERR_FAIL_COND(p_initial == NULL); // No negative durations - ERR_FAIL_COND_V(p_duration < 0, false); + ERR_FAIL_COND(p_duration < 0); // Ensure transition and easing types are valid - ERR_FAIL_COND_V(p_trans_type < 0 || p_trans_type >= TRANS_COUNT, false); - ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); + ERR_FAIL_COND(p_trans_type < 0 || p_trans_type >= TRANS_COUNT); + ERR_FAIL_COND(p_ease_type < 0 || p_ease_type >= EASE_COUNT); // No negative delays - ERR_FAIL_COND_V(p_delay < 0, false); + ERR_FAIL_COND(p_delay < 0); // Make sure both objects have the given method - ERR_FAIL_COND_V_MSG(!p_object->has_method(p_method), false, "Object has no method named: " + p_method + "."); - ERR_FAIL_COND_V_MSG(!p_initial->has_method(p_initial_method), false, "Initial Object has no method named: " + p_initial_method + "."); + ERR_FAIL_COND_MSG(!p_object->has_method(p_method), "Object has no method named: " + p_method + "."); + ERR_FAIL_COND_MSG(!p_initial->has_method(p_initial_method), "Initial Object has no method named: " + p_initial_method + "."); // Call the method to get the initial value Callable::CallError error; Variant initial_val = p_initial->call(p_initial_method, NULL, 0, error); - ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, false); + ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK); // Convert initial INT values to FLOAT as they aer better for interpolation if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t(); - ERR_FAIL_COND_V(initial_val.get_type() != p_final_val.get_type(), false); + ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type()); // Build the new InterpolateData object InterpolateData data; @@ -1741,12 +1723,12 @@ bool Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in data.delay = p_delay; // Ensure there is a valid delta - if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) - return false; + if (!_calc_delta_val(data.initial_val, data.final_val, data.delta_val)) { + return; + } // Add the interpolation _push_interpolate_data(data); - return true; } Tween::Tween() { diff --git a/scene/animation/tween.h b/scene/animation/tween.h index f1218cd698..f74df50f68 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -142,7 +142,7 @@ private: void _tween_process(float p_delta); void _remove_by_uid(int uid); void _push_interpolate_data(InterpolateData &p_data); - bool _build_interpolation(InterpolateType p_interpolation_type, Object *p_object, NodePath *p_property, StringName *p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay); + void _build_interpolation(InterpolateType p_interpolation_type, Object *p_object, NodePath *p_property, StringName *p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay); protected: bool _set(const StringName &p_name, const Variant &p_value); @@ -165,28 +165,28 @@ public: void set_speed_scale(float p_speed); float get_speed_scale() const; - bool start(); - bool reset(Object *p_object, StringName p_key); - bool reset_all(); - bool stop(Object *p_object, StringName p_key); - bool stop_all(); - bool resume(Object *p_object, StringName p_key); - bool resume_all(); - bool remove(Object *p_object, StringName p_key); - bool remove_all(); - - bool seek(real_t p_time); + void start(); + void reset(Object *p_object, StringName p_key); + void reset_all(); + void stop(Object *p_object, StringName p_key); + void stop_all(); + void resume(Object *p_object, StringName p_key); + void resume_all(); + void remove(Object *p_object, StringName p_key); + void remove_all(); + + void seek(real_t p_time); real_t tell() const; real_t get_runtime() const; - bool interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); - bool interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); - bool interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); - bool interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); - bool follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); - bool follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); - bool targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); - bool targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); + void interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); + void interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); + void interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); + void interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); + void follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); + void follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); + void targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); + void targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0); Tween(); ~Tween(); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index a7205cef66..3be77ff4b3 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -85,7 +85,7 @@ void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { bool handled = true; - switch (k->get_scancode()) { + switch (k->get_keycode()) { case KEY_H: { @@ -135,7 +135,8 @@ Vector<String> FileDialog::get_selected_files() const { void FileDialog::update_dir() { - dir->set_text(dir_access->get_current_dir()); + dir->set_text(dir_access->get_current_dir(false)); + if (drives->is_visible()) { drives->select(dir_access->get_current_drive()); } @@ -789,6 +790,12 @@ void FileDialog::_update_drives() { drives->hide(); } else { drives->clear(); + Node *dp = drives->get_parent(); + if (dp) { + dp->remove_child(drives); + } + dp = dir_access->drives_are_shortcuts() ? shortcuts_container : drives_container; + dp->add_child(drives); drives->show(); for (int i = 0; i < dir_access->get_drive_count(); i++) { @@ -829,6 +836,7 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("is_showing_hidden_files"), &FileDialog::is_showing_hidden_files); ClassDB::bind_method(D_METHOD("_update_file_name"), &FileDialog::update_file_name); ClassDB::bind_method(D_METHOD("_update_dir"), &FileDialog::update_dir); + ClassDB::bind_method(D_METHOD("_update_file_list"), &FileDialog::update_file_list); ClassDB::bind_method(D_METHOD("deselect_items"), &FileDialog::deselect_items); ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate); @@ -889,11 +897,14 @@ FileDialog::FileDialog() { hbc->add_child(dir_up); dir_up->connect("pressed", callable_mp(this, &FileDialog::_go_up)); + hbc->add_child(memnew(Label(RTR("Path:")))); + + drives_container = memnew(HBoxContainer); + hbc->add_child(drives_container); + drives = memnew(OptionButton); - hbc->add_child(drives); drives->connect("item_selected", callable_mp(this, &FileDialog::_select_drive)); - hbc->add_child(memnew(Label(RTR("Path:")))); dir = memnew(LineEdit); hbc->add_child(dir); dir->set_h_size_flags(SIZE_EXPAND_FILL); @@ -910,6 +921,9 @@ FileDialog::FileDialog() { show_hidden->connect("toggled", callable_mp(this, &FileDialog::set_show_hidden_files)); hbc->add_child(show_hidden); + shortcuts_container = memnew(HBoxContainer); + hbc->add_child(shortcuts_container); + makedir = memnew(Button); makedir->set_text(RTR("Create Folder")); makedir->connect("pressed", callable_mp(this, &FileDialog::_make_dir)); diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 9f6650c276..a7dc101d12 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -76,6 +76,8 @@ private: VBoxContainer *vbox; Mode mode; LineEdit *dir; + HBoxContainer *drives_container; + HBoxContainer *shortcuts_container; OptionButton *drives; Tree *tree; HBoxContainer *file_box; diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index c49cf0fcea..6345bfe562 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -96,7 +96,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; - if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && grabbed != -1) { + if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && grabbed != -1) { points.remove(grabbed); grabbed = -1; diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index bd29893bdf..4bc33b220e 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1043,22 +1043,22 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (k.is_valid()) { - if (k->get_scancode() == KEY_D && k->is_pressed() && k->get_command()) { + if (k->get_keycode() == KEY_D && k->is_pressed() && k->get_command()) { emit_signal("duplicate_nodes_request"); accept_event(); } - if (k->get_scancode() == KEY_C && k->is_pressed() && k->get_command()) { + if (k->get_keycode() == KEY_C && k->is_pressed() && k->get_command()) { emit_signal("copy_nodes_request"); accept_event(); } - if (k->get_scancode() == KEY_V && k->is_pressed() && k->get_command()) { + if (k->get_keycode() == KEY_V && k->is_pressed() && k->get_command()) { emit_signal("paste_nodes_request"); accept_event(); } - if (k->get_scancode() == KEY_DELETE && k->is_pressed()) { + if (k->get_keycode() == KEY_DELETE && k->is_pressed()) { emit_signal("delete_nodes_request"); accept_event(); } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 20b739d60f..fdddf0b5fa 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -165,7 +165,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { #ifdef APPLE_STYLE_KEYS if (k->get_control() && !k->get_shift() && !k->get_alt() && !k->get_command()) { uint32_t remap_key = KEY_UNKNOWN; - switch (k->get_scancode()) { + switch (k->get_keycode()) { case KEY_F: { remap_key = KEY_RIGHT; } break; @@ -193,13 +193,13 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { } if (remap_key != KEY_UNKNOWN) { - k->set_scancode(remap_key); + k->set_keycode(remap_key); k->set_control(false); } } #endif - unsigned int code = k->get_scancode(); + unsigned int code = k->get_keycode(); if (k->get_command() && is_shortcut_keys_enabled()) { @@ -571,7 +571,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if (handled) { accept_event(); } else if (!k->get_command()) { - if (k->get_unicode() >= 32 && k->get_scancode() != KEY_DELETE) { + if (k->get_unicode() >= 32 && k->get_keycode() != KEY_DELETE) { if (editable) { selection_delete(); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index c80a8b5f03..e75dadd5e0 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1075,7 +1075,7 @@ bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_fo Ref<InputEventKey> k = p_event; if (k.is_valid()) { - code = k->get_scancode(); + code = k->get_keycode(); if (code == 0) code = k->get_unicode(); if (k->get_control()) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 7a906fe91d..bc1510d6f6 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1209,7 +1209,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { if (k.is_valid()) { if (k->is_pressed() && !k->get_alt() && !k->get_shift()) { bool handled = false; - switch (k->get_scancode()) { + switch (k->get_keycode()) { case KEY_PAGEUP: { if (vscroll->is_visible_in_tree()) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 86002ed2c4..5e925bf37f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2564,9 +2564,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { k = k->duplicate(); // It will be modified later on. #ifdef OSX_ENABLED - if (k->get_scancode() == KEY_META) { + if (k->get_keycode() == KEY_META) { #else - if (k->get_scancode() == KEY_CONTROL) { + if (k->get_keycode() == KEY_CONTROL) { #endif if (select_identifiers_enabled) { @@ -2597,7 +2597,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (valid) { if (!k->get_alt()) { - if (k->get_scancode() == KEY_UP) { + if (k->get_keycode() == KEY_UP) { if (completion_index > 0) { completion_index--; @@ -2611,7 +2611,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_DOWN) { + if (k->get_keycode() == KEY_DOWN) { if (completion_index < completion_options.size() - 1) { completion_index++; @@ -2625,7 +2625,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_PAGEUP) { + if (k->get_keycode() == KEY_PAGEUP) { completion_index -= get_constant("completion_lines"); if (completion_index < 0) @@ -2636,7 +2636,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_PAGEDOWN) { + if (k->get_keycode() == KEY_PAGEDOWN) { completion_index += get_constant("completion_lines"); if (completion_index >= completion_options.size()) @@ -2647,7 +2647,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_HOME && completion_index > 0) { + if (k->get_keycode() == KEY_HOME && completion_index > 0) { completion_index = 0; completion_current = completion_options[completion_index]; @@ -2656,7 +2656,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_END && completion_index < completion_options.size() - 1) { + if (k->get_keycode() == KEY_END && completion_index < completion_options.size() - 1) { completion_index = completion_options.size() - 1; completion_current = completion_options[completion_index]; @@ -2665,14 +2665,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_KP_ENTER || k->get_scancode() == KEY_ENTER || k->get_scancode() == KEY_TAB) { + if (k->get_keycode() == KEY_KP_ENTER || k->get_keycode() == KEY_ENTER || k->get_keycode() == KEY_TAB) { _confirm_completion(); accept_event(); return; } - if (k->get_scancode() == KEY_BACKSPACE) { + if (k->get_keycode() == KEY_BACKSPACE) { _reset_caret_blink_timer(); @@ -2682,7 +2682,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_SHIFT) { + if (k->get_keycode() == KEY_SHIFT) { accept_event(); return; } @@ -2726,20 +2726,20 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { /* TEST CONTROL FIRST! */ // Some remaps for duplicate functions. - if (k->get_command() && !k->get_shift() && !k->get_alt() && !k->get_metakey() && k->get_scancode() == KEY_INSERT) { + if (k->get_command() && !k->get_shift() && !k->get_alt() && !k->get_metakey() && k->get_keycode() == KEY_INSERT) { - k->set_scancode(KEY_C); + k->set_keycode(KEY_C); } - if (!k->get_command() && k->get_shift() && !k->get_alt() && !k->get_metakey() && k->get_scancode() == KEY_INSERT) { + if (!k->get_command() && k->get_shift() && !k->get_alt() && !k->get_metakey() && k->get_keycode() == KEY_INSERT) { - k->set_scancode(KEY_V); + k->set_keycode(KEY_V); k->set_command(true); k->set_shift(false); } #ifdef APPLE_STYLE_KEYS if (k->get_control() && !k->get_shift() && !k->get_alt() && !k->get_command()) { uint32_t remap_key = KEY_UNKNOWN; - switch (k->get_scancode()) { + switch (k->get_keycode()) { case KEY_F: { remap_key = KEY_RIGHT; } break; @@ -2761,7 +2761,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } if (remap_key != KEY_UNKNOWN) { - k->set_scancode(remap_key); + k->set_keycode(remap_key); k->set_control(false); } } @@ -2779,7 +2779,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { bool unselect = false; bool dobreak = false; - switch (k->get_scancode()) { + switch (k->get_keycode()) { case KEY_TAB: { if (k->get_shift()) { @@ -2853,11 +2853,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { selection.selecting_text = false; - bool scancode_handled = true; + bool keycode_handled = true; - // Special scancode test. + // Special keycode test. - switch (k->get_scancode()) { + switch (k->get_keycode()) { case KEY_KP_ENTER: case KEY_ENTER: { @@ -2979,7 +2979,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { completion_hint = ""; update(); } else { - scancode_handled = false; + keycode_handled = false; } } break; case KEY_TAB: { @@ -3052,7 +3052,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (k->get_alt() && cursor.column > 1) { #else if (k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } else if (k->get_command() && cursor.column > 1) { #endif @@ -3109,7 +3109,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_4: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3145,7 +3145,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } else if (k->get_alt()) { #else if (k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } else if (k->get_command()) { #endif @@ -3185,7 +3185,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_6: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3207,7 +3207,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } else if (k->get_alt()) { #else if (k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } else if (k->get_command()) { #endif @@ -3246,7 +3246,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_8: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3254,7 +3254,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { case KEY_UP: { if (k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } #ifndef APPLE_STYLE_KEYS @@ -3299,7 +3299,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_2: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3307,7 +3307,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { case KEY_DOWN: { if (k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } #ifndef APPLE_STYLE_KEYS @@ -3367,7 +3367,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (k->get_alt() && cursor.column < curline_len - 1) { #else if (k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } else if (k->get_command() && cursor.column < curline_len - 1) { #endif @@ -3422,7 +3422,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_7: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3483,7 +3483,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_1: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3530,7 +3530,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_9: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3553,7 +3553,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_KP_3: { if (k->get_unicode() != 0) { - scancode_handled = false; + keycode_handled = false; break; } [[fallthrough]]; @@ -3578,7 +3578,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { #ifndef APPLE_STYLE_KEYS if (!k->get_control() || k->get_shift() || k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } if (is_shortcut_keys_enabled()) { @@ -3586,7 +3586,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } #else if ((!k->get_command() && !k->get_control())) { - scancode_handled = false; + keycode_handled = false; break; } if (!k->get_shift() && k->get_command() && is_shortcut_keys_enabled()) @@ -3617,7 +3617,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { case KEY_E: { if (!k->get_control() || k->get_command() || k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } @@ -3642,7 +3642,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { break; } if (!k->get_command() || k->get_shift() || k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } if (is_shortcut_keys_enabled()) { @@ -3653,7 +3653,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { case KEY_C: { if (!k->get_command() || k->get_shift() || k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } @@ -3669,7 +3669,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } if (!k->get_command()) { - scancode_handled = false; + keycode_handled = false; break; } @@ -3687,7 +3687,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } if (!k->get_command()) { - scancode_handled = false; + keycode_handled = false; break; } @@ -3700,7 +3700,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { break; } if (!k->get_command() || k->get_shift() || k->get_alt()) { - scancode_handled = false; + keycode_handled = false; break; } @@ -3717,9 +3717,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { #endif query_code_comple(); - scancode_handled = true; + keycode_handled = true; } else { - scancode_handled = false; + keycode_handled = false; } } break; @@ -3736,20 +3736,20 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { default: { - scancode_handled = false; + keycode_handled = false; } break; } - if (scancode_handled) + if (keycode_handled) accept_event(); - if (k->get_scancode() == KEY_INSERT) { + if (k->get_keycode() == KEY_INSERT) { set_insert_mode(!insert_mode); accept_event(); return; } - if (!scancode_handled && !k->get_command()) { // For German keyboards. + if (!keycode_handled && !k->get_command()) { // For German keyboards. if (k->get_unicode() >= 32) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 3461eef327..12b3d56938 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2439,7 +2439,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { return; } else { - if (k->get_scancode() != KEY_SHIFT) + if (k->get_keycode() != KEY_SHIFT) last_keypress = 0; } } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 649f61c1e5..370cf6a2a4 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -435,7 +435,7 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) { if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote()) { //quit from game window using F8 Ref<InputEventKey> k = ev; - if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_F8) { + if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_F8) { ScriptDebugger::get_singleton()->request_quit(); } } diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 97bd12c119..238bdf05ef 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -403,8 +403,6 @@ Ref<PackedScene> ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars return Ref<PackedScene>(); } } - - return packed_scene; } Error ResourceLoaderText::load() { @@ -671,10 +669,6 @@ Error ResourceLoaderText::load() { return error; } } - - if (progress) { - *progress = resource_current / float(resources_total); - } } //for scene files @@ -731,9 +725,15 @@ void ResourceLoaderText::set_translation_remapped(bool p_remapped) { } ResourceLoaderText::ResourceLoaderText() { + resources_total = 0; + resource_current = 0; + use_sub_threads = false; + progress = nullptr; + lines = false; translation_remapped = false; use_sub_threads = false; + error = OK; } ResourceLoaderText::~ResourceLoaderText() { |