1/**************************************************************************/
2/* scene_create_dialog.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef SCENE_CREATE_DIALOG_H
32#define SCENE_CREATE_DIALOG_H
33
34#include "scene/gui/dialogs.h"
35
36class ButtonGroup;
37class CheckBox;
38class CreateDialog;
39class EditorFileDialog;
40class EditorValidationPanel;
41class Label;
42class LineEdit;
43class OptionButton;
44
45class SceneCreateDialog : public ConfirmationDialog {
46 GDCLASS(SceneCreateDialog, ConfirmationDialog);
47
48 enum {
49 MSG_ID_PATH,
50 MSG_ID_ROOT,
51 };
52
53 const StringName type_meta = StringName("type");
54
55public:
56 enum RootType {
57 ROOT_2D_SCENE,
58 ROOT_3D_SCENE,
59 ROOT_USER_INTERFACE,
60 ROOT_OTHER,
61 };
62
63private:
64 String directory;
65 String scene_name;
66 String root_name;
67
68 Ref<ButtonGroup> node_type_group;
69 CheckBox *node_type_2d = nullptr;
70 CheckBox *node_type_3d = nullptr;
71 CheckBox *node_type_gui = nullptr;
72 CheckBox *node_type_other = nullptr;
73
74 LineEdit *other_type_display = nullptr;
75 Button *select_node_button = nullptr;
76 CreateDialog *select_node_dialog = nullptr;
77
78 LineEdit *scene_name_edit = nullptr;
79 OptionButton *scene_extension_picker = nullptr;
80 LineEdit *root_name_edit = nullptr;
81
82 EditorValidationPanel *validation_panel = nullptr;
83
84 void accept_create();
85 void browse_types();
86 void on_type_picked();
87 void update_dialog();
88
89protected:
90 void _notification(int p_what);
91
92public:
93 void config(const String &p_dir);
94
95 String get_scene_path() const;
96 Node *create_scene_root();
97
98 SceneCreateDialog();
99};
100
101#endif // SCENE_CREATE_DIALOG_H
102