diff options
Diffstat (limited to 'scene')
54 files changed, 388 insertions, 239 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index c2edb173d7..5982556c18 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -298,10 +298,8 @@ void AnimatedSprite::_validate_property(PropertyInfo &property) const { property.hint = PROPERTY_HINT_SPRITE_FRAME; - if (frames->has_animation(animation)) { + if (frames->has_animation(animation) && frames->get_frame_count(animation) > 1) { property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1"; - } else { - property.hint_string = "0,0,0"; } } } diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index c40aeb764e..73e633139b 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -113,7 +113,7 @@ void AudioStreamPlayer2D::_notification(int p_what) { AudioServer::get_singleton()->remove_callback(_mix_audios, this); } - if (p_what == NOTIFICATION_INTERNAL_FIXED_PROCESS) { + if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) { //update anything related to position first, if possible of course @@ -203,7 +203,7 @@ void AudioStreamPlayer2D::_notification(int p_what) { //stop playing if no longer active if (!active) { - set_fixed_process_internal(false); + set_physics_process_internal(false); //do not update, this makes it easier to animate (will shut off otherise) //_change_notify("playing"); //update property in editor emit_signal("finished"); @@ -255,7 +255,7 @@ void AudioStreamPlayer2D::play(float p_from_pos) { if (stream_playback.is_valid()) { setplay = p_from_pos; output_ready = false; - set_fixed_process_internal(true); + set_physics_process_internal(true); } } @@ -270,7 +270,7 @@ void AudioStreamPlayer2D::stop() { if (stream_playback.is_valid()) { active = false; - set_fixed_process_internal(false); + set_physics_process_internal(false); setplay = -1; } } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 0d04967f1c..4fcd6893b8 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -138,7 +138,7 @@ Transform2D Camera2D::get_camera_transform() { if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) { - float c = smoothing * get_fixed_process_delta_time(); + float c = smoothing * get_physics_process_delta_time(); smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos; ret_camera_pos = smoothed_camera_pos; //camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing; @@ -212,14 +212,14 @@ void Camera2D::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { _update_scroll(); } break; case NOTIFICATION_TRANSFORM_CHANGED: { - if (!is_fixed_processing()) + if (!is_physics_processing()) _update_scroll(); } break; @@ -241,7 +241,7 @@ void Camera2D::_notification(int p_what) { add_to_group(canvas_group_name); if (Engine::get_singleton()->is_editor_hint()) { - set_fixed_process(false); + set_physics_process(false); } _update_scroll(); @@ -498,9 +498,9 @@ void Camera2D::set_follow_smoothing(float p_speed) { smoothing = p_speed; if (smoothing > 0 && !(is_inside_tree() && Engine::get_singleton()->is_editor_hint())) - set_fixed_process(true); + set_physics_process(true); else - set_fixed_process(false); + set_physics_process(false); } float Camera2D::get_follow_smoothing() const { diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index c6cd3677cd..d3b37ae903 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -999,7 +999,7 @@ bool KinematicBody2D::move_and_collide(const Vector2 &p_motion, Collision &r_col Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) { - Vector2 motion = (floor_velocity + p_linear_velocity) * get_fixed_process_delta_time(); + Vector2 motion = (floor_velocity + p_linear_velocity) * get_physics_process_delta_time(); Vector2 lv = p_linear_velocity; on_floor = false; diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index f90331c411..b272da46f8 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -95,7 +95,7 @@ void RayCast2D::set_enabled(bool p_enabled) { enabled = p_enabled; if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) - set_fixed_process(p_enabled); + set_physics_process(p_enabled); if (!p_enabled) collided = false; } @@ -135,9 +135,9 @@ void RayCast2D::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { if (enabled && !Engine::get_singleton()->is_editor_hint()) - set_fixed_process(true); + set_physics_process(true); else - set_fixed_process(false); + set_physics_process(false); if (Object::cast_to<PhysicsBody2D>(get_parent())) { if (exclude_parent_body) @@ -149,7 +149,7 @@ void RayCast2D::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: { if (enabled) - set_fixed_process(false); + set_physics_process(false); } break; @@ -177,7 +177,7 @@ void RayCast2D::_notification(int p_what) { } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { if (!enabled) break; diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 8fc8b65217..ca7b6aa0e4 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -154,8 +154,8 @@ void VisibilityEnabler2D::_screen_enter() { _change_node_state(E->key(), true); } - if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent()) - get_parent()->set_fixed_process(true); + if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent()) + get_parent()->set_physics_process(true); if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) get_parent()->set_process(true); @@ -169,8 +169,8 @@ void VisibilityEnabler2D::_screen_exit() { _change_node_state(E->key(), false); } - if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent()) - get_parent()->set_fixed_process(false); + if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent()) + get_parent()->set_physics_process(false); if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) get_parent()->set_process(false); @@ -246,8 +246,8 @@ void VisibilityEnabler2D::_notification(int p_what) { _find_nodes(from); - if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent()) - get_parent()->set_fixed_process(false); + if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent()) + get_parent()->set_physics_process(false); if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) get_parent()->set_process(false); } @@ -339,14 +339,14 @@ void VisibilityEnabler2D::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_particles"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_PARTICLES); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animated_sprites"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATED_SPRITES); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PROCESS); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_FIXED_PROCESS); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "physics_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PHYSICS_PROCESS); BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES); BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS); BIND_ENUM_CONSTANT(ENABLER_PAUSE_PARTICLES); BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES); BIND_ENUM_CONSTANT(ENABLER_PARENT_PROCESS); - BIND_ENUM_CONSTANT(ENABLER_PARENT_FIXED_PROCESS); + BIND_ENUM_CONSTANT(ENABLER_PARENT_PHYSICS_PROCESS); BIND_ENUM_CONSTANT(ENABLER_MAX); } @@ -366,7 +366,7 @@ VisibilityEnabler2D::VisibilityEnabler2D() { for (int i = 0; i < ENABLER_MAX; i++) enabler[i] = true; enabler[ENABLER_PARENT_PROCESS] = false; - enabler[ENABLER_PARENT_FIXED_PROCESS] = false; + enabler[ENABLER_PARENT_PHYSICS_PROCESS] = false; visible = false; } diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h index ef0e1affd3..ee5152978b 100644 --- a/scene/2d/visibility_notifier_2d.h +++ b/scene/2d/visibility_notifier_2d.h @@ -74,7 +74,7 @@ public: ENABLER_FREEZE_BODIES, ENABLER_PAUSE_PARTICLES, ENABLER_PARENT_PROCESS, - ENABLER_PARENT_FIXED_PROCESS, + ENABLER_PARENT_PHYSICS_PROCESS, ENABLER_PAUSE_ANIMATED_SPRITES, ENABLER_MAX }; diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 147d3bf115..c6b6c02129 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -67,6 +67,105 @@ String ARVRCamera::get_configuration_warning() const { return String(); }; +Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector3()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3()); + + if (!is_inside_tree()) { + ERR_EXPLAIN("Camera is not inside scene."); + ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); + }; + + Size2 viewport_size = get_viewport()->get_camera_rect_size(); + Vector2 cpos = get_viewport()->get_camera_coords(p_pos); + Vector3 ray; + + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + float screen_w, screen_h; + cm.get_viewport_size(screen_w, screen_h); + ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_w, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_h, -get_znear()).normalized(); + + return ray; +}; + +Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector2()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector2()); + + if (!is_inside_tree()) { + ERR_EXPLAIN("Camera is not inside scene."); + ERR_FAIL_COND_V(!is_inside_tree(), Vector2()); + }; + + Size2 viewport_size = get_viewport()->get_visible_rect().size; + + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + + Plane p(get_camera_transform().xform_inv(p_pos), 1.0); + + p = cm.xform4(p); + p.normal /= p.d; + + Point2 res; + res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x; + res.y = (-p.normal.y * 0.5 + 0.5) * viewport_size.y; + + return res; +}; + +Vector3 ARVRCamera::project_position(const Point2 &p_point) const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector3()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3()); + + if (!is_inside_tree()) { + ERR_EXPLAIN("Camera is not inside scene."); + ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); + }; + + Size2 viewport_size = get_viewport()->get_visible_rect().size; + + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + + Size2 vp_size; + cm.get_viewport_size(vp_size.x, vp_size.y); + + Vector2 point; + point.x = (p_point.x / viewport_size.x) * 2.0 - 1.0; + point.y = (1.0 - (p_point.y / viewport_size.y)) * 2.0 - 1.0; + point *= vp_size; + + Vector3 p(point.x, point.y, -get_znear()); + + return get_camera_transform().xform(p); +}; + +Vector<Plane> ARVRCamera::get_frustum() const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector<Plane>()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector<Plane>()); + + ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>()); + + Size2 viewport_size = get_viewport()->get_visible_rect().size; + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + return cm.get_projection_planes(get_camera_transform()); +}; + ARVRCamera::ARVRCamera(){ // nothing to do here yet for now.. }; @@ -297,6 +396,8 @@ void ARVRAnchor::_bind_methods() { ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRAnchor::get_is_active); ClassDB::bind_method(D_METHOD("get_size"), &ARVRAnchor::get_size); + + ClassDB::bind_method(D_METHOD("get_plane"), &ARVRAnchor::get_plane); }; void ARVRAnchor::set_anchor_id(int p_anchor_id) { @@ -346,6 +447,15 @@ String ARVRAnchor::get_configuration_warning() const { return String(); }; +Plane ARVRAnchor::get_plane() const { + Vector3 location = get_translation(); + Basis orientation = get_transform().basis; + + Plane plane(location, orientation.get_axis(1).normalized()); + + return plane; +}; + ARVRAnchor::ARVRAnchor() { anchor_id = 0; is_active = true; diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index 5269ec0248..e0ccfab58b 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -52,6 +52,11 @@ protected: public: String get_configuration_warning() const; + virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const; + virtual Point2 unproject_position(const Vector3 &p_pos) const; + virtual Vector3 project_position(const Point2 &p_point) const; + virtual Vector<Plane> get_frustum() const; + ARVRCamera(); ~ARVRCamera(); }; @@ -118,6 +123,8 @@ public: bool get_is_active() const; Vector3 get_size() const; + Plane get_plane() const; + String get_configuration_warning() const; ARVRAnchor(); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 7bc8c9e89e..3c92814c87 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -214,7 +214,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { } } - if (p_what == NOTIFICATION_INTERNAL_FIXED_PROCESS) { + if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) { //update anything related to position first, if possible of course @@ -512,7 +512,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { //stop playing if no longer active if (!active) { - set_fixed_process_internal(false); + set_physics_process_internal(false); //do not update, this makes it easier to animate (will shut off otherise) //_change_notify("playing"); //update property in editor emit_signal("finished"); @@ -582,7 +582,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) { if (stream_playback.is_valid()) { setplay = p_from_pos; output_ready = false; - set_fixed_process_internal(true); + set_physics_process_internal(true); } } @@ -597,7 +597,7 @@ void AudioStreamPlayer3D::stop() { if (stream_playback.is_valid()) { active = false; - set_fixed_process_internal(false); + set_physics_process_internal(false); setplay = -1; } } @@ -776,7 +776,7 @@ void AudioStreamPlayer3D::set_doppler_tracking(DopplerTracking p_tracking) { if (doppler_tracking != DOPPLER_TRACKING_DISABLED) { set_notify_transform(true); - velocity_tracker->set_track_fixed_step(doppler_tracking == DOPPLER_TRACKING_FIXED_STEP); + velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP); velocity_tracker->reset(get_global_transform().origin); } else { set_notify_transform(false); @@ -880,7 +880,7 @@ void AudioStreamPlayer3D::_bind_methods() { BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED); BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP); - BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP); ADD_SIGNAL(MethodInfo("finished")); } diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index 2c2d4610c8..5982d7a3ac 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -26,7 +26,7 @@ public: enum DopplerTracking { DOPPLER_TRACKING_DISABLED, DOPPLER_TRACKING_IDLE_STEP, - DOPPLER_TRACKING_FIXED_STEP + DOPPLER_TRACKING_PHYSICS_STEP }; private: diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 02a7845e0b..7baf9a9deb 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -507,7 +507,7 @@ void Camera::set_doppler_tracking(DopplerTracking p_tracking) { doppler_tracking = p_tracking; if (p_tracking != DOPPLER_TRACKING_DISABLED) { - velocity_tracker->set_track_fixed_step(doppler_tracking == DOPPLER_TRACKING_FIXED_STEP); + velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP); velocity_tracker->reset(get_global_transform().origin); } } @@ -557,7 +557,7 @@ void Camera::_bind_methods() { BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED) BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP) - BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP) } float Camera::get_fov() const { diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 243a7b9b39..73c6844c1a 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -56,7 +56,7 @@ public: enum DopplerTracking { DOPPLER_TRACKING_DISABLED, DOPPLER_TRACKING_IDLE_STEP, - DOPPLER_TRACKING_FIXED_STEP + DOPPLER_TRACKING_PHYSICS_STEP }; private: @@ -127,16 +127,16 @@ public: virtual Transform get_camera_transform() const; Vector3 project_ray_normal(const Point2 &p_pos) const; - Vector3 project_ray_origin(const Point2 &p_pos) const; + virtual Vector3 project_ray_origin(const Point2 &p_pos) const; Vector3 project_local_ray_normal(const Point2 &p_pos) const; - Point2 unproject_position(const Vector3 &p_pos) const; + virtual Point2 unproject_position(const Vector3 &p_pos) const; bool is_position_behind(const Vector3 &p_pos) const; - Vector3 project_position(const Point2 &p_point) const; + virtual Vector3 project_position(const Point2 &p_point) const; void set_cull_mask(uint32_t p_layers); uint32_t get_cull_mask() const; - Vector<Plane> get_frustum() const; + virtual Vector<Plane> get_frustum() const; void set_environment(const Ref<Environment> &p_environment); Ref<Environment> get_environment() const; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 66364d40f9..9d55a82824 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1486,8 +1486,8 @@ GIProbe::GIProbe() { subdiv = SUBDIV_128; dynamic_range = 4; energy = 1.0; - bias = 0.0; - normal_bias = 0.8; + bias = 1.5; + normal_bias = 0.0; propagation = 1.0; extents = Vector3(10, 10, 10); color_scan_cell_width = 4; diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 0f281b694d..3ff8317732 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -37,7 +37,7 @@ void InterpolatedCamera::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { if (Engine::get_singleton()->is_editor_hint() && enabled) - set_fixed_process(false); + set_physics_process(false); } break; case NOTIFICATION_PROCESS: { diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index d8c7a78648..b226cca02b 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -35,8 +35,6 @@ void Navigation::_navmesh_link(int p_id) { NavMesh &nm = navmesh_map[p_id]; ERR_FAIL_COND(nm.linked); - print_line("LINK"); - PoolVector<Vector3> vertices = nm.navmesh->get_vertices(); int len = vertices.size(); if (len == 0) @@ -144,8 +142,6 @@ void Navigation::_navmesh_unlink(int p_id) { NavMesh &nm = navmesh_map[p_id]; ERR_FAIL_COND(!nm.linked); - print_line("UNLINK"); - for (List<Polygon>::Element *E = nm.polygons.front(); E; E = E->next()) { Polygon &p = E->get(); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 80c706898d..73749cacb3 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -462,8 +462,6 @@ void ParticlesMaterial::finish_shaders() { void ParticlesMaterial::_update_shader() { - print_line("updating shader"); - dirty_materials.remove(&element); MaterialKey mk = _compute_key(); @@ -913,9 +911,7 @@ void ParticlesMaterial::_queue_shader_change() { if (material_mutex) material_mutex->lock(); - print_line("queuing change"); if (!element.in_list()) { - print_line("not in list, adding"); dirty_materials.add(&element); } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 005ea1f8d1..d7fdf94d40 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -960,7 +960,7 @@ bool KinematicBody::move_and_collide(const Vector3 &p_motion, Collision &r_colli Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) { - Vector3 motion = (floor_velocity + p_linear_velocity) * get_fixed_process_delta_time(); + Vector3 motion = (floor_velocity + p_linear_velocity) * get_physics_process_delta_time(); Vector3 lv = p_linear_velocity; on_floor = false; diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 72b7706b77..df6764ee1a 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -97,7 +97,7 @@ void RayCast::set_enabled(bool p_enabled) { enabled = p_enabled; if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) - set_fixed_process(p_enabled); + set_physics_process(p_enabled); if (!p_enabled) collided = false; @@ -121,25 +121,25 @@ void RayCast::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { if (enabled && !Engine::get_singleton()->is_editor_hint()) { - set_fixed_process(true); + set_physics_process(true); if (get_tree()->is_debugging_collisions_hint()) _update_debug_shape(); } else - set_fixed_process(false); + set_physics_process(false); } break; case NOTIFICATION_EXIT_TREE: { if (enabled) { - set_fixed_process(false); + set_physics_process(false); } if (debug_shape) _clear_debug_shape(); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { if (!enabled) break; diff --git a/scene/3d/spatial_velocity_tracker.cpp b/scene/3d/spatial_velocity_tracker.cpp index dc822d0446..1c7423e645 100644 --- a/scene/3d/spatial_velocity_tracker.cpp +++ b/scene/3d/spatial_velocity_tracker.cpp @@ -1,21 +1,21 @@ #include "spatial_velocity_tracker.h" #include "engine.h" -void SpatialVelocityTracker::set_track_fixed_step(bool p_track_fixed_step) { +void SpatialVelocityTracker::set_track_physics_step(bool p_track_physics_step) { - fixed_step = p_track_fixed_step; + physics_step = p_track_physics_step; } -bool SpatialVelocityTracker::is_tracking_fixed_step() const { +bool SpatialVelocityTracker::is_tracking_physics_step() const { - return fixed_step; + return physics_step; } void SpatialVelocityTracker::update_position(const Vector3 &p_position) { PositionHistory ph; ph.position = p_position; - if (fixed_step) { - ph.frame = Engine::get_singleton()->get_fixed_frames(); + if (physics_step) { + ph.frame = Engine::get_singleton()->get_physics_frames(); } else { ph.frame = Engine::get_singleton()->get_idle_frame_ticks(); } @@ -40,8 +40,8 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const { float base_time = 0.0; if (position_history_len) { - if (fixed_step) { - uint64_t base = Engine::get_singleton()->get_fixed_frames(); + if (physics_step) { + uint64_t base = Engine::get_singleton()->get_physics_frames(); base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second(); } else { uint64_t base = Engine::get_singleton()->get_idle_frame_ticks(); @@ -54,7 +54,7 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const { uint64_t diff = position_history[i].frame - position_history[i + 1].frame; Vector3 distance = position_history[i].position - position_history[i + 1].position; - if (fixed_step) { + if (physics_step) { delta = float(diff) / Engine::get_singleton()->get_iterations_per_second(); } else { delta = double(diff) / 1000000.0; @@ -78,8 +78,8 @@ void SpatialVelocityTracker::reset(const Vector3 &p_new_pos) { PositionHistory ph; ph.position = p_new_pos; - if (fixed_step) { - ph.frame = Engine::get_singleton()->get_fixed_frames(); + if (physics_step) { + ph.frame = Engine::get_singleton()->get_physics_frames(); } else { ph.frame = Engine::get_singleton()->get_idle_frame_ticks(); } @@ -90,8 +90,8 @@ void SpatialVelocityTracker::reset(const Vector3 &p_new_pos) { void SpatialVelocityTracker::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_track_fixed_step", "enable"), &SpatialVelocityTracker::set_track_fixed_step); - ClassDB::bind_method(D_METHOD("is_tracking_fixed_step"), &SpatialVelocityTracker::is_tracking_fixed_step); + ClassDB::bind_method(D_METHOD("set_track_physics_step", "enable"), &SpatialVelocityTracker::set_track_physics_step); + ClassDB::bind_method(D_METHOD("is_tracking_physics_step"), &SpatialVelocityTracker::is_tracking_physics_step); ClassDB::bind_method(D_METHOD("update_position", "position"), &SpatialVelocityTracker::update_position); ClassDB::bind_method(D_METHOD("get_tracked_linear_velocity"), &SpatialVelocityTracker::get_tracked_linear_velocity); ClassDB::bind_method(D_METHOD("reset", "position"), &SpatialVelocityTracker::reset); @@ -100,5 +100,5 @@ void SpatialVelocityTracker::_bind_methods() { SpatialVelocityTracker::SpatialVelocityTracker() { position_history.resize(4); // should be configurable position_history_len = 0; - fixed_step = false; + physics_step = false; } diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h index b8237613a7..c4371ff1f7 100644 --- a/scene/3d/spatial_velocity_tracker.h +++ b/scene/3d/spatial_velocity_tracker.h @@ -11,7 +11,7 @@ class SpatialVelocityTracker : public Reference { Vector3 position; }; - bool fixed_step; + bool physics_step; Vector<PositionHistory> position_history; int position_history_len; @@ -20,8 +20,8 @@ protected: public: void reset(const Vector3 &p_new_pos); - void set_track_fixed_step(bool p_track_fixed_step); - bool is_tracking_fixed_step() const; + void set_track_physics_step(bool p_track_physics_step); + bool is_tracking_physics_step() const; void update_position(const Vector3 &p_position); Vector3 get_tracked_linear_velocity() const; diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index cadbd086bc..c4cfce5d72 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -192,7 +192,7 @@ void AnimationPlayer::_notification(int p_what) { if (!processing) { //make sure that a previous process state was not saved //only process if "processing" is set - set_fixed_process(false); + set_physics_process(false); set_process(false); } //_set_process(false); @@ -207,19 +207,19 @@ void AnimationPlayer::_notification(int p_what) { } } break; case NOTIFICATION_INTERNAL_PROCESS: { - if (animation_process_mode == ANIMATION_PROCESS_FIXED) + if (animation_process_mode == ANIMATION_PROCESS_PHYSICS) break; if (processing) _animation_process(get_process_delta_time()); } break; - case NOTIFICATION_INTERNAL_FIXED_PROCESS: { + case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (animation_process_mode == ANIMATION_PROCESS_IDLE) break; if (processing) - _animation_process(get_fixed_process_delta_time()); + _animation_process(get_physics_process_delta_time()); } break; case NOTIFICATION_EXIT_TREE: { @@ -434,7 +434,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float pa->object->set(pa->prop, value, &valid); //you are not speshul #ifdef DEBUG_ENABLED if (!valid) { - ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid"); + ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid. Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -442,7 +442,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_POS: { #ifdef DEBUG_ENABLED if (value.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2(). Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif static_cast<Node2D *>(pa->object)->set_position(value); @@ -450,7 +450,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED if (value.is_num()) { - ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical"); + ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical. Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -459,7 +459,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED if (value.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()." + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -529,12 +529,12 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f if (&cd == &playback.current) { - if (!backwards && cd.pos < len && next_pos == len /*&& playback.blend.empty()*/) { + if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) { //playback finished end_notify = true; } - if (backwards && cd.pos > 0 && next_pos == 0 /*&& playback.blend.empty()*/) { + if (backwards && cd.pos >= 0 && next_pos == 0 /*&& playback.blend.empty()*/) { //playback finished end_notify = true; } @@ -615,7 +615,7 @@ void AnimationPlayer::_animation_update_transforms() { pa->object->set(pa->prop, pa->value_accum, &valid); //you are not speshul #ifdef DEBUG_ENABLED if (!valid) { - ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property"); + ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property"); } #endif @@ -623,7 +623,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_POS: { #ifdef DEBUG_ENABLED if (pa->value_accum.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); } #endif static_cast<Node2D *>(pa->object)->set_position(pa->value_accum); @@ -631,7 +631,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED if (pa->value_accum.is_num()) { - ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not numerical"); + ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not numerical"); } #endif @@ -640,7 +640,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED if (pa->value_accum.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); } #endif @@ -1140,7 +1140,7 @@ void AnimationPlayer::_set_process(bool p_process, bool p_force) { switch (animation_process_mode) { - case ANIMATION_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break; + case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break; case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break; } @@ -1262,7 +1262,7 @@ void AnimationPlayer::_bind_methods() { ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name"))); ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "name"))); - BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED); + BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE); } diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index bface7aabb..83da3b2e5c 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -44,7 +44,7 @@ class AnimationPlayer : public Node { public: enum AnimationProcessMode { - ANIMATION_PROCESS_FIXED, + ANIMATION_PROCESS_PHYSICS, ANIMATION_PROCESS_IDLE, }; diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index a2a8adb653..d564671bcf 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -56,7 +56,7 @@ void AnimationTreePlayer::_set_process(bool p_process, bool p_force) { switch (animation_process_mode) { - case ANIMATION_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break; + case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break; case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break; } @@ -405,7 +405,7 @@ void AnimationTreePlayer::_notification(int p_what) { if (!processing) { //make sure that a previous process state was not saved //only process if "processing" is set - set_fixed_process_internal(false); + set_physics_process_internal(false); set_process_internal(false); } } break; @@ -416,19 +416,19 @@ void AnimationTreePlayer::_notification(int p_what) { } } break; case NOTIFICATION_INTERNAL_PROCESS: { - if (animation_process_mode == ANIMATION_PROCESS_FIXED) + if (animation_process_mode == ANIMATION_PROCESS_PHYSICS) break; if (processing) _process_animation(get_process_delta_time()); } break; - case NOTIFICATION_INTERNAL_FIXED_PROCESS: { + case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (animation_process_mode == ANIMATION_PROCESS_IDLE) break; if (processing) - _process_animation(get_fixed_process_delta_time()); + _process_animation(get_physics_process_delta_time()); } break; } } @@ -1809,7 +1809,7 @@ void AnimationTreePlayer::_bind_methods() { BIND_ENUM_CONSTANT(NODE_TIMESEEK); BIND_ENUM_CONSTANT(NODE_TRANSITION); - BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED); + BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE); } diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 806a4f6604..3e2bb88198 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -42,7 +42,7 @@ class AnimationTreePlayer : public Node { public: enum AnimationProcessMode { - ANIMATION_PROCESS_FIXED, + ANIMATION_PROCESS_PHYSICS, ANIMATION_PROCESS_IDLE, }; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index fb61c43d5c..fb327191b9 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -152,7 +152,7 @@ void Tween::_notification(int p_what) { if (!processing) { //make sure that a previous process state was not saved //only process if "processing" is set - set_fixed_process_internal(false); + set_physics_process_internal(false); set_process_internal(false); } } break; @@ -160,19 +160,19 @@ void Tween::_notification(int p_what) { } break; case NOTIFICATION_INTERNAL_PROCESS: { - if (tween_process_mode == TWEEN_PROCESS_FIXED) + if (tween_process_mode == TWEEN_PROCESS_PHYSICS) break; if (processing) _tween_process(get_process_delta_time()); } break; - case NOTIFICATION_INTERNAL_FIXED_PROCESS: { + case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (tween_process_mode == TWEEN_PROCESS_IDLE) break; if (processing) - _tween_process(get_fixed_process_delta_time()); + _tween_process(get_physics_process_delta_time()); } break; case NOTIFICATION_EXIT_TREE: { @@ -224,7 +224,7 @@ void Tween::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_tween_process_mode", "get_tween_process_mode"); - BIND_ENUM_CONSTANT(TWEEN_PROCESS_FIXED); + BIND_ENUM_CONSTANT(TWEEN_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(TWEEN_PROCESS_IDLE); BIND_ENUM_CONSTANT(TRANS_LINEAR); @@ -642,7 +642,7 @@ void Tween::_set_process(bool p_process, bool p_force) { switch (tween_process_mode) { - case TWEEN_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break; + case TWEEN_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break; case TWEEN_PROCESS_IDLE: set_process_internal(p_process && active); break; } diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 929d63a7fc..fac1d346b4 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -38,7 +38,7 @@ class Tween : public Node { public: enum TweenProcessMode { - TWEEN_PROCESS_FIXED, + TWEEN_PROCESS_PHYSICS, TWEEN_PROCESS_IDLE, }; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index e58cbe373b..dbd7c1bbc0 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -40,12 +40,15 @@ void ColorPicker::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { //sample->set_texture(get_icon("color_sample")); + btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); + bt_add_preset->set_icon(get_icon("add_preset")); _update_controls(); } break; case NOTIFICATION_ENTER_TREE: { btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); + bt_add_preset->set_icon(get_icon("add_preset")); _update_color(); } break; @@ -601,7 +604,6 @@ ColorPicker::ColorPicker() preset->connect("draw", this, "_update_presets"); bt_add_preset = memnew(Button); - bt_add_preset->set_icon(get_icon("add_preset")); bt_add_preset->set_tooltip(TTR("Add current color as a preset")); bt_add_preset->connect("pressed", this, "_add_preset_pressed"); bbc->add_child(bt_add_preset); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 87a232e766..d8ff048dfb 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -115,6 +115,9 @@ Vector<String> FileDialog::get_selected_files() const { void FileDialog::update_dir() { dir->set_text(dir_access->get_current_dir()); + if (drives->is_visible()) { + drives->select(dir_access->get_current_drive()); + } } void FileDialog::_dir_entered(String p_dir) { @@ -666,7 +669,6 @@ void FileDialog::_update_drives() { drives->show(); for (int i = 0; i < dir_access->get_drive_count(); i++) { - String d = dir_access->get_drive(i); drives->add_item(dir_access->get_drive(i)); } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 0d3cccc2b5..946a8c47a3 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -284,7 +284,6 @@ void GraphEdit::_notification(int p_what) { zoom_reset->set_icon(get_icon("reset")); zoom_plus->set_icon(get_icon("more")); snap_button->set_icon(get_icon("snap")); - //zoom_icon->set_texture( get_icon("Zoom", "EditorIcons")); } if (p_what == NOTIFICATION_DRAW) { diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 8ca487f2bd..ed8eff436c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -601,7 +601,10 @@ void LineEdit::_notification(int p_what) { } break; case ALIGN_CENTER: { - x_ofs = int(size.width - (cached_width)) / 2; + if (window_pos != 0) + x_ofs = style->get_offset().x; + else + x_ofs = int(size.width - (cached_width)) / 2; } break; case ALIGN_RIGHT: { @@ -846,7 +849,10 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { } break; case ALIGN_CENTER: { - pixel_ofs = int(size.width - (cached_width)) / 2; + if (window_pos != 0) + pixel_ofs = int(style->get_offset().x); + else + pixel_ofs = int(size.width - (cached_width)) / 2; } break; case ALIGN_RIGHT: { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index d9287e6f63..c2ce2a633e 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1949,7 +1949,7 @@ void RichTextLabel::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_percent_visible", "get_percent_visible"); - ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta"))); + ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); BIND_ENUM_CONSTANT(ALIGN_LEFT); BIND_ENUM_CONSTANT(ALIGN_CENTER); diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 6044b86ef5..c5ffec2d5e 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -113,7 +113,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) { if (smooth_scroll_enabled) { scrolling = true; - set_fixed_process(true); + set_physics_process(true); } else { set_value(target_scroll); } @@ -137,7 +137,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) { if (smooth_scroll_enabled) { scrolling = true; - set_fixed_process(true); + set_physics_process(true); } else { set_value(target_scroll); } @@ -335,13 +335,13 @@ void ScrollBar::_notification(int p_what) { drag_slave = NULL; } - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { if (scrolling) { if (get_value() != target_scroll) { double target = target_scroll - get_value(); double dist = sqrt(target * target); - double vel = ((target / dist) * 500) * get_fixed_process_delta_time(); + double vel = ((target / dist) * 500) * get_physics_process_delta_time(); if (Math::abs(vel) >= dist) { set_value(target_scroll); @@ -350,14 +350,14 @@ void ScrollBar::_notification(int p_what) { } } else { scrolling = false; - set_fixed_process(false); + set_physics_process(false); } } else if (drag_slave_touching) { if (drag_slave_touching_deaccel) { Vector2 pos = Vector2(orientation == HORIZONTAL ? get_value() : 0, orientation == VERTICAL ? get_value() : 0); - pos += drag_slave_speed * get_fixed_process_delta_time(); + pos += drag_slave_speed * get_physics_process_delta_time(); bool turnoff = false; @@ -377,7 +377,7 @@ void ScrollBar::_notification(int p_what) { float sgn_x = drag_slave_speed.x < 0 ? -1 : 1; float val_x = Math::abs(drag_slave_speed.x); - val_x -= 1000 * get_fixed_process_delta_time(); + val_x -= 1000 * get_physics_process_delta_time(); if (val_x < 0) { turnoff = true; @@ -401,7 +401,7 @@ void ScrollBar::_notification(int p_what) { float sgn_y = drag_slave_speed.y < 0 ? -1 : 1; float val_y = Math::abs(drag_slave_speed.y); - val_y -= 1000 * get_fixed_process_delta_time(); + val_y -= 1000 * get_physics_process_delta_time(); if (val_y < 0) { turnoff = true; @@ -410,7 +410,7 @@ void ScrollBar::_notification(int p_what) { } if (turnoff) { - set_fixed_process(false); + set_physics_process(false); drag_slave_touching = false; drag_slave_touching_deaccel = false; } @@ -421,10 +421,10 @@ void ScrollBar::_notification(int p_what) { Vector2 diff = drag_slave_accum - last_drag_slave_accum; last_drag_slave_accum = drag_slave_accum; - drag_slave_speed = diff / get_fixed_process_delta_time(); + drag_slave_speed = diff / get_physics_process_delta_time(); } - time_since_motion += get_fixed_process_delta_time(); + time_since_motion += get_physics_process_delta_time(); } } } @@ -579,7 +579,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) { if (mb->is_pressed()) { if (drag_slave_touching) { - set_fixed_process(false); + set_physics_process(false); drag_slave_touching_deaccel = false; drag_slave_touching = false; drag_slave_speed = Vector2(); @@ -599,7 +599,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) { drag_slave_touching_deaccel = false; time_since_motion = 0; if (drag_slave_touching) { - set_fixed_process(true); + set_physics_process(true); time_since_motion = 0; } } @@ -611,7 +611,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) { if (drag_slave_speed == Vector2()) { drag_slave_touching_deaccel = false; drag_slave_touching = false; - set_fixed_process(false); + set_physics_process(false); } else { drag_slave_touching_deaccel = true; diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index c71093b947..1ad1e3f638 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -67,7 +67,7 @@ Size2 ScrollContainer::get_minimum_size() const { }; void ScrollContainer::_cancel_drag() { - set_fixed_process(false); + set_physics_process(false); drag_touching_deaccel = false; drag_touching = false; drag_speed = Vector2(); @@ -121,7 +121,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) { if (mb->is_pressed()) { if (drag_touching) { - set_fixed_process(false); + set_physics_process(false); drag_touching_deaccel = false; drag_touching = false; drag_speed = Vector2(); @@ -139,7 +139,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) { drag_touching_deaccel = false; time_since_motion = 0; if (drag_touching) { - set_fixed_process(true); + set_physics_process(true); time_since_motion = 0; } } @@ -150,7 +150,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) { if (drag_speed == Vector2()) { drag_touching_deaccel = false; drag_touching = false; - set_fixed_process(false); + set_physics_process(false); } else { drag_touching_deaccel = true; @@ -257,14 +257,14 @@ void ScrollContainer::_notification(int p_what) { update_scrollbars(); } - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { if (drag_touching) { if (drag_touching_deaccel) { Vector2 pos = Vector2(h_scroll->get_value(), v_scroll->get_value()); - pos += drag_speed * get_fixed_process_delta_time(); + pos += drag_speed * get_physics_process_delta_time(); bool turnoff_h = false; bool turnoff_v = false; @@ -294,7 +294,7 @@ void ScrollContainer::_notification(int p_what) { float sgn_x = drag_speed.x < 0 ? -1 : 1; float val_x = Math::abs(drag_speed.x); - val_x -= 1000 * get_fixed_process_delta_time(); + val_x -= 1000 * get_physics_process_delta_time(); if (val_x < 0) { turnoff_h = true; @@ -302,7 +302,7 @@ void ScrollContainer::_notification(int p_what) { float sgn_y = drag_speed.y < 0 ? -1 : 1; float val_y = Math::abs(drag_speed.y); - val_y -= 1000 * get_fixed_process_delta_time(); + val_y -= 1000 * get_physics_process_delta_time(); if (val_y < 0) { turnoff_v = true; @@ -311,7 +311,7 @@ void ScrollContainer::_notification(int p_what) { drag_speed = Vector2(sgn_x * val_x, sgn_y * val_y); if (turnoff_h && turnoff_v) { - set_fixed_process(false); + set_physics_process(false); drag_touching = false; drag_touching_deaccel = false; } @@ -322,10 +322,10 @@ void ScrollContainer::_notification(int p_what) { Vector2 diff = drag_accum - last_drag_accum; last_drag_accum = drag_accum; - drag_speed = diff / get_fixed_process_delta_time(); + drag_speed = diff / get_physics_process_delta_time(); } - time_since_motion += get_fixed_process_delta_time(); + time_since_motion += get_physics_process_delta_time(); } } } diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp index 3db234f7cc..55d837458a 100644 --- a/scene/gui/separator.cpp +++ b/scene/gui/separator.cpp @@ -32,7 +32,11 @@ Size2 Separator::get_minimum_size() const { Size2 ms(3, 3); - ms[orientation] = get_constant("separation"); + if (orientation == VERTICAL) { + ms.x = get_constant("separation"); + } else { // HORIZONTAL + ms.y = get_constant("separation"); + } return ms; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 11bdbfc3e8..33c29547be 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -428,22 +428,22 @@ void TextEdit::_notification(int p_what) { draw_caret = false; update(); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { if (scrolling && v_scroll->get_value() != target_v_scroll) { double target_y = target_v_scroll - v_scroll->get_value(); double dist = sqrt(target_y * target_y); - double vel = ((target_y / dist) * v_scroll_speed) * get_fixed_process_delta_time(); + double vel = ((target_y / dist) * v_scroll_speed) * get_physics_process_delta_time(); if (Math::abs(vel) >= dist) { v_scroll->set_value(target_v_scroll); scrolling = false; - set_fixed_process(false); + set_physics_process(false); } else { v_scroll->set_value(v_scroll->get_value() + vel); } } else { scrolling = false; - set_fixed_process(false); + set_physics_process(false); } } break; case NOTIFICATION_DRAW: { @@ -1610,7 +1610,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { target_v_scroll = 0; } scrolling = true; - set_fixed_process(true); + set_physics_process(true); } else { v_scroll->set_value(target_v_scroll); } @@ -1632,7 +1632,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { target_v_scroll = max_v_scroll; } scrolling = true; - set_fixed_process(true); + set_physics_process(true); } else { v_scroll->set_value(target_v_scroll); } @@ -4287,6 +4287,14 @@ int TextEdit::get_v_scroll() const { } void TextEdit::set_v_scroll(int p_scroll) { + if (p_scroll < 0) { + p_scroll = 0; + } + if (!scroll_past_end_of_file_enabled) { + if (p_scroll + get_visible_rows() > get_line_count()) { + p_scroll = get_line_count() - get_visible_rows(); + } + } v_scroll->set_value(p_scroll); cursor.line_ofs = p_scroll; } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 613e5520a9..178a1c272b 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2493,7 +2493,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { if (drag_speed == 0) { drag_touching_deaccel = false; drag_touching = false; - set_fixed_process(false); + set_physics_process(false); } else { drag_touching_deaccel = true; @@ -2559,7 +2559,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { break; if (drag_touching) { - set_fixed_process(false); + set_physics_process(false); drag_touching_deaccel = false; drag_touching = false; drag_speed = 0; @@ -2574,7 +2574,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { drag_touching = OS::get_singleton()->has_touchscreen_ui_hint(); drag_touching_deaccel = false; if (drag_touching) { - set_fixed_process(true); + set_physics_process(true); } } @@ -2765,7 +2765,7 @@ void Tree::_notification(int p_what) { drop_mode_flags = 0; scrolling = false; - set_fixed_process(false); + set_physics_process(false); update(); } if (p_what == NOTIFICATION_DRAG_BEGIN) { @@ -2773,23 +2773,23 @@ void Tree::_notification(int p_what) { single_select_defer = NULL; if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) { scrolling = true; - set_fixed_process(true); + set_physics_process(true); } } - if (p_what == NOTIFICATION_FIXED_PROCESS) { + if (p_what == NOTIFICATION_PHYSICS_PROCESS) { if (drag_touching) { if (drag_touching_deaccel) { float pos = v_scroll->get_value(); - pos += drag_speed * get_fixed_process_delta_time(); + pos += drag_speed * get_physics_process_delta_time(); bool turnoff = false; if (pos < 0) { pos = 0; turnoff = true; - set_fixed_process(false); + set_physics_process(false); drag_touching = false; drag_touching_deaccel = false; } @@ -2801,7 +2801,7 @@ void Tree::_notification(int p_what) { v_scroll->set_value(pos); float sgn = drag_speed < 0 ? -1 : 1; float val = Math::abs(drag_speed); - val -= 1000 * get_fixed_process_delta_time(); + val -= 1000 * get_physics_process_delta_time(); if (val < 0) { turnoff = true; @@ -2809,7 +2809,7 @@ void Tree::_notification(int p_what) { drag_speed = sgn * val; if (turnoff) { - set_fixed_process(false); + set_physics_process(false); drag_touching = false; drag_touching_deaccel = false; } @@ -2834,7 +2834,7 @@ void Tree::_notification(int p_what) { } else { point.y = 0; } - point *= cache.scroll_speed * get_fixed_process_delta_time(); + point *= cache.scroll_speed * get_physics_process_delta_time(); point += get_scroll(); h_scroll->set_value(point.x); v_scroll->set_value(point.y); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 816556af30..190ccd50d5 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -285,6 +285,12 @@ float VideoPlayer::get_stream_position() const { return playback->get_playback_position(); }; +void VideoPlayer::set_stream_position(float p_position) { + + if (playback.is_valid()) + playback->seek(p_position); +} + Ref<Texture> VideoPlayer::get_video_texture() { if (playback.is_valid()) @@ -327,6 +333,7 @@ void VideoPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoPlayer::get_stream_name); + ClassDB::bind_method(D_METHOD("set_stream_position", "position"), &VideoPlayer::set_stream_position); ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoPlayer::get_stream_position); ClassDB::bind_method(D_METHOD("set_autoplay", "enabled"), &VideoPlayer::set_autoplay); diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h index bea10907bb..f04e90365f 100644 --- a/scene/gui/video_player.h +++ b/scene/gui/video_player.h @@ -93,6 +93,7 @@ public: String get_stream_name() const; float get_stream_position() const; + void set_stream_position(float p_position); void set_autoplay(bool p_enable); bool has_autoplay() const; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 658701dcc7..c2a31b4a8b 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -54,13 +54,13 @@ void Node::_notification(int p_notification) { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_process, ptr, 1); } } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { if (get_script_instance()) { - Variant time = get_fixed_process_delta_time(); + Variant time = get_physics_process_delta_time(); const Variant *ptr[1] = { &time }; - get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_fixed_process, ptr, 1); + get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_physics_process, ptr, 1); } } break; @@ -129,8 +129,8 @@ void Node::_notification(int p_notification) { set_process(true); } - if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_fixed_process)) { - set_fixed_process(true); + if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_physics_process)) { + set_physics_process(true); } get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0); @@ -367,46 +367,46 @@ void Node::move_child_notify(Node *p_child) { // to be used when not wanted } -void Node::set_fixed_process(bool p_process) { +void Node::set_physics_process(bool p_process) { - if (data.fixed_process == p_process) + if (data.physics_process == p_process) return; - data.fixed_process = p_process; + data.physics_process = p_process; - if (data.fixed_process) - add_to_group("fixed_process", false); + if (data.physics_process) + add_to_group("physics_process", false); else - remove_from_group("fixed_process"); + remove_from_group("physics_process"); - data.fixed_process = p_process; - _change_notify("fixed_process"); + data.physics_process = p_process; + _change_notify("physics_process"); } -bool Node::is_fixed_processing() const { +bool Node::is_physics_processing() const { - return data.fixed_process; + return data.physics_process; } -void Node::set_fixed_process_internal(bool p_process_internal) { +void Node::set_physics_process_internal(bool p_process_internal) { - if (data.fixed_process_internal == p_process_internal) + if (data.physics_process_internal == p_process_internal) return; - data.fixed_process_internal = p_process_internal; + data.physics_process_internal = p_process_internal; - if (data.fixed_process_internal) - add_to_group("fixed_process_internal", false); + if (data.physics_process_internal) + add_to_group("physics_process_internal", false); else - remove_from_group("fixed_process_internal"); + remove_from_group("physics_process_internal"); - data.fixed_process_internal = p_process_internal; - _change_notify("fixed_process_internal"); + data.physics_process_internal = p_process_internal; + _change_notify("physics_process_internal"); } -bool Node::is_fixed_processing_internal() const { +bool Node::is_physics_processing_internal() const { - return data.fixed_process_internal; + return data.physics_process_internal; } void Node::set_pause_mode(PauseMode p_mode) { @@ -1010,10 +1010,10 @@ bool Node::can_process() const { return true; } -float Node::get_fixed_process_delta_time() const { +float Node::get_physics_process_delta_time() const { if (data.tree) - return data.tree->get_fixed_process_time(); + return data.tree->get_physics_process_time(); else return 0; } @@ -2719,9 +2719,9 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("get_filename"), &Node::get_filename); ClassDB::bind_method(D_METHOD("propagate_notification", "what"), &Node::propagate_notification); ClassDB::bind_method(D_METHOD("propagate_call", "method", "args", "parent_first"), &Node::propagate_call, DEFVAL(Array()), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("set_fixed_process", "enable"), &Node::set_fixed_process); - ClassDB::bind_method(D_METHOD("get_fixed_process_delta_time"), &Node::get_fixed_process_delta_time); - ClassDB::bind_method(D_METHOD("is_fixed_processing"), &Node::is_fixed_processing); + ClassDB::bind_method(D_METHOD("set_physics_process", "enable"), &Node::set_physics_process); + ClassDB::bind_method(D_METHOD("get_physics_process_delta_time"), &Node::get_physics_process_delta_time); + ClassDB::bind_method(D_METHOD("is_physics_processing"), &Node::is_physics_processing); ClassDB::bind_method(D_METHOD("get_process_delta_time"), &Node::get_process_delta_time); ClassDB::bind_method(D_METHOD("set_process", "enable"), &Node::set_process); ClassDB::bind_method(D_METHOD("is_processing"), &Node::is_processing); @@ -2742,8 +2742,8 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("set_process_internal", "enable"), &Node::set_process_internal); ClassDB::bind_method(D_METHOD("is_processing_internal"), &Node::is_processing_internal); - ClassDB::bind_method(D_METHOD("set_fixed_process_internal", "enable"), &Node::set_fixed_process_internal); - ClassDB::bind_method(D_METHOD("is_fixed_processing_internal"), &Node::is_fixed_processing_internal); + ClassDB::bind_method(D_METHOD("set_physics_process_internal", "enable"), &Node::set_physics_process_internal); + ClassDB::bind_method(D_METHOD("is_physics_processing_internal"), &Node::is_physics_processing_internal); ClassDB::bind_method(D_METHOD("get_tree"), &Node::get_tree); @@ -2801,7 +2801,7 @@ void Node::_bind_methods() { BIND_CONSTANT(NOTIFICATION_EXIT_TREE); BIND_CONSTANT(NOTIFICATION_MOVED_IN_PARENT); BIND_CONSTANT(NOTIFICATION_READY); - BIND_CONSTANT(NOTIFICATION_FIXED_PROCESS); + BIND_CONSTANT(NOTIFICATION_PHYSICS_PROCESS); BIND_CONSTANT(NOTIFICATION_PROCESS); BIND_CONSTANT(NOTIFICATION_PARENTED); BIND_CONSTANT(NOTIFICATION_UNPARENTED); @@ -2813,7 +2813,7 @@ void Node::_bind_methods() { BIND_CONSTANT(NOTIFICATION_PATH_CHANGED); BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED); BIND_CONSTANT(NOTIFICATION_INTERNAL_PROCESS); - BIND_CONSTANT(NOTIFICATION_INTERNAL_FIXED_PROCESS); + BIND_CONSTANT(NOTIFICATION_INTERNAL_PHYSICS_PROCESS); BIND_ENUM_CONSTANT(RPC_MODE_DISABLED); BIND_ENUM_CONSTANT(RPC_MODE_REMOTE); @@ -2835,7 +2835,7 @@ void Node::_bind_methods() { ADD_SIGNAL(MethodInfo("tree_exited")); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),"set_process","is_processing") ; - //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), "set_fixed_process","is_fixed_processing") ; + //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/physics_process" ), "set_physics_process","is_physics_processing") ; //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/input" ), "set_process_input","is_processing_input" ) ; //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), "set_process_unhandled_input","is_processing_unhandled_input" ) ; ADD_GROUP("Pause", "pause_"); @@ -2843,7 +2843,7 @@ void Node::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "editor/display_folded", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_display_folded", "is_displayed_folded"); BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta"))); - BIND_VMETHOD(MethodInfo("_fixed_process", PropertyInfo(Variant::REAL, "delta"))); + BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta"))); BIND_VMETHOD(MethodInfo("_enter_tree")); BIND_VMETHOD(MethodInfo("_exit_tree")); BIND_VMETHOD(MethodInfo("_ready")); @@ -2872,9 +2872,9 @@ Node::Node() { data.blocked = 0; data.parent = NULL; data.tree = NULL; - data.fixed_process = false; + data.physics_process = false; data.idle_process = false; - data.fixed_process_internal = false; + data.physics_process_internal = false; data.idle_process_internal = false; data.inside_tree = false; data.ready_notified = false; diff --git a/scene/main/node.h b/scene/main/node.h index 12d6310062..c43e96063f 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -121,10 +121,10 @@ private: // variables used to properly sort the node when processing, ignored otherwise //should move all the stuff below to bits - bool fixed_process; + bool physics_process; bool idle_process; - bool fixed_process_internal; + bool physics_process_internal; bool idle_process_internal; bool input; @@ -213,7 +213,7 @@ public: NOTIFICATION_READY = 13, NOTIFICATION_PAUSED = 14, NOTIFICATION_UNPAUSED = 15, - NOTIFICATION_FIXED_PROCESS = 16, + NOTIFICATION_PHYSICS_PROCESS = 16, NOTIFICATION_PROCESS = 17, NOTIFICATION_PARENTED = 18, NOTIFICATION_UNPARENTED = 19, @@ -223,7 +223,7 @@ public: NOTIFICATION_PATH_CHANGED = 23, NOTIFICATION_TRANSLATION_CHANGED = 24, NOTIFICATION_INTERNAL_PROCESS = 25, - NOTIFICATION_INTERNAL_FIXED_PROCESS = 26, + NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26, }; @@ -299,16 +299,16 @@ public: void propagate_call(const StringName &p_method, const Array &p_args = Array(), const bool p_parent_first = false); /* PROCESSING */ - void set_fixed_process(bool p_process); - float get_fixed_process_delta_time() const; - bool is_fixed_processing() const; + void set_physics_process(bool p_process); + float get_physics_process_delta_time() const; + bool is_physics_processing() const; void set_process(bool p_idle_process); float get_process_delta_time() const; bool is_processing() const; - void set_fixed_process_internal(bool p_process_internal); - bool is_fixed_processing_internal() const; + void set_physics_process_internal(bool p_process_internal); + bool is_physics_processing_internal() const; void set_process_internal(bool p_idle_process_internal); bool is_processing_internal() const; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 5a1388458b..7a28e2a6f8 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -446,12 +446,12 @@ bool SceneTree::iteration(float p_time) { _flush_transform_notifications(); MainLoop::iteration(p_time); - fixed_process_time = p_time; + physics_process_time = p_time; - emit_signal("fixed_frame"); + emit_signal("physics_frame"); - _notify_group_pause("fixed_process_internal", Node::NOTIFICATION_INTERNAL_FIXED_PROCESS); - _notify_group_pause("fixed_process", Node::NOTIFICATION_FIXED_PROCESS); + _notify_group_pause("physics_process_internal", Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); + _notify_group_pause("physics_process", Node::NOTIFICATION_PHYSICS_PROCESS); _flush_ugc(); MessageQueue::get_singleton()->flush(); //small little hack _flush_transform_notifications(); @@ -2194,7 +2194,7 @@ void SceneTree::_bind_methods() { ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node"))); ADD_SIGNAL(MethodInfo("idle_frame")); - ADD_SIGNAL(MethodInfo("fixed_frame")); + ADD_SIGNAL(MethodInfo("physics_frame")); ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "screen"))); ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id"))); @@ -2254,7 +2254,7 @@ SceneTree::SceneTree() { collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000); tree_version = 1; - fixed_process_time = 1; + physics_process_time = 1; idle_process_time = 1; last_id = 1; root = NULL; diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index c116bec4fc..f3e689adab 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -105,7 +105,7 @@ private: Viewport *root; uint64_t tree_version; - float fixed_process_time; + float physics_process_time; float idle_process_time; bool accept_quit; bool quit_on_go_back; @@ -358,7 +358,7 @@ public: void set_input_as_handled(); bool is_input_handled(); - _FORCE_INLINE_ float get_fixed_process_time() const { return fixed_process_time; } + _FORCE_INLINE_ float get_physics_process_time() const { return physics_process_time; } _FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; } #ifdef TOOLS_ENABLED diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index df7d609ac0..23854b5f59 100755 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -47,7 +47,7 @@ void Timer::_notification(int p_what) { } } break; case NOTIFICATION_INTERNAL_PROCESS: { - if (timer_process_mode == TIMER_PROCESS_FIXED || !is_processing_internal()) + if (timer_process_mode == TIMER_PROCESS_PHYSICS || !is_processing_internal()) return; time_left -= get_process_delta_time(); @@ -61,10 +61,10 @@ void Timer::_notification(int p_what) { } } break; - case NOTIFICATION_INTERNAL_FIXED_PROCESS: { - if (timer_process_mode == TIMER_PROCESS_IDLE || !is_fixed_processing_internal()) + case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { + if (timer_process_mode == TIMER_PROCESS_IDLE || !is_physics_processing_internal()) return; - time_left -= get_fixed_process_delta_time(); + time_left -= get_physics_process_delta_time(); if (time_left < 0) { if (!one_shot) @@ -144,16 +144,16 @@ void Timer::set_timer_process_mode(TimerProcessMode p_mode) { return; switch (timer_process_mode) { - case TIMER_PROCESS_FIXED: - if (is_fixed_processing_internal()) { - set_fixed_process_internal(false); + case TIMER_PROCESS_PHYSICS: + if (is_physics_processing_internal()) { + set_physics_process_internal(false); set_process_internal(true); } break; case TIMER_PROCESS_IDLE: if (is_processing_internal()) { set_process_internal(false); - set_fixed_process_internal(true); + set_physics_process_internal(true); } break; } @@ -167,7 +167,7 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const { void Timer::_set_process(bool p_process, bool p_force) { switch (timer_process_mode) { - case TIMER_PROCESS_FIXED: set_fixed_process_internal(p_process && !paused); break; + case TIMER_PROCESS_PHYSICS: set_physics_process_internal(p_process && !paused); break; case TIMER_PROCESS_IDLE: set_process_internal(p_process && !paused); break; } processing = p_process; @@ -204,7 +204,7 @@ void Timer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "is_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autostart"), "set_autostart", "has_autostart"); - BIND_ENUM_CONSTANT(TIMER_PROCESS_FIXED); + BIND_ENUM_CONSTANT(TIMER_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE); } diff --git a/scene/main/timer.h b/scene/main/timer.h index 0cd92f12de..a02adbb0a3 100755 --- a/scene/main/timer.h +++ b/scene/main/timer.h @@ -50,7 +50,7 @@ protected: public: enum TimerProcessMode { - TIMER_PROCESS_FIXED, + TIMER_PROCESS_PHYSICS, TIMER_PROCESS_IDLE, }; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e19f2031dd..37a393b55b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -456,10 +456,10 @@ void Viewport::_notification(int p_what) { VS::get_singleton()->viewport_set_active(viewport, false); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { if (gui.tooltip_timer >= 0) { - gui.tooltip_timer -= get_fixed_process_delta_time(); + gui.tooltip_timer -= get_physics_process_delta_time(); if (gui.tooltip_timer < 0) { _gui_show_tooltip(); } @@ -2453,7 +2453,7 @@ Rect2 Viewport::get_attach_to_screen_rect() const { void Viewport::set_physics_object_picking(bool p_enable) { physics_object_picking = p_enable; - set_fixed_process(physics_object_picking); + set_physics_process(physics_object_picking); if (!physics_object_picking) physics_picking_events.clear(); } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index b9dfbd6bb0..75268aad1f 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -222,13 +222,18 @@ void register_scene_types() { String font_path = GLOBAL_DEF("gui/theme/custom_font", ""); ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); + bool has_theme = false; if (theme_path != String()) { Ref<Theme> theme = ResourceLoader::load(theme_path); if (theme.is_valid()) { Theme::set_default(theme); + has_theme = true; + } else { + ERR_PRINTS("Error loading custom theme '" + theme_path + "'"); } - } else { + } + if (!has_theme) { Ref<Font> font; if (font_path != String()) { font = ResourceLoader::load(font_path); @@ -261,9 +266,11 @@ void register_scene_types() { ClassDB::register_class<Control>(); ClassDB::register_class<Button>(); ClassDB::register_class<Label>(); + ClassDB::register_class<ScrollBar>(); ClassDB::register_class<HScrollBar>(); ClassDB::register_class<VScrollBar>(); ClassDB::register_class<ProgressBar>(); + ClassDB::register_class<Slider>(); ClassDB::register_class<HSlider>(); ClassDB::register_class<VSlider>(); ClassDB::register_class<Popup>(); @@ -347,6 +354,7 @@ void register_scene_types() { #ifndef _3D_DISABLED ClassDB::register_class<BoneAttachment>(); ClassDB::register_virtual_class<VisualInstance>(); + ClassDB::register_virtual_class<GeometryInstance>(); ClassDB::register_class<Camera>(); ClassDB::register_class<Listener>(); ClassDB::register_class<ARVRCamera>(); @@ -356,6 +364,7 @@ void register_scene_types() { ClassDB::register_class<InterpolatedCamera>(); ClassDB::register_class<MeshInstance>(); ClassDB::register_class<ImmediateGeometry>(); + ClassDB::register_virtual_class<SpriteBase3D>(); ClassDB::register_class<Sprite3D>(); ClassDB::register_class<AnimatedSprite3D>(); ClassDB::register_virtual_class<Light>(); @@ -375,6 +384,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init ClassDB::register_virtual_class<CollisionObject>(); + ClassDB::register_virtual_class<PhysicsBody>(); ClassDB::register_class<StaticBody>(); ClassDB::register_class<RigidBody>(); ClassDB::register_class<KinematicCollision>(); @@ -489,6 +499,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init + ClassDB::register_virtual_class<Shape>(); ClassDB::register_class<RayShape>(); ClassDB::register_class<SphereShape>(); ClassDB::register_class<BoxShape>(); @@ -526,6 +537,7 @@ void register_scene_types() { ClassDB::register_class<DynamicFontData>(); ClassDB::register_class<DynamicFont>(); + ClassDB::register_virtual_class<StyleBox>(); ClassDB::register_class<StyleBoxEmpty>(); ClassDB::register_class<StyleBoxTexture>(); ClassDB::register_class<StyleBoxFlat>(); diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 1fd84a860e..fdc3b79db6 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -486,7 +486,8 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const { { PoolVector<uint8_t>::Write w = pv.write(); - copymem(w.ptr(), data, data_bytes); + uint8_t *dataptr = (uint8_t *)data; + copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); } } diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index daa8fc1874..79cc94c911 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -485,17 +485,17 @@ void Curve::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points); ClassDB::bind_method(D_METHOD("get_point_position", "index"), &Curve::get_point_position); ClassDB::bind_method(D_METHOD("set_point_value", "index", "y"), &Curve::set_point_value); - ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_value); + ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_offset); ClassDB::bind_method(D_METHOD("interpolate", "offset"), &Curve::interpolate); ClassDB::bind_method(D_METHOD("interpolate_baked", "offset"), &Curve::interpolate_baked); ClassDB::bind_method(D_METHOD("get_point_left_tangent", "index"), &Curve::get_point_left_tangent); - ClassDB::bind_method(D_METHOD("get_point_right_tangent", "index"), &Curve::get_point_left_tangent); + ClassDB::bind_method(D_METHOD("get_point_right_tangent", "index"), &Curve::get_point_right_tangent); ClassDB::bind_method(D_METHOD("get_point_left_mode", "index"), &Curve::get_point_left_mode); - ClassDB::bind_method(D_METHOD("get_point_right_mode", "index"), &Curve::get_point_left_mode); + ClassDB::bind_method(D_METHOD("get_point_right_mode", "index"), &Curve::get_point_right_mode); ClassDB::bind_method(D_METHOD("set_point_left_tangent", "index", "tangent"), &Curve::set_point_left_tangent); - ClassDB::bind_method(D_METHOD("set_point_right_tangent", "index", "tangent"), &Curve::set_point_left_tangent); + ClassDB::bind_method(D_METHOD("set_point_right_tangent", "index", "tangent"), &Curve::set_point_right_tangent); ClassDB::bind_method(D_METHOD("set_point_left_mode", "index", "mode"), &Curve::set_point_left_mode); - ClassDB::bind_method(D_METHOD("set_point_right_mode", "index", "mode"), &Curve::set_point_left_mode); + ClassDB::bind_method(D_METHOD("set_point_right_mode", "index", "mode"), &Curve::set_point_right_mode); ClassDB::bind_method(D_METHOD("get_min_value"), &Curve::get_min_value); ClassDB::bind_method(D_METHOD("set_min_value", "min"), &Curve::set_min_value); ClassDB::bind_method(D_METHOD("get_max_value"), &Curve::get_max_value); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 923639bc79..ce439fece6 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -512,6 +512,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // HSlider theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_area", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); theme->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6)); theme->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6)); theme->set_stylebox("focus", "HSlider", focus); @@ -524,6 +525,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // VSlider theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_area", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); theme->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6)); theme->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6)); theme->set_stylebox("focus", "VSlider", focus); @@ -882,7 +884,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png)); theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png)); theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png)); - theme->set_icon("SnapGrid", "GraphEdit", make_icon(icon_snap_grid_png)); + theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_grid_png)); theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5)); theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05)); theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2)); diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index ec41630258..66df7dfda8 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -43,8 +43,6 @@ void Shader::set_code(const String &p_code) { String type = ShaderLanguage::get_shader_type(p_code); - print_line("mode: " + type); - if (type == "canvas_item") { mode = MODE_CANVAS_ITEM; } else if (type == "particles") { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index b8a0a7864e..f4a9abc1ea 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -765,7 +765,7 @@ void StyleBoxFlat::_bind_methods() { ClassDB::bind_method(D_METHOD("set_border_blend", "blend"), &StyleBoxFlat::set_border_blend); ClassDB::bind_method(D_METHOD("get_border_blend"), &StyleBoxFlat::get_border_blend); - ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_botton_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual); + ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_bottom_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual); ClassDB::bind_method(D_METHOD("set_corner_radius_all", "radius"), &StyleBoxFlat::set_corner_radius_all); ClassDB::bind_method(D_METHOD("set_corner_radius", "corner", "radius"), &StyleBoxFlat::set_corner_radius); diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 6b7168a529..d9770ec3f3 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -87,7 +87,7 @@ SceneStringNames::SceneStringNames() { _get_gizmo_geometry = StaticCString::create("_get_gizmo_geometry"); _can_gizmo_scale = StaticCString::create("_can_gizmo_scale"); - _fixed_process = StaticCString::create("_fixed_process"); + _physics_process = StaticCString::create("_physics_process"); _process = StaticCString::create("_process"); _enter_tree = StaticCString::create("_enter_tree"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 8676b8436e..3b110e7a62 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -106,7 +106,7 @@ public: StringName _get_gizmo_geometry; StringName _can_gizmo_scale; - StringName _fixed_process; + StringName _physics_process; StringName _process; StringName _enter_world; StringName _exit_world; |