Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/scene/scene_create_dialog.h
9896 views
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
#pragma once
32
33
#include "scene/gui/dialogs.h"
34
35
class ButtonGroup;
36
class CheckBox;
37
class CreateDialog;
38
class EditorFileDialog;
39
class EditorValidationPanel;
40
class Label;
41
class LineEdit;
42
class OptionButton;
43
44
class SceneCreateDialog : public ConfirmationDialog {
45
GDCLASS(SceneCreateDialog, ConfirmationDialog);
46
47
enum {
48
MSG_ID_PATH,
49
MSG_ID_ROOT,
50
};
51
52
const StringName type_meta = StringName("type");
53
54
public:
55
enum RootType {
56
ROOT_2D_SCENE,
57
ROOT_3D_SCENE,
58
ROOT_USER_INTERFACE,
59
ROOT_OTHER,
60
};
61
62
private:
63
String directory;
64
String scene_name;
65
String root_name;
66
67
Ref<ButtonGroup> node_type_group;
68
CheckBox *node_type_2d = nullptr;
69
CheckBox *node_type_3d = nullptr;
70
CheckBox *node_type_gui = nullptr;
71
CheckBox *node_type_other = nullptr;
72
73
LineEdit *other_type_display = nullptr;
74
Button *select_node_button = nullptr;
75
CreateDialog *select_node_dialog = nullptr;
76
77
LineEdit *scene_name_edit = nullptr;
78
OptionButton *scene_extension_picker = nullptr;
79
LineEdit *root_name_edit = nullptr;
80
81
EditorValidationPanel *validation_panel = nullptr;
82
83
void accept_create();
84
void browse_types();
85
void on_type_picked();
86
void update_dialog();
87
88
protected:
89
void _notification(int p_what);
90
91
public:
92
void config(const String &p_dir);
93
94
String get_scene_path() const;
95
Node *create_scene_root();
96
97
SceneCreateDialog();
98
};
99
100