ronantakizawa/codereview-bench huggingface dataset:
Repository: godotengine/godot
File: drivers/unix/os_unix.cpp (C++)

Code before:
		return false;
	}

	int status = 0;
	if (waitpid(p_pid, &status, WNOHANG) != 0) {
		if (pi) {
			pi->is_running = false;
			pi->exit_code = status;
		}
		return false;
	}

	return true;
}

int OS_Unix::get_process_exit_code(const ProcessID &p_pid) const {
	MutexLock lock(process_map_mutex);
	const ProcessInfo *pi = process_map->getptr(p_pid);

	if (pi && !pi->is_running) {
		return pi->exit_code;
	}

	int status = 0;
	if (waitpid(p_pid, &status, WNOHANG) != 0) {
		status = WIFEXITED(status) ? WEXITSTATUS(status) : status;
		if (pi) {
			pi->is_running = false;
			pi->exit_code = status;
		}
		return status;
	}
	return -1;
}

String OS_Unix::get_locale() const {
	if (!has_environment("LANG")) {
		return "en";
	}

	String locale = get_environment("LANG");
	int tp = locale.find_char('.');
	if (tp != -1) {
		locale = locale.substr(0, tp);
	}
	return locale;
}

Error OS_Unix::open_dynamic_library(const String &p_path, void *&p_library_handle, GDExtensionData *p_data) {
	String path = p_path;


Review comment (bug):
I just realized only this function ran the `WIFEXITED` check; if `is_process_running` was called first this could result in different behavior. I opted to use it for both cases, possibly fixing some obscure bug.

Code after:
		setsid();

		Vector<CharString> cs;
		cs.push_back(p_path.utf8());
		for (const String &arg : p_arguments) {
			cs.push_back(arg.utf8());
		}

		Vector<char *> args;
		for (int i = 0; i < cs.size(); i++) {
			args.push_back((char *)cs[i].get_data());
		}
		args.push_back(0);

		execvp(p_path.utf8().get_data(), &args[0]);
		// The execvp() function only returns if an error occurs.
		ERR_PRINT("Could not create child process: " + p_path);
		raise(SIGKILL);
	}

	ProcessInfo pi;
	process_map_mutex.lock();
	process_map->insert(pid, pi);
	process_map_mutex.unlock();

	if (r_child_id) {
		*r_child_id = pid;
	}
	return OK;
#endif
}

Error OS_Unix::kill(const ProcessID &p_pid) {
	int ret = ::kill(p_pid, SIGKILL);
	if (!ret) {
		//avoid zombie process
		int st;
		_wait_for_pid_completion(p_pid, &st, 0);
	}
	return ret ? ERR_INVALID_PARAMETER : OK;
}

int OS_Unix::get_process_id() const {
	return getpid();
}

bool OS_Unix::is_process_running(const ProcessID &p_pid) const {
	MutexLock lock(process_map_mutex);
	return _check_pid_is_running(p_pid, nullptr);
}
Repository: godotengine/godot
File: scene/2d/sprite_2d.cpp (C++)

Code before:
	set_region_rect(p_state["region_rect"]);
}

void Sprite2D::_edit_set_pivot(const Point2 &p_pivot) {
	set_offset(get_offset() - p_pivot);
	set_position(get_transform().xform(p_pivot));
}

Point2 Sprite2D::_edit_get_pivot() const {
	return Vector2();
}

bool Sprite2D::_edit_use_pivot() const {
	return true;
}

void Sprite2D::_edit_set_rect(const Rect2 &p_rect) {
	if (texture.is_null()) {
		return;
	}
	if (!(region_enabled && Input::get_singleton()->is_key_label_pressed(Key::CTRL))) {
		Node2D::_edit_set_rect(p_rect);
		return;
	}
	Point2 pivot = p_rect.position - (centered ? _get_rect_offset(p_rect.size) : Vector2());
	offset = pivot; // This is needed as we have to keep offset being Vector2()
	set_region_rect(Rect2(Vector2(), p_rect.size));
	_edit_set_pivot(pivot);
}
#endif // TOOLS_ENABLED

#ifdef DEBUG_ENABLED
bool Sprite2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
	return is_pixel_opaque(p_point);
}

