1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/*************************************************************************/
/* editor_build_profile.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef EDITOR_BUILD_PROFILE_H
#define EDITOR_BUILD_PROFILE_H
#include "core/io/file_access.h"
#include "core/object/ref_counted.h"
#include "editor/editor_help.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/option_button.h"
#include "scene/gui/separator.h"
#include "scene/gui/split_container.h"
#include "scene/gui/tree.h"
class EditorBuildProfile : public RefCounted {
GDCLASS(EditorBuildProfile, RefCounted);
public:
enum BuildOption {
BUILD_OPTION_3D,
BUILD_OPTION_PHYSICS_2D,
BUILD_OPTION_PHYSICS_3D,
BUILD_OPTION_NAVIGATION,
BUILD_OPTION_XR,
BUILD_OPTION_RENDERING_DEVICE,
BUILD_OPTION_OPENGL,
BUILD_OPTION_VULKAN,
BUILD_OPTION_TEXT_SERVER_FALLBACK,
BUILD_OPTION_TEXT_SERVER_ADVANCED,
BUILD_OPTION_DYNAMIC_FONTS,
BUILD_OPTION_WOFF2_FONTS,
BUILD_OPTION_GRPAHITE_FONTS,
BUILD_OPTION_MSDFGEN,
BUILD_OPTION_MAX,
};
enum BuildOptionCategory {
BUILD_OPTION_CATEGORY_GENERAL,
BUILD_OPTION_CATEGORY_TEXT_SERVER,
BUILD_OPTION_CATEGORY_MAX,
};
private:
HashSet<StringName> disabled_classes;
HashSet<StringName> collapsed_classes;
String force_detect_classes;
bool build_options_disabled[BUILD_OPTION_MAX] = {};
static const char *build_option_identifiers[BUILD_OPTION_MAX];
static const bool build_option_disabled_by_default[BUILD_OPTION_MAX];
static const bool build_option_disable_values[BUILD_OPTION_MAX];
static const BuildOptionCategory build_option_category[BUILD_OPTION_MAX];
String _get_build_option_name(BuildOption p_build_option) { return get_build_option_name(p_build_option); }
protected:
static void _bind_methods();
public:
void set_disable_class(const StringName &p_class, bool p_disabled);
bool is_class_disabled(const StringName &p_class) const;
void set_item_collapsed(const StringName &p_class, bool p_collapsed);
bool is_item_collapsed(const StringName &p_class) const;
void set_disable_build_option(BuildOption p_build_option, bool p_disable);
bool is_build_option_disabled(BuildOption p_build_option) const;
void set_force_detect_classes(const String &p_classes);
String get_force_detect_classes() const;
void clear_disabled_classes();
Error save_to_file(const String &p_path);
Error load_from_file(const String &p_path);
static String get_build_option_name(BuildOption p_build_option);
static String get_build_option_description(BuildOption p_build_option);
static bool get_build_option_disable_value(BuildOption p_build_option);
static BuildOptionCategory get_build_option_category(BuildOption p_build_option);
static String get_build_option_category_name(BuildOptionCategory p_build_option_category);
EditorBuildProfile();
};
VARIANT_ENUM_CAST(EditorBuildProfile::BuildOption)
VARIANT_ENUM_CAST(EditorBuildProfile::BuildOptionCategory)
class EditorFileDialog;
class EditorFileSystemDirectory;
class EditorBuildProfileManager : public AcceptDialog {
GDCLASS(EditorBuildProfileManager, AcceptDialog);
enum Action {
ACTION_NEW,
ACTION_RESET,
ACTION_LOAD,
ACTION_SAVE,
ACTION_SAVE_AS,
ACTION_DETECT,
ACTION_MAX
};
Action last_action = ACTION_NEW;
ConfirmationDialog *confirm_dialog = nullptr;
Button *profile_actions[ACTION_MAX];
Tree *class_list = nullptr;
EditorHelpBit *description_bit = nullptr;
EditorFileDialog *import_profile = nullptr;
EditorFileDialog *export_profile = nullptr;
LineEdit *profile_path = nullptr;
LineEdit *force_detect_classes = nullptr;
void _profile_action(int p_action);
void _action_confirm();
void _update_edited_profile();
void _fill_classes_from(TreeItem *p_parent, const String &p_class, const String &p_selected);
Ref<EditorBuildProfile> edited;
void _import_profile(const String &p_path);
void _export_profile(const String &p_path);
bool updating_build_options = false;
void _class_list_item_selected();
void _class_list_item_edited();
void _class_list_item_collapsed(Object *p_item);
void _detect_classes();
void _force_detect_classes_changed(const String &p_text);
struct DetectedFile {
uint32_t timestamp = 0;
String md5;
Vector<String> classes;
};
void _find_files(EditorFileSystemDirectory *p_dir, const HashMap<String, DetectedFile> &p_cache, HashMap<String, DetectedFile> &r_detected);
static EditorBuildProfileManager *singleton;
protected:
static void _bind_methods();
void _notification(int p_what);
public:
Ref<EditorBuildProfile> get_current_profile();
static EditorBuildProfileManager *get_singleton() { return singleton; }
EditorBuildProfileManager();
};
#endif // EDITOR_BUILD_PROFILE_H
|