ronantakizawa/codereview-bench huggingface dataset:
Repository: godotengine/godot
File: modules/gdscript/gdscript.cpp (C++)

Code before:

Variant GDScript::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
	GDScript *top = this;
	while (top) {
		if (likely(top->valid)) {
			HashMap<StringName, GDScriptFunction *>::Iterator E = top->member_functions.find(p_method);
			if (E) {
				ERR_FAIL_COND_V_MSG(!E->value->is_static(), Variant(), "Can't call non-static function '" + String(p_method) + "' in script.");

				return E->value->call(nullptr, p_args, p_argcount, r_error);
			}
		}
		top = top->_base;
	}

	Variant ret = Script::callp(p_method, p_args, p_argcount, r_error);
	if (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
		return ret;
	}

	if (native.is_valid()) {
		MethodBind *method = ClassDB::get_method(native->get_name(), p_method);
		if (method && method->is_static()) {
			// Native static method.
			return method->call(nullptr, p_args, p_argcount, r_error);
		}
	}

	r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
	return ret;
}

bool GDScript::_get(const StringName &p_name, Variant &r_ret) const {
	if (p_name == GDScriptLanguage::get_singleton()->strings._script_source) {
		r_ret = get_source_code();
		return true;
	}

	const GDScript *top = this;
	while (top) {
		{
			HashMap<StringName, Variant>::ConstIterator E = top->constants.find(p_name);
			if (E) {
				r_ret = E->value;
				return true;
			}
		}

		{
			HashMap<StringName, MemberInfo>::ConstIterator E = top->static_variables_indices.find(p_name);
			if (E) {

Review comment (suggestion):
As suggested by cdemirer:

```suggestion
		return native->callp(p_method, p_args, p_argcount, r_error);
```

Code after:
			}
		}
		top = top->base.ptr();
	}

	{
		Variant ret = Script::callp(p_method, p_args, p_argcount, r_error);
		if (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
			return ret;
		}
	}

	if (native.is_valid()) {
		return native->callp(p_method, p_args, p_argcount, r_error);
	}

	r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
	return Variant();
}

bool GDScript::_get(const StringName &p_name, Variant &r_ret) const {
	if (p_name == GDScriptLanguage::get_singleton()->strings._script_source) {
		r_ret = get_source_code();
		return true;
	}

	const GDScript *top = this;
	while (top) {
		{
			HashMap<StringName, Variant>::ConstIterator E = top->constants.find(p_name);
			if (E) {
				r_ret = E->value;
				return true;
			}
		}

		{
			HashMap<StringName, MemberInfo>::ConstIterator E = top->static_variables_indices.find(p_name);
			if (E) {
				if (likely(top->valid) && E->value.getter) {
					Callable::CallError ce;
					const Variant ret = const_cast<GDScript *>(this)->callp(E->value.getter, nullptr, 0, ce);
					r_ret = (ce.error == Callable::CallError::CALL_OK) ? ret : Variant();
					return true;
				}
				r_ret = top->static_variables[E->value.index];
				return true;
			}
		}

		if (likely(top->valid)) {
Repository: godotengine/godot
File: core/math/a_star_grid_2d.cpp (C++)

Code before:
			}
		}
		if (_is_walkable(to_x + dx, to_y + dy) && _is_walkable(to_x + dx, to_y) && _is_walkable(to_x, to_y + dy)) {
			return _jump(p_to, _get_point(to_x + dx, to_y + dy));
		}
	} else { // DIAGONAL_MODE_NEVER
		if (dx != 0) {
			if ((_is_walkable(to_x, to_y - 1) && !_is_walkable(to_x - dx, to_y - 1)) || (_is_walkable(to_x, to_y + 1) && !_is_walkable(to_x - dx, to_y + 1))) {
				return p_to;
			}
		} else if (dy != 0) {
			if ((_is_walkable(to_x - 1, to_y) && !_is_walkable(to_x - 1, to_y - dy)) || (_is_walkable(to_x + 1, to_y) && !_is_walkable(to_x + 1, to_y - dy))) {
				return p_to;
			}
			if (_jump(p_to, _get_point(to_x + 1, to_y)) != nullptr) {
				return p_to;
			}
			if (_jump(p_to, _get_point(to_x - 1, to_y)) != nullptr) {
				return p_to;
			}
		}
		return _jump(p_to, _get_point(to_x + dx, to_y + dy));
	}
	return nullptr;
}