Rect2 Sprite2D::_edit_get_rect() const {
	return get_rect();
}

bool Sprite2D::_edit_use_rect() const {
	return texture.is_valid();
}
#endif // DEBUG_ENABLED

Rect2 Sprite2D::get_anchorable_rect() const {
	return get_rect();
}

void Sprite2D::_get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_clip_enabled) const {
	Rect2 base_rect;

Review comment (suggestion):
It makes the sprite jump if it had non-zero offset:

https://github.com/user-attachments/assets/78a4435e-388d-440f-af5d-03242536e646



Code after:
	set_region_rect(p_state["region_rect"]);
}

void Sprite2D::_edit_set_pivot(const Point2 &p_pivot) {
	set_offset(get_offset() - p_pivot);
	set_position(get_transform().xform(p_pivot));
}

Point2 Sprite2D::_edit_get_pivot() const {
	return Vector2();
}

bool Sprite2D::_edit_use_pivot() const {
	return true;
}

void Sprite2D::_edit_set_rect(const Rect2 &p_rect) {
	if (texture.is_null()) {
		return;
	}
	if (!(region_enabled && hframes <= 1 && vframes <= 1 && Input::get_singleton()->is_key_label_pressed(Key::CTRL))) {
		Node2D::_edit_set_rect(p_rect);
		return;
	}
	Point2 delta = p_rect.position - (centered ? _get_rect_offset(p_rect.size) : Vector2());
	set_region_rect(Rect2(region_rect.position, p_rect.size));
	set_position(get_position() + get_transform().basis_xform(delta));
}
#endif // TOOLS_ENABLED

#ifdef DEBUG_ENABLED
bool Sprite2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
	return is_pixel_opaque(p_point);
}

Rect2 Sprite2D::_edit_get_rect() const {
	return get_rect();
}

bool Sprite2D::_edit_use_rect() const {
	return texture.is_valid();
}
#endif // DEBUG_ENABLED

Rect2 Sprite2D::get_anchorable_rect() const {
	return get_rect();
}

void Sprite2D::_get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_clip_enabled) const {
	Rect2 base_rect;
Repository: godotengine/godot
File: editor/plugins/sprite_2d_editor_plugin.cpp (C++)

Code before:
	sprite_editor->edit(spr);
	if (spr != nullptr) {
		_update_dragging_mode_hint(spr->is_editor_region_rect_draggable());
		if (!spr->is_connected(update_signal, update_text)) {
			spr->connect(update_signal, update_text);
		}
	}
}

bool Sprite2DEditorPlugin::handles(Object *p_object) const {
	return p_object->is_class("Sprite2D");
}

void Sprite2DEditorPlugin::make_visible(bool p_visible) {
	if (p_visible) {
		sprite_editor->options->show();
	} else {
		sprite_editor->options->hide();
		dragging_mode_hint->hide();
		sprite_editor->edit(nullptr);
	}
}

Sprite2DEditorPlugin::Sprite2DEditorPlugin() {
	sprite_editor = memnew(Sprite2DEditor);
	sprite_editor->connect("theme_changed", callable_mp(this, &Sprite2DEditorPlugin::_editor_theme_changed));
	EditorNode::get_singleton()->get_gui_base()->add_child(sprite_editor);

	dragging_mode_hint = memnew(Label);
	dragging_mode_hint->set_text(TTRC("When dragging:\nHold Ctrl + left mouse button to change the region_rect and position.\nHold left mouse button to modify the scale of the sprite."));
	CanvasItemEditor::get_singleton()->get_controls_container()->add_child(dragging_mode_hint);

	make_visible(false);
	//sprite_editor->options->hide();
}


Review comment (suggestion):
```suggestion
	sprite_editor->connect(SceneStringName(theme_changed), callable_mp(this, &Sprite2DEditorPlugin::_editor_theme_changed));
```

Code after:
	sprite_editor->edit(spr);
	if (spr != nullptr) {
		_update_dragging_mode_hint(spr->is_editor_region_rect_draggable());
		if (!spr->is_connected(update_signal, update_text)) {
			spr->connect(update_signal, update_text);
		}
	}
}

