From bfc30b874dd8c5f7a1f8856226fc83820693887f Mon Sep 17 00:00:00 2001 From: leogeier Date: Thu, 24 Aug 2023 15:12:08 +0200 Subject: [PATCH] :) --- addons/pronto/behaviors/ValueBehavior.gd | 28 +++-- addons/pronto/behaviors/WatchBehavior.gd | 2 +- addons/pronto/helpers/G.gd | 2 +- .../signal_connecting/expression_edit.tscn | 111 +++++++++--------- .../node_to_node_configurator.gd | 3 +- .../node_to_node_configurator.tscn | 13 +- project.godot | 3 +- 7 files changed, 86 insertions(+), 76 deletions(-) diff --git a/addons/pronto/behaviors/ValueBehavior.gd b/addons/pronto/behaviors/ValueBehavior.gd index 3c6488ca..c31ebc93 100644 --- a/addons/pronto/behaviors/ValueBehavior.gd +++ b/addons/pronto/behaviors/ValueBehavior.gd @@ -166,7 +166,7 @@ func _draw(): var font := ThemeDB.fallback_font var text_size = 4 draw_string(font, - Vector2(font.get_string_size(str, HORIZONTAL_ALIGNMENT_CENTER, -1, text_size).x / -2, 12), + Vector2(font.get_string_size(str, HORIZONTAL_ALIGNMENT_CENTER, -1, text_size).x / -2, 22), str, HORIZONTAL_ALIGNMENT_CENTER, -1, @@ -197,23 +197,29 @@ class DropPropertyPrompt extends ColorRect: # the prompt is only displayed if we have a drag operation with a valid object return true + func empty_script(a: Array, expr: String, return_value: bool): + var script := ConnectionScript.new(a, return_value, expr) + return script + func _drop_data(at_position, data): var root = editor_interface.get_edited_scene_root() var current = data["object"].get(data["property"]) var v = ValueBehavior.new() - v.from = min(0.0, current) - v.to = max(1.0, current) - v.value = current + v.float_from = min(0.0, current) + v.float_to = max(1.0, current) + v.float_value = current v.name = data["property"] v.position = Vector2(50, 50) data["object"].add_child(v) v.owner = root - var b = BindBehavior.new() - b.to_prop = data["property"] - b.name = "bind_" + b.to_prop - b.position = Vector2(100, 50) - b.convert = "G.at('{0}')".format([data["property"]]) - data["object"].add_child(b) - b.owner = root + Connection.connect_target(v, "value_changed", "..", "set", [empty_script(["value"], "\"%s\"" % [data["property"]], true), empty_script(["value"], "value", true)], [], empty_script(["value"], "true", true)) + +# var b = BindBehavior.new() +# b.to_prop = data["property"] +# b.name = "bind_" + b.to_prop +# b.position = Vector2(100, 50) +# b.convert = "G.at('{0}')".format([data["property"]]) +# data["object"].add_child(b) +# b.owner = root diff --git a/addons/pronto/behaviors/WatchBehavior.gd b/addons/pronto/behaviors/WatchBehavior.gd index 1c641ffe..527b56fa 100644 --- a/addons/pronto/behaviors/WatchBehavior.gd +++ b/addons/pronto/behaviors/WatchBehavior.gd @@ -20,7 +20,7 @@ func _ready(): func _process(delta): super._process(delta) if not Engine.is_editor_hint(): - var val = str(evaluate.run([], self)) + var val = str(await evaluate.run([], self)) if _last != val: if EngineDebugger.is_active(): EngineDebugger.send_message("pronto:watch_put", [get_path(), val]) _last = val diff --git a/addons/pronto/helpers/G.gd b/addons/pronto/helpers/G.gd index 713ec9ca..88a0ebfb 100644 --- a/addons/pronto/helpers/G.gd +++ b/addons/pronto/helpers/G.gd @@ -51,7 +51,7 @@ func maybe_add_value_user_interface(): return var panel = PanelContainer.new() - panel.size = Vector2(200, 200) + panel.size = Vector2(300, 200) var ui = PrototypingUIBehavior.new() ui.name = 'Config' panel.add_child(ui) diff --git a/addons/pronto/signal_connecting/expression_edit.tscn b/addons/pronto/signal_connecting/expression_edit.tscn index 9688a0a0..dd27ce6e 100644 --- a/addons/pronto/signal_connecting/expression_edit.tscn +++ b/addons/pronto/signal_connecting/expression_edit.tscn @@ -13,58 +13,58 @@ name = "RotateLeft" [sub_resource type="SystemFont" id="SystemFont_xd5ge"] font_names = PackedStringArray("Monospace") -[sub_resource type="CodeHighlighter" id="CodeHighlighter_we5wh"] -number_color = Color(0, 0.55, 0.28, 1) -symbol_color = Color(0, 0, 0.61, 1) -function_color = Color(0, 0.225, 0.9, 1) -member_variable_color = Color(0, 0.4, 0.68, 1) +[sub_resource type="CodeHighlighter" id="CodeHighlighter_86c27"] +number_color = Color(0.63, 1, 0.88, 1) +symbol_color = Color(0.67, 0.79, 1, 1) +function_color = Color(0.34, 0.7, 1, 1) +member_variable_color = Color(0.736, 0.88, 1, 1) keyword_colors = { -"INF": Color(0.9, 0.135, 0.51, 1), -"NAN": Color(0.9, 0.135, 0.51, 1), -"PI": Color(0.9, 0.135, 0.51, 1), -"TAU": Color(0.9, 0.135, 0.51, 1), -"and": Color(0.9, 0.135, 0.51, 1), -"as": Color(0.9, 0.135, 0.51, 1), -"assert": Color(0.9, 0.135, 0.51, 1), -"await": Color(0.9, 0.135, 0.51, 1), -"bool": Color(0.9, 0.135, 0.51, 1), -"break": Color(0.9, 0.135, 0.51, 1), -"breakpoint": Color(0.9, 0.135, 0.51, 1), -"class": Color(0.9, 0.135, 0.51, 1), -"class_name": Color(0.9, 0.135, 0.51, 1), -"const": Color(0.9, 0.135, 0.51, 1), -"continue": Color(0.9, 0.135, 0.51, 1), -"elif": Color(0.9, 0.135, 0.51, 1), -"else": Color(0.9, 0.135, 0.51, 1), -"enum": Color(0.9, 0.135, 0.51, 1), -"extends": Color(0.9, 0.135, 0.51, 1), -"false": Color(0.9, 0.135, 0.51, 1), -"float": Color(0.9, 0.135, 0.51, 1), -"for": Color(0.9, 0.135, 0.51, 1), -"func": Color(0.9, 0.135, 0.51, 1), -"if": Color(0.9, 0.135, 0.51, 1), -"in": Color(0.9, 0.135, 0.51, 1), -"int": Color(0.9, 0.135, 0.51, 1), -"is": Color(0.9, 0.135, 0.51, 1), -"match": Color(0.9, 0.135, 0.51, 1), -"not": Color(0.9, 0.135, 0.51, 1), -"null": Color(0.9, 0.135, 0.51, 1), -"or": Color(0.9, 0.135, 0.51, 1), -"pass": Color(0.9, 0.135, 0.51, 1), -"preload": Color(0.9, 0.135, 0.51, 1), -"return": Color(0.9, 0.135, 0.51, 1), -"self": Color(0.9, 0.135, 0.51, 1), -"signal": Color(0.9, 0.135, 0.51, 1), -"static": Color(0.9, 0.135, 0.51, 1), -"super": Color(0.9, 0.135, 0.51, 1), -"true": Color(0.9, 0.135, 0.51, 1), -"var": Color(0.9, 0.135, 0.51, 1), -"void": Color(0.9, 0.135, 0.51, 1), -"while": Color(0.9, 0.135, 0.51, 1) +"INF": Color(1, 0.44, 0.52, 1), +"NAN": Color(1, 0.44, 0.52, 1), +"PI": Color(1, 0.44, 0.52, 1), +"TAU": Color(1, 0.44, 0.52, 1), +"and": Color(1, 0.44, 0.52, 1), +"as": Color(1, 0.44, 0.52, 1), +"assert": Color(1, 0.44, 0.52, 1), +"await": Color(1, 0.44, 0.52, 1), +"bool": Color(1, 0.44, 0.52, 1), +"break": Color(1, 0.44, 0.52, 1), +"breakpoint": Color(1, 0.44, 0.52, 1), +"class": Color(1, 0.44, 0.52, 1), +"class_name": Color(1, 0.44, 0.52, 1), +"const": Color(1, 0.44, 0.52, 1), +"continue": Color(1, 0.44, 0.52, 1), +"elif": Color(1, 0.44, 0.52, 1), +"else": Color(1, 0.44, 0.52, 1), +"enum": Color(1, 0.44, 0.52, 1), +"extends": Color(1, 0.44, 0.52, 1), +"false": Color(1, 0.44, 0.52, 1), +"float": Color(1, 0.44, 0.52, 1), +"for": Color(1, 0.44, 0.52, 1), +"func": Color(1, 0.44, 0.52, 1), +"if": Color(1, 0.44, 0.52, 1), +"in": Color(1, 0.44, 0.52, 1), +"int": Color(1, 0.44, 0.52, 1), +"is": Color(1, 0.44, 0.52, 1), +"match": Color(1, 0.44, 0.52, 1), +"not": Color(1, 0.44, 0.52, 1), +"null": Color(1, 0.44, 0.52, 1), +"or": Color(1, 0.44, 0.52, 1), +"pass": Color(1, 0.44, 0.52, 1), +"preload": Color(1, 0.44, 0.52, 1), +"return": Color(1, 0.44, 0.52, 1), +"self": Color(1, 0.44, 0.52, 1), +"signal": Color(1, 0.44, 0.52, 1), +"static": Color(1, 0.44, 0.52, 1), +"super": Color(1, 0.44, 0.52, 1), +"true": Color(1, 0.44, 0.52, 1), +"var": Color(1, 0.44, 0.52, 1), +"void": Color(1, 0.44, 0.52, 1), +"while": Color(1, 0.44, 0.52, 1) } color_regions = { -"\"": Color(0.6, 0.42, 0, 1), -"'": Color(0.6, 0.42, 0, 1) +"\" \"": Color(1, 0.93, 0.63, 1), +"' '": Color(1, 0.93, 0.63, 1) } [sub_resource type="Texture2D" id="Texture2D_8ynin"] @@ -80,17 +80,16 @@ script = ExtResource("2_au0w8") name = "NodeWarning" [node name="expression_edit" type="VBoxContainer"] -custom_minimum_size = Vector2(0, 34.0249) -offset_right = 180.0 -offset_bottom = 34.0249 +custom_minimum_size = Vector2(0, 104.701) +offset_right = 500.0 +offset_bottom = 104.701 size_flags_horizontal = 3 theme_override_constants/separation = 0 script = ExtResource("1_lndi8") -expression_label = null placeholder_text = "Expression..." [node name="row" type="HBoxContainer" parent="."] -custom_minimum_size = Vector2(180, 32) +custom_minimum_size = Vector2(500, 60) layout_mode = 2 size_flags_vertical = 3 theme_override_constants/separation = 0 @@ -110,9 +109,8 @@ layout_mode = 2 size_flags_horizontal = 3 theme_override_fonts/font = SubResource("SystemFont_xd5ge") placeholder_text = "Expression..." -wrap_mode = 1 draw_tabs = true -syntax_highlighter = SubResource("CodeHighlighter_we5wh") +syntax_highlighter = SubResource("CodeHighlighter_86c27") code_completion_enabled = true code_completion_prefixes = Array[String]([".", ",", "(", "=", "$", "@", "\"", "'"]) indent_automatic = true @@ -122,6 +120,7 @@ script = ExtResource("2_7vlfx") [node name="OpenFile" type="Button" parent="row"] unique_name_in_owner = true layout_mode = 2 +size_flags_horizontal = 8 size_flags_vertical = 0 tooltip_text = "Open script" icon = SubResource("Texture2D_8ynin") diff --git a/addons/pronto/signal_connecting/node_to_node_configurator.gd b/addons/pronto/signal_connecting/node_to_node_configurator.gd index 937621cc..2f9daf8c 100644 --- a/addons/pronto/signal_connecting/node_to_node_configurator.gd +++ b/addons/pronto/signal_connecting/node_to_node_configurator.gd @@ -52,7 +52,8 @@ var undo_redo: EditorUndoRedoManager var anchor: Node: set(n): anchor = n - reset_size() +# reset_size() + size = custom_minimum_size %FunctionName.anchor = n var from: Node var existing_connection = null diff --git a/addons/pronto/signal_connecting/node_to_node_configurator.tscn b/addons/pronto/signal_connecting/node_to_node_configurator.tscn index fef0d400..4c92172a 100644 --- a/addons/pronto/signal_connecting/node_to_node_configurator.tscn +++ b/addons/pronto/signal_connecting/node_to_node_configurator.tscn @@ -37,8 +37,9 @@ script = ExtResource("2_2ll7t") name = "Remove" [node name="Node To Node Configurator" type="PanelContainer"] -offset_right = 364.0 -offset_bottom = 200.0 +custom_minimum_size = Vector2(2000, 2.08165e-12) +offset_right = 2000.0 +offset_bottom = 363.0 scale = Vector2(1, 1.00268) size_flags_horizontal = 3 size_flags_vertical = 3 @@ -122,13 +123,14 @@ size_flags_horizontal = 3 text = " " [node name="AddReferenceButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_direction = 2 layout_mode = 2 tooltip_text = "Add reference" icon = SubResource("Texture2D_i0w25") [node name="VSeparator" type="Control" parent="MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(20, 2.08165e-12) layout_mode = 2 -size_flags_horizontal = 3 [node name="ChangesNotifier" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer"] unique_name_in_owner = true @@ -175,6 +177,7 @@ text = "(" [node name="Args" type="BoxContainer" parent="MarginContainer/VBoxContainer/Receiver"] unique_name_in_owner = true layout_mode = 2 +size_flags_horizontal = 3 [node name="RightParen" type="Label" parent="MarginContainer/VBoxContainer/Receiver"] layout_mode = 2 @@ -188,7 +191,7 @@ sync_handles_x = true [node name="Expression" parent="MarginContainer/VBoxContainer/ResizableContainer" instance=ExtResource("5_ujudk")] unique_name_in_owner = true -custom_minimum_size = Vector2(0, 34.1782) +custom_minimum_size = Vector2(0, 102.28) layout_mode = 2 size_flags_horizontal = 1 return_value = false @@ -210,7 +213,7 @@ sync_handles_x = true [node name="Condition" parent="MarginContainer/VBoxContainer/HBoxContainer2/ResizableContainer2" instance=ExtResource("5_ujudk")] unique_name_in_owner = true -custom_minimum_size = Vector2(0, 34.8133) +custom_minimum_size = Vector2(0, 104.186) layout_mode = 2 default_text = "true" max_width = 500 diff --git a/project.godot b/project.godot index a7a0c545..085ca75a 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="pronto" -config/features=PackedStringArray("4.1", "Forward Plus") +config/features=PackedStringArray("4.2", "Forward Plus") run/low_processor_mode=true config/icon="res://icon.svg" @@ -23,6 +23,7 @@ LanguageClient="*res://addons/pronto/helpers/LanguageClient.gd" [display] +window/size/mode=2 window/stretch/mode="canvas_items" [editor_plugins]