void AStarGrid2D::_get_nbors(Point *p_point, LocalVector<Point *> &r_nbors) {
	bool ts0 = false, td0 = false,
		 ts1 = false, td1 = false,
		 ts2 = false, td2 = false,
		 ts3 = false, td3 = false;

	Point *left = nullptr;
	Point *right = nullptr;
	Point *top = nullptr;
	Point *bottom = nullptr;

	Point *top_left = nullptr;
	Point *top_right = nullptr;
	Point *bottom_left = nullptr;
	Point *bottom_right = nullptr;

	{
		bool has_left = false;
		bool has_right = false;

		if (p_point->id.x - 1 >= region.position.x) {
			left = _get_point_unchecked(p_point->id.x - 1, p_point->id.y);
			has_left = true;
		}
		if (p_point->id.x + 1 < region.position.x + region.size.width) {

Review comment (performance):
```suggestion
	// Remembering previous results can improve performance.
```

Code after:
			to_y += dy;
		}

	} else { // DIAGONAL_MODE_NEVER
		if (dy == 0) {
			return _forced_successor(from_x, from_y, dx, 0, true);
		}

		while (_is_walkable(to_x, to_y)) {
			if (end->id.x == to_x && end->id.y == to_y) {
				return end;
			}

			if ((_is_walkable(to_x - 1, to_y) && !_is_walkable(to_x - 1, to_y - dy)) || (_is_walkable(to_x + 1, to_y) && !_is_walkable(to_x + 1, to_y - dy))) {
				return _get_point_unchecked(to_x, to_y);
			}

			if (_forced_successor(to_x, to_y, 1, 0, true) != nullptr || _forced_successor(to_x, to_y, -1, 0, true) != nullptr) {
				return _get_point_unchecked(to_x, to_y);
			}

			to_y += dy;
		}
	}

	return nullptr;
}

AStarGrid2D::Point *AStarGrid2D::_forced_successor(int32_t p_x, int32_t p_y, int32_t p_dx, int32_t p_dy, bool p_inclusive) {
	// Remembering previous results can improve performance.
	bool l_prev = false, r_prev = false, l = false, r = false;

	int32_t o_x = p_x, o_y = p_y;
	if (p_inclusive) {
		o_x += p_dx;
		o_y += p_dy;
	}

	int32_t l_x = p_x - p_dy, l_y = p_y - p_dx;
	int32_t r_x = p_x + p_dy, r_y = p_y + p_dx;

	while (_is_walkable(o_x, o_y)) {
		if (end->id.x == o_x && end->id.y == o_y) {
			return end;
		}

		l_prev = l || _is_walkable(l_x, l_y);
		r_prev = r || _is_walkable(r_x, r_y);

		l_x += p_dx;
		l_y += p_dy;
Repository: godotengine/godot
File: modules/gdscript/gdscript_parser.h (C/C++)

Code before:
	};

private:
	friend class GDScriptAnalyzer;
	friend class GDScriptParserRef;

	bool _is_tool = false;
	String script_path;
	bool for_completion = false;
	bool parse_body = true;
	bool panic_mode = false;
	bool can_break = false;
	bool can_continue = false;
	List<bool> multiline_stack;
	HashMap<String, Ref<GDScriptParserRef>> depended_parsers;

	ClassNode *head = nullptr;
	Node *list = nullptr;
	List<ParserError> errors;

#ifdef DEBUG_ENABLED
public:
	struct WarningDirectoryRule {
		enum Decision {
			EXCLUDE,
			INCLUDE,
		};

		static constexpr int DECISION_COUNT = INCLUDE + 1;

		String directory_path; // With a trailing slash.
		Decision decision = EXCLUDE;
		int specificity = 0; // Number of slashes in `directory_path`.
	};

private:
	struct PendingWarning {
		const Node *source = nullptr;
		GDScriptWarning::Code code = GDScriptWarning::WARNING_MAX;
		bool treated_as_error = false;
		Vector<String> symbols;
	};

	static bool is_ignoring_warnings;
	static GDScriptWarning::WarnLevel warning_levels[GDScriptWarning::WARNING_MAX];
	static LocalVector<WarningDirectoryRule> warning_directory_rules;

	List<GDScriptWarning> warnings;
	List<PendingWarning> pending_warnings;
	HashSet<int> warning_ignored_lines[GDScriptWarning::WARNING_MAX];
	int warning_ignore_start_lines[GDScriptWarning::WARNING_MAX];

Review comment (suggestion):
```suggestion
			DECISION_EXCLUDE,
			DECISION_INCLUDE,
```
This, or use `enum class`.

Code after:
	};