bool Sprite2DEditorPlugin::handles(Object *p_object) const {
	return p_object->is_class("Sprite2D");
}

void Sprite2DEditorPlugin::make_visible(bool p_visible) {
	if (p_visible) {
		sprite_editor->options->show();
	} else {
		sprite_editor->options->hide();
		dragging_mode_hint->hide();
		sprite_editor->edit(nullptr);
	}
}

Sprite2DEditorPlugin::Sprite2DEditorPlugin() {
	sprite_editor = memnew(Sprite2DEditor);
	sprite_editor->connect(SceneStringName(theme_changed), callable_mp(this, &Sprite2DEditorPlugin::_editor_theme_changed));
	EditorNode::get_singleton()->get_gui_base()->add_child(sprite_editor);

	dragging_mode_hint = memnew(Label);
	dragging_mode_hint->set_text(TTRC("When dragging:\nHold Ctrl + left mouse button to change the region_rect and position.\nHold left mouse button to modify the scale of the sprite."));
	CanvasItemEditor::get_singleton()->get_controls_container()->add_child(dragging_mode_hint);

	make_visible(false);
	//sprite_editor->options->hide();
}
Repository: godotengine/godot
File: editor/inspector/editor_resource_picker.cpp (C++)

Code before:

String EditorResourcePicker::_get_resource_type(const Ref<Resource> &p_resource) const {
	if (p_resource.is_null()) {
		return String();
	}
	String res_type = p_resource->get_class();

	Ref<Script> res_script = p_resource->get_script();
	if (res_script.is_null()) {
		return res_type;
	}

	// TODO: Replace with EditorFileSystem when PR #60606 is merged to use cached resource type.
	String script_type = EditorNode::get_editor_data().script_class_get_name(res_script->get_path());
	if (!script_type.is_empty()) {
		res_type = script_type;
	}
	return res_type;
}

static bool _should_hide_type(const StringName &p_type) {
	if (ClassDB::is_virtual(p_type)) {
		return true;
	}

	if (p_type == "MissingResource") {
		return true;
	}

	return false;
}

static void _add_allowed_type(const StringName &p_type, List<StringName> *p_vector) {
	if (p_vector->find(p_type)) {
		// Already added.
		return;
	}

	if (ClassDB::class_exists(p_type)) {
		// Engine class.

		if (!_should_hide_type(p_type)) {
			p_vector->push_back(p_type);
		}

		LocalVector<StringName> inheriters;
		ClassDB::get_inheriters_from_class(p_type, inheriters);
		for (const StringName &S : inheriters) {
			_add_allowed_type(S, p_vector);
		}
	} else {

Review comment (suggestion):
```suggestion
	if (p_type == SNAME("MissingResource")) {
```

Code after:

String EditorResourcePicker::_get_resource_type(const Ref<Resource> &p_resource) const {
	if (p_resource.is_null()) {
		return String();
	}
	String res_type = p_resource->get_class();

	Ref<Script> res_script = p_resource->get_script();
	if (res_script.is_null()) {
		return res_type;
	}

	// TODO: Replace with EditorFileSystem when PR #60606 is merged to use cached resource type.
	String script_type = EditorNode::get_editor_data().script_class_get_name(res_script->get_path());
	if (!script_type.is_empty()) {
		res_type = script_type;
	}
	return res_type;
}

static bool _should_hide_type(const StringName &p_type) {
	if (ClassDB::is_virtual(p_type)) {
		return true;
	}

	if (p_type == SNAME("MissingResource")) {
		return true;
	}

	return false;
}

static void _add_allowed_type(const StringName &p_type, List<StringName> *p_vector) {
	if (p_vector->find(p_type)) {
		// Already added.
		return;
	}

	if (ClassDB::class_exists(p_type)) {
		// Engine class.

		if (!_should_hide_type(p_type)) {
			p_vector->push_back(p_type);
		}

		LocalVector<StringName> inheriters;
		ClassDB::get_inheriters_from_class(p_type, inheriters);
		for (const StringName &S : inheriters) {
			_add_allowed_type(S, p_vector);
		}
	} else {
Repository: godotengine/godot
File: scene/2d/path_2d.cpp (C++)

Code before:
	}

	_curve_changed();
}

Ref<Curve2D> Path2D::get_curve() const {
	return curve;
}

void Path2D::_bind_methods() {
	ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path2D::set_curve);
	ClassDB::bind_method(D_METHOD("get_curve"), &Path2D::get_curve);

	ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &Path2D::set_debug_enabled);
	ClassDB::bind_method(D_METHOD("get_debug_enabled"), &Path2D::get_debug_enabled);

	ClassDB::bind_method(D_METHOD("set_debug_custom_enabled", "enabled"), &Path2D::set_debug_custom_enabled);
	ClassDB::bind_method(D_METHOD("get_debug_custom_enabled"), &Path2D::get_debug_custom_enabled);

	ClassDB::bind_method(D_METHOD("set_debug_custom_color", "debug_custom_color"), &Path2D::set_debug_custom_color);
	ClassDB::bind_method(D_METHOD("get_debug_custom_color"), &Path2D::get_debug_custom_color);

	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT), "set_curve", "get_curve");

	ADD_GROUP("Debug", "debug_");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_custom_enabled"), "set_debug_custom_enabled", "get_debug_custom_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_custom_color"), "set_debug_custom_color", "get_debug_custom_color");
}

