summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/EditorSettings.xml14
-rw-r--r--editor/editor_node.cpp7
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_settings.cpp6
-rw-r--r--editor/filesystem_dock.cpp44
-rw-r--r--editor/filesystem_dock.h1
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp2
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.cpp6
-rw-r--r--scene/gui/color_picker.cpp84
-rw-r--r--scene/gui/color_picker.h8
-rw-r--r--scene/main/canvas_item.cpp10
-rw-r--r--scene/main/canvas_item.h1
12 files changed, 138 insertions, 47 deletions
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index fca87f6a56..9015a12b43 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -433,12 +433,24 @@
The size to use for port previews in the visual shader uniforms (toggled by clicking the "eye" icon next to an output). The value is defined in pixels at 100% zoom, and will scale with zoom automatically.
</member>
<member name="filesystem/directories/autoscan_project_path" type="String" setter="" getter="">
- The folder where projects should be scanned for (recursively), in a way similar to the project manager's [b]Scan[/b]button. This can be set to the same value as [member filesystem/directories/default_project_path] for convenience.
+ The folder where projects should be scanned for (recursively), in a way similar to the project manager's [b]Scan[/b] button. This can be set to the same value as [member filesystem/directories/default_project_path] for convenience.
[b]Note:[/b] Setting this path to a folder with very large amounts of files/folders can slow down the project manager startup significantly. To keep the project manager quick to start up, it is recommended to set this value to a folder as "specific" as possible.
</member>
<member name="filesystem/directories/default_project_path" type="String" setter="" getter="">
The folder where new projects should be created by default when clicking the project manager's [b]New Project[/b] button. This can be set to the same value as [member filesystem/directories/autoscan_project_path] for convenience.
</member>
+ <member name="filesystem/external_programs/3d_model_editor" type="String" setter="" getter="">
+ The program that opens 3D model scene files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
+ <member name="filesystem/external_programs/audio_editor" type="String" setter="" getter="">
+ The program that opens audio files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
+ <member name="filesystem/external_programs/raster_image_editor" type="String" setter="" getter="">
+ The program that opens raster image files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
+ <member name="filesystem/external_programs/vector_image_editor" type="String" setter="" getter="">
+ The program that opens vector image files when clicking "Open in External Program" option in Filesystem Dock. If not specified, the file will be opened in the system's default program.
+ </member>
<member name="filesystem/file_dialog/display_mode" type="int" setter="" getter="">
The display mode to use in the editor's file dialogs.
- [b]Thumbnails[/b] takes more space, but displays dynamic resource thumbnails, making resources easier to preview without having to open them.
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b0278030f9..bbd927dcd9 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3712,11 +3712,12 @@ void EditorNode::set_current_scene(int p_idx) {
call_deferred(SNAME("_set_main_scene_state"), state, get_edited_scene()); // Do after everything else is done setting up.
}
-void EditorNode::setup_color_picker(ColorPicker *picker) {
+void EditorNode::setup_color_picker(ColorPicker *p_picker) {
+ p_picker->set_editor_settings(EditorSettings::get_singleton());
int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode");
int picker_shape = EDITOR_GET("interface/inspector/default_color_picker_shape");
- picker->set_color_mode((ColorPicker::ColorModeType)default_color_mode);
- picker->set_picker_shape((ColorPicker::PickerShapeType)picker_shape);
+ p_picker->set_color_mode((ColorPicker::ColorModeType)default_color_mode);
+ p_picker->set_picker_shape((ColorPicker::PickerShapeType)picker_shape);
}
bool EditorNode::is_scene_open(const String &p_path) {
diff --git a/editor/editor_node.h b/editor/editor_node.h
index fb2544c141..d7a4bd4434 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -824,7 +824,7 @@ public:
void set_current_scene(int p_idx);
- void setup_color_picker(ColorPicker *picker);
+ void setup_color_picker(ColorPicker *p_picker);
void request_instantiate_scene(const String &p_path);
void request_instantiate_scenes(const Vector<String> &p_files);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 8ca98e6f76..4879790b74 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -473,6 +473,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
/* Filesystem */
+ // External Programs
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/external_programs/raster_image_editor", "", "")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/external_programs/vector_image_editor", "", "")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/external_programs/audio_editor", "", "")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/external_programs/3d_model_editor", "", "")
+
// Directories
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_DIR, "filesystem/directories/autoscan_project_path", "", "")
const String fs_dir_default_project_path = OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index f1ea8e8e65..f41792af7f 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1819,6 +1819,43 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
OS::get_singleton()->shell_open(String("file://") + dir);
} break;
+ case FILE_OPEN_EXTERNAL: {
+ String fpath = path;
+ if (path == "Favorites") {
+ fpath = p_selected[0];
+ }
+
+ String file = ProjectSettings::get_singleton()->globalize_path(fpath);
+
+ String resource_type = ResourceLoader::get_resource_type(fpath);
+ String external_program;
+
+ if (resource_type == "CompressedTexture2D" || resource_type == "Image") {
+ if (file.get_extension() == "svg" || file.get_extension() == "svgz") {
+ external_program = EDITOR_GET("filesystem/external_programs/vector_image_editor");
+ } else {
+ external_program = EDITOR_GET("filesystem/external_programs/raster_image_editor");
+ }
+ } else if (ClassDB::is_parent_class(resource_type, "AudioStream")) {
+ external_program = EDITOR_GET("filesystem/external_programs/audio_editor");
+ } else if (resource_type == "PackedScene") {
+ // Ignore non-model scenes.
+ if (file.get_extension() != "tscn" && file.get_extension() != "scn" && file.get_extension() != "res") {
+ external_program = EDITOR_GET("filesystem/external_programs/3d_model_editor");
+ }
+ } else if (ClassDB::is_parent_class(resource_type, "Script")) {
+ external_program = EDITOR_GET("text_editor/external/exec_path");
+ }
+
+ if (external_program.is_empty()) {
+ OS::get_singleton()->shell_open(file);
+ } else {
+ List<String> args;
+ args.push_back(file);
+ OS::get_singleton()->create_process(external_program, args);
+ }
+ } break;
+
case FILE_OPEN: {
// Open folders.
TreeItem *selected = tree->get_root();
@@ -2606,9 +2643,13 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
}
String fpath = p_paths[0];
- String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager");
+ bool is_directory = fpath.ends_with("/");
+ String item_text = is_directory ? TTR("Open in File Manager") : TTR("Show in File Manager");
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
p_popup->set_item_text(p_popup->get_item_index(FILE_SHOW_IN_EXPLORER), item_text);
+ if (!is_directory) {
+ p_popup->add_icon_item(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")), TTR("Open in External Program"), FILE_OPEN_EXTERNAL);
+ }
path = fpath;
}
}
@@ -2714,6 +2755,7 @@ void FileSystemDock::_file_list_empty_clicked(const Vector2 &p_pos, MouseButton
file_list_popup->add_icon_item(get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")), TTR("New TextFile..."), FILE_NEW_TEXTFILE);
file_list_popup->add_separator();
file_list_popup->add_icon_shortcut(get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_SHOW_IN_EXPLORER);
+
file_list_popup->set_position(files->get_screen_position() + p_pos);
file_list_popup->reset_size();
file_list_popup->popup();
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 2304d8f8ad..3f12b73043 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -94,6 +94,7 @@ private:
FILE_NEW_SCRIPT,
FILE_NEW_SCENE,
FILE_SHOW_IN_EXPLORER,
+ FILE_OPEN_EXTERNAL,
FILE_COPY_PATH,
FILE_COPY_UID,
FILE_NEW_RESOURCE,
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 5d000d5bfe..2394130ad6 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -922,7 +922,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
// Get the tile modulation.
Color modulate = tile_data->get_modulate();
- Color self_modulate = tile_map->get_self_modulate();
+ Color self_modulate = tile_map->get_modulate_in_tree() * tile_map->get_self_modulate();
modulate *= self_modulate;
modulate *= tile_map->get_layer_modulate(tile_map_layer);
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp
index 8d03e3d31c..3a245460b4 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.cpp
+++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp
@@ -81,7 +81,13 @@ static void handle_crash(int sig) {
print_error(vformat("Dumping the backtrace. %s", msg));
char **strings = backtrace_symbols(bt_buffer, size);
// PIE executable relocation, zero for non-PIE executables
+#ifdef __GLIBC__
+ // This is a glibc only thing apparently.
uintptr_t relocation = _r_debug.r_map->l_addr;
+#else
+ // Non glibc systems apparently don't give PIE relocation info.
+ uintptr_t relocation = 0;
+#endif //__GLIBC__
if (strings) {
List<String> args;
for (size_t i = 0; i < size; i++) {
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index b0261dcf23..2c5248f088 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -35,11 +35,6 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "scene/gui/color_mode.h"
-
-#ifdef TOOLS_ENABLED
-#include "editor/editor_settings.h"
-#endif
-
#include "thirdparty/misc/ok_color.h"
#include "thirdparty/misc/ok_color_shader.h"
@@ -50,31 +45,6 @@ void ColorPicker::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
_update_color();
-#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
- if (preset_cache.is_empty()) {
- PackedColorArray saved_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "presets", PackedColorArray());
- for (int i = 0; i < saved_presets.size(); i++) {
- preset_cache.push_back(saved_presets[i]);
- }
- }
-
- for (int i = 0; i < preset_cache.size(); i++) {
- presets.push_back(preset_cache[i]);
- }
-
- if (recent_preset_cache.is_empty()) {
- PackedColorArray saved_recent_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "recent_presets", PackedColorArray());
- for (int i = 0; i < saved_recent_presets.size(); i++) {
- recent_preset_cache.push_back(saved_recent_presets[i]);
- }
- }
-
- for (int i = 0; i < recent_preset_cache.size(); i++) {
- recent_presets.push_back(recent_preset_cache[i]);
- }
- }
-#endif
[[fallthrough]];
}
case NOTIFICATION_THEME_CHANGED: {
@@ -404,6 +374,40 @@ void ColorPicker::create_slider(GridContainer *gc, int idx) {
}
}
+#ifdef TOOLS_ENABLED
+void ColorPicker::set_editor_settings(Object *p_editor_settings) {
+ if (editor_settings) {
+ return;
+ }
+ editor_settings = p_editor_settings;
+
+ if (preset_cache.is_empty()) {
+ PackedColorArray saved_presets = editor_settings->call(SNAME("get_project_metadata"), "color_picker", "presets", PackedColorArray());
+ for (int i = 0; i < saved_presets.size(); i++) {
+ preset_cache.push_back(saved_presets[i]);
+ }
+ }
+
+ for (int i = 0; i < preset_cache.size(); i++) {
+ presets.push_back(preset_cache[i]);
+ }
+
+ if (recent_preset_cache.is_empty()) {
+ PackedColorArray saved_recent_presets = editor_settings->call(SNAME("get_project_metadata"), "color_picker", "recent_presets", PackedColorArray());
+ for (int i = 0; i < saved_recent_presets.size(); i++) {
+ recent_preset_cache.push_back(saved_recent_presets[i]);
+ }
+ }
+
+ for (int i = 0; i < recent_preset_cache.size(); i++) {
+ recent_presets.push_back(recent_preset_cache[i]);
+ }
+
+ _update_presets();
+ _update_recent_presets();
+}
+#endif
+
HSlider *ColorPicker::get_slider(int p_idx) {
if (p_idx < SLIDER_COUNT) {
return sliders[p_idx];
@@ -553,7 +557,7 @@ void ColorPicker::_update_presets() {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
// Only load preset buttons when the only child is the add-preset button.
if (preset_container->get_child_count() == 1) {
for (int i = 0; i < preset_cache.size(); i++) {
@@ -567,7 +571,7 @@ void ColorPicker::_update_presets() {
void ColorPicker::_update_recent_presets() {
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
int recent_preset_count = recent_preset_hbc->get_child_count();
for (int i = 0; i < recent_preset_count; i++) {
memdelete(recent_preset_hbc->get_child(0));
@@ -743,9 +747,9 @@ void ColorPicker::add_preset(const Color &p_color) {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "presets", arr_to_save);
}
#endif
}
@@ -764,9 +768,9 @@ void ColorPicker::add_recent_preset(const Color &p_color) {
_select_from_preset_container(p_color);
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_recent_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "recent_presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "recent_presets", arr_to_save);
}
#endif
}
@@ -787,9 +791,9 @@ void ColorPicker::erase_preset(const Color &p_color) {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "presets", arr_to_save);
}
#endif
}
@@ -811,9 +815,9 @@ void ColorPicker::erase_recent_preset(const Color &p_color) {
}
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (editor_settings) {
PackedColorArray arr_to_save = get_recent_presets();
- EditorSettings::get_singleton()->set_project_metadata("color_picker", "recent_presets", arr_to_save);
+ editor_settings->call(SNAME("set_project_metadata"), "color_picker", "recent_presets", arr_to_save);
}
#endif
}
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 5eaeecca2a..f7578612cd 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -100,6 +100,10 @@ private:
static List<Color> preset_cache;
static List<Color> recent_preset_cache;
+#ifdef TOOLS_ENABLED
+ Object *editor_settings = nullptr;
+#endif
+
int current_slider_count = SLIDER_COUNT;
static const int MODE_BUTTON_COUNT = 3;
@@ -231,6 +235,10 @@ protected:
static void _bind_methods();
public:
+#ifdef TOOLS_ENABLED
+ void set_editor_settings(Object *p_editor_settings);
+#endif
+
HSlider *get_slider(int idx);
Vector<float> get_active_slider_values();
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index bf0a8f7b6c..7b0554442c 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -388,6 +388,16 @@ Color CanvasItem::get_modulate() const {
return modulate;
}
+Color CanvasItem::get_modulate_in_tree() const {
+ Color final_modulate = modulate;
+ CanvasItem *parent_item = get_parent_item();
+ while (parent_item) {
+ final_modulate *= parent_item->get_modulate();
+ parent_item = parent_item->get_parent_item();
+ }
+ return final_modulate;
+}
+
void CanvasItem::set_as_top_level(bool p_top_level) {
if (top_level == p_top_level) {
return;
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index a7e9fc3c79..644fe856ec 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -224,6 +224,7 @@ public:
void set_modulate(const Color &p_modulate);
Color get_modulate() const;
+ Color get_modulate_in_tree() const;
void set_self_modulate(const Color &p_self_modulate);
Color get_self_modulate() const;