Repository: godotengine/godot
File: editor/scene/3d/path_3d_editor_plugin.cpp (C++)

Code before:
void Path3DEditorPlugin::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_TREE: {
			EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &Path3DEditorPlugin::_editor_settings_changed));
		} break;

		case NOTIFICATION_EXIT_TREE: {
			if (EditorSettings::get_singleton()) {
				EditorSettings::get_singleton()->disconnect("settings_changed", callable_mp(this, &Path3DEditorPlugin::_editor_settings_changed));
			}
		} break;
	}
}

void Path3DEditorPlugin::_bind_methods() {
	ClassDB::bind_method(D_METHOD("_update_toolbar"), &Path3DEditorPlugin::_update_toolbar);
	ClassDB::bind_method(D_METHOD("_clear_curve_points"), &Path3DEditorPlugin::_clear_curve_points);
	ClassDB::bind_method(D_METHOD("_restore_curve_points"), &Path3DEditorPlugin::_restore_curve_points);
}

Path3DEditorPlugin::Path3DEditorPlugin() {
	singleton = this;
	mirror_handle_angle = true;
	mirror_handle_length = true;

	Ref<Path3DGizmoPlugin> gizmo_plugin = memnew(Path3DGizmoPlugin());
	Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
	path_3d_gizmo_plugin = gizmo_plugin;

	topmenu_bar = memnew(HBoxContainer);
	topmenu_bar->hide();

	toolbar = memnew(HBoxContainer);
	topmenu_bar->add_child(toolbar);

	curve_edit = memnew(Button);
	curve_edit->set_theme_type_variation(SceneStringName(FlatButton));
	curve_edit->set_toggle_mode(true);
	curve_edit->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Click: Select multiple Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
	curve_edit->set_accessibility_name(TTRC("Select Points"));
	toolbar->add_child(curve_edit);
	curve_edit->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT));

	curve_edit_curve = memnew(Button);
	curve_edit_curve->set_theme_type_variation(SceneStringName(FlatButton));
	curve_edit_curve->set_toggle_mode(true);
	curve_edit_curve->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_edit_curve->set_tooltip_text(TTR("Select Control Points") + "\n" + TTR("Shift+Click: Drag out Control Points"));
	curve_edit_curve->set_accessibility_name(TTRC("Select Control Points"));
	toolbar->add_child(curve_edit_curve);

Review comment (suggestion):
```suggestion
	Ref<Path3DGizmoPlugin> gizmo_plugin;
	gizmo_plugin.instantiate();
```
Preferred syntax

Code after:

	toolbar = memnew(HBoxContainer);
	topmenu_bar->add_child(toolbar);

	curve_edit = memnew(Button);
	curve_edit->set_theme_type_variation(SceneStringName(FlatButton));
	curve_edit->set_toggle_mode(true);
	curve_edit->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Click: Select multiple Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
	curve_edit->set_accessibility_name(TTRC("Select Points"));
	toolbar->add_child(curve_edit);
	curve_edit->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT));

	curve_edit_curve = memnew(Button);
	curve_edit_curve->set_theme_type_variation(SceneStringName(FlatButton));
	curve_edit_curve->set_toggle_mode(true);
	curve_edit_curve->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_edit_curve->set_tooltip_text(TTR("Select Control Points") + "\n" + TTR("Shift+Click: Drag out Control Points"));
	curve_edit_curve->set_accessibility_name(TTRC("Select Control Points"));
	toolbar->add_child(curve_edit_curve);
	curve_edit_curve->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT_CURVE));

	curve_edit_tilt = memnew(Button);
	curve_edit_tilt->set_theme_type_variation(SceneStringName(FlatButton));
	curve_edit_tilt->set_toggle_mode(true);
	curve_edit_tilt->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_edit_tilt->set_tooltip_text(TTR("Select Tilt Handles"));
	toolbar->add_child(curve_edit_tilt);
	curve_edit_tilt->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT_TILT));

	curve_create = memnew(Button);
	curve_create->set_theme_type_variation(SceneStringName(FlatButton));
	curve_create->set_toggle_mode(true);
	curve_create->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_create->set_tooltip_text(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)"));
	curve_create->set_accessibility_name(TTRC("Add Point (in empty space)"));
	toolbar->add_child(curve_create);
	curve_create->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_CREATE));

	curve_del = memnew(Button);
	curve_del->set_theme_type_variation(SceneStringName(FlatButton));
	curve_del->set_toggle_mode(true);
	curve_del->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_del->set_tooltip_text(TTR("Delete Point"));
	toolbar->add_child(curve_del);
	curve_del->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_DELETE));

	curve_closed = memnew(Button);
	curve_closed->set_theme_type_variation(SceneStringName(FlatButton));
	curve_closed->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
	curve_closed->set_tooltip_text(TTR("Close Curve"));