diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 02c6925f14a..83a7e115c99 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -68,7 +68,7 @@ Size2 EditorProperty::get_minimum_size() const { Size2 ms; Ref font = get_theme_font(SNAME("font"), SNAME("Tree")); int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree")); - ms.height = font->get_height(font_size) + 4 * EDSCALE; + ms.height = label.is_empty() ? 0 : font->get_height(font_size) + 4 * EDSCALE; for (int i = 0; i < get_child_count(); i++) { Control *c = Object::cast_to(get_child(i)); @@ -106,7 +106,7 @@ Size2 EditorProperty::get_minimum_size() const { } if (bottom_editor != nullptr && bottom_editor->is_visible()) { - ms.height += get_theme_constant(SNAME("v_separation")); + ms.height += label.is_empty() ? 0 : get_theme_constant(SNAME("v_separation")); Size2 bems = bottom_editor->get_combined_minimum_size(); //bems.width += get_constant("item_margin", "Tree"); ms.height += bems.height; @@ -138,7 +138,7 @@ void EditorProperty::_notification(int p_what) { int child_room = size.width * (1.0 - split_ratio); Ref font = get_theme_font(SNAME("font"), SNAME("Tree")); int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree")); - int height = font->get_height(font_size) + 4 * EDSCALE; + int height = label.is_empty() ? 0 : font->get_height(font_size) + 4 * EDSCALE; bool no_children = true; //compute room needed @@ -176,9 +176,8 @@ void EditorProperty::_notification(int p_what) { } if (bottom_editor) { - int m = 0; //get_constant("item_margin", "Tree"); - - bottom_rect = Rect2(m, rect.size.height + get_theme_constant(SNAME("v_separation")), size.width - m, bottom_editor->get_combined_minimum_size().height); + int v_offset = label.is_empty() ? 0 : get_theme_constant(SNAME("v_separation")); + bottom_rect = Rect2(0, rect.size.height + v_offset, size.width, bottom_editor->get_combined_minimum_size().height); } if (keying) { @@ -254,8 +253,13 @@ void EditorProperty::_notification(int p_what) { size.height = label_reference->get_size().height; } - Ref sb = get_theme_stylebox(selected ? SNAME("bg_selected") : SNAME("bg")); - draw_style_box(sb, Rect2(Vector2(), size)); + // Only draw the label if it's not empty. + if (label.is_empty()) { + size.height = 0; + } else { + Ref sb = get_theme_stylebox(selected ? SNAME("bg_selected") : SNAME("bg")); + draw_style_box(sb, Rect2(Vector2(), size)); + } Ref bg_stylebox = get_theme_stylebox(SNAME("child_bg")); if (draw_top_bg && right_child_rect != Rect2()) { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index f5fadc2f1b3..0b7375b6ee4 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -818,6 +818,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool } hb->add_theme_constant_override("separation", 7 * EDSCALE); + // Default value button/property editor. Variant default_value; if (valid_left && !port_left_used) { @@ -2744,6 +2745,8 @@ void VisualShaderEditor::_edit_port_default_input(Object *p_button, int p_node, Variant value = vs_node->get_input_port_default_value(p_port); edited_property_holder->set_edited_property(value); + editing_node = p_node; + editing_port = p_port; if (property_editor) { property_editor->disconnect("property_changed", callable_mp(this, &VisualShaderEditor::_port_edited)); @@ -2751,29 +2754,49 @@ void VisualShaderEditor::_edit_port_default_input(Object *p_button, int p_node, } // TODO: Define these properties with actual PropertyInfo and feed it to the property editor widget. - property_editor = EditorInspector::instantiate_property_editor(edited_property_holder.ptr(), value.get_type(), "edited_property", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE); - if (property_editor) { - property_editor->set_object_and_property(edited_property_holder.ptr(), "edited_property"); - property_editor->update_property(); - property_editor->set_name_split_ratio(0); - property_editor_popup->add_child(property_editor); + property_editor = EditorInspector::instantiate_property_editor(edited_property_holder.ptr(), value.get_type(), "edited_property", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE, true); + ERR_FAIL_NULL_MSG(property_editor, "Failed to create property editor for type: " + Variant::get_type_name(value.get_type())); - property_editor->connect("property_changed", callable_mp(this, &VisualShaderEditor::_port_edited)); - - Button *button = Object::cast_to