From 42ae6a66dc03f06e3b40eaf7258cac456c189ecd Mon Sep 17 00:00:00 2001 From: LMW Date: Tue, 4 Aug 2026 00:02:22 +0800 Subject: [PATCH] Added button to clear console Added clear console button/icon and updated console icon --- material_maker/console.gd | 4 + material_maker/main_window.gd | 3 + material_maker/main_window.tscn | 39 +++++-- material_maker/theme/classic_base.tres | 16 +++ material_maker/theme/default.tres | 16 +++ material_maker/theme/default_theme_icons.svg | 108 ++++++++++++++++++- 6 files changed, 170 insertions(+), 16 deletions(-) diff --git a/material_maker/console.gd b/material_maker/console.gd index 6339e9f59..f4c1abc33 100644 --- a/material_maker/console.gd +++ b/material_maker/console.gd @@ -48,6 +48,10 @@ func write(l: String, m : String): else: $RichTextLabel.text += l+": "+m+"\n" +func clear() -> void: + $RichTextLabel.text = "" + mm_logger.message("Material Maker " + ProjectSettings.get_setting("application/config/actual_release")) + var generator = null func _on_rich_text_label_meta_clicked(meta): diff --git a/material_maker/main_window.gd b/material_maker/main_window.gd index 4d7f9b658..9972ee48f 100644 --- a/material_maker/main_window.gd +++ b/material_maker/main_window.gd @@ -1378,6 +1378,9 @@ func _notification(what : int) -> void: OS.low_processor_usage_mode_sleep_usec = (1.0 / clamp(mm_globals.get_config("fps_limit"), FPS_LIMIT_MIN, FPS_LIMIT_MAX)) * 1_000_000 NOTIFICATION_WM_ABOUT: about.call_deferred() + NOTIFICATION_THEME_CHANGED: + %ConsoleButton.texture_normal = get_theme_icon("console", "MM_Icons") + %ClearConsoleButton.texture_normal = get_theme_icon("clean", "MM_Icons") func on_close_requested(): await get_tree().process_frame diff --git a/material_maker/main_window.tscn b/material_maker/main_window.tscn index 10dc13b8d..ebdc77625 100644 --- a/material_maker/main_window.tscn +++ b/material_maker/main_window.tscn @@ -6,7 +6,6 @@ [ext_resource type="PackedScene" uid="uid://eiq3i53x72m2" path="res://addons/flexible_layout/flexible_layout.tscn" id="6_ygla4"] [ext_resource type="PackedScene" uid="uid://clw8sb0p8webl" path="res://material_maker/windows/add_node_popup/add_node_popup.tscn" id="7"] [ext_resource type="PackedScene" uid="uid://bnqq3vhwmudkw" path="res://material_maker/projects_panel.tscn" id="7_ih0ps"] -[ext_resource type="Texture2D" uid="uid://c0j4px4n72di5" path="res://material_maker/icons/icons.tres" id="8"] [ext_resource type="Script" uid="uid://bqwu78me3ek4o" path="res://material_maker/console.gd" id="8_1tb00"] [ext_resource type="Script" uid="uid://dhl8skl6fiyrn" path="res://material_maker/node_factory.gd" id="9"] [ext_resource type="PackedScene" uid="uid://cp2mbbfmrv6sf" path="res://material_maker/widgets/render_counter/render_counter.tscn" id="11"] @@ -66,11 +65,6 @@ _data = { &"show": SubResource("7") } -[sub_resource type="AtlasTexture" id="8"] -atlas = ExtResource("8") -region = Rect2(96, 128, 16, 16) -filter_clip = true - [sub_resource type="GDScript" id="9"] script/source = "extends HBoxContainer @@ -100,6 +94,10 @@ func _on_Timer_timeout(): tooltip_text = hint " +[sub_resource type="AtlasTexture" id="8"] +region = Rect2(112, 48, 16, 16) +filter_clip = true + [node name="MainWindow" type="PanelContainer" unique_id=1814280558 groups=["preview"]] anchors_preset = 15 anchor_right = 1.0 @@ -227,7 +225,7 @@ scroll_active = false [node name="UndoRedoLabel" type="Label" parent="VBoxContainer/StatusBar/HBox" unique_id=984075942] unique_name_in_owner = true -modulate = Color(1, 1, 1, 0) +visible = false layout_mode = 2 size_flags_horizontal = 4 text = "Undo/Redo action added" @@ -236,12 +234,30 @@ script = SubResource("6") [node name="AnimationPlayer" type="AnimationPlayer" parent="VBoxContainer/StatusBar/HBox/UndoRedoLabel" unique_id=955898904] libraries/ = SubResource("AnimationLibrary_kxf7t") -[node name="ConsoleButton" type="TextureButton" parent="VBoxContainer/StatusBar/HBox" unique_id=1288312618] +[node name="ConsoleControls" type="HBoxContainer" parent="VBoxContainer/StatusBar/HBox" unique_id=365066398] layout_mode = 2 -size_flags_horizontal = 4 +alignment = 2 + +[node name="ClearConsoleButton" type="TextureButton" parent="VBoxContainer/StatusBar/HBox/ConsoleControls" unique_id=416342385] +unique_name_in_owner = true +modulate = Color(1, 1, 1, 0.49803922) +custom_minimum_size = Vector2(20, 20) +custom_maximum_size = Vector2(20, 20) +layout_mode = 2 +size_flags_vertical = 4 +tooltip_text = "Clear console" +stretch_mode = 0 + +[node name="ConsoleButton" type="TextureButton" parent="VBoxContainer/StatusBar/HBox/ConsoleControls" unique_id=1288312618] +unique_name_in_owner = true +modulate = Color(1, 1, 1, 0.49803922) +custom_minimum_size = Vector2(20, 20) +custom_maximum_size = Vector2(20, 20) +layout_mode = 2 +size_flags_horizontal = 10 size_flags_vertical = 4 tooltip_text = "Show console" -texture_normal = SubResource("8") +stretch_mode = 0 [node name="VSeparator1" type="VSeparator" parent="VBoxContainer/StatusBar/HBox" unique_id=398470012] layout_mode = 2 @@ -293,5 +309,6 @@ visible = false [connection signal="meta_hover_ended" from="VBoxContainer/Console/RichTextLabel" to="VBoxContainer/Console" method="_on_rich_text_label_meta_hover_ended"] [connection signal="meta_hover_started" from="VBoxContainer/Console/RichTextLabel" to="VBoxContainer/Console" method="_on_rich_text_label_meta_hover_started"] [connection signal="timeout" from="VBoxContainer/StatusBar/HBox/Tip/Timer" to="." method="_on_Tip_Timer_timeout"] -[connection signal="pressed" from="VBoxContainer/StatusBar/HBox/ConsoleButton" to="VBoxContainer/Console" method="toggle"] +[connection signal="pressed" from="VBoxContainer/StatusBar/HBox/ConsoleControls/ClearConsoleButton" to="VBoxContainer/Console" method="clear"] +[connection signal="pressed" from="VBoxContainer/StatusBar/HBox/ConsoleControls/ConsoleButton" to="VBoxContainer/Console" method="toggle"] [connection signal="timeout" from="VBoxContainer/StatusBar/HBox/ClipBoardAnalyzer/Timer" to="VBoxContainer/StatusBar/HBox/ClipBoardAnalyzer" method="_on_Timer_timeout"] diff --git a/material_maker/theme/classic_base.tres b/material_maker/theme/classic_base.tres index 846f33cf3..574500770 100644 --- a/material_maker/theme/classic_base.tres +++ b/material_maker/theme/classic_base.tres @@ -436,10 +436,24 @@ atlas = ExtResource("1_fw8f4") region = Rect2(112, 224, 16, 16) metadata/scale = 2.0 +[sub_resource type="AtlasTexture" id="AtlasTexture_rgi6n"] +atlas = ExtResource("1_fw8f4") +region = Rect2(32, 240, 16, 16) +filter_clip = true +metadata/scale = 2.0 +metadata/recolor = true + [sub_resource type="AtlasTexture" id="AtlasTexture_7ns35"] atlas = ExtResource("1_fw8f4") region = Rect2(64, 160, 16, 16) +[sub_resource type="AtlasTexture" id="AtlasTexture_0v3cv"] +atlas = ExtResource("1_fw8f4") +region = Rect2(112, 48, 16, 16) +filter_clip = true +metadata/scale = 2.0 +metadata/recolor = true + [sub_resource type="AtlasTexture" id="AtlasTexture_agwde"] atlas = ExtResource("1_fw8f4") region = Rect2(32, 16, 16, 16) @@ -1186,7 +1200,9 @@ MM_Icons/icons/arrow_right = SubResource("AtlasTexture_r3xak") MM_Icons/icons/arrow_updown = SubResource("AtlasTexture_dnklm") MM_Icons/icons/category_ascending = SubResource("AtlasTexture_50kh2") MM_Icons/icons/category_descending = SubResource("AtlasTexture_ivx1c") +MM_Icons/icons/clean = SubResource("AtlasTexture_rgi6n") MM_Icons/icons/color_picker = SubResource("AtlasTexture_7ns35") +MM_Icons/icons/console = SubResource("AtlasTexture_0v3cv") MM_Icons/icons/delete = SubResource("AtlasTexture_agwde") MM_Icons/icons/draw = SubResource("AtlasTexture_oy0ko") MM_Icons/icons/dropdown = SubResource("AtlasTexture_2gawd") diff --git a/material_maker/theme/default.tres b/material_maker/theme/default.tres index dd8b6e67b..50426b8c5 100644 --- a/material_maker/theme/default.tres +++ b/material_maker/theme/default.tres @@ -485,6 +485,13 @@ atlas = ExtResource("1_s43fy") region = Rect2(112, 224, 16, 16) metadata/scale = 2.0 +[sub_resource type="AtlasTexture" id="AtlasTexture_888jp"] +atlas = ExtResource("1_s43fy") +region = Rect2(32, 240, 16, 16) +filter_clip = true +metadata/scale = 2.0 +metadata/recolor = true + [sub_resource type="AtlasTexture" id="AtlasTexture_j13i3"] atlas = ExtResource("1_s43fy") region = Rect2(64, 160, 16, 16) @@ -509,6 +516,13 @@ region = Rect2(32, 192, 16, 16) atlas = ExtResource("1_s43fy") region = Rect2(64, 192, 16, 16) +[sub_resource type="AtlasTexture" id="AtlasTexture_npn74"] +atlas = ExtResource("1_s43fy") +region = Rect2(112, 48, 16, 16) +filter_clip = true +metadata/scale = 2.0 +metadata/recolor = true + [sub_resource type="AtlasTexture" id="AtlasTexture_agwde"] atlas = ExtResource("1_s43fy") region = Rect2(32, 16, 16, 16) @@ -1402,12 +1416,14 @@ MM_Icons/icons/arrow_updown = SubResource("AtlasTexture_ovvp6") MM_Icons/icons/camera = SubResource("AtlasTexture_cscp3") MM_Icons/icons/category_ascending = SubResource("AtlasTexture_ha0qk") MM_Icons/icons/category_descending = SubResource("AtlasTexture_4tel2") +MM_Icons/icons/clean = SubResource("AtlasTexture_888jp") MM_Icons/icons/color_picker = SubResource("AtlasTexture_j13i3") MM_Icons/icons/connection_bezier = SubResource("AtlasTexture_rqjp3") MM_Icons/icons/connection_diagonal = SubResource("AtlasTexture_8tn7x") MM_Icons/icons/connection_direct = SubResource("AtlasTexture_pfiqs") MM_Icons/icons/connection_manhattan = SubResource("AtlasTexture_pfsii") MM_Icons/icons/connection_rounded = SubResource("AtlasTexture_1lfk8") +MM_Icons/icons/console = SubResource("AtlasTexture_npn74") MM_Icons/icons/delete = SubResource("AtlasTexture_agwde") MM_Icons/icons/draw = SubResource("AtlasTexture_oy0ko") MM_Icons/icons/dropdown = SubResource("AtlasTexture_2gawd") diff --git a/material_maker/theme/default_theme_icons.svg b/material_maker/theme/default_theme_icons.svg index cc03157af..5850c0d97 100644 --- a/material_maker/theme/default_theme_icons.svg +++ b/material_maker/theme/default_theme_icons.svg @@ -28,9 +28,9 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="true" - inkscape:zoom="16.000001" - inkscape:cx="18.624999" - inkscape:cy="246.87499" + inkscape:zoom="32" + inkscape:cx="39.375" + inkscape:cy="246.04687" inkscape:window-width="1152" inkscape:window-height="981" inkscape:window-x="0" @@ -76,6 +76,86 @@ margin="0" bleed="0" />