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
|
/*************************************************************************/
/* editor_feature_profile.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 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_FEATURE_PROFILE_H
#define EDITOR_FEATURE_PROFILE_H
#include "core/io/file_access.h"
#include "core/object/reference.h"
#include "editor/editor_file_dialog.h"
#include "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 EditorFeatureProfile : public Reference {
GDCLASS(EditorFeatureProfile, Reference);
public:
enum Feature {
FEATURE_3D,
FEATURE_SCRIPT,
FEATURE_ASSET_LIB,
FEATURE_SCENE_TREE,
FEATURE_NODE_DOCK,
FEATURE_FILESYSTEM_DOCK,
FEATURE_IMPORT_DOCK,
FEATURE_MAX
};
private:
Set<StringName> disabled_classes;
Set<StringName> disabled_editors;
Map<StringName, Set<StringName>> disabled_properties;
Set<StringName> collapsed_classes;
bool features_disabled[FEATURE_MAX];
static const char *feature_names[FEATURE_MAX];
static const char *feature_descriptions[FEATURE_MAX];
static const char *feature_identifiers[FEATURE_MAX];
String _get_feature_name(Feature p_feature) { return get_feature_name(p_feature); }
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_disable_class_editor(const StringName &p_class, bool p_disabled);
bool is_class_editor_disabled(const StringName &p_class) const;
void set_disable_class_property(const StringName &p_class, const StringName &p_property, bool p_disabled);
bool is_class_property_disabled(const StringName &p_class, const StringName &p_property) const;
bool has_class_properties_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_feature(Feature p_feature, bool p_disable);
bool is_feature_disabled(Feature p_feature) const;
Error save_to_file(const String &p_path);
Error load_from_file(const String &p_path);
static String get_feature_name(Feature p_feature);
static String get_feature_description(Feature p_feature);
EditorFeatureProfile();
};
VARIANT_ENUM_CAST(EditorFeatureProfile::Feature)
class EditorFeatureProfileManager : public AcceptDialog {
GDCLASS(EditorFeatureProfileManager, AcceptDialog);
enum Action {
PROFILE_CLEAR,
PROFILE_SET,
PROFILE_IMPORT,
PROFILE_EXPORT,
PROFILE_NEW,
PROFILE_ERASE,
PROFILE_MAX
};
enum ClassOptions {
CLASS_OPTION_DISABLE_EDITOR
};
ConfirmationDialog *erase_profile_dialog;
ConfirmationDialog *new_profile_dialog;
LineEdit *new_profile_name;
LineEdit *current_profile_name;
OptionButton *profile_list;
Button *profile_actions[PROFILE_MAX];
HSplitContainer *h_split;
VBoxContainer *class_list_vbc;
Tree *class_list;
VBoxContainer *property_list_vbc;
Tree *property_list;
EditorHelpBit *description_bit;
Label *no_profile_selected_help;
EditorFileDialog *import_profiles;
EditorFileDialog *export_profile;
void _profile_action(int p_action);
void _profile_selected(int p_what);
String current_profile;
void _update_profile_list(const String &p_select_profile = String());
void _update_selected_profile();
void _fill_classes_from(TreeItem *p_parent, const String &p_class, const String &p_selected);
Ref<EditorFeatureProfile> current;
Ref<EditorFeatureProfile> edited;
void _erase_selected_profile();
void _create_new_profile();
String _get_selected_profile();
void _import_profiles(const Vector<String> &p_paths);
void _export_profile(const String &p_path);
bool updating_features;
void _class_list_item_selected();
void _class_list_item_edited();
void _class_list_item_collapsed(Object *p_item);
void _property_item_edited();
void _save_and_update();
Timer *update_timer;
void _emit_current_profile_changed();
static EditorFeatureProfileManager *singleton;
protected:
static void _bind_methods();
void _notification(int p_what);
public:
Ref<EditorFeatureProfile> get_current_profile();
void notify_changed();
static EditorFeatureProfileManager *get_singleton() { return singleton; }
EditorFeatureProfileManager();
};
#endif // EDITOR_FEATURE_PROFILE_H
|