Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0: Backports 1 #746

Merged
merged 12 commits into from
Aug 25, 2024
65 changes: 34 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,36 +98,36 @@ INCLUDE(GodotCompilerWarnings)
# Setup compiler options for GDExtension Library based on the compiler used
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC
$<${compiler_is_msvc}:
/EHsc
/utf-8
/Zc:preprocessor
/wd5054 # operator '|' deprecated between enumerations of different types
$<$<CONFIG:Debug>:
/MDd
>
$<$<CONFIG:Release>:
/MD
/O2
>
/EHsc
/utf-8
/Zc:preprocessor
/wd5054 # operator '|' deprecated between enumerations of different types
$<$<CONFIG:Debug>:
/MDd
>
$<$<CONFIG:Release>:
/MD
/O2
>
>
$<$<NOT:${compiler_is_msvc}>:
-g
-Wno-unused-value
$<${compiler_is_gnu}:
-Wno-attributes
-Wno-attributes=r1::
>
$<${compiler_is_clang}:
-Wno-ignored-attributes
-Wno-unknown-attributes
>
$<$<CONFIG:Debug>:
-fno-omit-frame-pointer
-O0
>
$<$<CONFIG:Release>:
-O3
>
-Wno-unused-value
$<${compiler_is_gnu}:
-Wno-attributes
-Wno-attributes=r1::
>
$<${compiler_is_clang}:
-Wno-ignored-attributes
-Wno-unknown-attributes
>
$<$<CONFIG:Debug>:
-g
-fno-omit-frame-pointer
-O0
>
$<$<CONFIG:Release>:
-O3
>
>
)

Expand All @@ -147,9 +147,12 @@ IF (NOT APPLE)
# Linker options for the GDExtension library
TARGET_LINK_OPTIONS(${PROJECT_NAME} PRIVATE
$<$<NOT:${compiler_is_msvc}>:
-static-libgcc
-static-libstdc++
-Wl,-R,'$$ORIGIN'
-static-libgcc
-static-libstdc++
-Wl,-R,'$$ORIGIN'
$<$<CONFIG:Release>:
$<$<PLATFORM_ID:Android>:-s>
>
>
)
ENDIF ()
Expand Down
6 changes: 2 additions & 4 deletions src/common/file_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@
//
#include "common/file_utils.h"

#include "editor/plugins/orchestrator_editor_plugin.h"

#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/editor_paths.hpp>

namespace FileUtils
{
Ref<FileAccess> open_project_settings_file(const String& p_file_name, FileAccess::ModeFlags p_flags)
{
const EditorPaths* ep = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_paths();
const EditorPaths* ep = EditorInterface::get_singleton()->get_editor_paths();
return FileAccess::open(ep->get_project_settings_dir().path_join(p_file_name), p_flags);
}

void for_each_line(const Ref<FileAccess>& p_file, std::function<void(const String&)> p_callback)
void for_each_line(const Ref<FileAccess>& p_file, const std::function<void(const String&)>& p_callback)
{
if (p_file.is_valid() && p_file->is_open())
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/file_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace FileUtils
/// For the specified file, reads each line and calls the specified callback function with the line.
/// @param p_file the file to read
/// @param p_callback the callback function to call for each line
void for_each_line(const Ref<FileAccess>& p_file, std::function<void(const String&)> p_callback);
void for_each_line(const Ref<FileAccess>& p_file, const std::function<void(const String&)>& p_callback);
}

#endif // ORCHESTRATOR_FILE_UTILS_H
17 changes: 8 additions & 9 deletions src/common/scene_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
//
#include "scene_utils.h"

#include "editor/plugins/orchestrator_editor_plugin.h"
#include "script/script_server.h"

#include <godot_cpp/classes/editor_interface.hpp>
Expand All @@ -36,7 +35,7 @@ namespace SceneUtils
{
ERR_FAIL_COND_V_MSG(p_class_name.is_empty(), nullptr, "Class name cannot be empty.");

VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
if (vbox->has_theme_icon(p_class_name, "EditorIcons"))
return vbox->get_theme_icon(p_class_name, "EditorIcons");

Expand Down Expand Up @@ -66,13 +65,13 @@ namespace SceneUtils

bool has_editor_icon(const String& p_icon_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->has_theme_icon(p_icon_name);
}

Color get_editor_color(const String& p_color_name, const String& p_category)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->get_theme_color(p_color_name, p_category);
}

Expand All @@ -83,31 +82,31 @@ namespace SceneUtils

Ref<Texture2D> get_editor_icon(const String& p_icon_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->get_theme_icon(p_icon_name, "EditorIcons");
}

Ref<StyleBox> get_editor_style(const String& p_style_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->get_theme_stylebox(p_style_name, "EditorStyles");
}

Ref<Font> get_editor_font(const String& p_font_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->get_theme_font(p_font_name, "EditorFonts");
}

int get_editor_font_size(const String& p_font_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->get_theme_font_size(p_font_name, "EditorFonts");
}

Ref<StyleBox> get_editor_stylebox(const String& p_stylebox_name, const String& p_class_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
VBoxContainer* vbox = EditorInterface::get_singleton()->get_editor_main_screen();
return vbox->get_theme_stylebox(p_stylebox_name, p_class_name);
}

Expand Down
3 changes: 1 addition & 2 deletions src/editor/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <godot_cpp/classes/os.hpp>
#include <godot_cpp/classes/scroll_container.hpp>
#include <godot_cpp/classes/style_box_empty.hpp>
#include <godot_cpp/classes/style_box_flat.hpp>
#include <godot_cpp/classes/tab_container.hpp>
#include <godot_cpp/classes/texture_rect.hpp>
#include <godot_cpp/classes/theme.hpp>
Expand Down Expand Up @@ -259,7 +258,7 @@ void OrchestratorAboutDialog::_on_theme_changed()
}
}

