Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename global transform notification to contain the word "global" #104352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions doc/classes/CanvasItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,19 @@
Hide the [CanvasItem] if it's currently visible. This is equivalent to setting [member visible] to [code]false[/code].
</description>
</method>
<method name="is_global_transform_notification_enabled" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if global transform notifications are communicated to children.
</description>
</method>
<method name="is_local_transform_notification_enabled" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if the node receives [constant NOTIFICATION_LOCAL_TRANSFORM_CHANGED] whenever its local transform changes. This is enabled with [method set_notify_local_transform].
</description>
</method>
<method name="is_transform_notification_enabled" qualifiers="const">
<method name="is_transform_notification_enabled" qualifiers="const" deprecated="Use [method is_global_transform_notification_enabled] instead.">
<return type="bool" />
<description>
Returns [code]true[/code] if the node receives [constant NOTIFICATION_TRANSFORM_CHANGED] whenever its global transform changes. This is enabled with [method set_notify_transform].
Expand Down Expand Up @@ -581,6 +587,13 @@
[b]Note:[/b] [param name] is case-sensitive and must match the name of the uniform in the code exactly (not the capitalized name in the inspector).
</description>
</method>
<method name="set_notify_global_transform">
<return type="void" />
<param index="0" name="enable" type="bool" />
<description>
If [param enable] is [code]true[/code], this node will receive [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] when its global transform changes.
</description>
</method>
<method name="set_notify_local_transform">
<return type="void" />
<param index="0" name="enable" type="bool" />
Expand All @@ -589,11 +602,11 @@
[b]Note:[/b] Many canvas items such as [Bone2D] or [CollisionShape2D] automatically enable this in order to function correctly.
</description>
</method>
<method name="set_notify_transform">
<method name="set_notify_transform" deprecated="Use [method set_notify_global_transform] instead.">
<return type="void" />
<param index="0" name="enable" type="bool" />
<description>
If [code]true[/code], the node will receive [constant NOTIFICATION_TRANSFORM_CHANGED] whenever global transform changes.
If [code]true[/code], the node will receive [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] whenever global transform changes.
[b]Note:[/b] Many canvas items such as [Camera2D] or [Light2D] automatically enable this in order to function correctly.
</description>
</method>
Expand Down Expand Up @@ -692,10 +705,13 @@
</signal>
</signals>
<constants>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000">
Notification received when this node's global transform changes, if [method is_transform_notification_enabled] is [code]true[/code]. See also [method set_notify_transform] and [method get_transform].
<constant name="NOTIFICATION_GLOBAL_TRANSFORM_CHANGED" value="2000" keywords="NOTIFICATION_TRANSFORM_CHANGED">
Notification received when this node's global transform changes, if [method is_global_transform_notification_enabled] is [code]true[/code]. See also [method set_notify_global_transform] and [method get_transform].
[b]Note:[/b] Many canvas items such as [Camera2D] or [CollisionObject2D] automatically enable this in order to function correctly.
</constant>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000" deprecated="Use [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] instead.">
The [CanvasItem]'s global transform has changed. This notification is only received if enabled by [method set_notify_global_transform].
</constant>
<constant name="NOTIFICATION_LOCAL_TRANSFORM_CHANGED" value="35">
Notification received when this node's transform changes, if [method is_local_transform_notification_enabled] is [code]true[/code]. This is not received when a parent [Node2D]'s transform changes. See also [method set_notify_local_transform].
[b]Note:[/b] Many canvas items such as [Camera2D] or [CollisionShape2D] automatically enable this in order to function correctly.
Expand Down
36 changes: 28 additions & 8 deletions doc/classes/Node3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<method name="force_update_transform">
<return type="void" />
<description>
Forces the node's [member global_transform] to update, by sending [constant NOTIFICATION_TRANSFORM_CHANGED]. Fails if the node is not inside the tree.
Forces the node's [member global_transform] to update, by sending [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED]. Fails if the node is not inside the tree.
[b]Note:[/b] For performance reasons, transform changes are usually accumulated and applied [i]once[/i] at the end of the frame. The update propagates through [Node3D] children, as well. Therefore, use this method only when you need an up-to-date transform (such as during physics operations).
</description>
</method>
Expand Down Expand Up @@ -98,6 +98,12 @@
Prevents this node from being rendered. Equivalent to setting [member visible] to [code]false[/code]. This is the opposite of [method show].
</description>
</method>
<method name="is_global_transform_notification_enabled" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if the node receives [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] whenever [member global_transform] changes. This is enabled with [method set_notify_global_transform].
</description>
</method>
<method name="is_local_transform_notification_enabled" qualifiers="const">
<return type="bool" />
<description>
Expand All @@ -111,10 +117,10 @@
[b]Note:[/b] [member transform] is not affected by this setting.
</description>
</method>
<method name="is_transform_notification_enabled" qualifiers="const">
<method name="is_transform_notification_enabled" qualifiers="const" deprecated="Use [method is_global_transform_notification_enabled] instead.">
<return type="bool" />
<description>
Returns [code]true[/code] if the node receives [constant NOTIFICATION_TRANSFORM_CHANGED] whenever [member global_transform] changes. This is enabled with [method set_notify_transform].
Returns [code]true[/code] if the node receives [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] whenever [member global_transform] changes. This is enabled with [method set_notify_global_transform].
</description>
</method>
<method name="is_visible_in_tree" qualifiers="const">
Expand Down Expand Up @@ -215,10 +221,19 @@
<return type="void" />
<param index="0" name="enabled" type="bool" />
<description>
If [code]true[/code], the node will not receive [constant NOTIFICATION_TRANSFORM_CHANGED] or [constant NOTIFICATION_LOCAL_TRANSFORM_CHANGED].
If [code]true[/code], the node will not receive [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] or [constant NOTIFICATION_LOCAL_TRANSFORM_CHANGED].
It may useful to call this method when handling these notifications to prevent infinite recursion.
</description>
</method>
<method name="set_notify_global_transform" keywords="set_notify_global_transform">
<return type="void" />
<param index="0" name="enable" type="bool" />
<description>
If [code]true[/code], the node will receive [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] whenever [member global_transform] changes.
[b]Note:[/b] Most 3D nodes such as [VisualInstance3D] or [CollisionObject3D] automatically enable this to function correctly.
[b]Note:[/b] In the editor, nodes will propagate this notification to their children if a gizmo is attached (see [method add_gizmo]).
</description>
</method>
<method name="set_notify_local_transform">
<return type="void" />
<param index="0" name="enable" type="bool" />
Expand All @@ -227,11 +242,11 @@
[b]Note:[/b] Some 3D nodes such as [CSGShape3D] or [CollisionShape3D] automatically enable this to function correctly.
</description>
</method>
<method name="set_notify_transform" keywords="set_notify_global_transform">
<method name="set_notify_transform" deprecated="Use [method set_notify_global_transform] instead.">
<return type="void" />
<param index="0" name="enable" type="bool" />
<description>
If [code]true[/code], the node will receive [constant NOTIFICATION_TRANSFORM_CHANGED] whenever [member global_transform] changes.
If [code]true[/code], the node will receive [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] whenever [member global_transform] changes.
[b]Note:[/b] Most 3D nodes such as [VisualInstance3D] or [CollisionObject3D] automatically enable this to function correctly.
[b]Note:[/b] In the editor, nodes will propagate this notification to their children if a gizmo is attached (see [method add_gizmo]).
</description>
Expand Down Expand Up @@ -370,8 +385,13 @@
</signal>
</signals>
<constants>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000" keywords="NOTIFICATION_GLOBAL_TRANSFORM_CHANGED">
Notification received when this node's [member global_transform] changes, if [method is_transform_notification_enabled] is [code]true[/code]. See also [method set_notify_transform].
<constant name="NOTIFICATION_GLOBAL_TRANSFORM_CHANGED" value="2000" keywords="NOTIFICATION_TRANSFORM_CHANGED">
Notification received when this node's [member global_transform] changes, if [method is_global_transform_notification_enabled] is [code]true[/code]. See also [method set_notify_global_transform].
[b]Note:[/b] Most 3D nodes such as [VisualInstance3D] or [CollisionObject3D] automatically enable this to function correctly.
[b]Note:[/b] In the editor, nodes will propagate this notification to their children if a gizmo is attached (see [method add_gizmo]).
</constant>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000" deprecated="Use [constant NOTIFICATION_GLOBAL_TRANSFORM_CHANGED] instead.">
Notification received when this node's [member global_transform] changes, if [method is_global_transform_notification_enabled] is [code]true[/code]. See also [method set_notify_global_transform].
[b]Note:[/b] Most 3D nodes such as [VisualInstance3D] or [CollisionObject3D] automatically enable this to function correctly.
[b]Note:[/b] In the editor, nodes will propagate this notification to their children if a gizmo is attached (see [method add_gizmo]).
</constant>
Expand Down
4 changes: 2 additions & 2 deletions editor/gui/editor_toaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void EditorToaster::_notification(int p_what) {
error_panel_style_progress->set_border_color(get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
_update_vbox_position();
_update_disable_notifications_button();
} break;
Expand Down Expand Up @@ -533,7 +533,7 @@ EditorToaster *EditorToaster::get_singleton() {
}

EditorToaster::EditorToaster() {
set_notify_transform(true);
set_notify_global_transform(true);

// VBox.
vbox_container = memnew(VBoxContainer);
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/embedded_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void EmbeddedProcess::embed_process(OS::ProcessID p_pid) {
embedding_grab_focus = has_focus();
timer_update_embedded_process->start();
set_process(true);
set_notify_transform(true);
set_notify_global_transform(true);

// Attempt to embed the process, but if it has just started and the window is not ready yet,
// we will retry in this case.
Expand All @@ -191,7 +191,7 @@ void EmbeddedProcess::reset() {
timer_embedding->stop();
timer_update_embedded_process->stop();
set_process(false);
set_notify_transform(false);
set_notify_global_transform(false);
queue_redraw();
}

Expand Down
2 changes: 1 addition & 1 deletion modules/csg/csg_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ void CSGShape3D::_notification(int p_what) {
}
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
}
Expand Down
4 changes: 2 additions & 2 deletions modules/gridmap/grid_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void GridMap::_notification(int p_what) {
_update_visibility();
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
Transform3D new_xform = get_global_transform();
if (new_xform == last_transform) {
break;
Expand Down Expand Up @@ -1372,7 +1372,7 @@ RID GridMap::get_bake_mesh_instance(int p_idx) {
}

GridMap::GridMap() {
set_notify_transform(true);
set_notify_global_transform(true);
#ifdef DEBUG_ENABLED
NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &GridMap::_navigation_map_changed));
NavigationServer3D::get_singleton()->connect("navigation_debug_changed", callable_mp(this, &GridMap::_update_navigation_debug_edge_connections));
Expand Down
8 changes: 4 additions & 4 deletions scene/2d/camera_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ Transform2D Camera2D::get_camera_transform() {
void Camera2D::_ensure_update_interpolation_data() {
// The "curr -> previous" update can either occur
// on NOTIFICATION_INTERNAL_PHYSICS_PROCESS, OR
// on NOTIFICATION_TRANSFORM_CHANGED,
// if NOTIFICATION_TRANSFORM_CHANGED takes place earlier than
// on NOTIFICATION_GLOBAL_TRANSFORM_CHANGED,
// if NOTIFICATION_GLOBAL_TRANSFORM_CHANGED takes place earlier than
// NOTIFICATION_INTERNAL_PHYSICS_PROCESS on a tick.
// This is to ensure that the data keeps flowing, but the new data
// doesn't overwrite before prev has been set.
Expand Down Expand Up @@ -359,7 +359,7 @@ void Camera2D::_notification(int p_what) {
}
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
if ((!position_smoothing_enabled && !is_physics_interpolated_and_enabled()) || is_part_of_edited_scene()) {
_update_scroll();
}
Expand Down Expand Up @@ -1065,7 +1065,7 @@ void Camera2D::_bind_methods() {
}

Camera2D::Camera2D() {
set_notify_transform(true);
set_notify_global_transform(true);
set_hide_clip_children(true);

#ifdef TOOLS_ENABLED
Expand Down
8 changes: 4 additions & 4 deletions scene/2d/cpu_particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ void CPUParticles2D::set_use_local_coordinates(bool p_enable) {
// and inform the RenderingServer to use identity mode.
set_canvas_item_use_identity_transform(!local_coords);

// We only need NOTIFICATION_TRANSFORM_CHANGED
// We only need NOTIFICATION_GLOBAL_TRANSFORM_CHANGED
// when following an interpolated target.

#ifdef TOOLS_ENABLED
set_notify_transform(_interpolation_data.interpolated_follow || (Engine::get_singleton()->is_editor_hint() && !local_coords));
set_notify_global_transform(_interpolation_data.interpolated_follow || (Engine::get_singleton()->is_editor_hint() && !local_coords));
#else
set_notify_transform(_interpolation_data.interpolated_follow);
set_notify_global_transform(_interpolation_data.interpolated_follow);
#endif

queue_redraw();
Expand Down Expand Up @@ -1281,7 +1281,7 @@ void CPUParticles2D::_notification(int p_what) {
}
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
if (_interpolation_data.interpolated_follow) {
// If the transform has been updated AFTER the physics tick, keep data flowing.
if (Engine::get_singleton()->is_in_physics_frame()) {
Expand Down
4 changes: 2 additions & 2 deletions scene/2d/gpu_particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
void GPUParticles2D::set_use_local_coordinates(bool p_enable) {
local_coords = p_enable;
RS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
set_notify_transform(!p_enable);
set_notify_global_transform(!p_enable);
if (!p_enable && is_inside_tree()) {
_update_particle_emission_transform();
}
Expand Down Expand Up @@ -763,7 +763,7 @@ void GPUParticles2D::_notification(int p_what) {
}
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
_update_particle_emission_transform();
} break;

Expand Down
6 changes: 3 additions & 3 deletions scene/2d/light_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void Light2D::_notification(int p_what) {
_update_light_visibility();
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
RS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform());
} break;

Expand All @@ -219,7 +219,7 @@ void Light2D::_notification(int p_what) {
case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: {
if (is_visible_in_tree() && is_physics_interpolated()) {
// Explicitly make sure the transform is up to date in RenderingServer before
// resetting. This is necessary because NOTIFICATION_TRANSFORM_CHANGED
// resetting. This is necessary because NOTIFICATION_GLOBAL_TRANSFORM_CHANGED
// is normally deferred, and a client change to transform will not always be sent
// before the reset, so we need to guarantee this.
RS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform());
Expand Down Expand Up @@ -332,7 +332,7 @@ void Light2D::_bind_methods() {

Light2D::Light2D() {
canvas_light = RenderingServer::get_singleton()->canvas_light_create();
set_notify_transform(true);
set_notify_global_transform(true);
}

Light2D::~Light2D() {
Expand Down
6 changes: 3 additions & 3 deletions scene/2d/light_occluder_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void LightOccluder2D::_notification(int p_what) {
RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree());
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
} break;

Expand Down Expand Up @@ -208,7 +208,7 @@ void LightOccluder2D::_notification(int p_what) {
case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: {
if (is_visible_in_tree() && is_physics_interpolated()) {
// Explicitly make sure the transform is up to date in RenderingServer before
// resetting. This is necessary because NOTIFICATION_TRANSFORM_CHANGED
// resetting. This is necessary because NOTIFICATION_GLOBAL_TRANSFORM_CHANGED
// is normally deferred, and a client change to transform will not always be sent
// before the reset, so we need to guarantee this.
RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
Expand Down Expand Up @@ -303,7 +303,7 @@ void LightOccluder2D::_bind_methods() {
LightOccluder2D::LightOccluder2D() {
occluder = RS::get_singleton()->canvas_light_occluder_create();

set_notify_transform(true);
set_notify_global_transform(true);
set_as_sdf_collision(true);
}

Expand Down
4 changes: 2 additions & 2 deletions scene/2d/navigation_link_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void NavigationLink2D::_notification(int p_what) {
_link_enter_navigation_map();
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
set_physics_process_internal(true);
} break;

Expand Down Expand Up @@ -436,7 +436,7 @@ NavigationLink2D::NavigationLink2D() {
NavigationServer2D::get_singleton()->link_set_bidirectional(link, bidirectional);
NavigationServer2D::get_singleton()->link_set_enabled(link, enabled);

set_notify_transform(true);
set_notify_global_transform(true);
set_hide_clip_children(true);
}

Expand Down
4 changes: 2 additions & 2 deletions scene/2d/navigation_region_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void NavigationRegion2D::_notification(int p_what) {
_region_enter_navigation_map();
} break;

case NOTIFICATION_TRANSFORM_CHANGED: {
case NOTIFICATION_GLOBAL_TRANSFORM_CHANGED: {
set_physics_process_internal(true);
} break;

Expand Down Expand Up @@ -378,7 +378,7 @@ bool NavigationRegion2D::_get(const StringName &p_name, Variant &r_ret) const {
#endif // DISABLE_DEPRECATED

NavigationRegion2D::NavigationRegion2D() {
set_notify_transform(true);
set_notify_global_transform(true);
set_hide_clip_children(true);

region = NavigationServer2D::get_singleton()->region_create();
Expand Down
Loading