From 2d6ad58c1d7a6c3c6ce4f836d94d0b7c4f7ff93f Mon Sep 17 00:00:00 2001 From: MacDugRPG <57243055+MacDugRPG@users.noreply.github.com> Date: Sun, 11 Jun 2023 13:28:29 -0400 Subject: [PATCH] Experimental Code Updated For Color Adds color codes for the ColorRect selection using the recommended depth system. --- .../location_userEnteredName/config.txt | 1 + .../region_userEnteredName/config.txt | 1 + .../project.godot | 2 +- .../AssetsContainer.gd | 25 ++++++++++++++++--- .../PanelCanvas_Temp.gd | 24 +++++++++++++++++- .../draggable_assets.tscn | 5 ++-- .../draggable_assets_final.gd | 3 +++ .../tabbed_merged_test_interface.tscn | 5 ++++ 8 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/location_userEnteredName/config.txt create mode 100644 Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/region_userEnteredName/config.txt diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/location_userEnteredName/config.txt b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/location_userEnteredName/config.txt new file mode 100644 index 0000000..02c4af3 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/location_userEnteredName/config.txt @@ -0,0 +1 @@ +Temp Config File diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/region_userEnteredName/config.txt b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/region_userEnteredName/config.txt new file mode 100644 index 0000000..02c4af3 --- /dev/null +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/_temp_places/region_userEnteredName/config.txt @@ -0,0 +1 @@ +Temp Config File diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/project.godot b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/project.godot index 6bd7cef..0ba5b07 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/project.godot +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/project.godot @@ -27,7 +27,7 @@ _global_script_class_icons={ [application] config/name="Experiment_Location_Folders" -run/main_scene="res://toolset_test/drag_and_drop_demo_final.tscn" +run/main_scene="res://toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn" config/icon="res://icon.png" [gui] diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/AssetsContainer.gd b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/AssetsContainer.gd index 726e1a2..4d6244d 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/AssetsContainer.gd +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/AssetsContainer.gd @@ -6,10 +6,10 @@ onready var draggable_assets_scene: PackedScene = preload("res://toolset_test_ta onready var draggable_assets_container = $Padding/AssetsRows var dragables = [ - {"id": 1, "label": "region"}, - {"id": 2, "label": "location"}, - {"id": 3, "label": "space"}, - {"id": 4, "label": "scene"}, + {"id": 1, "label": "region", "color": "red"}, + {"id": 2, "label": "location", "color": "orange"}, + {"id": 3, "label": "space", "color": "yellow"}, + {"id": 4, "label": "scene", "color": "green"}, ] @@ -22,6 +22,7 @@ func _populate_dragables(): var drag_item = draggable_assets_scene.instance() drag_item.id = dragable["id"] drag_item.label = dragable["label"] + drag_item.color = _set_color_from_text(dragable["color"]) draggable_assets_container.add_child(drag_item) func _on_item_dropped_on_target(dropped_item: Draggable_Assets) -> void: @@ -31,3 +32,19 @@ func _on_item_dropped_on_target(dropped_item: Draggable_Assets) -> void: #draggable_container.remove_child(drag_item) #drag_item.queue_free() break + +#DKM TEMP: for refactoring, this should live elsewhere, but as we get this up. +func _set_color_from_text(colorTerm: String) -> Color: + var end_color = Color8(0,0,0) + match(colorTerm): + "red": + end_color = Color8(255,0,0) + "orange": + end_color = Color8(255,102,0) + "yellow": + end_color = Color8(255,255,0) + "green": + end_color = Color8(0,102,0) + "blue": + end_color = Color8(0,0,255) + return end_color diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/PanelCanvas_Temp.gd b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/PanelCanvas_Temp.gd index ee54fcd..3dc0625 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/PanelCanvas_Temp.gd +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/PanelCanvas_Temp.gd @@ -7,6 +7,12 @@ var draggable_assets: PackedScene = preload("res://toolset_test_tabbed_merged/dr func can_drop_data(position: Vector2, data) -> bool: var can_drop: bool = data is Node and data.is_in_group("DRAGGABLE_ASSETS") print("[TargetContainer] can_drop_data has run, returning %s" % can_drop) + #DKM TEMP: + if(!can_drop): + var temp_bool: bool = data is Node + print("Is node? %s" % temp_bool) + temp_bool = data.is_in_group("DRAGGABLE_ASSETS") + print("Is in group DRAGGABLE_ASSETS? %s" % temp_bool) return can_drop func drop_data(position: Vector2, data) -> void: @@ -19,7 +25,23 @@ func drop_data(position: Vector2, data) -> void: draggable_copy.id = data.id #Instantiate a new version of the specific item in this content capsule draggable_copy.label = data.label + draggable_copy.color = data.color draggable_copy.dropped_on_target = true # disable further dragging - $Padding/Rows.add_child(draggable_copy) + + #DKM TEMP: create directory + var directory = Directory.new() + #DKM TEMP: this is ridiculously unchecked -- need to verify this, etc: + var directoryPath = "res://_temp_places/%s_userEnteredName" % data.label + directory.make_dir(directoryPath) + var file = File.new() + var configFilePath = directoryPath + "/config.txt" + file.open(configFilePath, File.WRITE) + file.store_line("Temp Config File") + file.close() + + #DKM TEMP: Add to the visual display (for now). Instead of this, we want to + # read the directories that are there for our UI. We can then still use + # something like a ColorRect, but it should come from that. + $Rows.add_child(draggable_copy) emit_signal("item_dropped_on_target", data) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets.tscn b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets.tscn index a8f07e6..1367779 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets.tscn +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://Cabin-VariableFont_wdth,wght.ttf" type="DynamicFontData" id=1] -[ext_resource path="res://toolset_test/draggable_final.gd" type="Script" id=2] +[ext_resource path="res://toolset_test_tabbed_merged/draggable_assets_final.gd" type="Script" id=2] [sub_resource type="DynamicFont" id=6] size = 24 @@ -11,10 +11,11 @@ font_data = ExtResource( 1 ) margin_right = 150.0 margin_bottom = 35.0 rect_min_size = Vector2( 150, 35 ) -color = Color( 0.752941, 0.305882, 0.305882, 1 ) +color = Color( 1, 0, 0, 1 ) script = ExtResource( 2 ) [node name="Label" type="Label" parent="."] +modulate = Color( 0, 0, 0, 1 ) anchor_right = 1.0 anchor_bottom = 1.0 custom_fonts/font = SubResource( 6 ) diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets_final.gd b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets_final.gd index 2630041..6ec7d1e 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets_final.gd +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/draggable_assets_final.gd @@ -37,6 +37,9 @@ func _get_preview_control() -> Control: preview.rect_size = rect_size var preview_color = color preview_color.a = .5 + #DKM TEMP: + var testColor = Color8(125,125,125) + preview_color = testColor preview.color = preview_color preview.set_rotation(.1) # in readians return preview diff --git a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn index 39d4be1..8c3c756 100644 --- a/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn +++ b/Phase2/Godot_Toolset/CodeSandboxes/Experiment_Location_Folders_2023_0430/toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn @@ -143,6 +143,7 @@ margin_right = -4.0 margin_bottom = -4.0 [node name="Structural_Tab" type="Tabs" parent="VLayout/HBoxContainer/TabContainer"] +visible = false margin_right = 40.0 margin_bottom = 24.0 @@ -159,6 +160,10 @@ margin_right = 643.0 margin_bottom = 525.0 script = ExtResource( 4 ) +[node name="Rows" type="VBoxContainer" parent="VLayout/HBoxContainer/TabContainer/Structural_Tab/PanelCanvas_Temp"] +margin_right = 40.0 +margin_bottom = 40.0 + [node name="DetailsContainer" type="Panel" parent="VLayout/HBoxContainer"] margin_left = 833.0 margin_right = 1008.0