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/navigation_region.cpp | 14 | ||||
-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/debugger/scene_debugger.cpp | 21 | ||||
-rw-r--r-- | scene/debugger/scene_debugger.h | 5 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 19 | ||||
-rw-r--r-- | scene/gui/file_dialog.h | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 34 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 1 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 10 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 5 | ||||
-rw-r--r-- | scene/resources/mesh.cpp | 16 | ||||
-rw-r--r-- | scene/resources/primitive_meshes.cpp | 2 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 12 |
19 files changed, 209 insertions, 191 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/navigation_region.cpp b/scene/3d/navigation_region.cpp index d96d095797..53b707a29a 100644 --- a/scene/3d/navigation_region.cpp +++ b/scene/3d/navigation_region.cpp @@ -162,22 +162,22 @@ Ref<NavigationMesh> NavigationRegion::get_navigation_mesh() const { } struct BakeThreadsArgs { - NavigationRegion *nav_mesh_instance; + NavigationRegion *nav_region; }; void _bake_navigation_mesh(void *p_user_data) { BakeThreadsArgs *args = static_cast<BakeThreadsArgs *>(p_user_data); - if (args->nav_mesh_instance->get_navigation_mesh().is_valid()) { - Ref<NavigationMesh> nav_mesh = args->nav_mesh_instance->get_navigation_mesh()->duplicate(); + if (args->nav_region->get_navigation_mesh().is_valid()) { + Ref<NavigationMesh> nav_mesh = args->nav_region->get_navigation_mesh()->duplicate(); - NavigationServer::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_mesh_instance); - args->nav_mesh_instance->call_deferred("_bake_finished", nav_mesh); + NavigationServer::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_region); + args->nav_region->call_deferred("_bake_finished", nav_mesh); memdelete(args); } else { ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist"); - args->nav_mesh_instance->call_deferred("_bake_finished", Ref<NavigationMesh>()); + args->nav_region->call_deferred("_bake_finished", Ref<NavigationMesh>()); memdelete(args); } } @@ -186,7 +186,7 @@ void NavigationRegion::bake_navigation_mesh() { ERR_FAIL_COND(bake_thread != NULL); BakeThreadsArgs *args = memnew(BakeThreadsArgs); - args->nav_mesh_instance = this; + args->nav_region = this; bake_thread = Thread::create(_bake_navigation_mesh, args); ERR_FAIL_COND(bake_thread == NULL); 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/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 22ff0611a7..2a98b4cf22 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -30,8 +30,9 @@ #include "scene_debugger.h" +#include "core/debugger/engine_debugger.h" #include "core/io/marshalls.h" -#include "core/script_debugger_remote.h" +#include "core/script_language.h" #include "scene/main/scene_tree.h" #include "scene/main/viewport.h" #include "scene/resources/packed_scene.h" @@ -39,13 +40,16 @@ void SceneDebugger::initialize() { #ifdef DEBUG_ENABLED LiveEditor::singleton = memnew(LiveEditor); - ScriptDebuggerRemote::scene_tree_parse_func = SceneDebugger::parse_message; + EngineDebugger::register_message_capture("scene", EngineDebugger::Capture(NULL, SceneDebugger::parse_message)); #endif } void SceneDebugger::deinitialize() { #ifdef DEBUG_ENABLED if (LiveEditor::singleton) { + // Should be removed automatically when deiniting debugger, but just in case + if (EngineDebugger::has_capture("scene")) + EngineDebugger::unregister_message_capture("scene"); memdelete(LiveEditor::singleton); LiveEditor::singleton = NULL; } @@ -53,13 +57,15 @@ void SceneDebugger::deinitialize() { } #ifdef DEBUG_ENABLED -Error SceneDebugger::parse_message(const String &p_msg, const Array &p_args) { +Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured) { SceneTree *scene_tree = SceneTree::get_singleton(); if (!scene_tree) return ERR_UNCONFIGURED; LiveEditor *live_editor = LiveEditor::get_singleton(); if (!live_editor) return ERR_UNCONFIGURED; + + r_captured = true; if (p_msg == "request_scene_tree") { // Scene tree live_editor->_send_tree(); @@ -171,7 +177,7 @@ Error SceneDebugger::parse_message(const String &p_msg, const Array &p_args) { ERR_FAIL_COND_V(p_args.size() < 4, ERR_INVALID_DATA); live_editor->_reparent_node_func(p_args[0], p_args[1], p_args[2], p_args[3]); } else { - return ERR_SKIP; + r_captured = false; } return OK; } @@ -180,7 +186,6 @@ void SceneDebugger::_save_node(ObjectID id, const String &p_path) { Node *node = Object::cast_to<Node>(ObjectDB::get_instance(id)); ERR_FAIL_COND(!node); - WARN_PRINT("SAVING " + itos(id) + " TO " + p_path); Ref<PackedScene> ps = memnew(PackedScene); ps->pack(node); ResourceSaver::save(p_path, ps); @@ -193,7 +198,7 @@ void SceneDebugger::_send_object_id(ObjectID p_id, int p_max_size) { Array arr; obj.serialize(arr); - ScriptDebugger::get_singleton()->send_message("inspect_object", arr); + EngineDebugger::get_singleton()->send_message("scene:inspect_object", arr); } void SceneDebugger::_set_object_property(ObjectID p_id, const String &p_property, const Variant &p_value) { @@ -216,7 +221,7 @@ void SceneDebugger::add_to_cache(const String &p_filename, Node *p_node) { if (!debugger) return; - if (ScriptDebugger::get_singleton() && p_filename != String()) { + if (EngineDebugger::get_script_debugger() && p_filename != String()) { debugger->live_scene_edit_cache[p_filename].insert(p_node); } } @@ -487,7 +492,7 @@ void LiveEditor::_send_tree() { // Encoded as a flat list depth fist. SceneDebuggerTree tree(scene_tree->root); tree.serialize(arr); - ScriptDebugger::get_singleton()->send_message("scene_tree", arr); + EngineDebugger::get_singleton()->send_message("scene:scene_tree", arr); } void LiveEditor::_node_path_func(const NodePath &p_path, int p_id) { diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.h index d22f8e8e18..afe58a5d01 100644 --- a/scene/debugger/scene_debugger.h +++ b/scene/debugger/scene_debugger.h @@ -34,9 +34,10 @@ #include "core/array.h" #include "core/object.h" #include "core/pair.h" -#include "core/script_language.h" #include "core/ustring.h" +class Script; + class SceneDebugger { public: @@ -50,7 +51,7 @@ private: static void _send_object_id(ObjectID p_id, int p_max_size = 1 << 20); public: - static Error parse_message(const String &p_msg, const Array &p_args); + static Error parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured); static void add_to_cache(const String &p_filename, Node *p_node); static void remove_from_cache(const String &p_filename, Node *p_node); #endif diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 1d813d8081..3be77ff4b3 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -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++) { @@ -890,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); @@ -911,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/text_edit.cpp b/scene/gui/text_edit.cpp index 5e925bf37f..06691d09be 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1856,6 +1856,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) { bool in_single_quote = false; bool in_double_quote = false; + bool found_comment = false; int c = 0; while (c < line.length()) { @@ -1865,6 +1866,9 @@ void TextEdit::_consume_pair_symbol(CharType ch) { if (cursor.column == c) { break; } + } else if (!in_single_quote && !in_double_quote && line[c] == '#') { + found_comment = true; + break; } else { if (line[c] == '\'' && !in_double_quote) { in_single_quote = !in_single_quote; @@ -1880,7 +1884,15 @@ void TextEdit::_consume_pair_symbol(CharType ch) { } } - // Disallow inserting duplicated quotes while already in string + // Do not need to duplicate quotes while in comments + if (found_comment) { + insert_text_at_cursor(ch_single); + cursor_set_column(cursor_position_to_move); + + return; + } + + // Disallow inserting duplicated quotes while already in string if ((in_single_quote || in_double_quote) && (ch == '"' || ch == '\'')) { insert_text_at_cursor(ch_single); cursor_set_column(cursor_position_to_move); @@ -2517,13 +2529,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { String new_word = get_word_at_pos(mm->get_position()); if (new_word != highlighted_word) { - highlighted_word = new_word; - update(); + emit_signal("symbol_validate", new_word); } } else { if (highlighted_word != String()) { - highlighted_word = String(); - update(); + set_highlighted_word(String()); } } } @@ -2572,13 +2582,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (select_identifiers_enabled) { if (k->is_pressed() && !dragging_minimap && !dragging_selection) { - - highlighted_word = get_word_at_pos(get_local_mouse_position()); - update(); - + emit_signal("symbol_validate", get_word_at_pos(get_local_mouse_position())); } else { - highlighted_word = String(); - update(); + set_highlighted_word(String()); } } } @@ -6996,6 +7002,11 @@ void TextEdit::menu_option(int p_option) { } } +void TextEdit::set_highlighted_word(const String &new_word) { + highlighted_word = new_word; + update(); +} + void TextEdit::set_select_identifiers_on_hover(bool p_enable) { select_identifiers_enabled = p_enable; @@ -7213,6 +7224,7 @@ void TextEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo(Variant::INT, "row"))); ADD_SIGNAL(MethodInfo("symbol_lookup", PropertyInfo(Variant::STRING, "symbol"), PropertyInfo(Variant::INT, "row"), PropertyInfo(Variant::INT, "column"))); ADD_SIGNAL(MethodInfo("info_clicked", PropertyInfo(Variant::INT, "row"), PropertyInfo(Variant::STRING, "info"))); + ADD_SIGNAL(MethodInfo("symbol_validate", PropertyInfo(Variant::STRING, "symbol"))); BIND_ENUM_CONSTANT(MENU_CUT); BIND_ENUM_CONSTANT(MENU_COPY); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 6e267f5a47..3c9d1a5c85 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -585,6 +585,7 @@ public: bool is_insert_text_operation(); + void set_highlighted_word(const String &new_word); void set_text(String p_text); void insert_text_at_cursor(const String &p_text); void insert_at(const String &p_text, int at); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 370cf6a2a4..57bb3b6b5e 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -30,6 +30,7 @@ #include "scene_tree.h" +#include "core/debugger/engine_debugger.h" #include "core/io/marshalls.h" #include "core/io/resource_loader.h" #include "core/message_queue.h" @@ -38,7 +39,6 @@ #include "core/os/os.h" #include "core/print_string.h" #include "core/project_settings.h" -#include "core/script_debugger_remote.h" #include "main/input_default.h" #include "node.h" #include "scene/debugger/scene_debugger.h" @@ -432,11 +432,11 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) { call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_vp_input", ev); //special one for GUI, as controls use their own process check - if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote()) { + if (EngineDebugger::is_active()) { //quit from game window using F8 Ref<InputEventKey> k = ev; if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_F8) { - ScriptDebugger::get_singleton()->request_quit(); + EngineDebugger::get_singleton()->send_message("request_quit", Array()); } } @@ -1737,10 +1737,6 @@ SceneTree::SceneTree() { last_screen_size = Size2(OS::get_singleton()->get_window_size().width, OS::get_singleton()->get_window_size().height); _update_root_rect(); - if (ScriptDebugger::get_singleton()) { - ScriptDebugger::get_singleton()->set_multiplayer(multiplayer); - } - root->set_physics_object_picking(GLOBAL_DEF("physics/common/enable_object_picking", true)); #ifdef TOOLS_ENABLED diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e027ec9b4b..c11b11bc71 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -31,6 +31,7 @@ #include "viewport.h" #include "core/core_string_names.h" +#include "core/debugger/engine_debugger.h" #include "core/os/input.h" #include "core/os/os.h" #include "core/project_settings.h" @@ -1927,12 +1928,12 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { mb->set_position(pos); #ifdef DEBUG_ENABLED - if (ScriptDebugger::get_singleton() && gui.mouse_focus) { + if (EngineDebugger::get_singleton() && gui.mouse_focus) { Array arr; arr.push_back(gui.mouse_focus->get_path()); arr.push_back(gui.mouse_focus->get_class()); - ScriptDebugger::get_singleton()->send_message("click_ctrl", arr); + EngineDebugger::get_singleton()->send_message("scene:click_ctrl", arr); } #endif diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index a063b7f74f..5e032c41bf 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -252,10 +252,12 @@ Ref<Shape> Mesh::create_trimesh_shape() const { Vector<Vector3> face_points; face_points.resize(faces.size() * 3); - for (int i = 0; i < face_points.size(); i++) { + for (int i = 0; i < face_points.size(); i += 3) { Face3 f = faces.get(i / 3); - face_points.set(i, f.vertex[i % 3]); + face_points.set(i, f.vertex[0]); + face_points.set(i + 1, f.vertex[1]); + face_points.set(i + 2, f.vertex[2]); } Ref<ConcavePolygonShape> shape = memnew(ConcavePolygonShape); @@ -543,15 +545,9 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const { ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape> >()); - Vector<Face3> faces = get_faces(); - Vector<Face3> f3; - f3.resize(faces.size()); - const Face3 *f = faces.ptr(); - for (int i = 0; i < f3.size(); i++) { - f3.write[i] = f[i]; - } + const Vector<Face3> faces = get_faces(); - Vector<Vector<Face3> > decomposed = convex_composition_function(f3); + Vector<Vector<Face3> > decomposed = convex_composition_function(faces); Vector<Ref<Shape> > ret; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 00fc016ca1..959ee214a2 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -150,7 +150,7 @@ Array PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) const { uint32_t PrimitiveMesh::surface_get_format(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, 1, 0); - return VS::ARRAY_COMPRESS_DEFAULT; + return VS::ARRAY_FORMAT_VERTEX | VS::ARRAY_FORMAT_NORMAL | VS::ARRAY_FORMAT_TANGENT | VS::ARRAY_FORMAT_TEX_UV | VS::ARRAY_FORMAT_INDEX | VS::ARRAY_COMPRESS_DEFAULT; } Mesh::PrimitiveType PrimitiveMesh::surface_get_primitive_type(int p_idx) const { 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() { |