private:
	friend class GDScriptAnalyzer;
	friend class GDScriptParserRef;

	bool _is_tool = false;
	String script_path;
	bool for_completion = false;
	bool parse_body = true;
	bool panic_mode = false;
	bool can_break = false;
	bool can_continue = false;
	List<bool> multiline_stack;
	HashMap<String, Ref<GDScriptParserRef>> depended_parsers;

	ClassNode *head = nullptr;
	Node *list = nullptr;
	List<ParserError> errors;

#ifdef DEBUG_ENABLED
public:
	struct WarningDirectoryRule {
		enum Decision {
			DECISION_EXCLUDE,
			DECISION_INCLUDE,
			DECISION_MAX,
		};

		String directory_path; // With a trailing slash.
		Decision decision = DECISION_EXCLUDE;
	};

private:
	struct PendingWarning {
		const Node *source = nullptr;
		GDScriptWarning::Code code = GDScriptWarning::WARNING_MAX;
		bool treated_as_error = false;
		Vector<String> symbols;
	};

	static bool is_project_ignoring_warnings;
	static GDScriptWarning::WarnLevel warning_levels[GDScriptWarning::WARNING_MAX];
	static LocalVector<WarningDirectoryRule> warning_directory_rules;

	List<GDScriptWarning> warnings;
	List<PendingWarning> pending_warnings;
	bool is_script_ignoring_warnings = false;
	HashSet<int> warning_ignored_lines[GDScriptWarning::WARNING_MAX];
	int warning_ignore_start_lines[GDScriptWarning::WARNING_MAX];
	HashSet<int> unsafe_lines;
Repository: godotengine/godot
File: editor/plugins/polygon_2d_editor_plugin.cpp (C++)

Code before:
#include "core/input/input_event.h"
#include "core/math/geometry_2d.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/editor_zoom_widget.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/themes/editor_scale.h"
#include "scene/2d/skeleton_2d.h"
#include "scene/gui/check_box.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/label.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/view_panner.h"

Node2D *Polygon2DEditor::_get_node() const {
	return node;
}

void Polygon2DEditor::_set_node(Node *p_polygon) {
	node = Object::cast_to<Polygon2D>(p_polygon);
	_update_polygon_editing_state();
}

Vector2 Polygon2DEditor::_get_offset(int p_idx) const {
	return node->get_offset();
}

int Polygon2DEditor::_get_polygon_count() const {
	if (node->get_internal_vertex_count() > 0) {
		return 0; //do not edit if internal vertices exist
	} else {
		return 1;
	}
}

void Polygon2DEditor::_notification(int p_what) {
	switch (p_what) {
		case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
			if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) {
				break;
			}
			[[fallthrough]];
		}

Review comment (suggestion):
```suggestion
	void shortcut_input(const Ref<InputEvent> &p_event) override {
```

Code after:
#include "core/input/input_event.h"
#include "core/math/geometry_2d.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/editor_zoom_widget.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/themes/editor_scale.h"
#include "scene/2d/skeleton_2d.h"
#include "scene/gui/check_box.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/label.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/view_panner.h"

class UVEditDialog : public AcceptDialog {
	GDCLASS(UVEditDialog, AcceptDialog);

	void shortcut_input(const Ref<InputEvent> &p_event) override {
		const Ref<InputEventKey> k = p_event;
		if (k.is_valid() && k->is_pressed()) {
			bool handled = false;

			if (ED_IS_SHORTCUT("ui_undo", p_event)) {
				EditorNode::get_singleton()->undo();
				handled = true;
			}

			if (ED_IS_SHORTCUT("ui_redo", p_event)) {
				EditorNode::get_singleton()->redo();
				handled = true;
			}

			if (handled) {
				set_input_as_handled();
			}
		}
	}
};

