Skip to content

Commit

Permalink
additional cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Snaiel committed Jun 26, 2024
1 parent b49ea1d commit 4d995a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
24 changes: 21 additions & 3 deletions addons/beehave/debug/new_frames.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ func _init() -> void:
return


titlebar_normal = plugin.get_editor_interface().get_base_control().get_theme_stylebox(&"titlebar", &"GraphNode").duplicate()
titlebar_normal = (
plugin
.get_editor_interface()
.get_base_control()
.get_theme_stylebox(&"titlebar", &"GraphNode")\
.duplicate()
)
titlebar_success = titlebar_normal.duplicate()
titlebar_failure = titlebar_normal.duplicate()
titlebar_running = titlebar_normal.duplicate()
Expand All @@ -41,8 +47,20 @@ func _init() -> void:
titlebar_running.border_color = RUNNING_COLOR


panel_normal = plugin.get_editor_interface().get_base_control().get_theme_stylebox(&"panel", &"GraphNode").duplicate()
panel_success = plugin.get_editor_interface().get_base_control().get_theme_stylebox(&"panel_selected", &"GraphNode").duplicate()
panel_normal = (
plugin
.get_editor_interface()
.get_base_control()
.get_theme_stylebox(&"panel", &"GraphNode")
.duplicate()
)
panel_success = (
plugin
.get_editor_interface()
.get_base_control()
.get_theme_stylebox(&"panel_selected", &"GraphNode")
.duplicate()
)
panel_failure = panel_success.duplicate()
panel_running = panel_success.duplicate()

Expand Down
19 changes: 7 additions & 12 deletions addons/beehave/debug/new_graph_node.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ extends GraphNode

const BeehaveUtils := preload("res://addons/beehave/utils/utils.gd")


const DEFAULT_COLOR := Color("#dad4cb")

const PORT_TOP_ICON := preload("icons/port_top.svg")
const PORT_BOTTOM_ICON := preload("icons/port_bottom.svg")
const PORT_LEFT_ICON := preload("icons/port_left.svg")
Expand Down Expand Up @@ -36,10 +33,8 @@ var layout_size: float:
return size.y if horizontal else size.x


var panel: PanelContainer
var icon_rect: TextureRect
var title_label: Label
var container: VBoxContainer
var label: Label
var titlebar_hbox: HBoxContainer

Expand All @@ -66,6 +61,11 @@ func _ready() -> void:
icon_rect = TextureRect.new()
icon_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED

titlebar_hbox = get_titlebar_hbox()
titlebar_hbox.remove_child(titlebar_hbox.get_child(0))
titlebar_hbox.alignment = BoxContainer.ALIGNMENT_BEGIN
titlebar_hbox.add_child(icon_rect)

title_label = Label.new()
title_label.add_theme_color_override("font_color", Color.WHITE)
var title_font: FontVariation = get_theme_font("title_font").duplicate()
Expand All @@ -74,19 +74,14 @@ func _ready() -> void:
title_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
title_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
title_label.text = title_text
titlebar_hbox.add_child(title_label)

label = Label.new()
label.text = " " if text.is_empty() else text
add_child(label)

# For bottom port
add_child(Control.new())

titlebar_hbox = get_titlebar_hbox()
titlebar_hbox.remove_child(titlebar_hbox.get_child(0))
titlebar_hbox.alignment = BoxContainer.ALIGNMENT_BEGIN
titlebar_hbox.add_child(icon_rect)
titlebar_hbox.add_child(title_label)

minimum_size_changed.connect(_on_size_changed)
_on_size_changed.call_deferred()
Expand Down Expand Up @@ -154,4 +149,4 @@ func _set_stylebox_overrides(panel_stylebox: StyleBox, titlebar_stylebox: StyleB


func _on_size_changed():
add_theme_constant_override("port_offset", 12 * BeehaveUtils.get_editor_scale() if horizontal else round(size.x / 1.0))
add_theme_constant_override("port_offset", 12 * BeehaveUtils.get_editor_scale() if horizontal else round(size.x))

0 comments on commit 4d995a8

Please sign in to comment.