diff options
-rw-r--r-- | editor/editor_node.cpp | 6 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 48 | ||||
-rw-r--r-- | editor/editor_properties.h | 3 | ||||
-rw-r--r-- | editor/editor_resource_preview.h | 18 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/import/resource_importer_csv_translation.cpp | 2 | ||||
-rw-r--r-- | modules/opensimplex/noise_texture.cpp | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script.cpp | 21 | ||||
-rw-r--r-- | modules/visual_script/visual_script.h | 1 | ||||
-rw-r--r-- | modules/visual_script/visual_script_func_nodes.cpp | 5 |
11 files changed, 66 insertions, 44 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 83fb7ade40..a29b50185c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1460,7 +1460,7 @@ void EditorNode::edit_item(Object *p_object) { _set_editing_top_editors(p_object); _display_top_editors(true); } else { - _hide_top_editors(); + hide_top_editors(); } } @@ -1498,7 +1498,7 @@ void EditorNode::_save_default_environment() { } } -void EditorNode::_hide_top_editors() { +void EditorNode::hide_top_editors() { _display_top_editors(false); @@ -1675,7 +1675,7 @@ void EditorNode::_edit_current() { } else if (!editor_plugins_over->get_plugins_list().empty()) { - _hide_top_editors(); + hide_top_editors(); } } diff --git a/editor/editor_node.h b/editor/editor_node.h index 192dc649e9..267c70c773 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -452,7 +452,6 @@ private: void _instance_request(const Vector<String> &p_files); - void _hide_top_editors(); void _display_top_editors(bool p_display); void _set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over); void _set_editing_top_editors(Object *p_current_object); @@ -677,6 +676,7 @@ public: void edit_item(Object *p_object); void edit_item_resource(RES p_resource); bool item_has_editor(Object *p_object); + void hide_top_editors(); void open_request(const String &p_path); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index a07cffb078..16a4654123 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2443,6 +2443,38 @@ void EditorPropertyResource::_open_editor_pressed() { } } +void EditorPropertyResource::_fold_other_editors(Object *p_self) { + + if (this == p_self) { + return; + } + + RES res = get_edited_object()->get(get_edited_property()); + + if (!res.is_valid()) + return; + bool use_editor = false; + for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) { + EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i); + if (ep->handles(res.ptr())) { + use_editor = true; + } + } + + if (!use_editor) + return; + bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property()); + + opened_editor = false; + + if (unfolded) { + //refold + assign->set_pressed(false); + get_edited_object()->editor_set_section_unfold(get_edited_property(), false); + update_property(); + } +} + void EditorPropertyResource::update_property() { RES res = get_edited_object()->get(get_edited_property()); @@ -2487,12 +2519,20 @@ void EditorPropertyResource::update_property() { } if (use_editor) { + //open editor directly and hide other open of these + _open_editor_pressed(); + if (is_inside_tree()) { + get_tree()->call_deferred("call_group", "_editor_resource_properties", "_fold_other_editors", this); + } + opened_editor = true; + /* Button *open_in_editor = memnew(Button); open_in_editor->set_text(TTR("Open Editor")); open_in_editor->set_icon(get_icon("Edit", "EditorIcons")); sub_inspector_vbox->add_child(open_in_editor); open_in_editor->connect("pressed", this, "_open_editor_pressed"); open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER); + */ } } @@ -2506,6 +2546,10 @@ void EditorPropertyResource::update_property() { memdelete(sub_inspector_vbox); sub_inspector = NULL; sub_inspector_vbox = NULL; + if (opened_editor) { + EditorNode::get_singleton()->hide_top_editors(); + opened_editor = false; + } } } #endif @@ -2726,10 +2770,12 @@ void EditorPropertyResource::_bind_methods() { ClassDB::bind_method(D_METHOD("_button_draw"), &EditorPropertyResource::_button_draw); ClassDB::bind_method(D_METHOD("_open_editor_pressed"), &EditorPropertyResource::_open_editor_pressed); ClassDB::bind_method(D_METHOD("_button_input"), &EditorPropertyResource::_button_input); + ClassDB::bind_method(D_METHOD("_fold_other_editors"), &EditorPropertyResource::_fold_other_editors); } EditorPropertyResource::EditorPropertyResource() { + opened_editor = true; sub_inspector = NULL; sub_inspector_vbox = NULL; use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector")); @@ -2766,6 +2812,8 @@ EditorPropertyResource::EditorPropertyResource() { file = NULL; scene_tree = NULL; dropping = false; + + add_to_group("_editor_resource_properties"); } ////////////// DEFAULT PLUGIN ////////////////////// diff --git a/editor/editor_properties.h b/editor/editor_properties.h index df01ee83b5..574767890c 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -581,6 +581,9 @@ class EditorPropertyResource : public EditorProperty { void _button_input(const Ref<InputEvent> &p_event); void _open_editor_pressed(); + void _fold_other_editors(Object *p_self); + + bool opened_editor; protected: static void _bind_methods(); diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index 703ba34e43..9b9223a818 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -36,24 +36,6 @@ #include "scene/main/node.h" #include "scene/resources/texture.h" -/* make previews for: -*packdscene -*wav -*image -*mesh --font -*script -*material --shader --shader graph? --navigation mesh --collision? --occluder polygon --navigation polygon --tileset --curve and curve2D -*/ - class EditorResourcePreviewGenerator : public Reference { GDCLASS(EditorResourcePreviewGenerator, Reference); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index c9bdd8d1c4..bc42a3f23b 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -641,7 +641,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon("GuiVisibilityXray", "EditorIcons")); theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size + 1) * EDSCALE); - Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1, 2, 0, 2, 2); + Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1.linear_interpolate(accent_color, 0.08), 2, 0, 2, 2); sub_inspector_bg->set_border_width(MARGIN_LEFT, 2); sub_inspector_bg->set_border_color(MARGIN_LEFT, accent_color * Color(1, 1, 1, 0.3)); sub_inspector_bg->set_border_width(MARGIN_RIGHT, 2); diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp index b4b3e0e551..cfcdbc8de4 100644 --- a/editor/import/resource_importer_csv_translation.cpp +++ b/editor/import/resource_importer_csv_translation.cpp @@ -119,7 +119,7 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const if (key != "") { for (int i = 1; i < line.size(); i++) { - translations.write[i - 1]->add_message(key, line[i]); + translations.write[i - 1]->add_message(key, line[i].c_unescape()); } } diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 9a92c5fd6f..9240183265 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -41,7 +41,7 @@ NoiseTexture::NoiseTexture() { size = Vector2i(512, 512); seamless = false; as_normalmap = false; - bump_strength = 1.0; //1.0 is a little low. Keep at 1.0 for compatibility for now. For 3.2 increase to 8.0. + bump_strength = 8.0; flags = FLAGS_DEFAULT; noise = Ref<OpenSimplexNoise>(); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 2c89e5a35c..581809fec9 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -48,22 +48,12 @@ bool VisualScriptNode::is_breakpoint() const { void VisualScriptNode::_notification(int p_what) { if (p_what == NOTIFICATION_POSTINITIALIZE) { - _update_input_ports(); - } -} - -void VisualScriptNode::_update_input_ports() { - default_input_values.resize(MAX(default_input_values.size(), get_input_value_port_count())); //let it grow as big as possible, we don't want to lose values on resize - int port_count = get_input_value_port_count(); - for (int i = 0; i < port_count; i++) { - Variant::Type expected = get_input_value_port_info(i).type; - Variant::CallError ce; - set_default_input_value(i, Variant::construct(expected, NULL, 0, ce, false)); + validate_input_default_values(); } } void VisualScriptNode::ports_changed_notify() { - _update_input_ports(); + validate_input_default_values(); emit_signal("ports_changed"); } @@ -92,8 +82,7 @@ void VisualScriptNode::_set_default_input_values(Array p_values) { } void VisualScriptNode::validate_input_default_values() { - - default_input_values.resize(get_input_value_port_count()); + default_input_values.resize(MAX(default_input_values.size(), get_input_value_port_count())); //let it grow as big as possible, we don't want to lose values on resize //actually validate on save for (int i = 0; i < get_input_value_port_count(); i++) { @@ -119,8 +108,10 @@ void VisualScriptNode::validate_input_default_values() { Array VisualScriptNode::_get_default_input_values() const { //validate on save, since on load there is little info about this + Array values = default_input_values; + values.resize(get_input_value_port_count()); - return default_input_values; + return values; } String VisualScriptNode::get_text() const { diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 0768ff61f7..0171b8e6f1 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -52,7 +52,6 @@ class VisualScriptNode : public Resource { Array _get_default_input_values() const; void validate_input_default_values(); - void _update_input_ports(); protected: void _notification(int p_what); diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 7dba8fd488..bb0435a679 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -129,9 +129,8 @@ StringName VisualScriptFunctionCall::_get_base_type() const { int VisualScriptFunctionCall::get_input_value_port_count() const { if (call_mode == CALL_MODE_BASIC_TYPE) { - - Vector<StringName> names = Variant::get_method_argument_names(basic_type, function); - return names.size() + (rpc_call_mode >= RPC_RELIABLE_TO_ID ? 1 : 0) + 1; + Vector<Variant::Type> types = Variant::get_method_argument_types(basic_type, function); + return types.size() + (rpc_call_mode >= RPC_RELIABLE_TO_ID ? 1 : 0) + 1; } else { |