/////////////////////////////////////////////////////////////////////////////////

void PathFollow2D::path_changed() {
	if (update_timer && !update_timer->is_stopped()) {
		update_timer->start();
	} else {
		_update_transform();
	}
}

void PathFollow2D::_update_transform() {
	if (!path) {
		return;
	}

	Ref<Curve2D> c = path->get_curve();
	if (c.is_null()) {
		return;
	}

	real_t path_length = c->get_baked_length();

Review comment (bug):
This property is misleading. It does nothing in the editor and does nothing at runtime, unless you enable Path Debug.
While this is properly documented, it might be better to rename it to `disable_debug` or something similar, to make its only use clearer.

Code after:
	ERR_FAIL_COND_MSG(path->get_curve().is_null(), "Can't set progress ratio on a PathFollow2D that does not have a Curve.");
	ERR_FAIL_COND_MSG(!path->get_curve()->get_baked_length(), "Can't set progress ratio on a PathFollow2D that has a 0 length curve.");
	set_progress(p_ratio * path->get_curve()->get_baked_length());
}

real_t PathFollow2D::get_progress_ratio() const {
	if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) {
		return get_progress() / path->get_curve()->get_baked_length();
	} else {
		return 0;
	}
}

void PathFollow2D::set_rotation_enabled(bool p_enabled) {
	rotates = p_enabled;
	_update_transform();
}

bool PathFollow2D::is_rotation_enabled() const {
	return rotates;
}

void PathFollow2D::set_loop(bool p_loop) {
	loop = p_loop;
}

bool PathFollow2D::has_loop() const {
	return loop;
}
Repository: godotengine/godot
File: scene/2d/path_2d.h (C/C++)

Code before:
	static void set_debug_paths_fish_bones_interval(int p_interval);
	static int get_debug_paths_fish_bones_interval();

	PathDebug2D();
	~PathDebug2D();
};

class Path2D : public Node2D {
	GDCLASS(Path2D, Node2D);

	Ref<Curve2D> curve;

	void _curve_changed();

	RID debug_mesh_rid;
	RID debug_instance;
	bool debug_enabled = true;
	bool debug_custom_enabled = false;
	Color debug_custom_color = Color(1.0, 1.0, 1.0, 1.0);

	void _debug_create();
	void _debug_update();
	void _debug_clear();
	void _debug_free();

	bool _emitting_debug_changed = false;
	void _on_debug_global_changed();
	void _emit_debug_changed_deferred();

protected:
	void _notification(int p_what);
	static void _bind_methods();

public:
#ifdef DEBUG_ENABLED
	virtual Rect2 _edit_get_rect() const override;
	virtual bool _edit_use_rect() const override;
	virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif

	void set_curve(const Ref<Curve2D> &p_curve);
	Ref<Curve2D> get_curve() const;

	void set_debug_enabled(bool p_enabled);
	bool get_debug_enabled() const;