Node2D *Polygon2DEditor::_get_node() const {
	return node;
}
Repository: godotengine/godot
File: editor/plugins/node_3d_editor_plugin.cpp (C++)

Code before:
		if (editor_selection->get_selected_node_list().size() == 1) {
			EditorNode::get_singleton()->edit_node(editor_selection->get_selected_node_list().front()->get());
		}
	}
}

ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos) const {
	Vector3 ray = get_ray(p_pos);
	Vector3 pos = get_ray_pos(p_pos);
	Vector2 shrinked_pos = p_pos / subviewport_container->get_stretch_shrink();

	if (viewport->get_debug_draw() == Viewport::DEBUG_DRAW_SDFGI_PROBES) {
		RS::get_singleton()->sdfgi_set_debug_probe_select(pos, ray);
	}

	Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, pos + ray * camera->get_far(), get_tree()->get_root()->get_world_3d()->get_scenario());
	HashSet<Ref<EditorNode3DGizmo>> found_gizmos;

	Node *edited_scene = get_tree()->get_edited_scene_root();
	ObjectID closest;
	Node *item = nullptr;
	float closest_dist = 1e20;

	for (int i = 0; i < instances.size(); i++) {
		Node3D *spat = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i]));

		if (!spat) {
			continue;
		}

		Vector<Ref<Node3DGizmo>> gizmos = spat->get_gizmos();

		for (int j = 0; j < gizmos.size(); j++) {
			Ref<EditorNode3DGizmo> seg = gizmos[j];

			if ((!seg.is_valid()) || found_gizmos.has(seg)) {
				continue;
			}

			found_gizmos.insert(seg);
			Vector3 point;
			Vector3 normal;

			bool inters = seg->intersect_ray(camera, shrinked_pos, point, normal);

			if (!inters) {
				continue;
			}

			const real_t dist = pos.distance_to(point);


Review comment (suggestion):
```suggestion
	for (Node3D *spat : nodes_with_gizmos) {
```
Can use for-each here while we're at it

Code after:
		if (editor_selection->get_selected_node_list().size() == 1) {
			EditorNode::get_singleton()->edit_node(editor_selection->get_selected_node_list().front()->get());
		}
	}
}

ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos) const {
	Vector3 ray = get_ray(p_pos);
	Vector3 pos = get_ray_pos(p_pos);
	Vector2 shrinked_pos = p_pos / subviewport_container->get_stretch_shrink();

	if (viewport->get_debug_draw() == Viewport::DEBUG_DRAW_SDFGI_PROBES) {
		RS::get_singleton()->sdfgi_set_debug_probe_select(pos, ray);
	}

	HashSet<Ref<EditorNode3DGizmo>> found_gizmos;

	Node *edited_scene = get_tree()->get_edited_scene_root();
	ObjectID closest;
	Node *item = nullptr;
	float closest_dist = 1e20;

	Vector<Node3D *> nodes_with_gizmos = Node3DEditor::get_singleton()->gizmo_bvh_ray_query(pos, pos + ray * camera->get_far());

	for (Node3D *spat : nodes_with_gizmos) {
		if (!spat) {
			continue;
		}

		Vector<Ref<Node3DGizmo>> gizmos = spat->get_gizmos();

		for (int j = 0; j < gizmos.size(); j++) {
			Ref<EditorNode3DGizmo> seg = gizmos[j];

			if ((!seg.is_valid()) || found_gizmos.has(seg)) {
				continue;
			}

			found_gizmos.insert(seg);
			Vector3 point;
			Vector3 normal;

			bool inters = seg->intersect_ray(camera, shrinked_pos, point, normal);

			if (!inters) {
				continue;
			}

			const real_t dist = pos.distance_to(point);

			if (dist < 0) {
Repository: godotengine/godot
File: editor/plugins/node_3d_editor_plugin.cpp (C++)

Code before:
				}

				closest = item->get_instance_id();
				closest_dist = dist;
			}
		}
	}

	if (!item) {
		return ObjectID();
	}

	return closest;
}

