Skip to content

Commit

Permalink
Added wireframe toggle for main viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
kb173 committed Jun 12, 2019
1 parent 98b51b3 commit 0ace7f9
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 24 deletions.
3 changes: 3 additions & 0 deletions Global/GlobalSignal.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ signal changed_asset_id(json_item_id)
signal debug_enable
signal debug_disable

# enable and disable wireframe drawing
signal wireframe_toggle

# enable and disable vr mode
signal vr_enable
signal vr_disable
Expand Down
8 changes: 5 additions & 3 deletions Perspectives/PerspectiveHandler.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://UI/MainUI.tscn" type="PackedScene" id=1]
[ext_resource path="res://UI/MiniView/MiniView.tscn" type="PackedScene" id=2]
[ext_resource path="res://Perspectives/WireframeSupportingViewport.gd" type="Script" id=2]
[ext_resource path="res://UI/MiniView/MiniView.tscn" type="PackedScene" id=3]

[sub_resource type="GDScript" id=1]
script/source = "extends Node
Expand Down Expand Up @@ -190,6 +191,7 @@ size = Vector2( 1920, 1080 )
handle_input_locally = false
render_target_update_mode = 3
shadow_atlas_size = 64
script = ExtResource( 2 )
[node name="UIMargin" type="MarginContainer" parent="."]
anchor_right = 1.0
Expand All @@ -200,7 +202,7 @@ margin_right = -10.0
margin_bottom = -10.0
mouse_filter = 2
[node name="MiniView" parent="UIMargin" instance=ExtResource( 2 )]
[node name="MiniView" parent="UIMargin" instance=ExtResource( 3 )]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
Expand Down
44 changes: 28 additions & 16 deletions UI/DebugInfo/DebugInfo.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://UI/DebugInfo/DebugInfo.gd" type="Script" id=1]
[ext_resource path="res://UI/DebugInfo/PositionDisplay.gd" type="Script" id=2]
[ext_resource path="res://UI/DebugInfo/WireframeToggle.gd" type="Script" id=3]

[sub_resource type="Theme" id=1]

Expand All @@ -12,7 +13,7 @@ script = ExtResource( 1 )

[node name="DebugPanel" type="Panel" parent="."]
margin_right = 1920.0
margin_bottom = 1056.0
margin_bottom = 998.0
rect_min_size = Vector2( 200, 500 )
size_flags_horizontal = 3
size_flags_vertical = 3
Expand All @@ -24,9 +25,9 @@ anchor_bottom = 1.0
scroll_following = true

[node name="LogLevelInfo" type="HBoxContainer" parent="."]
margin_top = 1060.0
margin_top = 1002.0
margin_right = 1920.0
margin_bottom = 1076.0
margin_bottom = 1018.0

[node name="Label" type="Label" parent="LogLevelInfo"]
margin_top = 1.0
Expand All @@ -42,24 +43,35 @@ size_flags_horizontal = 3
max_value = 4.0
ticks_on_borders = true

[node name="PositionDisplay" type="Control" parent="."]
margin_top = 1080.0
[node name="PositionDisplay" type="HBoxContainer" parent="."]
margin_top = 1022.0
margin_right = 1920.0
margin_bottom = 1080.0
margin_bottom = 1036.0
script = ExtResource( 2 )

[node name="HBoxContainer" type="HBoxContainer" parent="PositionDisplay"]
margin_right = 40.0
margin_bottom = 40.0

[node name="Name" type="Label" parent="PositionDisplay/HBoxContainer"]
margin_top = 13.0
[node name="Name" type="Label" parent="PositionDisplay"]
margin_right = 60.0
margin_bottom = 27.0
margin_bottom = 14.0
text = "Position: "

[node name="Data" type="Label" parent="PositionDisplay/HBoxContainer"]
[node name="Data" type="Label" parent="PositionDisplay"]
margin_left = 64.0
margin_top = 13.0
margin_right = 64.0
margin_bottom = 14.0

[node name="WireframeToggle" type="HBoxContainer" parent="."]
margin_top = 1040.0
margin_right = 1920.0
margin_bottom = 1080.0
script = ExtResource( 3 )

[node name="Name" type="Label" parent="WireframeToggle"]
margin_top = 13.0
margin_right = 78.0
margin_bottom = 27.0
text = "Wireframes:"

[node name="CheckButton" type="CheckButton" parent="WireframeToggle"]
margin_left = 82.0
margin_right = 158.0
margin_bottom = 40.0
4 changes: 2 additions & 2 deletions UI/DebugInfo/PositionDisplay.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends Control
extends HBoxContainer

onready var label = get_node("HBoxContainer/Data")
onready var label = get_node("Data")


func _process(delta: float) -> void:
Expand Down
16 changes: 16 additions & 0 deletions UI/DebugInfo/WireframeToggle.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extends HBoxContainer

#
# UI element with a toggle which activates or deactivates wireframe mode.
#


onready var toggle = get_node("CheckButton")


func _ready() -> void:
toggle.connect("toggled", self, "_on_toggled")


func _on_toggled(button_pressed):
GlobalSignal.emit_signal("wireframe_toggle", button_pressed)
6 changes: 3 additions & 3 deletions UI/MainUI.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ alignment = 1

[node name="HBoxLeft" type="HBoxContainer" parent="Top Menu Bar"]
margin_right = 272.0
margin_bottom = 586.0
margin_bottom = 644.0
size_flags_horizontal = 0
size_flags_vertical = 0

[node name="VBox" type="VBoxContainer" parent="Top Menu Bar/HBoxLeft"]
margin_right = 272.0
margin_bottom = 586.0
margin_bottom = 644.0
size_flags_horizontal = 0
size_flags_vertical = 0

Expand Down Expand Up @@ -100,7 +100,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 62.0
margin_right = 272.0
margin_bottom = 586.0
margin_bottom = 644.0

[node name="HBoxCenter" type="HBoxContainer" parent="Top Menu Bar"]
margin_left = 276.0
Expand Down

0 comments on commit 0ace7f9

Please sign in to comment.