	void set_debug_custom_enabled(bool p_enabled);
	bool get_debug_custom_enabled() const;

	void set_debug_custom_color(const Color &p_color);
	const Color &get_debug_custom_color() const;

Review comment (bug):
Why is this underscored?
Also could use a better name, like `debug_emit_queued`.

Code after:
	Timer *update_timer = nullptr;
	real_t h_offset = 0.0;
	real_t v_offset = 0.0;
	bool cubic = true;
	bool loop = true;
	bool rotates = true;

	void _update_transform();

protected:
	void _validate_property(PropertyInfo &p_property) const;

	void _notification(int p_what);
	static void _bind_methods();

public:
	void path_changed();

	void set_progress(real_t p_progress);
	real_t get_progress() const;

	void set_h_offset(real_t p_h_offset);
	real_t get_h_offset() const;

	void set_v_offset(real_t p_v_offset);
	real_t get_v_offset() const;

	void set_progress_ratio(real_t p_ratio);
	real_t get_progress_ratio() const;

	void set_loop(bool p_loop);
	bool has_loop() const;

	void set_rotation_enabled(bool p_enabled);
	bool is_rotation_enabled() const;

	void set_cubic_interpolation_enabled(bool p_enabled);
	bool is_cubic_interpolation_enabled() const;

	PackedStringArray get_configuration_warnings() const override;
};
Repository: godotengine/godot
File: scene/2d/path_2d.cpp (C++)

Code before:
		Vector2 segment_a = curve->get_point_position(i);

		for (int j = 1; j <= 8; j++) {
			real_t frac = j / 8.0;
			const Vector2 segment_b = curve->sample(i, frac);

			Vector2 p = Geometry2D::get_closest_point_to_segment(p_point, segment_a, segment_b);
			if (p.distance_to(p_point) <= p_tolerance) {
				return true;
			}

			segment_a = segment_b;
		}
	}

	return false;
}
#endif

void Path2D::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_TREE: {
			PathDebug2D::add_update_callback(this, callable_mp(this, &Path2D::_on_debug_global_changed));
			_debug_create();
			queue_redraw();
		} break;

		case NOTIFICATION_EXIT_TREE: {
			PathDebug2D::remove_update_callback(this);
			_debug_free();
		} break;

		case NOTIFICATION_DRAW: {
			_debug_update();
		} break;
	}
}

void Path2D::_on_debug_global_changed() {
	if (_emitting_debug_changed) {
		return;
	}
	_emitting_debug_changed = true;
	callable_mp(this, &Path2D::_emit_debug_changed_deferred).call_deferred();
}