Ref<Theme> theme = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_theme();
Ref<Theme> theme = EditorInterface::get_singleton()->get_editor_theme();
if (theme.is_valid())
{
Ref<StyleBox> sb = theme->get_stylebox("panel", "EditorAbout");
Expand Down
6 changes: 3 additions & 3 deletions src/editor/component_panels/component_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include "common/callable_lambda.h"
#include "common/name_utils.h"
#include "common/scene_utils.h"
#include "editor/plugins/orchestrator_editor_plugin.h"

#include <godot_cpp/classes/accept_dialog.hpp>
#include <godot_cpp/classes/button.hpp>
#include <godot_cpp/classes/confirmation_dialog.hpp>
#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/h_box_container.hpp>
#include <godot_cpp/classes/input_event_mouse_button.hpp>
#include <godot_cpp/classes/label.hpp>
Expand Down Expand Up @@ -112,7 +112,7 @@ void OrchestratorScriptComponentPanel::_remove_confirmed()
{
if (_tree->get_selected())
{
OrchestratorPlugin::get_singleton()->get_editor_interface()->inspect_object(nullptr);
EditorInterface::get_singleton()->inspect_object(nullptr);
_handle_remove(_tree->get_selected());

update();
Expand Down Expand Up @@ -234,7 +234,7 @@ void OrchestratorScriptComponentPanel::_update_theme()
if (!_theme_changing)
return;

Ref<Theme> theme = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_theme();
Ref<Theme> theme = EditorInterface::get_singleton()->get_editor_theme();
if (theme.is_valid() && _panel)
{
Ref<StyleBoxFlat> sb = theme->get_stylebox("panel", "ItemList")->duplicate();
Expand Down
4 changes: 2 additions & 2 deletions src/editor/component_panels/functions_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#include "common/dictionary_utils.h"
#include "common/scene_utils.h"
#include "common/settings.h"
#include "editor/plugins/orchestrator_editor_plugin.h"
#include "editor/script_connections.h"
#include "script/script.h"

#include <godot_cpp/classes/button.hpp>
#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/h_box_container.hpp>
#include <godot_cpp/classes/popup_menu.hpp>
#include <godot_cpp/classes/tree.hpp>
Expand Down Expand Up @@ -147,7 +147,7 @@ void OrchestratorScriptFunctionsComponentPanel::_handle_item_selected()
{
const Ref<OScriptNode> node = function->get_owning_node();
if (node.is_valid())
OrchestratorPlugin::get_singleton()->get_editor_interface()->edit_resource(node);
EditorInterface::get_singleton()->edit_resource(node);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/editor/component_panels/signals_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

#include "common/dictionary_utils.h"
#include "common/scene_utils.h"
#include "common/settings.h"
#include "editor/plugins/orchestrator_editor_plugin.h"

#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/popup_menu.hpp>
#include <godot_cpp/classes/tree.hpp>

Expand Down Expand Up @@ -73,13 +72,13 @@ void OrchestratorScriptSignalsComponentPanel::_handle_item_selected()
TreeItem* item = _tree->get_selected();

Ref<OScriptSignal> signal = _orchestration->get_custom_signal(_get_tree_item_name(item));
OrchestratorPlugin::get_singleton()->get_editor_interface()->edit_resource(signal);
EditorInterface::get_singleton()->edit_resource(signal);
}

void OrchestratorScriptSignalsComponentPanel::_handle_item_activated(TreeItem* p_item)
{
Ref<OScriptSignal> signal = _orchestration->get_custom_signal(_get_tree_item_name(p_item));
OrchestratorPlugin::get_singleton()->get_editor_interface()->edit_resource(signal);
EditorInterface::get_singleton()->edit_resource(signal);
}

bool OrchestratorScriptSignalsComponentPanel::_handle_item_renamed(const String& p_old_name, const String& p_new_name)
Expand Down
5 changes: 3 additions & 2 deletions src/editor/component_panels/variables_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "editor/plugins/inspector_plugins.h"
#include "editor/plugins/orchestrator_editor_plugin.h"

#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/popup_menu.hpp>
#include <godot_cpp/classes/tree.hpp>

Expand Down Expand Up @@ -145,13 +146,13 @@ void OrchestratorScriptVariablesComponentPanel::_handle_item_selected()
TreeItem* item = _tree->get_selected();

Ref<OScriptVariable> variable = _orchestration->get_variable(_get_tree_item_name(item));
OrchestratorPlugin::get_singleton()->get_editor_interface()->edit_resource(variable);
EditorInterface::get_singleton()->edit_resource(variable);
}

void OrchestratorScriptVariablesComponentPanel::_handle_item_activated(TreeItem* p_item)
{
Ref<OScriptVariable> variable = _orchestration->get_variable(_get_tree_item_name(p_item));
OrchestratorPlugin::get_singleton()->get_editor_interface()->edit_resource(variable);
EditorInterface::get_singleton()->edit_resource(variable);
}

bool OrchestratorScriptVariablesComponentPanel::_handle_item_renamed(const String& p_old_name, const String& p_new_name)
Expand Down
6 changes: 3 additions & 3 deletions src/editor/editor_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
//
#include "editor/editor_cache.h"
#include "plugins/orchestrator_editor_debugger_plugin.h"
#include "plugins/orchestrator_editor_plugin.h"

#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/editor_paths.hpp>

#if GODOT_VERSION >= 0x040300
Expand All @@ -29,7 +29,7 @@ PackedInt64Array OrchestratorEditorCache::_get_breakpoints_for_path(const String

Error OrchestratorEditorCache::load()
{
const EditorInterface* ei = OrchestratorPlugin::get_singleton()->get_editor_interface();
const EditorInterface* ei = EditorInterface::get_singleton();

_cache = Ref<ConfigFile>(memnew(ConfigFile));

Expand Down Expand Up @@ -65,7 +65,7 @@ Error OrchestratorEditorCache::save()
{
if (_cache.is_valid())
{
const EditorInterface* ei = OrchestratorPlugin::get_singleton()->get_editor_interface();
const EditorInterface* ei = EditorInterface::get_singleton();
return _cache->save(ei->get_editor_paths()->get_project_settings_dir().path_join(CACHE_FILE));
}

Expand Down
8 changes: 4 additions & 4 deletions src/editor/editor_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void OrchestratorEditorPanel::_update_scene_tab_signals(bool p_connect)

void OrchestratorEditorPanel::_update_file_system_dock_signals(bool p_connect)
{
FileSystemDock* file_system_dock = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_file_system_dock();
FileSystemDock* file_system_dock = EditorInterface::get_singleton()->get_file_system_dock();
if (!file_system_dock)
return;

Expand Down Expand Up @@ -405,7 +405,7 @@ bool OrchestratorEditorPanel::_has_open_files() const

void OrchestratorEditorPanel::_show_editor_viewport(const String& p_file_name)
{
OrchestratorPlugin::get_singleton()->get_editor_interface()->inspect_object(nullptr);
EditorInterface::get_singleton()->inspect_object(nullptr);

_files_context.show(p_file_name);

Expand Down Expand Up @@ -567,7 +567,7 @@ void OrchestratorEditorPanel::_show_create_new_script_dialog()
_script_create_dialog->set_title("Create Orchestration");
_script_create_dialog->config(inherits, "new_script.os", false, false);

Ref<EditorSettings> editor_settings = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_settings();
Ref<EditorSettings> editor_settings = EditorInterface::get_singleton()->get_editor_settings();
editor_settings->set_project_metadata("script_setup", "last_selected_language", language_name);

_script_create_dialog->popup_centered();
Expand Down Expand Up @@ -821,7 +821,7 @@ void OrchestratorEditorPanel::_navigate_to_file_in_filesystem()

const String file_name = _files_context.get_selected_file_name();
if (!file_name.is_empty())
OrchestratorPlugin::get_singleton()->get_editor_interface()->get_file_system_dock()->navigate_to_path(file_name);
EditorInterface::get_singleton()->get_file_system_dock()->navigate_to_path(file_name);
}

void OrchestratorEditorPanel::edit_resource(const Ref<Resource>& p_resource)
Expand Down
2 changes: 1 addition & 1 deletion src/editor/editor_viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ OrchestratorGraphEdit* OrchestratorEditorViewport::_get_or_create_tab(const Stri
if (!script_graph.is_valid())
return nullptr;

OrchestratorGraphEdit* graph = memnew(OrchestratorGraphEdit(OrchestratorPlugin::get_singleton(), script_graph));
OrchestratorGraphEdit* graph = memnew(OrchestratorGraphEdit(script_graph));
_tabs->add_child(graph);

const String tab_icon = graph->is_function() ? "MemberMethod" : "ClassList";
Expand Down
5 changes: 2 additions & 3 deletions src/editor/file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
#include "editor/file_dialog.h"

#include "plugins/orchestrator_editor_plugin.h"
#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/line_edit.hpp>

void OrchestratorFileDialog::_focus_file_text()
Expand All @@ -37,8 +37,7 @@ void OrchestratorFileDialog::_focus_file_text()

void OrchestratorFileDialog::popup_file_dialog()
{
const float EDSCALE = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_scale();
popup_centered_clamped(Size2(1050, 700) * EDSCALE, 0.8);
popup_centered_clamped(Size2(1050, 700) * EditorInterface::get_singleton()->get_editor_scale(), 0.8);
_focus_file_text();
}

Expand Down
Loading
Loading