diff options
-rw-r--r-- | core/safe_refcount.h | 16 | ||||
-rw-r--r-- | doc/classes/GraphNode.xml | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 1 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/editor_plugin_settings.cpp | 88 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 1 | ||||
-rw-r--r-- | scene/2d/canvas_item.cpp | 9 | ||||
-rw-r--r-- | scene/gui/graph_node.cpp | 3 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 8 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 1 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 2 |
16 files changed, 89 insertions, 49 deletions
diff --git a/core/safe_refcount.h b/core/safe_refcount.h index 0b65ffb9ca..54f540b0c7 100644 --- a/core/safe_refcount.h +++ b/core/safe_refcount.h @@ -97,8 +97,8 @@ static _ALWAYS_INLINE_ T atomic_exchange_if_greater(volatile T *pw, volatile V v /* Implementation for GCC & Clang */ -#include <stdbool.h> -#include <atomic> +// GCC guarantees atomic intrinsics for sizes of 1, 2, 4 and 8 bytes. +// Clang states it supports GCC atomic builtins. template <class T> static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { @@ -107,7 +107,7 @@ static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { T tmp = static_cast<T const volatile &>(*pw); if (tmp == 0) return 0; // if zero, can't add to it anymore - if (__atomic_compare_exchange_n(pw, &tmp, tmp + 1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) == true) + if (__sync_val_compare_and_swap(pw, tmp, tmp + 1) == tmp) return tmp + 1; } } @@ -115,25 +115,25 @@ static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { template <class T> static _ALWAYS_INLINE_ T atomic_decrement(volatile T *pw) { - return __atomic_sub_fetch(pw, 1, __ATOMIC_SEQ_CST); + return __sync_sub_and_fetch(pw, 1); } template <class T> static _ALWAYS_INLINE_ T atomic_increment(volatile T *pw) { - return __atomic_add_fetch(pw, 1, __ATOMIC_SEQ_CST); + return __sync_add_and_fetch(pw, 1); } template <class T, class V> static _ALWAYS_INLINE_ T atomic_sub(volatile T *pw, volatile V val) { - return __atomic_sub_fetch(pw, val, __ATOMIC_SEQ_CST); + return __sync_sub_and_fetch(pw, val); } template <class T, class V> static _ALWAYS_INLINE_ T atomic_add(volatile T *pw, volatile V val) { - return __atomic_add_fetch(pw, val, __ATOMIC_SEQ_CST); + return __sync_add_and_fetch(pw, val); } template <class T, class V> @@ -143,7 +143,7 @@ static _ALWAYS_INLINE_ T atomic_exchange_if_greater(volatile T *pw, volatile V v T tmp = static_cast<T const volatile &>(*pw); if (tmp >= val) return tmp; // already greater, or equal - if (__atomic_compare_exchange_n(pw, &tmp, val, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) == true) + if (__sync_val_compare_and_swap(pw, tmp, val) == tmp) return val; } } diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml index 6bc09e5289..8aefa41f8a 100644 --- a/doc/classes/GraphNode.xml +++ b/doc/classes/GraphNode.xml @@ -257,6 +257,8 @@ </theme_item> <theme_item name="resizer" type="Texture"> </theme_item> + <theme_item name="resizer_color" type="Color" default="Color( 0, 0, 0, 1 )"> + </theme_item> <theme_item name="selectedframe" type="StyleBox"> </theme_item> <theme_item name="separation" type="int" default="1"> diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 2e8f8ec646..e6df00b48c 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -54,6 +54,7 @@ void EditorHelp::_init_colors() { qualifier_color = text_color * Color(1, 1, 1, 0.8); type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); + class_desc->add_constant_override("line_separation", Math::round(5 * EDSCALE)); } void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) { diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index e27f1ab9eb..d9fd0659aa 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -238,7 +238,7 @@ Control *EditorInterface::get_base_control() { } void EditorInterface::set_plugin_enabled(const String &p_plugin, bool p_enabled) { - EditorNode::get_singleton()->set_addon_plugin_enabled(p_plugin, p_enabled); + EditorNode::get_singleton()->set_addon_plugin_enabled(p_plugin, p_enabled, true); } bool EditorInterface::is_plugin_enabled(const String &p_plugin) const { diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 09577e39e1..514b3ff5d2 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -96,45 +96,59 @@ void EditorPluginSettings::update_plugins() { if (err2 != OK) { WARN_PRINTS("Can't load plugin config: " + path); - } else if (!cf->has_section_key("plugin", "name")) { - WARN_PRINTS("Plugin misses plugin/name: " + path); - } else if (!cf->has_section_key("plugin", "author")) { - WARN_PRINTS("Plugin misses plugin/author: " + path); - } else if (!cf->has_section_key("plugin", "version")) { - WARN_PRINTS("Plugin misses plugin/version: " + path); - } else if (!cf->has_section_key("plugin", "description")) { - WARN_PRINTS("Plugin misses plugin/description: " + path); - } else if (!cf->has_section_key("plugin", "script")) { - WARN_PRINTS("Plugin misses plugin/script: " + path); } else { + bool key_missing = false; - String d2 = plugins[i]; - String name = cf->get_value("plugin", "name"); - String author = cf->get_value("plugin", "author"); - String version = cf->get_value("plugin", "version"); - String description = cf->get_value("plugin", "description"); - String script = cf->get_value("plugin", "script"); - - TreeItem *item = plugin_list->create_item(root); - item->set_text(0, name); - item->set_tooltip(0, "Name: " + name + "\nPath: " + path + "\nMain Script: " + script + "\nDescription: " + description); - item->set_metadata(0, d2); - item->set_text(1, version); - item->set_metadata(1, script); - item->set_text(2, author); - item->set_metadata(2, description); - item->set_cell_mode(3, TreeItem::CELL_MODE_RANGE); - item->set_range_config(3, 0, 1, 1); - item->set_text(3, "Inactive,Active"); - item->set_editable(3, true); - item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); - - if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) { - item->set_custom_color(3, get_color("success_color", "Editor")); - item->set_range(3, 1); - } else { - item->set_custom_color(3, get_color("disabled_font_color", "Editor")); - item->set_range(3, 0); + if (!cf->has_section_key("plugin", "name")) { + WARN_PRINTS("Plugin config misses \"plugin/name\" key: " + path); + key_missing = true; + } + if (!cf->has_section_key("plugin", "author")) { + WARN_PRINTS("Plugin config misses \"plugin/author\" key: " + path); + key_missing = true; + } + if (!cf->has_section_key("plugin", "version")) { + WARN_PRINTS("Plugin config misses \"plugin/version\" key: " + path); + key_missing = true; + } + if (!cf->has_section_key("plugin", "description")) { + WARN_PRINTS("Plugin config misses \"plugin/description\" key: " + path); + key_missing = true; + } + if (!cf->has_section_key("plugin", "script")) { + WARN_PRINTS("Plugin config misses \"plugin/script\" key: " + path); + key_missing = true; + } + + if (!key_missing) { + String d2 = plugins[i]; + String name = cf->get_value("plugin", "name"); + String author = cf->get_value("plugin", "author"); + String version = cf->get_value("plugin", "version"); + String description = cf->get_value("plugin", "description"); + String script = cf->get_value("plugin", "script"); + + TreeItem *item = plugin_list->create_item(root); + item->set_text(0, name); + item->set_tooltip(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + script + "\n" + TTR("Description:") + " " + description); + item->set_metadata(0, d2); + item->set_text(1, version); + item->set_metadata(1, script); + item->set_text(2, author); + item->set_metadata(2, description); + item->set_cell_mode(3, TreeItem::CELL_MODE_RANGE); + item->set_range_config(3, 0, 1, 1); + item->set_text(3, "Inactive,Active"); + item->set_editable(3, true); + item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); + + if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) { + item->set_custom_color(3, get_color("success_color", "Editor")); + item->set_range(3, 1); + } else { + item->set_custom_color(3, get_color("disabled_font_color", "Editor")); + item->set_range(3, 0); + } } } } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index c15d24719f..e29e44caa2 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1066,6 +1066,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("title_color", "GraphNode", default_node_color); default_node_color.a = 0.7; theme->set_color("close_color", "GraphNode", default_node_color); + theme->set_color("resizer_color", "GraphNode", default_node_color); theme->set_constant("port_offset", "GraphNode", 14 * EDSCALE); theme->set_constant("title_h_offset", "GraphNode", -16 * EDSCALE); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 574f906cfa..235c204265 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -249,6 +249,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { node->add_color_override("title_color", c); c.a = 0.7; node->add_color_override("close_color", c); + node->add_color_override("resizer_color", c); } } diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index cb68f5eaaf..894e5c7298 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -290,6 +290,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { desc_vbox->add_child(description); description->set_v_size_flags(SIZE_EXPAND_FILL); description->connect("meta_clicked", this, "_link_click"); + description->add_constant_override("line_separation", Math::round(5 * EDSCALE)); VBoxContainer *previews_vbox = memnew(VBoxContainer); hbox->add_child(previews_vbox); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index c8ffc2744a..8acc41a2c7 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -624,6 +624,7 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S uint8_t *imgw = imgdata.ptr(); Ref<AudioStreamPlayback> playback = stream->instance_playback(); + ERR_FAIL_COND_V(playback.is_null(), Ref<Texture>()); float len_s = stream->get_length(); if (len_s == 0) { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 66fbc32b1c..6b338ca02b 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -410,6 +410,7 @@ void VisualShaderEditor::_update_created_node(GraphNode *node) { node->add_color_override("title_color", c); c.a = 0.7; node->add_color_override("close_color", c); + node->add_color_override("resizer_color", c); } } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index eef3f0f8ae..8faa342bbe 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -591,6 +591,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->add_color_override("title_color", c); c.a = 0.7; gnode->add_color_override("close_color", c); + gnode->add_color_override("resizer_color", c); gnode->add_style_override("frame", sbf); } diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index b605be47df..fc5e5cbba2 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -641,6 +641,9 @@ void CanvasItem::update() { void CanvasItem::set_modulate(const Color &p_modulate) { + if (modulate == p_modulate) + return; + modulate = p_modulate; VisualServer::get_singleton()->canvas_item_set_modulate(canvas_item, modulate); } @@ -679,6 +682,9 @@ CanvasItem *CanvasItem::get_parent_item() const { void CanvasItem::set_self_modulate(const Color &p_self_modulate) { + if (self_modulate == p_self_modulate) + return; + self_modulate = p_self_modulate; VisualServer::get_singleton()->canvas_item_set_self_modulate(canvas_item, self_modulate); } @@ -689,6 +695,9 @@ Color CanvasItem::get_self_modulate() const { void CanvasItem::set_light_mask(int p_light_mask) { + if (light_mask == p_light_mask) + return; + light_mask = p_light_mask; VS::get_singleton()->canvas_item_set_light_mask(canvas_item, p_light_mask); } diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index f7bef4ed39..5b2f8812d5 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -210,6 +210,7 @@ void GraphNode::_notification(int p_what) { int close_offset = get_constant("close_offset"); int close_h_offset = get_constant("close_h_offset"); Color close_color = get_color("close_color"); + Color resizer_color = get_color("resizer_color"); Ref<Font> title_font = get_font("title_font"); int title_offset = get_constant("title_offset"); int title_h_offset = get_constant("title_h_offset"); @@ -274,7 +275,7 @@ void GraphNode::_notification(int p_what) { } if (resizable) { - draw_texture(resizer, get_size() - resizer->get_size()); + draw_texture(resizer, get_size() - resizer->get_size(), resizer_color); } } break; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 65554b1f5e..ab5ed3166c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -596,8 +596,14 @@ void TextEdit::_update_minimap_drag() { return; } + int control_height = _get_control_height(); + int scroll_height = v_scroll->get_max() * (minimap_char_size.y + minimap_line_spacing); + if (control_height > scroll_height) { + control_height = scroll_height; + } + Point2 mp = get_local_mouse_position(); - double diff = (mp.y - minimap_scroll_click_pos) / _get_control_height(); + double diff = (mp.y - minimap_scroll_click_pos) / control_height; v_scroll->set_as_ratio(minimap_scroll_ratio + diff); } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 1a5f57ce48..d761eb01fe 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -611,6 +611,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_font("title_font", "GraphNode", default_font); theme->set_color("title_color", "GraphNode", Color(0, 0, 0, 1)); theme->set_color("close_color", "GraphNode", Color(0, 0, 0, 1)); + theme->set_color("resizer_color", "GraphNode", Color(0, 0, 0, 1)); theme->set_constant("title_offset", "GraphNode", 20 * scale); theme->set_constant("close_offset", "GraphNode", 18 * scale); theme->set_constant("port_offset", "GraphNode", 3 * scale); diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 699410719c..e37cbd9f92 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -2479,9 +2479,9 @@ String VisualShaderNodeExpression::generate_code(Shader::Mode p_mode, VisualShad static Vector<String> post_symbols; if (post_symbols.empty()) { - post_symbols.push_back("\0"); post_symbols.push_back("\t"); post_symbols.push_back("\n"); + post_symbols.push_back(","); post_symbols.push_back(";"); post_symbols.push_back("}"); post_symbols.push_back("]"); |