void Path2D::_emit_debug_changed_deferred() {
	_emitting_debug_changed = false;

	if (is_inside_tree()) {
		queue_redraw();

Review comment (suggestion):
`sample_count / fish_bones_interval` will get recalculated every time. You can do it once, before the loop (unless it can change).

Code after:

		for (int i = 0; i < sample_count; i++) {
			ribbon_ptrw[i] = samples_ptr[i].get_origin();
		}

		Array ribbon_array;
		ribbon_array.resize(Mesh::ARRAY_MAX);
		ribbon_array[Mesh::ARRAY_VERTEX] = ribbon;
		Vector<Color> ribbon_color;
		ribbon_color.resize(ribbon.size());
		ribbon_color.fill(debug_color);
		ribbon_array[Mesh::ARRAY_COLOR] = ribbon_color;

		rs->mesh_add_surface_from_arrays(debug_mesh_rid, RS::PRIMITIVE_LINE_STRIP, ribbon_array, Array(), Dictionary(), RS::ARRAY_FLAG_USE_2D_VERTICES);
	}

	// Render path fish bones.
	if (debug_paths_show_fish_bones) {
		int fish_bones_interval = 4;

		const int vertex_per_bone = 4;
		Vector<Vector2> bones;
		bones.resize(sample_count * vertex_per_bone);
		Vector2 *bones_ptrw = bones.ptrw();

		for (int i = 0; i < sample_count; i += fish_bones_interval) {
			const Transform2D &sample_transform = samples_ptr[i];

			const Vector2 point = sample_transform.get_origin();
			const Vector2 &side = sample_transform.columns[1];
			const Vector2 &forward = sample_transform.columns[0];

			const int bone_idx = i * vertex_per_bone;

			bones_ptrw[bone_idx] = point;
			bones_ptrw[bone_idx + 1] = point + (side - forward) * 5;
			bones_ptrw[bone_idx + 2] = point;
			bones_ptrw[bone_idx + 3] = point + (-side - forward) * 5;
		}

		Array bone_array;
		bone_array.resize(Mesh::ARRAY_MAX);
		bone_array[Mesh::ARRAY_VERTEX] = bones;
		Vector<Color> bones_color;
		bones_color.resize(bones.size());
		bones_color.fill(debug_color);
		bone_array[Mesh::ARRAY_COLOR] = bones_color;

		rs->mesh_add_surface_from_arrays(debug_mesh_rid, RS::PRIMITIVE_LINES, bone_array, Array(), Dictionary(), RS::ARRAY_FLAG_USE_2D_VERTICES);
	}
Repository: godotengine/godot
File: scene/3d/node_3d.cpp (C++)

Code before:
			}
			data.parent = nullptr;
			data.C = nullptr;
			_update_visibility_parent(true);
			_disable_client_physics_interpolation();
		} break;

		case NOTIFICATION_ENTER_WORLD: {
			ERR_MAIN_THREAD_GUARD;

			data.inside_world = true;
			data.viewport = nullptr;
			Node *parent = get_parent();
			while (parent && !data.viewport) {
				data.viewport = Object::cast_to<Viewport>(parent);
				parent = parent->get_parent();
			}

			ERR_FAIL_NULL(data.viewport);

			if (get_script_instance()) {
				get_script_instance()->call(SNAME("_enter_world"));
			}

#ifdef TOOLS_ENABLED
			if (is_part_of_edited_scene()) {
				if (!data.gizmos_requested) {
					data.gizmos_requested = true;
					get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
				}
			}
#endif
		} break;

		case NOTIFICATION_EXIT_WORLD: {
			ERR_MAIN_THREAD_GUARD;

#ifdef TOOLS_ENABLED
			clear_gizmos();
#endif

			if (get_script_instance()) {
				get_script_instance()->call(SNAME("_exit_world"));
			}

			data.viewport = nullptr;
			data.inside_world = false;
		} break;

		case NOTIFICATION_TRANSFORM_CHANGED: {
			ERR_THREAD_GUARD;

Review comment (suggestion):
Can be single condition.
```suggestion
			if (is_part_of_edited_scene() && !data.gizmos_requested) {
```

Code after:
			}
			data.parent = nullptr;
			data.C = nullptr;
			_update_visibility_parent(true);
			_disable_client_physics_interpolation();
		} break;

		case NOTIFICATION_ENTER_WORLD: {
			ERR_MAIN_THREAD_GUARD;

			data.inside_world = true;
			data.viewport = nullptr;
			Node *parent = get_parent();
			while (parent && !data.viewport) {
				data.viewport = Object::cast_to<Viewport>(parent);
				parent = parent->get_parent();
			}

			ERR_FAIL_NULL(data.viewport);

			if (get_script_instance()) {
				get_script_instance()->call(SNAME("_enter_world"));
			}

#ifdef TOOLS_ENABLED
			if (is_part_of_edited_scene() && !data.gizmos_requested) {
				data.gizmos_requested = true;
				get_tree()->call_group_flags(SceneTree::GROUP_CALL_DEFERRED, SceneStringName(_spatial_editor_group), SNAME("_request_gizmo_for_id"), get_instance_id());
			}
#endif
		} break;

		case NOTIFICATION_EXIT_WORLD: {
			ERR_MAIN_THREAD_GUARD;

#ifdef TOOLS_ENABLED
			clear_gizmos();
#endif

			if (get_script_instance()) {
				get_script_instance()->call(SNAME("_exit_world"));
			}

			data.viewport = nullptr;
			data.inside_world = false;
		} break;

		case NOTIFICATION_TRANSFORM_CHANGED: {
			ERR_THREAD_GUARD;

#ifdef TOOLS_ENABLED