diff --git a/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.gd b/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.gd index 260d4d4..460d918 100644 --- a/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.gd +++ b/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.gd @@ -1,14 +1,22 @@ tool extends Control -onready var label_output = $MarginContainer/VBoxContainer/Output +onready var label_output = $"%Output" +var base_theme: Theme # passed from the EditorPlugin +onready var tab_parent_bottom_panel: PanelContainer + + +func _ready() -> void: + tab_parent_bottom_panel = get_parent().get_parent() as PanelContainer + if base_theme: + $TabContainer.add_stylebox_override("panel", base_theme.get_stylebox("DebuggerPanel", "EditorStyles")) func _run_command(command: String, is_ui_visible = false): label_output.text = '' - + var output = [] var global_path = ProjectSettings.globalize_path("res://addons/godot-mod-export/ModDevTool.exe") var exit_code = OS.execute(global_path, ['--headless' if !is_ui_visible else '', command], true, output) @@ -26,3 +34,22 @@ func _on_btn_build_pressed(): func _on_btn_ui_pressed(): _run_command("", true) + + +# replicates the behaviour for the debugger tab styles +# for the full setup of this, the TabContainer needs to be the child of a +# full rect Control and have a margin_left of -10 and a margin_right of 10 +# this is to offset the 10px content margins that are still present in the +# BottomPanelDebuggerOverride stylebox for some reason. It's how Godot does it. +func _on_ModToolsDock_visibility_changed() -> void: + if not visible or not base_theme or not tab_parent_bottom_panel: + return + + # the panel style is overridden by godot after this method is called + # make sure our override-override is applied after that + yield(get_tree(), "idle_frame") + + var panel_box: StyleBoxFlat = base_theme.get_stylebox("BottomPanelDebuggerOverride", "EditorStyles") + tab_parent_bottom_panel.add_stylebox_override("panel", panel_box) + + diff --git a/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.tscn b/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.tscn index 35fca14..d32fe74 100644 --- a/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.tscn +++ b/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/dock.tscn @@ -1,63 +1,241 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://addons/godot-mod-export/dock.gd" type="Script" id=1] -[sub_resource type="Gradient" id=1] -interpolation_mode = 1 -colors = PoolColorArray( 0.21875, 0.21875, 0.21875, 1, 1, 1, 1, 1 ) +[sub_resource type="InputEventKey" id=1] +meta = true +command = true +scancode = 67 +unicode = 67 -[sub_resource type="GradientTexture" id=2] -gradient = SubResource( 1 ) +[sub_resource type="ShortCut" id=12] +resource_name = "Copy Selection" +shortcut = SubResource( 1 ) +__meta__ = { +"original": SubResource( 1 ) +} -[node name="Dock" type="Control"] +[sub_resource type="InputEventKey" id=3] +shift = true +meta = true +command = true +scancode = 75 +unicode = 75 + +[sub_resource type="ShortCut" id=13] +resource_name = "Clear Output" +shortcut = SubResource( 3 ) +__meta__ = { +"original": SubResource( 3 ) +} + +[node name="ModToolsDock" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +rect_min_size = Vector2( 0, 400 ) script = ExtResource( 1 ) -[node name="MarginContainer" type="MarginContainer" parent="."] +[node name="TabContainer" type="TabContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -10.0 +margin_right = 10.0 +tab_align = 0 + +[node name="Export" type="PanelContainer" parent="TabContainer"] anchor_right = 1.0 anchor_bottom = 1.0 -custom_constants/margin_right = 15 -custom_constants/margin_top = 15 -custom_constants/margin_left = 15 -custom_constants/margin_bottom = 15 - -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] -margin_left = 15.0 -margin_top = 15.0 -margin_right = 1009.0 -margin_bottom = 585.0 -custom_constants/separation = 10 - -[node name="btn_run_game" type="Button" parent="MarginContainer/VBoxContainer"] -margin_right = 994.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 + +[node name="HSplit" type="HSplitContainer" parent="TabContainer/Export"] +margin_left = 7.0 +margin_top = 7.0 +margin_right = 1925.0 +margin_bottom = 1037.0 + +[node name="Console" type="VBoxContainer" parent="TabContainer/Export/HSplit"] +margin_right = 1272.0 +margin_bottom = 1030.0 +rect_pivot_offset = Vector2( -230, -400 ) +size_flags_horizontal = 3 + +[node name="HBox" type="HBoxContainer" parent="TabContainer/Export/HSplit/Console"] +margin_right = 1272.0 margin_bottom = 20.0 -text = "Run Game" -[node name="btn_build" type="Button" parent="MarginContainer/VBoxContainer"] -margin_top = 30.0 -margin_right = 994.0 -margin_bottom = 50.0 -text = "Only Build" +[node name="Label" type="Label" parent="TabContainer/Export/HSplit/Console/HBox"] +margin_top = 3.0 +margin_right = 1177.0 +margin_bottom = 17.0 +size_flags_horizontal = 3 +text = "Output:" + +[node name="CopyOutput" type="Button" parent="TabContainer/Export/HSplit/Console/HBox"] +unique_name_in_owner = true +margin_left = 1181.0 +margin_right = 1224.0 +margin_bottom = 20.0 +shortcut = SubResource( 12 ) +text = "Copy" + +[node name="ClearOutput" type="Button" parent="TabContainer/Export/HSplit/Console/HBox"] +unique_name_in_owner = true +margin_left = 1228.0 +margin_right = 1272.0 +margin_bottom = 20.0 +shortcut = SubResource( 13 ) +text = "Clear" + +[node name="Output" type="RichTextLabel" parent="TabContainer/Export/HSplit/Console"] +unique_name_in_owner = true +margin_top = 24.0 +margin_right = 1272.0 +margin_bottom = 1030.0 +focus_mode = 2 +size_flags_vertical = 3 +bbcode_enabled = true +scroll_following = true +selection_enabled = true + +[node name="Buttons" type="VBoxContainer" parent="TabContainer/Export/HSplit"] +margin_left = 1284.0 +margin_right = 1918.0 +margin_bottom = 1030.0 +rect_min_size = Vector2( 300, 0 ) +rect_pivot_offset = Vector2( -1685, 180 ) +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.5 + +[node name="Label" type="Label" parent="TabContainer/Export/HSplit/Buttons"] +margin_right = 634.0 +margin_bottom = 14.0 +text = "Export Settings" +align = 1 + +[node name="ScrollContainer" type="ScrollContainer" parent="TabContainer/Export/HSplit/Buttons"] +margin_top = 18.0 +margin_right = 634.0 +margin_bottom = 944.0 +size_flags_vertical = 3 +scroll_horizontal_enabled = false -[node name="btn_ui" type="Button" parent="MarginContainer/VBoxContainer"] -margin_top = 60.0 -margin_right = 994.0 +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer"] +margin_right = 634.0 margin_bottom = 80.0 -text = "Settings UI" +size_flags_horizontal = 3 -[node name="Output" type="Label" parent="MarginContainer/VBoxContainer"] -margin_top = 90.0 -margin_right = 994.0 -margin_bottom = 104.0 +[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer"] +margin_right = 634.0 +margin_bottom = 24.0 +hint_tooltip = "ID of the mod to be exported. +Format: Namespace-ModName +(Often Author-ModName)" -[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/Output"] -show_behind_parent = true +[node name="Label" type="Label" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer/HBoxContainer"] +margin_top = 5.0 +margin_right = 315.0 +margin_bottom = 19.0 +size_flags_horizontal = 3 +text = "Mod ID" +clip_text = true + +[node name="ModId" type="LineEdit" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer/HBoxContainer"] +unique_name_in_owner = true +margin_left = 319.0 +margin_right = 634.0 +margin_bottom = 24.0 +size_flags_horizontal = 3 +placeholder_text = "Author-ModName" + +[node name="HBoxContainer3" type="HBoxContainer" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer"] +margin_top = 28.0 +margin_right = 634.0 +margin_bottom = 52.0 + +[node name="Label" type="Label" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer/HBoxContainer3"] +margin_top = 5.0 +margin_right = 315.0 +margin_bottom = 19.0 +size_flags_horizontal = 3 +text = "Export Path" +clip_text = true + +[node name="ExportPath" type="LineEdit" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer/HBoxContainer3"] +unique_name_in_owner = true +margin_left = 319.0 +margin_right = 634.0 +margin_bottom = 24.0 +size_flags_horizontal = 3 +text = "res://zips" + +[node name="HBoxContainer4" type="HBoxContainer" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer"] +margin_top = 56.0 +margin_right = 634.0 +margin_bottom = 80.0 +hint_tooltip = "Modify the zip before compressing +to follow Thunderstore specifications" + +[node name="Label" type="Label" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer/HBoxContainer4"] +margin_top = 5.0 +margin_right = 315.0 +margin_bottom = 19.0 +size_flags_horizontal = 3 +text = "Thunderstore Export" +clip_text = true + +[node name="CheckBox" type="CheckBox" parent="TabContainer/Export/HSplit/Buttons/ScrollContainer/VBoxContainer/HBoxContainer4"] +margin_left = 319.0 +margin_right = 634.0 +margin_bottom = 24.0 +size_flags_horizontal = 3 +text = "On" + +[node name="PanelContainer" type="PanelContainer" parent="TabContainer/Export/HSplit/Buttons"] +margin_top = 948.0 +margin_right = 634.0 +margin_bottom = 1030.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Export/HSplit/Buttons/PanelContainer"] +margin_left = 7.0 +margin_top = 7.0 +margin_right = 627.0 +margin_bottom = 75.0 + +[node name="ExportRun" type="Button" parent="TabContainer/Export/HSplit/Buttons/PanelContainer/VBoxContainer"] +unique_name_in_owner = true +margin_right = 620.0 +margin_bottom = 20.0 +text = "Export Mod & Run Game" + +[node name="Export" type="Button" parent="TabContainer/Export/HSplit/Buttons/PanelContainer/VBoxContainer"] +unique_name_in_owner = true +margin_top = 24.0 +margin_right = 620.0 +margin_bottom = 44.0 +text = "Export Mod" + +[node name="ModSkeleton" type="Button" parent="TabContainer/Export/HSplit/Buttons/PanelContainer/VBoxContainer"] +unique_name_in_owner = true +margin_top = 48.0 +margin_right = 620.0 +margin_bottom = 68.0 +text = "Generate Mod Skeleton" + +[node name="Mod Manifest" type="PanelContainer" parent="TabContainer"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 -texture = SubResource( 2 ) -expand = true +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 + +[node name="Default Configuration" type="PanelContainer" parent="TabContainer"] +visible = false +margin_right = 40.0 +margin_bottom = 24.0 -[connection signal="pressed" from="MarginContainer/VBoxContainer/btn_run_game" to="." method="_on_btn_run_game_pressed"] -[connection signal="pressed" from="MarginContainer/VBoxContainer/btn_build" to="." method="_on_btn_build_pressed"] -[connection signal="pressed" from="MarginContainer/VBoxContainer/btn_ui" to="." method="_on_btn_ui_pressed"] +[connection signal="visibility_changed" from="." to="." method="_on_ModToolsDock_visibility_changed"] diff --git a/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/plugin.gd b/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/plugin.gd index 9655f51..5a59431 100644 --- a/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/plugin.gd +++ b/godot-mod-export-tool-plugin/godot-3/addons/godot-mod-export/plugin.gd @@ -1,16 +1,18 @@ tool extends EditorPlugin -var dock +var dock: Control + func _enter_tree(): dock = preload("res://addons/godot-mod-export/dock.tscn").instance() - + dock.base_theme = get_editor_interface().get_base_control().theme + add_control_to_bottom_panel(dock, 'Mod Tools') func _exit_tree(): - + remove_control_from_bottom_panel(dock) - + dock.free()