Merge pull request #58151 from akien-mga/notification-switch-scene
This commit is contained in:
commit
98b97d34df
@ -247,7 +247,6 @@ void AnimatedSprite2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
|
texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ void AudioListener2D::_notification(int p_what) {
|
|||||||
make_current();
|
make_current();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (!get_tree()->is_node_being_edited(this)) {
|
if (!get_tree()->is_node_being_edited(this)) {
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
|
@ -36,31 +36,32 @@
|
|||||||
#include "scene/resources/world_2d.h"
|
#include "scene/resources/world_2d.h"
|
||||||
|
|
||||||
void AudioStreamPlayer2D::_notification(int p_what) {
|
void AudioStreamPlayer2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
AudioServer::get_singleton()->add_listener_changed_callback(_listener_changed_cb, this);
|
AudioServer::get_singleton()->add_listener_changed_callback(_listener_changed_cb, this);
|
||||||
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
stop();
|
stop();
|
||||||
AudioServer::get_singleton()->remove_listener_changed_callback(_listener_changed_cb, this);
|
AudioServer::get_singleton()->remove_listener_changed_callback(_listener_changed_cb, this);
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_PAUSED) {
|
case NOTIFICATION_PAUSED: {
|
||||||
if (!can_process()) {
|
if (!can_process()) {
|
||||||
// Node can't process so we start fading out to silence
|
// Node can't process so we start fading out to silence.
|
||||||
set_stream_paused(true);
|
set_stream_paused(true);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_UNPAUSED) {
|
case NOTIFICATION_UNPAUSED: {
|
||||||
set_stream_paused(false);
|
set_stream_paused(false);
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
//update anything related to position first, if possible of course
|
// Update anything related to position first, if possible of course.
|
||||||
if (setplay.get() > 0 || (active.is_set() && last_mix_count != AudioServer::get_singleton()->get_mix_count())) {
|
if (setplay.get() > 0 || (active.is_set() && last_mix_count != AudioServer::get_singleton()->get_mix_count())) {
|
||||||
_update_panning();
|
_update_panning();
|
||||||
}
|
}
|
||||||
@ -100,6 +101,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
|
|||||||
AudioServer::get_singleton()->stop_playback_stream(stream_playbacks[0]);
|
AudioServer::get_singleton()->stop_playback_stream(stream_playbacks[0]);
|
||||||
stream_playbacks.remove_at(0);
|
stream_playbacks.remove_at(0);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,15 +206,7 @@ Transform2D Camera2D::get_camera_transform() {
|
|||||||
if (rotating) {
|
if (rotating) {
|
||||||
xform.set_rotation(angle);
|
xform.set_rotation(angle);
|
||||||
}
|
}
|
||||||
xform.set_origin(screen_rect.position /*.floor()*/);
|
xform.set_origin(screen_rect.position);
|
||||||
|
|
||||||
/*
|
|
||||||
if (0) {
|
|
||||||
xform = get_global_transform() * xform;
|
|
||||||
} else {
|
|
||||||
xform.elements[2]+=get_global_transform().get_origin();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return (xform).affine_inverse();
|
return (xform).affine_inverse();
|
||||||
}
|
}
|
||||||
@ -224,14 +216,14 @@ void Camera2D::_notification(int p_what) {
|
|||||||
case NOTIFICATION_INTERNAL_PROCESS:
|
case NOTIFICATION_INTERNAL_PROCESS:
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
_update_scroll();
|
_update_scroll();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (!is_processing_internal() && !is_physics_processing_internal()) {
|
if (!is_processing_internal() && !is_physics_processing_internal()) {
|
||||||
_update_scroll();
|
_update_scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
ERR_FAIL_COND(!is_inside_tree());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) {
|
if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) {
|
||||||
@ -256,8 +248,8 @@ void Camera2D::_notification(int p_what) {
|
|||||||
_update_process_callback();
|
_update_process_callback();
|
||||||
_update_scroll();
|
_update_scroll();
|
||||||
first = true;
|
first = true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
|
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
|
||||||
@ -269,8 +261,8 @@ void Camera2D::_notification(int p_what) {
|
|||||||
remove_from_group(group_name);
|
remove_from_group(group_name);
|
||||||
remove_from_group(canvas_group_name);
|
remove_from_group(canvas_group_name);
|
||||||
viewport = nullptr;
|
viewport = nullptr;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (!is_inside_tree() || !Engine::get_singleton()->is_editor_hint()) {
|
if (!is_inside_tree() || !Engine::get_singleton()->is_editor_hint()) {
|
||||||
|
@ -31,18 +31,22 @@
|
|||||||
#include "canvas_modulate.h"
|
#include "canvas_modulate.h"
|
||||||
|
|
||||||
void CanvasModulate::_notification(int p_what) {
|
void CanvasModulate::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_CANVAS) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_CANVAS: {
|
||||||
if (is_visible_in_tree()) {
|
if (is_visible_in_tree()) {
|
||||||
RS::get_singleton()->canvas_set_modulate(get_canvas(), color);
|
RS::get_singleton()->canvas_set_modulate(get_canvas(), color);
|
||||||
add_to_group("_canvas_modulate_" + itos(get_canvas().get_id()));
|
add_to_group("_canvas_modulate_" + itos(get_canvas().get_id()));
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
} else if (p_what == NOTIFICATION_EXIT_CANVAS) {
|
case NOTIFICATION_EXIT_CANVAS: {
|
||||||
if (is_visible_in_tree()) {
|
if (is_visible_in_tree()) {
|
||||||
RS::get_singleton()->canvas_set_modulate(get_canvas(), Color(1, 1, 1, 1));
|
RS::get_singleton()->canvas_set_modulate(get_canvas(), Color(1, 1, 1, 1));
|
||||||
remove_from_group("_canvas_modulate_" + itos(get_canvas().get_id()));
|
remove_from_group("_canvas_modulate_" + itos(get_canvas().get_id()));
|
||||||
}
|
}
|
||||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (is_visible_in_tree()) {
|
if (is_visible_in_tree()) {
|
||||||
RS::get_singleton()->canvas_set_modulate(get_canvas(), color);
|
RS::get_singleton()->canvas_set_modulate(get_canvas(), color);
|
||||||
add_to_group("_canvas_modulate_" + itos(get_canvas().get_id()));
|
add_to_group("_canvas_modulate_" + itos(get_canvas().get_id()));
|
||||||
@ -52,6 +56,7 @@ void CanvasModulate::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_configuration_warnings();
|
update_configuration_warnings();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,26 +102,20 @@ void CollisionPolygon2D::_notification(int p_what) {
|
|||||||
_build_polygon();
|
_build_polygon();
|
||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
//display above all else
|
|
||||||
set_z_as_relative(false);
|
|
||||||
set_z_index(RS::CANVAS_ITEM_Z_MAX - 1);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner(true);
|
_update_in_shape_owner(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_UNPARENTED: {
|
case NOTIFICATION_UNPARENTED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->remove_shape_owner(owner_id);
|
parent->remove_shape_owner(owner_id);
|
||||||
|
@ -59,34 +59,28 @@ void CollisionShape2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
//display above all else
|
|
||||||
set_z_as_relative(false);
|
|
||||||
set_z_index(RS::CANVAS_ITEM_Z_MAX - 1);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner(true);
|
_update_in_shape_owner(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_UNPARENTED: {
|
case NOTIFICATION_UNPARENTED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->remove_shape_owner(owner_id);
|
parent->remove_shape_owner(owner_id);
|
||||||
}
|
}
|
||||||
owner_id = 0;
|
owner_id = 0;
|
||||||
parent = nullptr;
|
parent = nullptr;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
ERR_FAIL_COND(!is_inside_tree());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
|
|
||||||
|
@ -1091,9 +1091,11 @@ void CPUParticles2D::_notification(int p_what) {
|
|||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
set_process_internal(emitting);
|
set_process_internal(emitting);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_set_redraw(false);
|
_set_redraw(false);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
// first update before rendering to avoid one frame delay after emitting starts
|
// first update before rendering to avoid one frame delay after emitting starts
|
||||||
if (emitting && (time == 0)) {
|
if (emitting && (time == 0)) {
|
||||||
@ -1111,9 +1113,11 @@ void CPUParticles2D::_notification(int p_what) {
|
|||||||
|
|
||||||
RS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid);
|
RS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
_update_internal();
|
_update_internal();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
inv_emission_transform = get_global_transform().affine_inverse();
|
inv_emission_transform = get_global_transform().affine_inverse();
|
||||||
|
|
||||||
|
@ -377,7 +377,8 @@ void GPUParticles2D::restart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GPUParticles2D::_notification(int p_what) {
|
void GPUParticles2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
RID texture_rid;
|
RID texture_rid;
|
||||||
Size2 size;
|
Size2 size;
|
||||||
if (texture.is_valid()) {
|
if (texture.is_valid()) {
|
||||||
@ -496,35 +497,37 @@ void GPUParticles2D::_notification(int p_what) {
|
|||||||
draw_rect(visibility_rect, Color(0, 0.7, 0.9, 0.4), false);
|
draw_rect(visibility_rect, Color(0, 0.7, 0.9, 0.4), false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (sub_emitter != NodePath()) {
|
if (sub_emitter != NodePath()) {
|
||||||
_attach_sub_emitter();
|
_attach_sub_emitter();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
RS::get_singleton()->particles_set_subemitter(particles, RID());
|
RS::get_singleton()->particles_set_subemitter(particles, RID());
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
|
case NOTIFICATION_PAUSED:
|
||||||
|
case NOTIFICATION_UNPAUSED: {
|
||||||
if (can_process()) {
|
if (can_process()) {
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||||
} else {
|
} else {
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
_update_particle_emission_transform();
|
_update_particle_emission_transform();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (one_shot && !is_emitting()) {
|
if (one_shot && !is_emitting()) {
|
||||||
notify_property_list_changed();
|
notify_property_list_changed();
|
||||||
set_process_internal(false);
|
set_process_internal(false);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +162,7 @@ void Joint2D::_notification(int p_what) {
|
|||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
_update_joint();
|
_update_joint();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
_disconnect_signals();
|
_disconnect_signals();
|
||||||
|
@ -192,21 +192,24 @@ Light2D::BlendMode Light2D::get_blend_mode() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Light2D::_notification(int p_what) {
|
void Light2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
RS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, get_canvas());
|
RS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, get_canvas());
|
||||||
_update_light_visibility();
|
_update_light_visibility();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
RS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform());
|
RS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform());
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
|
||||||
_update_light_visibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
_update_light_visibility();
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
RS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, RID());
|
RS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, RID());
|
||||||
_update_light_visibility();
|
_update_light_visibility();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "light_occluder_2d.h"
|
#include "light_occluder_2d.h"
|
||||||
#include "core/math/geometry_2d.h"
|
|
||||||
|
|
||||||
#include "core/config/engine.h"
|
#include "core/config/engine.h"
|
||||||
|
#include "core/math/geometry_2d.h"
|
||||||
|
|
||||||
#define LINE_GRAB_WIDTH 8
|
#define LINE_GRAB_WIDTH 8
|
||||||
|
|
||||||
@ -158,19 +158,22 @@ void LightOccluder2D::_poly_changed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LightOccluder2D::_notification(int p_what) {
|
void LightOccluder2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_CANVAS) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_CANVAS: {
|
||||||
RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, get_canvas());
|
RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, get_canvas());
|
||||||
RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
|
RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
|
||||||
RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree());
|
RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree());
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
|
||||||
RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
|
|
||||||
}
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
|
||||||
RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
|
RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree());
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
if (occluder_polygon.is_valid()) {
|
if (occluder_polygon.is_valid()) {
|
||||||
Vector<Vector2> poly = occluder_polygon->get_polygon();
|
Vector<Vector2> poly = occluder_polygon->get_polygon();
|
||||||
@ -190,10 +193,11 @@ void LightOccluder2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_CANVAS) {
|
case NOTIFICATION_EXIT_CANVAS: {
|
||||||
RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, RID());
|
RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, RID());
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,9 +228,9 @@ Line2D::LineCapMode Line2D::get_end_cap_mode() const {
|
|||||||
|
|
||||||
void Line2D::_notification(int p_what) {
|
void Line2D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_DRAW:
|
case NOTIFICATION_DRAW: {
|
||||||
_draw();
|
_draw();
|
||||||
break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,13 +29,16 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "mesh_instance_2d.h"
|
#include "mesh_instance_2d.h"
|
||||||
|
|
||||||
#include "scene/scene_string_names.h"
|
#include "scene/scene_string_names.h"
|
||||||
|
|
||||||
void MeshInstance2D::_notification(int p_what) {
|
void MeshInstance2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
if (mesh.is_valid()) {
|
if (mesh.is_valid()) {
|
||||||
draw_mesh(mesh, texture);
|
draw_mesh(mesh, texture);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,13 +29,16 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "multimesh_instance_2d.h"
|
#include "multimesh_instance_2d.h"
|
||||||
|
|
||||||
#include "scene/scene_string_names.h"
|
#include "scene/scene_string_names.h"
|
||||||
|
|
||||||
void MultiMeshInstance2D::_notification(int p_what) {
|
void MultiMeshInstance2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
if (multimesh.is_valid()) {
|
if (multimesh.is_valid()) {
|
||||||
draw_multimesh(multimesh, texture);
|
draw_multimesh(multimesh, texture);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,10 +97,12 @@ void NavigationAgent2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
agent_parent = nullptr;
|
agent_parent = nullptr;
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (agent_parent) {
|
if (agent_parent) {
|
||||||
NavigationServer2D::get_singleton()->agent_set_position(agent, agent_parent->get_global_position());
|
NavigationServer2D::get_singleton()->agent_set_position(agent, agent_parent->get_global_position());
|
||||||
|
@ -63,17 +63,21 @@ void NavigationObstacle2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
parent_node2d = nullptr;
|
parent_node2d = nullptr;
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PARENTED: {
|
case NOTIFICATION_PARENTED: {
|
||||||
parent_node2d = Object::cast_to<Node2D>(get_parent());
|
parent_node2d = Object::cast_to<Node2D>(get_parent());
|
||||||
reevaluate_agent_radius();
|
reevaluate_agent_radius();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_UNPARENTED: {
|
case NOTIFICATION_UNPARENTED: {
|
||||||
parent_node2d = nullptr;
|
parent_node2d = nullptr;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (parent_node2d) {
|
if (parent_node2d) {
|
||||||
NavigationServer2D::get_singleton()->agent_set_position(agent, parent_node2d->get_global_position());
|
NavigationServer2D::get_singleton()->agent_set_position(agent, parent_node2d->get_global_position());
|
||||||
|
@ -406,15 +406,18 @@ void NavigationRegion2D::_notification(int p_what) {
|
|||||||
NavigationServer2D::get_singleton_mut()->connect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
NavigationServer2D::get_singleton_mut()->connect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
NavigationServer2D::get_singleton()->region_set_transform(region, get_global_transform());
|
NavigationServer2D::get_singleton()->region_set_transform(region, get_global_transform());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
NavigationServer2D::get_singleton()->region_set_map(region, RID());
|
NavigationServer2D::get_singleton()->region_set_map(region, RID());
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
NavigationServer2D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
NavigationServer2D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) {
|
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) {
|
||||||
Vector<Vector2> verts = navpoly->get_vertices();
|
Vector<Vector2> verts = navpoly->get_vertices();
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "parallax_background.h"
|
#include "parallax_background.h"
|
||||||
|
|
||||||
#include "parallax_layer.h"
|
#include "parallax_layer.h"
|
||||||
|
|
||||||
void ParallaxBackground::_notification(int p_what) {
|
void ParallaxBackground::_notification(int p_what) {
|
||||||
@ -36,8 +37,8 @@ void ParallaxBackground::_notification(int p_what) {
|
|||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
group_name = "__cameras_" + itos(get_viewport().get_id());
|
group_name = "__cameras_" + itos(get_viewport().get_id());
|
||||||
add_to_group(group_name);
|
add_to_group(group_name);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
remove_from_group(group_name);
|
remove_from_group(group_name);
|
||||||
} break;
|
} break;
|
||||||
|
@ -99,6 +99,7 @@ void ParallaxLayer::_notification(int p_what) {
|
|||||||
orig_scale = get_scale();
|
orig_scale = get_scale();
|
||||||
_update_mirroring();
|
_update_mirroring();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
break;
|
break;
|
||||||
|
@ -86,8 +86,12 @@ bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Path2D::_notification(int p_what) {
|
void Path2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW && curve.is_valid()) {
|
switch (p_what) {
|
||||||
//draw the curve!!
|
// Draw the curve if navigation debugging is enabled.
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
|
if (!curve.is_valid()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
|
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
|
||||||
return;
|
return;
|
||||||
@ -116,6 +120,7 @@ void Path2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
draw_polyline(_cached_draw_pts, color, line_width, true);
|
draw_polyline(_cached_draw_pts, color, line_width, true);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +231,8 @@ void PathFollow2D::_notification(int p_what) {
|
|||||||
if (path) {
|
if (path) {
|
||||||
_update_transform();
|
_update_transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
path = nullptr;
|
path = nullptr;
|
||||||
} break;
|
} break;
|
||||||
|
@ -906,7 +906,7 @@ void RigidDynamicBody2D::_notification(int p_what) {
|
|||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
set_notify_local_transform(true); //used for warnings and only in editor
|
set_notify_local_transform(true); // Used for warnings and only in editor.
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ void Position2D::_notification(int p_what) {
|
|||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (!is_inside_tree()) {
|
if (!is_inside_tree()) {
|
||||||
break;
|
break;
|
||||||
@ -97,7 +98,6 @@ void Position2D::_notification(int p_what) {
|
|||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
_draw_cross();
|
_draw_cross();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,11 +150,11 @@ void RayCast2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
@ -163,16 +163,13 @@ void RayCast2D::_notification(int p_what) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_draw_debug_shape();
|
_draw_debug_shape();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_raycast_state();
|
_update_raycast_state();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,8 +115,8 @@ void RemoteTransform2D::_notification(int p_what) {
|
|||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
_update_cache();
|
_update_cache();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (!is_inside_tree()) {
|
if (!is_inside_tree()) {
|
||||||
break;
|
break;
|
||||||
@ -125,7 +125,6 @@ void RemoteTransform2D::_notification(int p_what) {
|
|||||||
if (cache.is_valid()) {
|
if (cache.is_valid()) {
|
||||||
_update_remote();
|
_update_remote();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,6 +201,7 @@ void ShapeCast2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
@ -254,6 +255,7 @@ void ShapeCast2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
break;
|
break;
|
||||||
|
@ -93,7 +93,8 @@ void Bone2D::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bone2D::_notification(int p_what) {
|
void Bone2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
Node *parent = get_parent();
|
Node *parent = get_parent();
|
||||||
parent_bone = Object::cast_to<Bone2D>(parent);
|
parent_bone = Object::cast_to<Bone2D>(parent);
|
||||||
skeleton = nullptr;
|
skeleton = nullptr;
|
||||||
@ -127,9 +128,9 @@ void Bone2D::_notification(int p_what) {
|
|||||||
|
|
||||||
update();
|
update();
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
}
|
} break;
|
||||||
|
|
||||||
else if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
skeleton->_make_transform_dirty();
|
skeleton->_make_transform_dirty();
|
||||||
}
|
}
|
||||||
@ -151,18 +152,18 @@ void Bone2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
}
|
} break;
|
||||||
|
|
||||||
else if (p_what == NOTIFICATION_MOVED_IN_PARENT) {
|
case NOTIFICATION_MOVED_IN_PARENT: {
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
skeleton->_make_bone_setup_dirty();
|
skeleton->_make_bone_setup_dirty();
|
||||||
}
|
}
|
||||||
if (copy_transform_to_cache) {
|
if (copy_transform_to_cache) {
|
||||||
cache_transform = get_transform();
|
cache_transform = get_transform();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
else if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
for (int i = 0; i < skeleton->bones.size(); i++) {
|
for (int i = 0; i < skeleton->bones.size(); i++) {
|
||||||
if (skeleton->bones[i].bone == this) {
|
if (skeleton->bones[i].bone == this) {
|
||||||
@ -175,24 +176,27 @@ void Bone2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
parent_bone = nullptr;
|
parent_bone = nullptr;
|
||||||
set_transform(cache_transform);
|
set_transform(cache_transform);
|
||||||
}
|
} break;
|
||||||
|
|
||||||
else if (p_what == NOTIFICATION_READY) {
|
case NOTIFICATION_READY: {
|
||||||
if (autocalculate_length_and_angle) {
|
if (autocalculate_length_and_angle) {
|
||||||
calculate_length_and_rotation();
|
calculate_length_and_rotation();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
else if (p_what == NOTIFICATION_EDITOR_PRE_SAVE || p_what == NOTIFICATION_EDITOR_POST_SAVE) {
|
case NOTIFICATION_EDITOR_PRE_SAVE:
|
||||||
|
case NOTIFICATION_EDITOR_POST_SAVE: {
|
||||||
Transform2D tmp_trans = get_transform();
|
Transform2D tmp_trans = get_transform();
|
||||||
set_transform(cache_transform);
|
set_transform(cache_transform);
|
||||||
cache_transform = tmp_trans;
|
cache_transform = tmp_trans;
|
||||||
}
|
} break;
|
||||||
|
|
||||||
// Bone2D Editor gizmo drawing:
|
// Bone2D Editor gizmo drawing:
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#warning TODO Bone2D gizmo drawing needs to be moved to an editor plugin
|
#warning TODO Bone2D gizmo drawing needs to be moved to an editor plugin
|
||||||
#endif
|
#endif
|
||||||
else if (p_what == NOTIFICATION_DRAW) {
|
case NOTIFICATION_DRAW: {
|
||||||
// Only draw the gizmo in the editor!
|
// Only draw the gizmo in the editor!
|
||||||
if (Engine::get_singleton()->is_editor_hint() == false) {
|
if (Engine::get_singleton()->is_editor_hint() == false) {
|
||||||
return;
|
return;
|
||||||
@ -308,8 +312,9 @@ void Bone2D::_notification(int p_what) {
|
|||||||
RenderingServer::get_singleton()->canvas_item_add_polygon(editor_gizmo_rid, bone_shape_outline, outline_colors);
|
RenderingServer::get_singleton()->canvas_item_add_polygon(editor_gizmo_rid, bone_shape_outline, outline_colors);
|
||||||
RenderingServer::get_singleton()->canvas_item_add_polygon(editor_gizmo_rid, bone_shape, colors);
|
RenderingServer::get_singleton()->canvas_item_add_polygon(editor_gizmo_rid, bone_shape, colors);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
#endif // TOOLS_ENABLED
|
||||||
}
|
}
|
||||||
#endif // TOOLS_ENALBED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
@ -122,11 +122,6 @@ void Sprite2D::_notification(int p_what) {
|
|||||||
|
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
|
|
||||||
/*
|
|
||||||
texture->draw(ci,Point2());
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
Rect2 src_rect, dst_rect;
|
Rect2 src_rect, dst_rect;
|
||||||
bool filter_clip_enabled;
|
bool filter_clip_enabled;
|
||||||
_get_rects(src_rect, dst_rect, filter_clip_enabled);
|
_get_rects(src_rect, dst_rect, filter_clip_enabled);
|
||||||
|
@ -489,6 +489,7 @@ void TileMap::_notification(int p_what) {
|
|||||||
_clear_internals();
|
_clear_internals();
|
||||||
_recreate_internals();
|
_recreate_internals();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_clear_internals();
|
_clear_internals();
|
||||||
} break;
|
} break;
|
||||||
@ -980,7 +981,7 @@ void TileMap::_recompute_rect_cache() {
|
|||||||
|
|
||||||
void TileMap::_rendering_notification(int p_what) {
|
void TileMap::_rendering_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case CanvasItem::NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
bool visible = is_visible_in_tree();
|
bool visible = is_visible_in_tree();
|
||||||
for (int layer = 0; layer < (int)layers.size(); layer++) {
|
for (int layer = 0; layer < (int)layers.size(); layer++) {
|
||||||
for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
|
for (KeyValue<Vector2i, TileMapQuadrant> &E_quadrant : layers[layer].quadrant_map) {
|
||||||
@ -997,7 +998,8 @@ void TileMap::_rendering_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case CanvasItem::NOTIFICATION_TRANSFORM_CHANGED: {
|
|
||||||
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (!is_inside_tree()) {
|
if (!is_inside_tree()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1016,7 +1018,8 @@ void TileMap::_rendering_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case CanvasItem::NOTIFICATION_DRAW: {
|
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
if (tile_set.is_valid()) {
|
if (tile_set.is_valid()) {
|
||||||
RenderingServer::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), is_y_sort_enabled());
|
RenderingServer::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), is_y_sort_enabled());
|
||||||
}
|
}
|
||||||
@ -1369,7 +1372,7 @@ void TileMap::draw_tile(RID p_canvas_item, Vector2i p_position, const Ref<TileSe
|
|||||||
|
|
||||||
void TileMap::_physics_notification(int p_what) {
|
void TileMap::_physics_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case CanvasItem::NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
bool in_editor = false;
|
bool in_editor = false;
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
in_editor = Engine::get_singleton()->is_editor_hint();
|
in_editor = Engine::get_singleton()->is_editor_hint();
|
||||||
@ -1382,7 +1385,8 @@ void TileMap::_physics_notification(int p_what) {
|
|||||||
set_notify_local_transform(true);
|
set_notify_local_transform(true);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case CanvasItem::NOTIFICATION_TRANSFORM_CHANGED: {
|
|
||||||
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
bool in_editor = false;
|
bool in_editor = false;
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
in_editor = Engine::get_singleton()->is_editor_hint();
|
in_editor = Engine::get_singleton()->is_editor_hint();
|
||||||
@ -1404,6 +1408,7 @@ void TileMap::_physics_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
bool in_editor = false;
|
bool in_editor = false;
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
@ -1600,7 +1605,7 @@ void TileMap::_physics_draw_quadrant_debug(TileMapQuadrant *p_quadrant) {
|
|||||||
|
|
||||||
void TileMap::_navigation_notification(int p_what) {
|
void TileMap::_navigation_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case CanvasItem::NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (is_inside_tree()) {
|
if (is_inside_tree()) {
|
||||||
for (int layer = 0; layer < (int)layers.size(); layer++) {
|
for (int layer = 0; layer < (int)layers.size(); layer++) {
|
||||||
Transform2D tilemap_xform = get_global_transform();
|
Transform2D tilemap_xform = get_global_transform();
|
||||||
|
@ -134,8 +134,8 @@ void TouchScreenButton::_notification(int p_what) {
|
|||||||
draw_set_transform_matrix(get_canvas_transform().translated(pos));
|
draw_set_transform_matrix(get_canvas_transform().translated(pos));
|
||||||
shape->draw(get_canvas_item(), draw_col);
|
shape->draw(get_canvas_item(), draw_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (!Engine::get_singleton()->is_editor_hint() && !!DisplayServer::get_singleton()->screen_is_touchscreen(DisplayServer::get_singleton()->window_get_current_screen(get_viewport()->get_window_id())) && visibility == VISIBILITY_TOUCHSCREEN_ONLY) {
|
if (!Engine::get_singleton()->is_editor_hint() && !!DisplayServer::get_singleton()->screen_is_touchscreen(DisplayServer::get_singleton()->window_get_current_screen(get_viewport()->get_window_id())) && visibility == VISIBILITY_TOUCHSCREEN_ONLY) {
|
||||||
return;
|
return;
|
||||||
@ -145,13 +145,14 @@ void TouchScreenButton::_notification(int p_what) {
|
|||||||
if (!Engine::get_singleton()->is_editor_hint()) {
|
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||||
set_process_input(is_visible_in_tree());
|
set_process_input(is_visible_in_tree());
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (is_pressed()) {
|
if (is_pressed()) {
|
||||||
_release(true);
|
_release(true);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
break;
|
break;
|
||||||
@ -165,6 +166,7 @@ void TouchScreenButton::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PAUSED: {
|
case NOTIFICATION_PAUSED: {
|
||||||
if (is_pressed()) {
|
if (is_pressed()) {
|
||||||
_release();
|
_release();
|
||||||
|
@ -75,15 +75,16 @@ Rect2 VisibleOnScreenNotifier2D::get_rect() const {
|
|||||||
void VisibleOnScreenNotifier2D::_notification(int p_what) {
|
void VisibleOnScreenNotifier2D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
//get_world_2d()->
|
|
||||||
on_screen = false;
|
on_screen = false;
|
||||||
RS::get_singleton()->canvas_item_set_visibility_notifier(get_canvas_item(), true, rect, callable_mp(this, &VisibleOnScreenNotifier2D::_visibility_enter), callable_mp(this, &VisibleOnScreenNotifier2D::_visibility_exit));
|
RS::get_singleton()->canvas_item_set_visibility_notifier(get_canvas_item(), true, rect, callable_mp(this, &VisibleOnScreenNotifier2D::_visibility_enter), callable_mp(this, &VisibleOnScreenNotifier2D::_visibility_exit));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
draw_rect(rect, Color(1, 0.5, 1, 0.2));
|
draw_rect(rect, Color(1, 0.5, 1, 0.2));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
on_screen = false;
|
on_screen = false;
|
||||||
RS::get_singleton()->canvas_item_set_visibility_notifier(get_canvas_item(), false, Rect2(), Callable(), Callable());
|
RS::get_singleton()->canvas_item_set_visibility_notifier(get_canvas_item(), false, Rect2(), Callable(), Callable());
|
||||||
@ -169,7 +170,8 @@ void VisibleOnScreenEnabler2D::_update_enable_mode(bool p_enable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void VisibleOnScreenEnabler2D::_notification(int p_what) {
|
void VisibleOnScreenEnabler2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -180,10 +182,11 @@ void VisibleOnScreenEnabler2D::_notification(int p_what) {
|
|||||||
node_id = node->get_instance_id();
|
node_id = node->get_instance_id();
|
||||||
node->set_process_mode(PROCESS_MODE_DISABLED);
|
node->set_process_mode(PROCESS_MODE_DISABLED);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
node_id = ObjectID();
|
node_id = ObjectID();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,10 +344,14 @@ void Area3D::_clear_monitoring() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Area3D::_notification(int p_what) {
|
void Area3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_clear_monitoring();
|
_clear_monitoring();
|
||||||
} else if (p_what == NOTIFICATION_ENTER_TREE) {
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
_initialize_wind();
|
_initialize_wind();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +85,11 @@ void AudioListener3D::_notification(int p_what) {
|
|||||||
make_current();
|
make_current();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
_request_listener_update();
|
_request_listener_update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_WORLD: {
|
case NOTIFICATION_EXIT_WORLD: {
|
||||||
if (!get_tree()->is_node_being_edited(this)) {
|
if (!get_tree()->is_node_being_edited(this)) {
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
@ -100,7 +102,6 @@ void AudioListener3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_viewport()->_audio_listener_3d_remove(this);
|
get_viewport()->_audio_listener_3d_remove(this);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,38 +239,39 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioStreamPlayer3D::_notification(int p_what) {
|
void AudioStreamPlayer3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
velocity_tracker->reset(get_global_transform().origin);
|
velocity_tracker->reset(get_global_transform().origin);
|
||||||
AudioServer::get_singleton()->add_listener_changed_callback(_listener_changed_cb, this);
|
AudioServer::get_singleton()->add_listener_changed_callback(_listener_changed_cb, this);
|
||||||
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
stop();
|
stop();
|
||||||
AudioServer::get_singleton()->remove_listener_changed_callback(_listener_changed_cb, this);
|
AudioServer::get_singleton()->remove_listener_changed_callback(_listener_changed_cb, this);
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_PAUSED) {
|
case NOTIFICATION_PAUSED: {
|
||||||
if (!can_process()) {
|
if (!can_process()) {
|
||||||
// Node can't process so we start fading out to silence
|
// Node can't process so we start fading out to silence.
|
||||||
set_stream_paused(true);
|
set_stream_paused(true);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_UNPAUSED) {
|
case NOTIFICATION_UNPAUSED: {
|
||||||
set_stream_paused(false);
|
set_stream_paused(false);
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
|
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
|
||||||
velocity_tracker->update_position(get_global_transform().origin);
|
velocity_tracker->update_position(get_global_transform().origin);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
//update anything related to position first, if possible of course
|
// Update anything related to position first, if possible of course.
|
||||||
Vector<AudioFrame> volume_vector;
|
Vector<AudioFrame> volume_vector;
|
||||||
if (setplay.get() > 0 || (active.is_set() && last_mix_count != AudioServer::get_singleton()->get_mix_count())) {
|
if (setplay.get() > 0 || (active.is_set() && last_mix_count != AudioServer::get_singleton()->get_mix_count())) {
|
||||||
volume_vector = _update_panning();
|
volume_vector = _update_panning();
|
||||||
@ -313,6 +314,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
|||||||
AudioServer::get_singleton()->stop_playback_stream(stream_playbacks[0]);
|
AudioServer::get_singleton()->stop_playback_stream(stream_playbacks[0]);
|
||||||
stream_playbacks.remove_at(0);
|
stream_playbacks.remove_at(0);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,17 +340,20 @@ void BoneAttachment3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
_check_bind();
|
_check_bind();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_check_unbind();
|
_check_unbind();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
_transform_changed();
|
_transform_changed();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (_override_dirty) {
|
if (_override_dirty) {
|
||||||
_override_dirty = false;
|
_override_dirty = false;
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,14 +108,15 @@ void Camera3D::_notification(int p_what) {
|
|||||||
if (current || first_camera) {
|
if (current || first_camera) {
|
||||||
viewport->_camera_3d_set(this);
|
viewport->_camera_3d_set(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
_request_camera_update();
|
_request_camera_update();
|
||||||
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
|
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
|
||||||
velocity_tracker->update_position(get_global_transform().origin);
|
velocity_tracker->update_position(get_global_transform().origin);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_WORLD: {
|
case NOTIFICATION_EXIT_WORLD: {
|
||||||
if (!get_tree()->is_node_being_edited(this)) {
|
if (!get_tree()->is_node_being_edited(this)) {
|
||||||
if (is_current()) {
|
if (is_current()) {
|
||||||
@ -131,13 +132,14 @@ void Camera3D::_notification(int p_what) {
|
|||||||
viewport->_camera_3d_remove(this);
|
viewport->_camera_3d_remove(this);
|
||||||
viewport = nullptr;
|
viewport = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_BECAME_CURRENT: {
|
case NOTIFICATION_BECAME_CURRENT: {
|
||||||
if (viewport) {
|
if (viewport) {
|
||||||
viewport->find_world_3d()->_register_camera(this);
|
viewport->find_world_3d()->_register_camera(this);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOST_CURRENT: {
|
case NOTIFICATION_LOST_CURRENT: {
|
||||||
if (viewport) {
|
if (viewport) {
|
||||||
viewport->find_world_3d()->_remove_camera(this);
|
viewport->find_world_3d()->_remove_camera(this);
|
||||||
|
@ -93,18 +93,19 @@ void CollisionPolygon3D::_notification(int p_what) {
|
|||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner(true);
|
_update_in_shape_owner(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_UNPARENTED: {
|
case NOTIFICATION_UNPARENTED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->remove_shape_owner(owner_id);
|
parent->remove_shape_owner(owner_id);
|
||||||
|
@ -87,16 +87,19 @@ void CollisionShape3D::_notification(int p_what) {
|
|||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner();
|
_update_in_shape_owner();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
_update_in_shape_owner(true);
|
_update_in_shape_owner(true);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_UNPARENTED: {
|
case NOTIFICATION_UNPARENTED: {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->remove_shape_owner(owner_id);
|
parent->remove_shape_owner(owner_id);
|
||||||
|
@ -1251,31 +1251,32 @@ void CPUParticles3D::_update_render_thread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPUParticles3D::_notification(int p_what) {
|
void CPUParticles3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
set_process_internal(emitting);
|
set_process_internal(emitting);
|
||||||
|
|
||||||
// first update before rendering to avoid one frame delay after emitting starts
|
// first update before rendering to avoid one frame delay after emitting starts
|
||||||
if (emitting && (time == 0)) {
|
if (emitting && (time == 0)) {
|
||||||
_update_internal();
|
_update_internal();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_set_redraw(false);
|
_set_redraw(false);
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
// first update before rendering to avoid one frame delay after emitting starts
|
// first update before rendering to avoid one frame delay after emitting starts
|
||||||
if (emitting && (time == 0)) {
|
if (emitting && (time == 0)) {
|
||||||
_update_internal();
|
_update_internal();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
_update_internal();
|
_update_internal();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
inv_emission_transform = get_global_transform().affine_inverse();
|
inv_emission_transform = get_global_transform().affine_inverse();
|
||||||
|
|
||||||
if (!local_coords) {
|
if (!local_coords) {
|
||||||
@ -1310,6 +1311,7 @@ void CPUParticles3D::_notification(int p_what) {
|
|||||||
|
|
||||||
can_update.set();
|
can_update.set();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,38 +423,41 @@ NodePath GPUParticles3D::get_sub_emitter() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GPUParticles3D::_notification(int p_what) {
|
void GPUParticles3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_PAUSED:
|
||||||
|
case NOTIFICATION_UNPAUSED: {
|
||||||
if (can_process()) {
|
if (can_process()) {
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||||
} else {
|
} else {
|
||||||
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
// Use internal process when emitting and one_shot is on so that when
|
// Use internal process when emitting and one_shot is on so that when
|
||||||
// the shot ends the editor can properly update
|
// the shot ends the editor can properly update.
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (one_shot && !is_emitting()) {
|
if (one_shot && !is_emitting()) {
|
||||||
notify_property_list_changed();
|
notify_property_list_changed();
|
||||||
set_process_internal(false);
|
set_process_internal(false);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (sub_emitter != NodePath()) {
|
if (sub_emitter != NodePath()) {
|
||||||
_attach_sub_emitter();
|
_attach_sub_emitter();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
RS::get_singleton()->particles_set_subemitter(particles, RID());
|
RS::get_singleton()->particles_set_subemitter(particles, RID());
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
// make sure particles are updated before rendering occurs if they were active before
|
// Make sure particles are updated before rendering occurs if they were active before.
|
||||||
if (is_visible_in_tree() && !RS::get_singleton()->particles_is_inactive(particles)) {
|
if (is_visible_in_tree() && !RS::get_singleton()->particles_is_inactive(particles)) {
|
||||||
RS::get_singleton()->particles_request_process(particles);
|
RS::get_singleton()->particles_request_process(particles);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,8 @@ GPUParticlesCollisionSDF3D::~GPUParticlesCollisionSDF3D() {
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
|
||||||
void GPUParticlesCollisionHeightField3D::_notification(int p_what) {
|
void GPUParticlesCollisionHeightField3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (update_mode == UPDATE_MODE_ALWAYS) {
|
if (update_mode == UPDATE_MODE_ALWAYS) {
|
||||||
RS::get_singleton()->particles_collision_height_field_update(_get_collision());
|
RS::get_singleton()->particles_collision_height_field_update(_get_collision());
|
||||||
}
|
}
|
||||||
@ -621,10 +622,11 @@ void GPUParticlesCollisionHeightField3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
RS::get_singleton()->particles_collision_height_field_update(_get_collision());
|
RS::get_singleton()->particles_collision_height_field_update(_get_collision());
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +169,7 @@ void Joint3D::_notification(int p_what) {
|
|||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
_update_joint();
|
_update_joint();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
_disconnect_signals();
|
_disconnect_signals();
|
||||||
|
@ -177,12 +177,11 @@ void Light3D::_update_visibility() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Light3D::_notification(int p_what) {
|
void Light3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
switch (p_what) {
|
||||||
_update_visibility();
|
case NOTIFICATION_VISIBILITY_CHANGED:
|
||||||
}
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
|
||||||
_update_visibility();
|
_update_visibility();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1176,16 +1176,18 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LightmapGI::_notification(int p_what) {
|
void LightmapGI::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_POST_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_POST_ENTER_TREE: {
|
||||||
if (light_data.is_valid()) {
|
if (light_data.is_valid()) {
|
||||||
_assign_lightmaps();
|
_assign_lightmaps();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (light_data.is_valid()) {
|
if (light_data.is_valid()) {
|
||||||
_clear_lightmaps();
|
_clear_lightmaps();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,8 +328,10 @@ void MeshInstance3D::create_multiple_convex_collisions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MeshInstance3D::_notification(int p_what) {
|
void MeshInstance3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
_resolve_skeleton_path();
|
_resolve_skeleton_path();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +103,12 @@ void NavigationAgent3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
agent_parent = nullptr;
|
agent_parent = nullptr;
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (agent_parent) {
|
if (agent_parent) {
|
||||||
NavigationServer3D::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
|
NavigationServer3D::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
|
||||||
|
@ -63,17 +63,21 @@ void NavigationObstacle3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
parent_node3d = nullptr;
|
parent_node3d = nullptr;
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PARENTED: {
|
case NOTIFICATION_PARENTED: {
|
||||||
parent_node3d = Object::cast_to<Node3D>(get_parent());
|
parent_node3d = Object::cast_to<Node3D>(get_parent());
|
||||||
reevaluate_agent_radius();
|
reevaluate_agent_radius();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_UNPARENTED: {
|
case NOTIFICATION_UNPARENTED: {
|
||||||
parent_node3d = nullptr;
|
parent_node3d = nullptr;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (parent_node3d) {
|
if (parent_node3d) {
|
||||||
NavigationServer3D::get_singleton()->agent_set_position(agent, parent_node3d->get_global_transform().origin);
|
NavigationServer3D::get_singleton()->agent_set_position(agent, parent_node3d->get_global_transform().origin);
|
||||||
|
@ -93,12 +93,12 @@ void NavigationRegion3D::_notification(int p_what) {
|
|||||||
add_child(dm);
|
add_child(dm);
|
||||||
debug_view = dm;
|
debug_view = dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
NavigationServer3D::get_singleton()->region_set_transform(region, get_global_transform());
|
NavigationServer3D::get_singleton()->region_set_transform(region, get_global_transform());
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
NavigationServer3D::get_singleton()->region_set_map(region, RID());
|
NavigationServer3D::get_singleton()->region_set_map(region, RID());
|
||||||
|
|
||||||
|
@ -147,8 +147,8 @@ void Node3D::_notification(int p_what) {
|
|||||||
|
|
||||||
notification(NOTIFICATION_ENTER_WORLD);
|
notification(NOTIFICATION_ENTER_WORLD);
|
||||||
_update_visibility_parent(true);
|
_update_visibility_parent(true);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
notification(NOTIFICATION_EXIT_WORLD, true);
|
notification(NOTIFICATION_EXIT_WORLD, true);
|
||||||
if (xform_change.in_list()) {
|
if (xform_change.in_list()) {
|
||||||
@ -162,6 +162,7 @@ void Node3D::_notification(int p_what) {
|
|||||||
data.top_level_active = false;
|
data.top_level_active = false;
|
||||||
_update_visibility_parent(true);
|
_update_visibility_parent(true);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_WORLD: {
|
case NOTIFICATION_ENTER_WORLD: {
|
||||||
data.inside_world = true;
|
data.inside_world = true;
|
||||||
data.viewport = nullptr;
|
data.viewport = nullptr;
|
||||||
@ -192,6 +193,7 @@ void Node3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_WORLD: {
|
case NOTIFICATION_EXIT_WORLD: {
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
clear_gizmos();
|
clear_gizmos();
|
||||||
@ -203,7 +205,6 @@ void Node3D::_notification(int p_what) {
|
|||||||
|
|
||||||
data.viewport = nullptr;
|
data.viewport = nullptr;
|
||||||
data.inside_world = false;
|
data.inside_world = false;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
@ -213,9 +214,6 @@ void Node3D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
default: {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +122,10 @@ AABB Occluder3D::get_aabb() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Occluder3D::_notification(int p_what) {
|
void Occluder3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_POSTINITIALIZE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_POSTINITIALIZE: {
|
||||||
_update();
|
_update();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
|
|
||||||
#include "path_3d.h"
|
#include "path_3d.h"
|
||||||
|
|
||||||
void Path3D::_notification(int p_what) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void Path3D::_curve_changed() {
|
void Path3D::_curve_changed() {
|
||||||
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
|
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
|
||||||
update_gizmos();
|
update_gizmos();
|
||||||
@ -223,8 +220,8 @@ void PathFollow3D::_notification(int p_what) {
|
|||||||
_update_transform(false);
|
_update_transform(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
path = nullptr;
|
path = nullptr;
|
||||||
} break;
|
} break;
|
||||||
|
@ -42,7 +42,6 @@ class Path3D : public Node3D {
|
|||||||
void _curve_changed();
|
void _curve_changed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -601,7 +601,7 @@ void RigidDynamicBody3D::_notification(int p_what) {
|
|||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
set_notify_local_transform(true); //used for warnings and only in editor
|
set_notify_local_transform(true); // Used for warnings and only in editor.
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ void RayCast3D::_notification(int p_what) {
|
|||||||
exclude.erase(Object::cast_to<CollisionObject3D>(get_parent())->get_rid());
|
exclude.erase(Object::cast_to<CollisionObject3D>(get_parent())->get_rid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
@ -181,8 +181,8 @@ void RayCast3D::_notification(int p_what) {
|
|||||||
if (debug_shape) {
|
if (debug_shape) {
|
||||||
_clear_debug_shape();
|
_clear_debug_shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
break;
|
break;
|
||||||
@ -193,7 +193,6 @@ void RayCast3D::_notification(int p_what) {
|
|||||||
if (prev_collision_state != collided && get_tree()->is_debugging_collisions_hint()) {
|
if (prev_collision_state != collided && get_tree()->is_debugging_collisions_hint()) {
|
||||||
_update_debug_shape_material(true);
|
_update_debug_shape_material(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,8 +111,8 @@ void RemoteTransform3D::_notification(int p_what) {
|
|||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
_update_cache();
|
_update_cache();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
if (!is_inside_tree()) {
|
if (!is_inside_tree()) {
|
||||||
break;
|
break;
|
||||||
@ -121,7 +121,6 @@ void RemoteTransform3D::_notification(int p_what) {
|
|||||||
if (cache.is_valid()) {
|
if (cache.is_valid()) {
|
||||||
_update_remote();
|
_update_remote();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,11 +318,9 @@ void Skeleton3D::_notification(int p_what) {
|
|||||||
rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].pose_global * skin->get_bind_pose(i));
|
rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].pose_global * skin->get_bind_pose(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
emit_signal(SceneStringNames::get_singleton()->pose_updated);
|
emit_signal(SceneStringNames::get_singleton()->pose_updated);
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
@ -344,19 +342,14 @@ void Skeleton3D::_notification(int p_what) {
|
|||||||
if (modification_stack.is_valid()) {
|
if (modification_stack.is_valid()) {
|
||||||
execute_modifications(get_physics_process_delta_time(), SkeletonModificationStack3D::EXECUTION_MODE::execution_mode_physics_process);
|
execute_modifications(get_physics_process_delta_time(), SkeletonModificationStack3D::EXECUTION_MODE::execution_mode_physics_process);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
#endif // _3D_DISABLED
|
|
||||||
|
|
||||||
#ifndef _3D_DISABLED
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (modification_stack.is_valid()) {
|
if (modification_stack.is_valid()) {
|
||||||
execute_modifications(get_process_delta_time(), SkeletonModificationStack3D::EXECUTION_MODE::execution_mode_process);
|
execute_modifications(get_process_delta_time(), SkeletonModificationStack3D::EXECUTION_MODE::execution_mode_process);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
#endif // _3D_DISABLED
|
|
||||||
|
|
||||||
#ifndef _3D_DISABLED
|
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
set_process_internal(true);
|
set_process_internal(true);
|
||||||
|
@ -407,14 +407,14 @@ void SkeletonIK3D::_notification(int p_what) {
|
|||||||
set_process_priority(1);
|
set_process_priority(1);
|
||||||
reload_chain();
|
reload_chain();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (target_node_override) {
|
if (target_node_override) {
|
||||||
reload_goal();
|
reload_goal();
|
||||||
}
|
}
|
||||||
|
|
||||||
_solve_chain();
|
_solve_chain();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
reload_chain();
|
reload_chain();
|
||||||
} break;
|
} break;
|
||||||
|
@ -29,23 +29,26 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "spring_arm_3d.h"
|
#include "spring_arm_3d.h"
|
||||||
|
|
||||||
#include "scene/3d/camera_3d.h"
|
#include "scene/3d/camera_3d.h"
|
||||||
|
|
||||||
void SpringArm3D::_notification(int p_what) {
|
void SpringArm3D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (!Engine::get_singleton()->is_editor_hint()) {
|
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE:
|
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (!Engine::get_singleton()->is_editor_hint()) {
|
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS:
|
|
||||||
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
process_spring();
|
process_spring();
|
||||||
break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,8 @@ void SpriteBase3D::_propagate_color_changed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpriteBase3D::_notification(int p_what) {
|
void SpriteBase3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (!pending_update) {
|
if (!pending_update) {
|
||||||
_im_update();
|
_im_update();
|
||||||
}
|
}
|
||||||
@ -75,14 +76,15 @@ void SpriteBase3D::_notification(int p_what) {
|
|||||||
if (parent_sprite) {
|
if (parent_sprite) {
|
||||||
pI = parent_sprite->children.push_back(this);
|
pI = parent_sprite->children.push_back(this);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (parent_sprite) {
|
if (parent_sprite) {
|
||||||
parent_sprite->children.erase(pI);
|
parent_sprite->children.erase(pI);
|
||||||
pI = nullptr;
|
pI = nullptr;
|
||||||
parent_sprite = nullptr;
|
parent_sprite = nullptr;
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,11 @@ bool VisibleOnScreenNotifier3D::is_on_screen() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VisibleOnScreenNotifier3D::_notification(int p_what) {
|
void VisibleOnScreenNotifier3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_EXIT_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
on_screen = false;
|
on_screen = false;
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +164,8 @@ void VisibleOnScreenEnabler3D::_update_enable_mode(bool p_enable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void VisibleOnScreenEnabler3D::_notification(int p_what) {
|
void VisibleOnScreenEnabler3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -172,10 +176,11 @@ void VisibleOnScreenEnabler3D::_notification(int p_what) {
|
|||||||
node_id = node->get_instance_id();
|
node_id = node->get_instance_id();
|
||||||
node->set_process_mode(PROCESS_MODE_DISABLED);
|
node->set_process_mode(PROCESS_MODE_DISABLED);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
node_id = ObjectID();
|
node_id = ObjectID();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,27 +47,21 @@ void VisualInstance3D::_update_visibility() {
|
|||||||
void VisualInstance3D::_notification(int p_what) {
|
void VisualInstance3D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_WORLD: {
|
case NOTIFICATION_ENTER_WORLD: {
|
||||||
// CHECK SKELETON => moving skeleton attaching logic to MeshInstance
|
|
||||||
/*
|
|
||||||
Skeleton *skeleton=Object::cast_to<Skeleton>(get_parent());
|
|
||||||
if (skeleton)
|
|
||||||
RenderingServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() );
|
|
||||||
*/
|
|
||||||
ERR_FAIL_COND(get_world_3d().is_null());
|
ERR_FAIL_COND(get_world_3d().is_null());
|
||||||
RenderingServer::get_singleton()->instance_set_scenario(instance, get_world_3d()->get_scenario());
|
RenderingServer::get_singleton()->instance_set_scenario(instance, get_world_3d()->get_scenario());
|
||||||
_update_visibility();
|
_update_visibility();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
Transform3D gt = get_global_transform();
|
Transform3D gt = get_global_transform();
|
||||||
RenderingServer::get_singleton()->instance_set_transform(instance, gt);
|
RenderingServer::get_singleton()->instance_set_transform(instance, gt);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_WORLD: {
|
case NOTIFICATION_EXIT_WORLD: {
|
||||||
RenderingServer::get_singleton()->instance_set_scenario(instance, RID());
|
RenderingServer::get_singleton()->instance_set_scenario(instance, RID());
|
||||||
RenderingServer::get_singleton()->instance_attach_skeleton(instance, RID());
|
RenderingServer::get_singleton()->instance_attach_skeleton(instance, RID());
|
||||||
//RS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() );
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
_update_visibility();
|
_update_visibility();
|
||||||
} break;
|
} break;
|
||||||
@ -220,9 +214,6 @@ GeometryInstance3D::VisibilityRangeFadeMode GeometryInstance3D::get_visibility_r
|
|||||||
return visibility_range_fade_mode;
|
return visibility_range_fade_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryInstance3D::_notification(int p_what) {
|
|
||||||
}
|
|
||||||
|
|
||||||
const StringName *GeometryInstance3D::_instance_uniform_get_remap(const StringName p_name) const {
|
const StringName *GeometryInstance3D::_instance_uniform_get_remap(const StringName p_name) const {
|
||||||
StringName *r = instance_uniform_property_remap.getptr(p_name);
|
StringName *r = instance_uniform_property_remap.getptr(p_name);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
|
@ -137,7 +137,6 @@ protected:
|
|||||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||||
|
|
||||||
void _notification(int p_what);
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -34,7 +34,9 @@
|
|||||||
#include "scene/main/window.h"
|
#include "scene/main/window.h"
|
||||||
|
|
||||||
void WorldEnvironment::_notification(int p_what) {
|
void WorldEnvironment::_notification(int p_what) {
|
||||||
if (p_what == Node3D::NOTIFICATION_ENTER_WORLD || p_what == Node3D::NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case Node3D::NOTIFICATION_ENTER_WORLD:
|
||||||
|
case Node3D::NOTIFICATION_ENTER_TREE: {
|
||||||
if (environment.is_valid()) {
|
if (environment.is_valid()) {
|
||||||
add_to_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
add_to_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
||||||
_update_current_environment();
|
_update_current_environment();
|
||||||
@ -44,8 +46,10 @@ void WorldEnvironment::_notification(int p_what) {
|
|||||||
add_to_group("_world_camera_effects_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
add_to_group("_world_camera_effects_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
||||||
_update_current_camera_effects();
|
_update_current_camera_effects();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
} else if (p_what == Node3D::NOTIFICATION_EXIT_WORLD || p_what == Node3D::NOTIFICATION_EXIT_TREE) {
|
case Node3D::NOTIFICATION_EXIT_WORLD:
|
||||||
|
case Node3D::NOTIFICATION_EXIT_TREE: {
|
||||||
if (environment.is_valid()) {
|
if (environment.is_valid()) {
|
||||||
remove_from_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
remove_from_group("_world_environment_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
||||||
_update_current_environment();
|
_update_current_environment();
|
||||||
@ -55,6 +59,7 @@ void WorldEnvironment::_notification(int p_what) {
|
|||||||
remove_from_group("_world_camera_effects_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
remove_from_group("_world_camera_effects_" + itos(get_viewport()->find_world_3d()->get_scenario().get_id()));
|
||||||
_update_current_camera_effects();
|
_update_current_camera_effects();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,16 +44,17 @@ void XRCamera3D::_notification(int p_what) {
|
|||||||
if (origin != nullptr) {
|
if (origin != nullptr) {
|
||||||
origin->set_tracked_camera(this);
|
origin->set_tracked_camera(this);
|
||||||
}
|
}
|
||||||
}; break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
// need to find our XROrigin3D parent and let it know we're no longer its camera!
|
// need to find our XROrigin3D parent and let it know we're no longer its camera!
|
||||||
XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
|
XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
|
||||||
if (origin != nullptr && origin->get_tracked_camera() == this) {
|
if (origin != nullptr && origin->get_tracked_camera() == this) {
|
||||||
origin->set_tracked_camera(nullptr);
|
origin->set_tracked_camera(nullptr);
|
||||||
}
|
}
|
||||||
}; break;
|
} break;
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void XRCamera3D::_changed_tracker(const StringName p_tracker_name, int p_tracker_type) {
|
void XRCamera3D::_changed_tracker(const StringName p_tracker_name, int p_tracker_type) {
|
||||||
if (p_tracker_name == tracker_name) {
|
if (p_tracker_name == tracker_name) {
|
||||||
@ -657,10 +658,12 @@ void XROrigin3D::_notification(int p_what) {
|
|||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
set_process_internal(true);
|
set_process_internal(true);
|
||||||
}; break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
set_process_internal(false);
|
set_process_internal(false);
|
||||||
}; break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
// set our world origin to our node transform
|
// set our world origin to our node transform
|
||||||
xr_server->set_world_origin(get_global_transform());
|
xr_server->set_world_origin(get_global_transform());
|
||||||
@ -673,11 +676,9 @@ void XROrigin3D::_notification(int p_what) {
|
|||||||
|
|
||||||
// now apply this to our camera
|
// now apply this to our camera
|
||||||
tracked_camera->set_transform(t);
|
tracked_camera->set_transform(t);
|
||||||
};
|
}
|
||||||
}; break;
|
} break;
|
||||||
default:
|
}
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
// send our notification to all active XE interfaces, they may need to react to it also
|
// send our notification to all active XE interfaces, they may need to react to it also
|
||||||
for (int i = 0; i < xr_server->get_interface_count(); i++) {
|
for (int i = 0; i < xr_server->get_interface_count(); i++) {
|
||||||
|
@ -807,9 +807,6 @@ String AnimationNodeStateMachine::get_caption() const {
|
|||||||
return "StateMachine";
|
return "StateMachine";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationNodeStateMachine::_notification(int p_what) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<AnimationNode> AnimationNodeStateMachine::get_child_by_name(const StringName &p_name) {
|
Ref<AnimationNode> AnimationNodeStateMachine::get_child_by_name(const StringName &p_name) {
|
||||||
return get_node(p_name);
|
return get_node(p_name);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,6 @@ private:
|
|||||||
void _tree_changed();
|
void _tree_changed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
bool _set(const StringName &p_name, const Variant &p_value);
|
bool _set(const StringName &p_name, const Variant &p_value);
|
||||||
|
@ -202,15 +202,16 @@ void AnimationPlayer::_notification(int p_what) {
|
|||||||
set_physics_process_internal(false);
|
set_physics_process_internal(false);
|
||||||
set_process_internal(false);
|
set_process_internal(false);
|
||||||
}
|
}
|
||||||
//_set_process(false);
|
|
||||||
clear_caches();
|
clear_caches();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) {
|
if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) {
|
||||||
play(autoplay);
|
play(autoplay);
|
||||||
_animation_process(0);
|
_animation_process(0);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (process_callback == ANIMATION_PROCESS_PHYSICS) {
|
if (process_callback == ANIMATION_PROCESS_PHYSICS) {
|
||||||
break;
|
break;
|
||||||
@ -220,6 +221,7 @@ void AnimationPlayer::_notification(int p_what) {
|
|||||||
_animation_process(get_process_delta_time());
|
_animation_process(get_process_delta_time());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
if (process_callback == ANIMATION_PROCESS_IDLE) {
|
if (process_callback == ANIMATION_PROCESS_IDLE) {
|
||||||
break;
|
break;
|
||||||
@ -229,6 +231,7 @@ void AnimationPlayer::_notification(int p_what) {
|
|||||||
_animation_process(get_physics_process_delta_time());
|
_animation_process(get_physics_process_delta_time());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
clear_caches();
|
clear_caches();
|
||||||
} break;
|
} break;
|
||||||
|
@ -1586,15 +1586,17 @@ void AnimationTree::advance(real_t p_time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTree::_notification(int p_what) {
|
void AnimationTree::_notification(int p_what) {
|
||||||
if (active && p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS && process_callback == ANIMATION_PROCESS_PHYSICS) {
|
switch (p_what) {
|
||||||
_process_graph(get_physics_process_delta_time());
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
if (last_animation_player.is_valid()) {
|
||||||
|
Object *player = ObjectDB::get_instance(last_animation_player);
|
||||||
|
if (player) {
|
||||||
|
player->connect("caches_cleared", callable_mp(this, &AnimationTree::_clear_caches));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active && p_what == NOTIFICATION_INTERNAL_PROCESS && process_callback == ANIMATION_PROCESS_IDLE) {
|
|
||||||
_process_graph(get_process_delta_time());
|
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_clear_caches();
|
_clear_caches();
|
||||||
if (last_animation_player.is_valid()) {
|
if (last_animation_player.is_valid()) {
|
||||||
Object *player = ObjectDB::get_instance(last_animation_player);
|
Object *player = ObjectDB::get_instance(last_animation_player);
|
||||||
@ -1602,13 +1604,19 @@ void AnimationTree::_notification(int p_what) {
|
|||||||
player->disconnect("caches_cleared", callable_mp(this, &AnimationTree::_clear_caches));
|
player->disconnect("caches_cleared", callable_mp(this, &AnimationTree::_clear_caches));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (p_what == NOTIFICATION_ENTER_TREE) {
|
} break;
|
||||||
if (last_animation_player.is_valid()) {
|
|
||||||
Object *player = ObjectDB::get_instance(last_animation_player);
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (player) {
|
if (active && process_callback == ANIMATION_PROCESS_IDLE) {
|
||||||
player->connect("caches_cleared", callable_mp(this, &AnimationTree::_clear_caches));
|
_process_graph(get_process_delta_time());
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
|
if (active && process_callback == ANIMATION_PROCESS_PHYSICS) {
|
||||||
|
_process_graph(get_physics_process_delta_time());
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,10 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "root_motion_view.h"
|
#include "root_motion_view.h"
|
||||||
|
|
||||||
#include "scene/animation/animation_tree.h"
|
#include "scene/animation/animation_tree.h"
|
||||||
#include "scene/resources/material.h"
|
#include "scene/resources/material.h"
|
||||||
|
|
||||||
void RootMotionView::set_animation_path(const NodePath &p_path) {
|
void RootMotionView::set_animation_path(const NodePath &p_path) {
|
||||||
path = p_path;
|
path = p_path;
|
||||||
first = true;
|
first = true;
|
||||||
@ -76,12 +78,14 @@ bool RootMotionView::get_zero_y() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RootMotionView::_notification(int p_what) {
|
void RootMotionView::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
immediate_material = StandardMaterial3D::get_material_for_2d(false, true, false, false, false);
|
immediate_material = StandardMaterial3D::get_material_for_2d(false, true, false, false, false);
|
||||||
first = true;
|
first = true;
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS || p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
|
case NOTIFICATION_INTERNAL_PROCESS:
|
||||||
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||||
Transform3D transform;
|
Transform3D transform;
|
||||||
|
|
||||||
if (has_node(path)) {
|
if (has_node(path)) {
|
||||||
@ -154,6 +158,7 @@ void RootMotionView::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
immediate->surface_end();
|
immediate->surface_end();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,13 +35,14 @@
|
|||||||
#include "servers/audio_server.h"
|
#include "servers/audio_server.h"
|
||||||
|
|
||||||
void AudioStreamPlayer::_notification(int p_what) {
|
void AudioStreamPlayer::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
Vector<Ref<AudioStreamPlayback>> playbacks_to_remove;
|
Vector<Ref<AudioStreamPlayback>> playbacks_to_remove;
|
||||||
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
|
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
|
||||||
if (playback.is_valid() && !AudioServer::get_singleton()->is_playback_active(playback) && !AudioServer::get_singleton()->is_playback_paused(playback)) {
|
if (playback.is_valid() && !AudioServer::get_singleton()->is_playback_active(playback) && !AudioServer::get_singleton()->is_playback_paused(playback)) {
|
||||||
@ -60,24 +61,25 @@ void AudioStreamPlayer::_notification(int p_what) {
|
|||||||
if (!playbacks_to_remove.is_empty()) {
|
if (!playbacks_to_remove.is_empty()) {
|
||||||
emit_signal(SNAME("finished"));
|
emit_signal(SNAME("finished"));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
|
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
|
||||||
AudioServer::get_singleton()->stop_playback_stream(playback);
|
AudioServer::get_singleton()->stop_playback_stream(playback);
|
||||||
}
|
}
|
||||||
stream_playbacks.clear();
|
stream_playbacks.clear();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_PAUSED) {
|
case NOTIFICATION_PAUSED: {
|
||||||
if (!can_process()) {
|
if (!can_process()) {
|
||||||
// Node can't process so we start fading out to silence
|
// Node can't process so we start fading out to silence
|
||||||
set_stream_paused(true);
|
set_stream_paused(true);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_UNPAUSED) {
|
case NOTIFICATION_UNPAUSED: {
|
||||||
set_stream_paused(false);
|
set_stream_paused(false);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,42 +81,50 @@ void BaseButton::gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseButton::_notification(int p_what) {
|
void BaseButton::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_MOUSE_ENTER) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_MOUSE_ENTER: {
|
||||||
status.hovering = true;
|
status.hovering = true;
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_MOUSE_EXIT) {
|
case NOTIFICATION_MOUSE_EXIT: {
|
||||||
status.hovering = false;
|
status.hovering = false;
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_DRAG_BEGIN || p_what == NOTIFICATION_SCROLL_BEGIN) {
|
|
||||||
|
case NOTIFICATION_DRAG_BEGIN:
|
||||||
|
case NOTIFICATION_SCROLL_BEGIN: {
|
||||||
if (status.press_attempt) {
|
if (status.press_attempt) {
|
||||||
status.press_attempt = false;
|
status.press_attempt = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_FOCUS_ENTER) {
|
case NOTIFICATION_FOCUS_ENTER: {
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_FOCUS_EXIT) {
|
case NOTIFICATION_FOCUS_EXIT: {
|
||||||
if (status.press_attempt) {
|
if (status.press_attempt) {
|
||||||
status.press_attempt = false;
|
status.press_attempt = false;
|
||||||
update();
|
update();
|
||||||
} else if (status.hovering) {
|
} else if (status.hovering) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE || (p_what == NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree())) {
|
case NOTIFICATION_VISIBILITY_CHANGED:
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
if (p_what == NOTIFICATION_VISIBILITY_CHANGED && is_visible_in_tree()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!toggle_mode) {
|
if (!toggle_mode) {
|
||||||
status.pressed = false;
|
status.pressed = false;
|
||||||
}
|
}
|
||||||
status.hovering = false;
|
status.hovering = false;
|
||||||
status.press_attempt = false;
|
status.press_attempt = false;
|
||||||
status.pressing_inside = false;
|
status.pressing_inside = false;
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "box_container.h"
|
#include "box_container.h"
|
||||||
|
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
#include "margin_container.h"
|
#include "margin_container.h"
|
||||||
|
|
||||||
@ -294,9 +295,11 @@ void BoxContainer::_notification(int p_what) {
|
|||||||
case NOTIFICATION_SORT_CHILDREN: {
|
case NOTIFICATION_SORT_CHILDREN: {
|
||||||
_resort();
|
_resort();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
queue_sort();
|
queue_sort();
|
||||||
|
@ -78,6 +78,7 @@ void Button::_notification(int p_what) {
|
|||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
xl_text = atr(text);
|
xl_text = atr(text);
|
||||||
_shape();
|
_shape();
|
||||||
@ -85,12 +86,14 @@ void Button::_notification(int p_what) {
|
|||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
_shape();
|
_shape();
|
||||||
|
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
Size2 size = get_size();
|
Size2 size = get_size();
|
||||||
|
@ -78,7 +78,8 @@ Vector<int> CenterContainer::get_allowed_size_flags_vertical() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CenterContainer::_notification(int p_what) {
|
void CenterContainer::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_SORT_CHILDREN: {
|
||||||
Size2 size = get_size();
|
Size2 size = get_size();
|
||||||
for (int i = 0; i < get_child_count(); i++) {
|
for (int i = 0; i < get_child_count(); i++) {
|
||||||
Control *c = Object::cast_to<Control>(get_child(i));
|
Control *c = Object::cast_to<Control>(get_child(i));
|
||||||
@ -93,6 +94,7 @@ void CenterContainer::_notification(int p_what) {
|
|||||||
Point2 ofs = use_top_left ? (-minsize * 0.5).floor() : ((size - minsize) / 2.0).floor();
|
Point2 ofs = use_top_left ? (-minsize * 0.5).floor() : ((size - minsize) / 2.0).floor();
|
||||||
fit_child_in_rect(c, Rect2(ofs, minsize));
|
fit_child_in_rect(c, Rect2(ofs, minsize));
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,10 @@ Size2 CheckBox::get_minimum_size() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckBox::_notification(int p_what) {
|
void CheckBox::_notification(int p_what) {
|
||||||
if ((p_what == NOTIFICATION_THEME_CHANGED) || (p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || (p_what == NOTIFICATION_TRANSLATION_CHANGED))) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
if (is_layout_rtl()) {
|
if (is_layout_rtl()) {
|
||||||
_set_internal_margin(SIDE_LEFT, 0.f);
|
_set_internal_margin(SIDE_LEFT, 0.f);
|
||||||
_set_internal_margin(SIDE_RIGHT, get_icon_size().width);
|
_set_internal_margin(SIDE_RIGHT, get_icon_size().width);
|
||||||
@ -92,7 +95,9 @@ void CheckBox::_notification(int p_what) {
|
|||||||
_set_internal_margin(SIDE_LEFT, get_icon_size().width);
|
_set_internal_margin(SIDE_LEFT, get_icon_size().width);
|
||||||
_set_internal_margin(SIDE_RIGHT, 0.f);
|
_set_internal_margin(SIDE_RIGHT, 0.f);
|
||||||
}
|
}
|
||||||
} else if (p_what == NOTIFICATION_DRAW) {
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
|
|
||||||
Ref<Texture2D> on = Control::get_theme_icon(vformat("%s%s", is_radio() ? "radio_checked" : "checked", is_disabled() ? "_disabled" : ""));
|
Ref<Texture2D> on = Control::get_theme_icon(vformat("%s%s", is_radio() ? "radio_checked" : "checked", is_disabled() ? "_disabled" : ""));
|
||||||
@ -112,6 +117,7 @@ void CheckBox::_notification(int p_what) {
|
|||||||
} else {
|
} else {
|
||||||
off->draw(ci, ofs);
|
off->draw(ci, ofs);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,10 @@ Size2 CheckButton::get_minimum_size() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckButton::_notification(int p_what) {
|
void CheckButton::_notification(int p_what) {
|
||||||
if ((p_what == NOTIFICATION_THEME_CHANGED) || (p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED) || (p_what == NOTIFICATION_TRANSLATION_CHANGED)) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
if (is_layout_rtl()) {
|
if (is_layout_rtl()) {
|
||||||
_set_internal_margin(SIDE_LEFT, get_icon_size().width);
|
_set_internal_margin(SIDE_LEFT, get_icon_size().width);
|
||||||
_set_internal_margin(SIDE_RIGHT, 0.f);
|
_set_internal_margin(SIDE_RIGHT, 0.f);
|
||||||
@ -69,7 +72,9 @@ void CheckButton::_notification(int p_what) {
|
|||||||
_set_internal_margin(SIDE_LEFT, 0.f);
|
_set_internal_margin(SIDE_LEFT, 0.f);
|
||||||
_set_internal_margin(SIDE_RIGHT, get_icon_size().width);
|
_set_internal_margin(SIDE_RIGHT, get_icon_size().width);
|
||||||
}
|
}
|
||||||
} else if (p_what == NOTIFICATION_DRAW) {
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
bool rtl = is_layout_rtl();
|
bool rtl = is_layout_rtl();
|
||||||
|
|
||||||
@ -102,6 +107,7 @@ void CheckButton::_notification(int p_what) {
|
|||||||
} else {
|
} else {
|
||||||
off->draw(ci, ofs);
|
off->draw(ci, ofs);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ void CodeEdit::_notification(int p_what) {
|
|||||||
|
|
||||||
line_length_guideline_color = get_theme_color(SNAME("line_length_guideline_color"));
|
line_length_guideline_color = get_theme_color(SNAME("line_length_guideline_color"));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
const Size2 size = get_size();
|
const Size2 size = get_size();
|
||||||
|
@ -33,11 +33,11 @@
|
|||||||
#include "core/input/input.h"
|
#include "core/input/input.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
|
#include "scene/main/window.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
#endif
|
#endif
|
||||||
#include "scene/main/window.h"
|
|
||||||
|
|
||||||
List<Color> ColorPicker::preset_cache;
|
List<Color> ColorPicker::preset_cache;
|
||||||
|
|
||||||
@ -45,7 +45,6 @@ void ColorPicker::_notification(int p_what) {
|
|||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
_update_color();
|
_update_color();
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
if (preset_cache.is_empty()) {
|
if (preset_cache.is_empty()) {
|
||||||
@ -1347,17 +1346,18 @@ void ColorPickerButton::_notification(int p_what) {
|
|||||||
draw_texture(Control::get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), normal->get_offset());
|
draw_texture(Control::get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), normal->get_offset());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
||||||
if (popup) {
|
if (popup) {
|
||||||
popup->hide();
|
popup->hide();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (popup && !is_visible_in_tree()) {
|
if (popup && !is_visible_in_tree()) {
|
||||||
popup->hide();
|
popup->hide();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,10 @@ Color ColorRect::get_color() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ColorRect::_notification(int p_what) {
|
void ColorRect::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
draw_rect(Rect2(Point2(), get_size()), color);
|
draw_rect(Rect2(Point2(), get_size()), color);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "container.h"
|
#include "container.h"
|
||||||
|
|
||||||
#include "core/object/message_queue.h"
|
#include "core/object/message_queue.h"
|
||||||
#include "scene/scene_string_names.h"
|
#include "scene/scene_string_names.h"
|
||||||
|
|
||||||
@ -177,12 +178,12 @@ void Container::_notification(int p_what) {
|
|||||||
pending_sort = false;
|
pending_sort = false;
|
||||||
queue_sort();
|
queue_sort();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_RESIZED: {
|
|
||||||
queue_sort();
|
case NOTIFICATION_RESIZED:
|
||||||
} break;
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
queue_sort();
|
queue_sort();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (is_visible_in_tree()) {
|
if (is_visible_in_tree()) {
|
||||||
queue_sort();
|
queue_sort();
|
||||||
|
@ -691,17 +691,17 @@ void Control::_update_canvas_item_transform() {
|
|||||||
|
|
||||||
void Control::_notification(int p_notification) {
|
void Control::_notification(int p_notification) {
|
||||||
switch (p_notification) {
|
switch (p_notification) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
|
||||||
} break;
|
|
||||||
case NOTIFICATION_POST_ENTER_TREE: {
|
case NOTIFICATION_POST_ENTER_TREE: {
|
||||||
data.minimum_size_valid = false;
|
data.minimum_size_valid = false;
|
||||||
data.is_rtl_dirty = true;
|
data.is_rtl_dirty = true;
|
||||||
_size_changed();
|
_size_changed();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
release_focus();
|
release_focus();
|
||||||
get_viewport()->_gui_remove_control(this);
|
get_viewport()->_gui_remove_control(this);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
connect("ready", callable_mp(this, &Control::_clear_size_warning), varray(), CONNECT_DEFERRED | CONNECT_ONESHOT);
|
connect("ready", callable_mp(this, &Control::_clear_size_warning), varray(), CONNECT_DEFERRED | CONNECT_ONESHOT);
|
||||||
@ -764,6 +764,7 @@ void Control::_notification(int p_notification) {
|
|||||||
viewport->connect("size_changed", callable_mp(this, &Control::_size_changed));
|
viewport->connect("size_changed", callable_mp(this, &Control::_size_changed));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_CANVAS: {
|
case NOTIFICATION_EXIT_CANVAS: {
|
||||||
if (data.parent_canvas_item) {
|
if (data.parent_canvas_item) {
|
||||||
data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed));
|
data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed));
|
||||||
@ -784,8 +785,8 @@ void Control::_notification(int p_notification) {
|
|||||||
data.parent_canvas_item = nullptr;
|
data.parent_canvas_item = nullptr;
|
||||||
data.parent_window = nullptr;
|
data.parent_window = nullptr;
|
||||||
data.is_rtl_dirty = true;
|
data.is_rtl_dirty = true;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOVED_IN_PARENT: {
|
case NOTIFICATION_MOVED_IN_PARENT: {
|
||||||
// some parents need to know the order of the children to draw (like TabContainer)
|
// some parents need to know the order of the children to draw (like TabContainer)
|
||||||
// update if necessary
|
// update if necessary
|
||||||
@ -797,50 +798,52 @@ void Control::_notification(int p_notification) {
|
|||||||
if (data.RI) {
|
if (data.RI) {
|
||||||
get_viewport()->_gui_set_root_order_dirty();
|
get_viewport()->_gui_set_root_order_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_RESIZED: {
|
case NOTIFICATION_RESIZED: {
|
||||||
emit_signal(SceneStringNames::get_singleton()->resized);
|
emit_signal(SceneStringNames::get_singleton()->resized);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
_update_canvas_item_transform();
|
_update_canvas_item_transform();
|
||||||
RenderingServer::get_singleton()->canvas_item_set_custom_rect(get_canvas_item(), !data.disable_visibility_clip, Rect2(Point2(), get_size()));
|
RenderingServer::get_singleton()->canvas_item_set_custom_rect(get_canvas_item(), !data.disable_visibility_clip, Rect2(Point2(), get_size()));
|
||||||
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), data.clip_contents);
|
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), data.clip_contents);
|
||||||
//emit_signal(SceneStringNames::get_singleton()->draw);
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOUSE_ENTER: {
|
case NOTIFICATION_MOUSE_ENTER: {
|
||||||
emit_signal(SceneStringNames::get_singleton()->mouse_entered);
|
emit_signal(SceneStringNames::get_singleton()->mouse_entered);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOUSE_EXIT: {
|
case NOTIFICATION_MOUSE_EXIT: {
|
||||||
emit_signal(SceneStringNames::get_singleton()->mouse_exited);
|
emit_signal(SceneStringNames::get_singleton()->mouse_exited);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_FOCUS_ENTER: {
|
case NOTIFICATION_FOCUS_ENTER: {
|
||||||
emit_signal(SceneStringNames::get_singleton()->focus_entered);
|
emit_signal(SceneStringNames::get_singleton()->focus_entered);
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_FOCUS_EXIT: {
|
case NOTIFICATION_FOCUS_EXIT: {
|
||||||
emit_signal(SceneStringNames::get_singleton()->focus_exited);
|
emit_signal(SceneStringNames::get_singleton()->focus_exited);
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (!is_visible_in_tree()) {
|
if (!is_visible_in_tree()) {
|
||||||
if (get_viewport() != nullptr) {
|
if (get_viewport() != nullptr) {
|
||||||
get_viewport()->_gui_hide_control(this);
|
get_viewport()->_gui_hide_control(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove key focus
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
data.minimum_size_valid = false;
|
data.minimum_size_valid = false;
|
||||||
_size_changed();
|
_size_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
if (is_inside_tree()) {
|
if (is_inside_tree()) {
|
||||||
|
@ -67,21 +67,25 @@ void AcceptDialog::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
bg->add_theme_style_override("panel", bg->get_theme_stylebox(SNAME("panel"), SNAME("AcceptDialog")));
|
bg->add_theme_style_override("panel", bg->get_theme_stylebox(SNAME("panel"), SNAME("AcceptDialog")));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (parent_visible) {
|
if (parent_visible) {
|
||||||
parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
|
parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
|
||||||
parent_visible = nullptr;
|
parent_visible = nullptr;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_READY:
|
case NOTIFICATION_READY:
|
||||||
case NOTIFICATION_WM_SIZE_CHANGED: {
|
case NOTIFICATION_WM_SIZE_CHANGED: {
|
||||||
if (is_visible()) {
|
if (is_visible()) {
|
||||||
_update_child_rects();
|
_update_child_rects();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
||||||
_cancel_pressed();
|
_cancel_pressed();
|
||||||
} break;
|
} break;
|
||||||
|
@ -92,12 +92,14 @@ void FileDialog::_theme_changed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileDialog::_notification(int p_what) {
|
void FileDialog::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (!is_visible()) {
|
if (!is_visible()) {
|
||||||
set_process_unhandled_input(false);
|
set_process_unhandled_input(false);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
dir_up->set_icon(vbox->get_theme_icon(SNAME("parent_folder"), SNAME("FileDialog")));
|
dir_up->set_icon(vbox->get_theme_icon(SNAME("parent_folder"), SNAME("FileDialog")));
|
||||||
if (vbox->is_layout_rtl()) {
|
if (vbox->is_layout_rtl()) {
|
||||||
dir_prev->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog")));
|
dir_prev->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog")));
|
||||||
@ -109,9 +111,11 @@ void FileDialog::_notification(int p_what) {
|
|||||||
refresh->set_icon(vbox->get_theme_icon(SNAME("reload"), SNAME("FileDialog")));
|
refresh->set_icon(vbox->get_theme_icon(SNAME("reload"), SNAME("FileDialog")));
|
||||||
show_hidden->set_icon(vbox->get_theme_icon(SNAME("toggle_hidden"), SNAME("FileDialog")));
|
show_hidden->set_icon(vbox->get_theme_icon(SNAME("toggle_hidden"), SNAME("FileDialog")));
|
||||||
_theme_changed();
|
_theme_changed();
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
|
|
||||||
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
update_filters();
|
update_filters();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,9 +251,11 @@ void FlowContainer::_notification(int p_what) {
|
|||||||
_resort();
|
_resort();
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
queue_sort();
|
queue_sort();
|
||||||
|
@ -287,18 +287,19 @@ void GradientEdit::gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GradientEdit::_notification(int p_what) {
|
void GradientEdit::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (!picker->is_connected("color_changed", callable_mp(this, &GradientEdit::_color_changed))) {
|
if (!picker->is_connected("color_changed", callable_mp(this, &GradientEdit::_color_changed))) {
|
||||||
picker->connect("color_changed", callable_mp(this, &GradientEdit::_color_changed));
|
picker->connect("color_changed", callable_mp(this, &GradientEdit::_color_changed));
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
|
||||||
draw_spacing = BASE_SPACING * get_theme_default_base_scale();
|
draw_spacing = BASE_SPACING * get_theme_default_base_scale();
|
||||||
draw_point_width = BASE_POINT_WIDTH * get_theme_default_base_scale();
|
draw_point_width = BASE_POINT_WIDTH * get_theme_default_base_scale();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
case NOTIFICATION_DRAW: {
|
||||||
int w = get_size().x;
|
int w = get_size().x;
|
||||||
int h = get_size().y;
|
int h = get_size().y;
|
||||||
|
|
||||||
@ -312,7 +313,6 @@ void GradientEdit::_notification(int p_what) {
|
|||||||
draw_texture_rect(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")), Rect2(0, 0, total_w, h), true);
|
draw_texture_rect(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")), Rect2(0, 0, total_w, h), true);
|
||||||
|
|
||||||
// Draw color ramp.
|
// Draw color ramp.
|
||||||
|
|
||||||
gradient_cache->set_points(points);
|
gradient_cache->set_points(points);
|
||||||
gradient_cache->set_interpolation_mode(interpolation_mode);
|
gradient_cache->set_interpolation_mode(interpolation_mode);
|
||||||
preview_texture->set_gradient(gradient_cache);
|
preview_texture->set_gradient(gradient_cache);
|
||||||
@ -340,13 +340,13 @@ void GradientEdit::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw "button" for color selector
|
// Draw "button" for color selector.
|
||||||
draw_texture_rect(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")), Rect2(total_w + draw_spacing, 0, h, h), true);
|
draw_texture_rect(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")), Rect2(total_w + draw_spacing, 0, h, h), true);
|
||||||
if (grabbed != -1) {
|
if (grabbed != -1) {
|
||||||
//Draw with selection color
|
// Draw with selection color.
|
||||||
draw_rect(Rect2(total_w + draw_spacing, 0, h, h), points[grabbed].color);
|
draw_rect(Rect2(total_w + draw_spacing, 0, h, h), points[grabbed].color);
|
||||||
} else {
|
} else {
|
||||||
//if no color selected draw grey color with 'X' on top.
|
// If no color selected draw grey color with 'X' on top.
|
||||||
draw_rect(Rect2(total_w + draw_spacing, 0, h, h), Color(0.5, 0.5, 0.5, 1));
|
draw_rect(Rect2(total_w + draw_spacing, 0, h, h), Color(0.5, 0.5, 0.5, 1));
|
||||||
draw_line(Vector2(total_w + draw_spacing, 0), Vector2(total_w + draw_spacing + h, h), Color(1, 1, 1, 0.6));
|
draw_line(Vector2(total_w + draw_spacing, 0), Vector2(total_w + draw_spacing + h, h), Color(1, 1, 1, 0.6));
|
||||||
draw_line(Vector2(total_w + draw_spacing, h), Vector2(total_w + draw_spacing + h, 0), Color(1, 1, 1, 0.6));
|
draw_line(Vector2(total_w + draw_spacing, h), Vector2(total_w + draw_spacing + h, 0), Color(1, 1, 1, 0.6));
|
||||||
@ -359,12 +359,13 @@ void GradientEdit::_notification(int p_what) {
|
|||||||
draw_line(Vector2(total_w + 1, h + 1), Vector2(-1, h + 1), Color(1, 1, 1, 0.6));
|
draw_line(Vector2(total_w + 1, h + 1), Vector2(-1, h + 1), Color(1, 1, 1, 0.6));
|
||||||
draw_line(Vector2(-1, -1), Vector2(-1, h + 1), Color(1, 1, 1, 0.6));
|
draw_line(Vector2(-1, -1), Vector2(-1, h + 1), Color(1, 1, 1, 0.6));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (!is_visible()) {
|
if (!is_visible()) {
|
||||||
grabbing = false;
|
grabbing = false;
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,9 @@ void GraphEdit::remove_child_notify(Node *p_child) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GraphEdit::_notification(int p_what) {
|
void GraphEdit::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
port_grab_distance_horizontal = get_theme_constant(SNAME("port_grab_distance_horizontal"));
|
port_grab_distance_horizontal = get_theme_constant(SNAME("port_grab_distance_horizontal"));
|
||||||
port_grab_distance_vertical = get_theme_constant(SNAME("port_grab_distance_vertical"));
|
port_grab_distance_vertical = get_theme_constant(SNAME("port_grab_distance_vertical"));
|
||||||
|
|
||||||
@ -435,8 +437,9 @@ void GraphEdit::_notification(int p_what) {
|
|||||||
layout_button->set_icon(get_theme_icon(SNAME("layout")));
|
layout_button->set_icon(get_theme_icon(SNAME("layout")));
|
||||||
|
|
||||||
zoom_label->set_custom_minimum_size(Size2(48, 0) * get_theme_default_base_scale());
|
zoom_label->set_custom_minimum_size(Size2(48, 0) * get_theme_default_base_scale());
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_READY) {
|
|
||||||
|
case NOTIFICATION_READY: {
|
||||||
Size2 hmin = h_scroll->get_combined_minimum_size();
|
Size2 hmin = h_scroll->get_combined_minimum_size();
|
||||||
Size2 vmin = v_scroll->get_combined_minimum_size();
|
Size2 vmin = v_scroll->get_combined_minimum_size();
|
||||||
|
|
||||||
@ -449,13 +452,13 @@ void GraphEdit::_notification(int p_what) {
|
|||||||
v_scroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0);
|
v_scroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0);
|
||||||
v_scroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 0);
|
v_scroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 0);
|
||||||
v_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
|
v_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
draw_style_box(get_theme_stylebox(SNAME("bg")), Rect2(Point2(), get_size()));
|
draw_style_box(get_theme_stylebox(SNAME("bg")), Rect2(Point2(), get_size()));
|
||||||
|
|
||||||
if (is_using_snap()) {
|
if (is_using_snap()) {
|
||||||
//draw grid
|
// Draw grid.
|
||||||
|
|
||||||
int snap = get_snap();
|
int snap = get_snap();
|
||||||
|
|
||||||
Vector2 offset = get_scroll_ofs() / zoom;
|
Vector2 offset = get_scroll_ofs() / zoom;
|
||||||
@ -493,12 +496,13 @@ void GraphEdit::_notification(int p_what) {
|
|||||||
draw_line(Vector2(0, base_ofs), Vector2(get_size().width, base_ofs), color);
|
draw_line(Vector2(0, base_ofs), Vector2(get_size().width, base_ofs), color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_RESIZED) {
|
case NOTIFICATION_RESIZED: {
|
||||||
_update_scroll();
|
_update_scroll();
|
||||||
top_layer->update();
|
top_layer->update();
|
||||||
minimap->update();
|
minimap->update();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "graph_node.h"
|
#include "graph_node.h"
|
||||||
|
|
||||||
#include "core/string/translation.h"
|
#include "core/string/translation.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "graph_edit.h"
|
#include "graph_edit.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -179,11 +179,12 @@ void GridContainer::_notification(int p_what) {
|
|||||||
col_ofs += s.width + hsep;
|
col_ofs += s.width + hsep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
queue_sort();
|
queue_sort();
|
||||||
|
@ -855,20 +855,23 @@ static Rect2 _adjust_to_max_size(Size2 p_size, Size2 p_max_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ItemList::_notification(int p_what) {
|
void ItemList::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_RESIZED) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_RESIZED: {
|
||||||
shape_changed = true;
|
shape_changed = true;
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if ((p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED) || (p_what == NOTIFICATION_TRANSLATION_CHANGED) || (p_what == NOTIFICATION_THEME_CHANGED)) {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
|
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
_shape(i);
|
_shape(i);
|
||||||
}
|
}
|
||||||
shape_changed = true;
|
shape_changed = true;
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
case NOTIFICATION_DRAW: {
|
||||||
Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
|
Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
|
||||||
|
|
||||||
int mw = scroll_bar->get_minimum_size().x;
|
int mw = scroll_bar->get_minimum_size().x;
|
||||||
@ -1294,6 +1297,7 @@ void ItemList::_notification(int p_what) {
|
|||||||
const int y = base_ofs.y + separators[i];
|
const int y = base_ofs.y + separators[i];
|
||||||
draw_line(Vector2(bg->get_margin(SIDE_LEFT), y), Vector2(width, y), guide_color);
|
draw_line(Vector2(bg->get_margin(SIDE_LEFT), y), Vector2(width, y), guide_color);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,8 @@ inline void draw_glyph_outline(const Glyph &p_gl, const RID &p_canvas, const Col
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Label::_notification(int p_what) {
|
void Label::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
String new_text = atr(text);
|
String new_text = atr(text);
|
||||||
if (new_text == xl_text) {
|
if (new_text == xl_text) {
|
||||||
return; // Nothing new.
|
return; // Nothing new.
|
||||||
@ -275,13 +276,13 @@ void Label::_notification(int p_what) {
|
|||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED) {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
case NOTIFICATION_DRAW: {
|
||||||
if (clip) {
|
if (clip) {
|
||||||
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
|
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
|
||||||
}
|
}
|
||||||
@ -528,14 +529,16 @@ void Label::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
ofs.y += TS->shaped_text_get_descent(lines_rid[i]) + vsep + line_spacing + font->get_spacing(TextServer::SPACING_BOTTOM);
|
ofs.y += TS->shaped_text_get_descent(lines_rid[i]) + vsep + line_spacing + font->get_spacing(TextServer::SPACING_BOTTOM);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
font_dirty = true;
|
font_dirty = true;
|
||||||
update();
|
update();
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_RESIZED) {
|
|
||||||
|
case NOTIFICATION_RESIZED: {
|
||||||
lines_dirty = true;
|
lines_dirty = true;
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,31 +656,37 @@ void LineEdit::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case NOTIFICATION_RESIZED: {
|
case NOTIFICATION_RESIZED: {
|
||||||
_fit_to_width();
|
_fit_to_width();
|
||||||
scroll_offset = 0;
|
scroll_offset = 0;
|
||||||
set_caret_column(get_caret_column());
|
set_caret_column(get_caret_column());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
_shape();
|
_shape();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
placeholder_translated = atr(placeholder);
|
placeholder_translated = atr(placeholder);
|
||||||
_shape();
|
_shape();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
|
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
|
||||||
window_has_focus = true;
|
window_has_focus = true;
|
||||||
draw_caret = true;
|
draw_caret = true;
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_WINDOW_FOCUS_OUT: {
|
case NOTIFICATION_WM_WINDOW_FOCUS_OUT: {
|
||||||
window_has_focus = false;
|
window_has_focus = false;
|
||||||
draw_caret = false;
|
draw_caret = false;
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if ((!has_focus() && !(menu && menu->has_focus()) && !caret_force_displayed) || !window_has_focus) {
|
if ((!has_focus() && !(menu && menu->has_focus()) && !caret_force_displayed) || !window_has_focus) {
|
||||||
draw_caret = false;
|
draw_caret = false;
|
||||||
@ -923,6 +929,7 @@ void LineEdit::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_FOCUS_ENTER: {
|
case NOTIFICATION_FOCUS_ENTER: {
|
||||||
if (!caret_force_displayed) {
|
if (!caret_force_displayed) {
|
||||||
if (caret_blink_enabled) {
|
if (caret_blink_enabled) {
|
||||||
@ -942,6 +949,7 @@ void LineEdit::_notification(int p_what) {
|
|||||||
|
|
||||||
show_virtual_keyboard();
|
show_virtual_keyboard();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_FOCUS_EXIT: {
|
case NOTIFICATION_FOCUS_EXIT: {
|
||||||
if (caret_blink_enabled && !caret_force_displayed) {
|
if (caret_blink_enabled && !caret_force_displayed) {
|
||||||
caret_blink_timer->stop();
|
caret_blink_timer->stop();
|
||||||
@ -964,6 +972,7 @@ void LineEdit::_notification(int p_what) {
|
|||||||
deselect();
|
deselect();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
|
case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
|
||||||
if (has_focus()) {
|
if (has_focus()) {
|
||||||
ime_text = DisplayServer::get_singleton()->ime_get_text();
|
ime_text = DisplayServer::get_singleton()->ime_get_text();
|
||||||
@ -974,10 +983,12 @@ void LineEdit::_notification(int p_what) {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Control::NOTIFICATION_DRAG_BEGIN: {
|
|
||||||
|
case NOTIFICATION_DRAG_BEGIN: {
|
||||||
drag_action = true;
|
drag_action = true;
|
||||||
} break;
|
} break;
|
||||||
case Control::NOTIFICATION_DRAG_END: {
|
|
||||||
|
case NOTIFICATION_DRAG_END: {
|
||||||
if (is_drag_successful()) {
|
if (is_drag_successful()) {
|
||||||
if (selection.drag_attempt) {
|
if (selection.drag_attempt) {
|
||||||
selection.drag_attempt = false;
|
selection.drag_attempt = false;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "link_button.h"
|
#include "link_button.h"
|
||||||
|
|
||||||
#include "core/string/translation.h"
|
#include "core/string/translation.h"
|
||||||
|
|
||||||
void LinkButton::_shape() {
|
void LinkButton::_shape() {
|
||||||
@ -148,18 +149,20 @@ void LinkButton::_notification(int p_what) {
|
|||||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
xl_text = atr(text);
|
xl_text = atr(text);
|
||||||
_shape();
|
_shape();
|
||||||
|
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
_shape();
|
_shape();
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
Size2 size = get_size();
|
Size2 size = get_size();
|
||||||
@ -230,7 +233,6 @@ void LinkButton::_notification(int p_what) {
|
|||||||
draw_line(Vector2(0, y), Vector2(width, y), color, text_buf->get_line_underline_thickness());
|
draw_line(Vector2(0, y), Vector2(width, y), color, text_buf->get_line_underline_thickness());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ void MarginContainer::_notification(int p_what) {
|
|||||||
fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
|
fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
@ -139,11 +139,13 @@ void MenuButton::_notification(int p_what) {
|
|||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
popup->set_layout_direction((Window::LayoutDirection)get_layout_direction());
|
popup->set_layout_direction((Window::LayoutDirection)get_layout_direction());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (!is_visible_in_tree()) {
|
if (!is_visible_in_tree()) {
|
||||||
popup->hide();
|
popup->hide();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
Vector2i mouse_pos = DisplayServer::get_singleton()->mouse_get_position() - mouse_pos_adjusted;
|
Vector2i mouse_pos = DisplayServer::get_singleton()->mouse_get_position() - mouse_pos_adjusted;
|
||||||
MenuButton *menu_btn_other = Object::cast_to<MenuButton>(get_viewport()->gui_find_control(mouse_pos));
|
MenuButton *menu_btn_other = Object::cast_to<MenuButton>(get_viewport()->gui_find_control(mouse_pos));
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
#include "servers/rendering_server.h"
|
#include "servers/rendering_server.h"
|
||||||
|
|
||||||
void NinePatchRect::_notification(int p_what) {
|
void NinePatchRect::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
if (texture.is_null()) {
|
if (texture.is_null()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -46,6 +47,7 @@ void NinePatchRect::_notification(int p_what) {
|
|||||||
|
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
RS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[SIDE_LEFT], margin[SIDE_TOP]), Vector2(margin[SIDE_RIGHT], margin[SIDE_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center);
|
RS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[SIDE_LEFT], margin[SIDE_TOP]), Vector2(margin[SIDE_RIGHT], margin[SIDE_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ void OptionButton::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
arrow->draw(ci, ofs, clr);
|
arrow->draw(ci, ofs, clr);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||||
popup->set_layout_direction((Window::LayoutDirection)get_layout_direction());
|
popup->set_layout_direction((Window::LayoutDirection)get_layout_direction());
|
||||||
@ -107,6 +108,7 @@ void OptionButton::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (!is_visible_in_tree()) {
|
if (!is_visible_in_tree()) {
|
||||||
popup->hide();
|
popup->hide();
|
||||||
|
@ -31,10 +31,12 @@
|
|||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
|
|
||||||
void Panel::_notification(int p_what) {
|
void Panel::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
|
Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
|
||||||
style->draw(ci, Rect2(Point2(), get_size()));
|
style->draw(ci, Rect2(Point2(), get_size()));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ Vector<int> PanelContainer::get_allowed_size_flags_vertical() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PanelContainer::_notification(int p_what) {
|
void PanelContainer::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
RID ci = get_canvas_item();
|
RID ci = get_canvas_item();
|
||||||
Ref<StyleBox> style;
|
Ref<StyleBox> style;
|
||||||
|
|
||||||
@ -90,9 +91,9 @@ void PanelContainer::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
style->draw(ci, Rect2(Point2(), get_size()));
|
style->draw(ci, Rect2(Point2(), get_size()));
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
case NOTIFICATION_SORT_CHILDREN: {
|
||||||
Ref<StyleBox> style;
|
Ref<StyleBox> style;
|
||||||
|
|
||||||
if (has_theme_stylebox(SNAME("panel"))) {
|
if (has_theme_stylebox(SNAME("panel"))) {
|
||||||
@ -119,6 +120,7 @@ void PanelContainer::_notification(int p_what) {
|
|||||||
|
|
||||||
fit_child_in_rect(c, Rect2(ofs, size));
|
fit_child_in_rect(c, Rect2(ofs, size));
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,19 +74,19 @@ void Popup::_notification(int p_what) {
|
|||||||
emit_signal(SNAME("popup_hide"));
|
emit_signal(SNAME("popup_hide"));
|
||||||
popped_up = false;
|
popped_up = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
|
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
|
||||||
if (has_focus()) {
|
if (has_focus()) {
|
||||||
popped_up = true;
|
popped_up = true;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_deinitialize_visible_parents();
|
_deinitialize_visible_parents();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_WM_CLOSE_REQUEST: {
|
|
||||||
_close_pressed();
|
case NOTIFICATION_WM_CLOSE_REQUEST:
|
||||||
} break;
|
|
||||||
case NOTIFICATION_APPLICATION_FOCUS_OUT: {
|
case NOTIFICATION_APPLICATION_FOCUS_OUT: {
|
||||||
_close_pressed();
|
_close_pressed();
|
||||||
} break;
|
} break;
|
||||||
@ -241,13 +241,20 @@ void PopupPanel::_update_child_rects() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PopupPanel::_notification(int p_what) {
|
void PopupPanel::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name()));
|
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name()));
|
||||||
} else if (p_what == NOTIFICATION_READY || p_what == NOTIFICATION_ENTER_TREE) {
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
case NOTIFICATION_READY: {
|
||||||
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name()));
|
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name()));
|
||||||
_update_child_rects();
|
_update_child_rects();
|
||||||
} else if (p_what == NOTIFICATION_WM_SIZE_CHANGED) {
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_WM_SIZE_CHANGED: {
|
||||||
_update_child_rects();
|
_update_child_rects();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,6 +736,7 @@ void PopupMenu::_notification(int p_what) {
|
|||||||
set_submenu_popup_delay(pm_delay);
|
set_submenu_popup_delay(pm_delay);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED:
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
@ -748,23 +749,25 @@ void PopupMenu::_notification(int p_what) {
|
|||||||
child_controls_changed();
|
child_controls_changed();
|
||||||
control->update();
|
control->update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_MOUSE_ENTER: {
|
case NOTIFICATION_WM_MOUSE_ENTER: {
|
||||||
grab_focus();
|
grab_focus();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_MOUSE_EXIT: {
|
case NOTIFICATION_WM_MOUSE_EXIT: {
|
||||||
if (mouse_over >= 0 && (items[mouse_over].submenu.is_empty() || submenu_over != -1)) {
|
if (mouse_over >= 0 && (items[mouse_over].submenu.is_empty() || submenu_over != -1)) {
|
||||||
mouse_over = -1;
|
mouse_over = -1;
|
||||||
control->update();
|
control->update();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_POST_POPUP: {
|
case NOTIFICATION_POST_POPUP: {
|
||||||
initial_button_mask = Input::get_singleton()->get_mouse_button_mask();
|
initial_button_mask = Input::get_singleton()->get_mouse_button_mask();
|
||||||
during_grabbed_click = (bool)initial_button_mask;
|
during_grabbed_click = (bool)initial_button_mask;
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_WM_SIZE_CHANGED: {
|
|
||||||
} break;
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
//only used when using operating system windows
|
// Only used when using operating system windows.
|
||||||
if (!is_embedded() && autohide_areas.size()) {
|
if (!is_embedded() && autohide_areas.size()) {
|
||||||
Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
|
Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
|
||||||
mouse_pos -= get_position();
|
mouse_pos -= get_position();
|
||||||
@ -777,6 +780,7 @@ void PopupMenu::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (!is_visible()) {
|
if (!is_visible()) {
|
||||||
if (mouse_over >= 0) {
|
if (mouse_over >= 0) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user