void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayResult> &r_results, bool p_include_locked_nodes) {
	Vector3 ray = get_ray(p_pos);
	Vector3 pos = get_ray_pos(p_pos);

	Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, pos + ray * camera->get_far(), get_tree()->get_root()->get_world_3d()->get_scenario());
	HashSet<Node3D *> found_nodes;

	for (int i = 0; i < instances.size(); i++) {
		Node3D *spat = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i]));

		if (!spat) {
			continue;
		}

		if (found_nodes.has(spat)) {
			continue;
		}

		if (!p_include_locked_nodes && _is_node_locked(spat)) {
			continue;
		}

		Vector<Ref<Node3DGizmo>> gizmos = spat->get_gizmos();
		for (int j = 0; j < gizmos.size(); j++) {
			Ref<EditorNode3DGizmo> seg = gizmos[j];

			if (!seg.is_valid()) {
				continue;
			}

			Vector3 point;
			Vector3 normal;

			bool inters = seg->intersect_ray(camera, p_pos, point, normal);

			if (!inters) {

Review comment (suggestion):
```suggestion
	for (Node3D *spat : nodes_with_gizmos) {
```

Code after:

				closest = item->get_instance_id();
				closest_dist = dist;
			}
		}
	}

	if (!item) {
		return ObjectID();
	}

	return closest;
}

void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayResult> &r_results, bool p_include_locked_nodes) {
	Vector3 ray = get_ray(p_pos);
	Vector3 pos = get_ray_pos(p_pos);

	Vector<Node3D *> nodes_with_gizmos = Node3DEditor::get_singleton()->gizmo_bvh_ray_query(pos, pos + ray * camera->get_far());

	HashSet<Node3D *> found_nodes;

	for (Node3D *spat : nodes_with_gizmos) {
		if (!spat) {
			continue;
		}

		if (found_nodes.has(spat)) {
			continue;
		}

		if (!p_include_locked_nodes && _is_node_locked(spat)) {
			continue;
		}

		Vector<Ref<Node3DGizmo>> gizmos = spat->get_gizmos();
		for (int j = 0; j < gizmos.size(); j++) {
			Ref<EditorNode3DGizmo> seg = gizmos[j];

			if (!seg.is_valid()) {
				continue;
			}

			Vector3 point;
			Vector3 normal;

			bool inters = seg->intersect_ray(camera, p_pos, point, normal);

			if (!inters) {
				continue;
			}
Repository: godotengine/godot
File: editor/plugins/node_3d_editor_plugin.cpp (C++)

Code before:
					old_gizmo->redraw();
				}

				spatial_editor->update_transform_gizmo();
			}

			if (found_subgizmos) {
				return;
			}
		}
	}

	if (!clicked_wants_append) {
		_clear_selected();
	}

	Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world_3d()->get_scenario());
	HashSet<Node3D *> found_nodes;
	Vector<Node *> selected;

	Node *edited_scene = get_tree()->get_edited_scene_root();

	for (int i = 0; i < instances.size(); i++) {
		Node3D *sp = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i]));
		if (!sp || _is_node_locked(sp)) {
			continue;
		}

		if (found_nodes.has(sp)) {
			continue;
		}

		found_nodes.insert(sp);

		Node *node = Object::cast_to<Node>(sp);
		if (node != edited_scene) {
			node = edited_scene->get_deepest_editable_node(node);
		}

		// Prevent selection of nodes not owned by the edited scene.
		while (node && node != edited_scene->get_parent()) {
			Node *node_owner = node->get_owner();
			if (node_owner == edited_scene || node == edited_scene || (node_owner != nullptr && edited_scene->is_editable_instance(node_owner))) {
				break;
			}
			node = node->get_parent();
		}

		// Replace the node by the group if grouped
		if (node->is_class("Node3D")) {
			Node3D *sel = Object::cast_to<Node3D>(node);

Review comment (suggestion):
```suggestion
	for (Node3D *sp : nodes_with_gizmos) {
```

Code after:

				spatial_editor->update_transform_gizmo();
			}

			if (found_subgizmos) {
				return;
			}
		}
	}

	if (!clicked_wants_append) {
		_clear_selected();
	}

	Vector<Node3D *> nodes_with_gizmos = Node3DEditor::get_singleton()->gizmo_bvh_frustum_query(frustum);
	HashSet<Node3D *> found_nodes;
	Vector<Node *> selected;

	Node *edited_scene = get_tree()->get_edited_scene_root();

	for (Node3D *sp : nodes_with_gizmos) {
		if (!sp || _is_node_locked(sp)) {
			continue;
		}

		if (found_nodes.has(sp)) {
			continue;
		}

		found_nodes.insert(sp);

		Node *node = Object::cast_to<Node>(sp);
		if (node != edited_scene) {
			node = edited_scene->get_deepest_editable_node(node);
		}

		// Prevent selection of nodes not owned by the edited scene.
		while (node && node != edited_scene->get_parent()) {
			Node *node_owner = node->get_owner();
			if (node_owner == edited_scene || node == edited_scene || (node_owner != nullptr && edited_scene->is_editable_instance(node_owner))) {
				break;
			}
			node = node->get_parent();
		}

		// Replace the node by the group if grouped
		if (node->is_class("Node3D")) {
			Node3D *sel = Object::cast_to<Node3D>(node);
			while (node && node != EditorNode::get_singleton()->get_edited_scene()->get_parent()) {
				Node3D *selected_tmp = Object::cast_to<Node3D>(node);
				if (selected_tmp && node->has_meta("_edit_group_")) {
Repository: godotengine/godot
File: editor/import/3d/scene_import_settings.cpp (C++)

Code before:
		} break;
		case Animation::LOOP_LINEAR: {
			animation_player->play(p_name);
		} break;
		case Animation::LOOP_PINGPONG: {
			if (animation_pingpong) {
				animation_player->play(p_name);
			} else {
				animation_player->play_backwards(p_name);
			}
			animation_pingpong = !animation_pingpong;
		} break;
		default: {
		} break;
	}
}

void SceneImportSettingsDialog::_material_tree_selected() {
	if (selecting) {
		return;
	}
	TreeItem *item = material_tree->get_selected();
	String type = item->get_meta("type");
	String import_id = item->get_meta("import_id");

	_select(material_tree, type, import_id);
}

void SceneImportSettingsDialog::_mesh_tree_selected() {
	if (selecting) {
		return;
	}

	TreeItem *item = mesh_tree->get_selected();
	String type = item->get_meta("type");
	String import_id = item->get_meta("import_id");

	_select(mesh_tree, type, import_id);
}

void SceneImportSettingsDialog::_scene_tree_selected() {
	if (selecting) {
		return;
	}
	TreeItem *item = scene_tree->get_selected();
	String type = item->get_meta("type");
	String import_id = item->get_meta("import_id");

	_select(scene_tree, type, import_id);
}


Review comment (suggestion):
```suggestion
void SceneImportSettingsDialog::_skeleton_tree_entered(Skeleton3D *p_skeleton) {
```

Code after:
			animation_player->play(p_animation_name);
		} else {
			animation_player->stop(true);
			animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
			animation_player->set_assigned_animation(p_animation_name);
			animation_player->seek(0.0, true);
			animation_slider->set_value_no_signal(0.0);
			set_process(false);
		}
	}
}

