Repository: godotengine/godot
File: editor/plugins/node_3d_editor_plugin.cpp (C++)

Code before:
		Transform3D global_transform;
		Node3D *parent_node3d = Object::cast_to<Node3D>(parent);
		if (parent_node3d) {
			global_transform = parent_node3d->get_global_gizmo_transform();
		}

		global_transform.origin = spatial_editor->snap_point(_get_instance_position(p_point));
		global_transform.basis *= node3d->get_transform().basis;

		editor_data->get_undo_redo().add_do_method(instantiated_scene, "set_global_transform", global_transform);
	}

	return true;
}

void Node3DEditorViewport::_perform_drop_data() {
	if (spatial_editor->get_preview_material_target().is_valid()) {
		GeometryInstance3D *geometry_instance = Object::cast_to<GeometryInstance3D>(ObjectDB::get_instance(spatial_editor->get_preview_material_target()));
		MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(ObjectDB::get_instance(spatial_editor->get_preview_material_target()));
		if (mesh_instance && spatial_editor->get_preview_material_surface() != -1) {
			editor_data->get_undo_redo().create_action(vformat(TTR("Set surface %d override material"), spatial_editor->get_preview_material_surface()));
			editor_data->get_undo_redo().add_do_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_material());
			editor_data->get_undo_redo().add_undo_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_reset_material());
			editor_data->get_undo_redo().commit_action();
		} else if (geometry_instance) {
			editor_data->get_undo_redo().create_action(TTR("Set material override"));
			editor_data->get_undo_redo().add_do_method(geometry_instance, "set_material_override", spatial_editor->get_preview_material());
			editor_data->get_undo_redo().add_undo_method(geometry_instance, "set_material_override", spatial_editor->get_preview_reset_material());
			editor_data->get_undo_redo().commit_action();
		}

		_remove_preview_material();
		return;
	}

	_remove_preview_node();

	Vector<String> error_files;

	editor_data->get_undo_redo().create_action(TTR("Create Node"));

	for (int i = 0; i < selected_files.size(); i++) {
		String path = selected_files[i];
		RES res = ResourceLoader::load(path);
		if (res.is_null()) {
			continue;
		}
		Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
		Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
		if (mesh != nullptr || scene != nullptr) {
			bool success = _create_instance(target_node, path, drop_pos);

Review comment (suggestion):
```suggestion
			editor_data->get_undo_redo().create_action(TTR("Set Material Override"));
```
Same.

Code after:
	}

	if (instantiated_scene == nullptr) {
		return false;
	}

	if (!EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path().is_empty()) { // cyclical instancing
		if (_cyclical_dependency_exists(EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path(), instantiated_scene)) {
			memdelete(instantiated_scene);
			return false;
		}
	}

	if (scene != nullptr) {
		instantiated_scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(path));
	}

	editor_data->get_undo_redo().add_do_method(parent, "add_child", instantiated_scene, true);
	editor_data->get_undo_redo().add_do_method(instantiated_scene, "set_owner", EditorNode::get_singleton()->get_edited_scene());
	editor_data->get_undo_redo().add_do_reference(instantiated_scene);
	editor_data->get_undo_redo().add_undo_method(parent, "remove_child", instantiated_scene);

	String new_name = parent->validate_child_name(instantiated_scene);
	EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
	editor_data->get_undo_redo().add_do_method(ed, "live_debug_instance_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), path, new_name);
	editor_data->get_undo_redo().add_undo_method(ed, "live_debug_remove_node", NodePath(String(EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent)) + "/" + new_name));

	Node3D *node3d = Object::cast_to<Node3D>(instantiated_scene);
	if (node3d) {
		Transform3D global_transform;
		Node3D *parent_node3d = Object::cast_to<Node3D>(parent);
		if (parent_node3d) {
			global_transform = parent_node3d->get_global_gizmo_transform();
		}

		global_transform.origin = spatial_editor->snap_point(_get_instance_position(p_point));
		global_transform.basis *= node3d->get_transform().basis;

		editor_data->get_undo_redo().add_do_method(instantiated_scene, "set_global_transform", global_transform);
	}

	return true;
}

void Node3DEditorViewport::_perform_drop_data() {
	if (spatial_editor->get_preview_material_target().is_valid()) {
		GeometryInstance3D *geometry_instance = Object::cast_to<GeometryInstance3D>(ObjectDB::get_instance(spatial_editor->get_preview_material_target()));
		MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(ObjectDB::get_instance(spatial_editor->get_preview_material_target()));
		if (mesh_instance && spatial_editor->get_preview_material_surface() != -1) {
			editor_data->get_undo_redo().create_action(vformat(TTR("Set Surface %d Override Material"), spatial_editor->get_preview_material_surface()));
			editor_data->get_undo_redo().add_do_method(geometry_instance, "set_surface_override_material", spatial_editor->get_preview_material_surface(), spatial_editor->get_preview_material());