initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
214
editor/settings/editor_build_profile.h
Normal file
214
editor/settings/editor_build_profile.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/**************************************************************************/
|
||||
/* editor_build_profile.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* 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. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "editor/doc/editor_help.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class EditorBuildProfile : public RefCounted {
|
||||
GDCLASS(EditorBuildProfile, RefCounted);
|
||||
|
||||
public:
|
||||
enum BuildOption {
|
||||
BUILD_OPTION_3D,
|
||||
BUILD_OPTION_NAVIGATION_2D,
|
||||
BUILD_OPTION_NAVIGATION_3D,
|
||||
BUILD_OPTION_XR,
|
||||
BUILD_OPTION_OPENXR,
|
||||
BUILD_OPTION_WAYLAND,
|
||||
BUILD_OPTION_X11,
|
||||
BUILD_OPTION_RENDERING_DEVICE,
|
||||
BUILD_OPTION_FORWARD_RENDERER,
|
||||
BUILD_OPTION_MOBILE_RENDERER,
|
||||
BUILD_OPTION_VULKAN,
|
||||
BUILD_OPTION_D3D12,
|
||||
BUILD_OPTION_METAL,
|
||||
BUILD_OPTION_OPENGL,
|
||||
BUILD_OPTION_PHYSICS_2D,
|
||||
BUILD_OPTION_PHYSICS_GODOT_2D,
|
||||
BUILD_OPTION_PHYSICS_3D,
|
||||
BUILD_OPTION_PHYSICS_GODOT_3D,
|
||||
BUILD_OPTION_PHYSICS_JOLT,
|
||||
BUILD_OPTION_TEXT_SERVER_FALLBACK,
|
||||
BUILD_OPTION_TEXT_SERVER_ADVANCED,
|
||||
BUILD_OPTION_DYNAMIC_FONTS,
|
||||
BUILD_OPTION_WOFF2_FONTS,
|
||||
BUILD_OPTION_GRAPHITE_FONTS,
|
||||
BUILD_OPTION_MSDFGEN,
|
||||
BUILD_OPTION_MAX,
|
||||
};
|
||||
|
||||
enum BuildOptionCategory {
|
||||
BUILD_OPTION_CATEGORY_GENERAL,
|
||||
BUILD_OPTION_CATEGORY_GRAPHICS,
|
||||
BUILD_OPTION_CATEGORY_PHYSICS,
|
||||
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 bool build_option_explicit_use[BUILD_OPTION_MAX];
|
||||
static const BuildOptionCategory build_option_category[BUILD_OPTION_MAX];
|
||||
static const HashMap<BuildOption, LocalVector<BuildOption>> build_option_dependencies;
|
||||
static HashMap<BuildOption, HashMap<String, LocalVector<Variant>>> build_option_settings;
|
||||
static const HashMap<BuildOption, LocalVector<String>> build_option_classes;
|
||||
|
||||
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 reset_build_options();
|
||||
|
||||
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 String get_build_option_identifier(BuildOption p_build_option);
|
||||
static bool get_build_option_disable_value(BuildOption p_build_option);
|
||||
static bool get_build_option_explicit_use(BuildOption p_build_option);
|
||||
static BuildOptionCategory get_build_option_category(BuildOption p_build_option);
|
||||
static LocalVector<BuildOption> get_build_option_dependencies(BuildOption p_build_option);
|
||||
static HashMap<String, LocalVector<Variant>> get_build_option_settings(BuildOption p_build_option);
|
||||
static LocalVector<String> get_build_option_classes(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 _hide_requested();
|
||||
|
||||
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);
|
||||
|
||||
bool project_scan_canceled = false;
|
||||
|
||||
void _detect_from_project();
|
||||
|
||||
void _force_detect_classes_changed(const String &p_text);
|
||||
|
||||
struct DetectedFile {
|
||||
uint32_t timestamp = 0;
|
||||
String md5;
|
||||
Vector<String> classes;
|
||||
Vector<String> build_deps;
|
||||
};
|
||||
|
||||
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();
|
||||
};
|
Reference in New Issue
Block a user