void SceneImportSettingsDialog::_animation_slider_value_changed(double p_value) {
	if (animation_player == nullptr || !animation_map.has(selected_id) || animation_map[selected_id].animation.is_null()) {
		return;
	}
	if (animation_player->is_playing()) {
		animation_player->stop();
		animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
		set_process(false);
	}
	animation_player->seek(p_value * animation_map[selected_id].animation->get_length(), true);
}

void SceneImportSettingsDialog::_skeleton_tree_entered(Skeleton3D *p_skeleton) {
	bones_mesh_preview->set_skeleton_path(p_skeleton->get_path());
	bones_mesh_preview->set_skin(p_skeleton->register_skin(p_skeleton->create_skin_from_rest_transforms()));
}

void SceneImportSettingsDialog::_animation_finished(const StringName &p_name) {
	Animation::LoopMode loop_mode = animation_loop_mode;

	switch (loop_mode) {
		case Animation::LOOP_NONE: {
			animation_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
			animation_slider->set_value_no_signal(1.0);
			set_process(false);
		} break;
		case Animation::LOOP_LINEAR: {
			animation_player->play(p_name);
		} break;
		case Animation::LOOP_PINGPONG: {
			if (animation_pingpong) {
				animation_player->play(p_name);
			} else {
				animation_player->play_backwards(p_name);
			}
			animation_pingpong = !animation_pingpong;
		} break;
		default: {
		} break;