diff --git a/Scenes/main.tscn b/Scenes/main.tscn index 8b27739..2df3af7 100644 --- a/Scenes/main.tscn +++ b/Scenes/main.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=6 format=3 uid="uid://b4ot3p50x08po"] +[gd_scene load_steps=7 format=3 uid="uid://b4ot3p50x08po"] [ext_resource type="PackedScene" uid="uid://cuqeg7u667dw6" path="res://Blends/Room/room.gltf" id="1_jjgbg"] [ext_resource type="PackedScene" uid="uid://j06vthscroca" path="res://Scenes/bullet.tscn" id="3_8gbba"] [ext_resource type="PackedScene" uid="uid://bge7npb7b1y6x" path="res://Scenes/revolver.tscn" id="4_jjvhh"] [ext_resource type="Script" uid="uid://dcmqt4341kxem" path="res://Scripts/bullet_stack.gd" id="4_kry3j"] [ext_resource type="PackedScene" uid="uid://bueqdw22nl501" path="res://Scenes/AI.tscn" id="5_kry3j"] +[ext_resource type="PackedScene" uid="uid://cbr3e8xsfwyhf" path="res://Scenes/main_game_ui.tscn" id="6_21xkr"] [node name="Node3D" type="Node3D"] @@ -26,7 +27,7 @@ transform = Transform3D(-0.1, -8.74228e-09, 0, 8.74228e-09, -0.1, 0, 0, 0, 0.1, is_player_revolver = true [node name="BulletStack" type="Node3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.09463, 3.35364, -0.941887) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.39969, 3.35364, -0.941887) script = ExtResource("4_kry3j") [node name="bullet2" parent="BulletStack" instance=ExtResource("3_8gbba")] @@ -47,10 +48,33 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.126874, -0.00966144, 0.1641 [node name="bullet6" parent="BulletStack" instance=ExtResource("3_8gbba")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.300729, -0.0193229, 0.207828) +[node name="bullet7" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0812991, -0.0193229, 0.241967) + +[node name="bullet8" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000887632, -0.00966144, 0.23783) + +[node name="bullet9" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.172968, -0.0193229, 0.281501) + +[node name="bullet10" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.20906, -0.0193229, 0.401988) + +[node name="bullet11" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.126874, -0.00966144, 0.397851) + +[node name="bullet12" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.300729, -0.0193229, 0.441522) + +[node name="bullet13" parent="BulletStack" instance=ExtResource("3_8gbba")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.162003, -0.0193229, 0.00827265) + [node name="person3" parent="." instance=ExtResource("5_kry3j")] transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0.0599972, 3.68584, -2.25251) [node name="enemy_revolver" parent="." instance=ExtResource("4_jjvhh")] transform = Transform3D(0.1, 0, 0, 0, -0.1, -8.74228e-09, 0, 8.74228e-09, -0.1, 0.354285, 4.2476, -0.496572) +[node name="MainGame" parent="." instance=ExtResource("6_21xkr")] + [editable path="revolver"] diff --git a/Scenes/main_game_ui.tscn b/Scenes/main_game_ui.tscn new file mode 100644 index 0000000..d9d532f --- /dev/null +++ b/Scenes/main_game_ui.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=2 format=3 uid="uid://cbr3e8xsfwyhf"] + +[ext_resource type="Script" uid="uid://2ktulh0d67v0" path="res://Scripts/player_choice_box.gd" id="1_mx1e2"] + +[node name="MainGame" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -86.5 +offset_top = -125.08 +offset_right = 86.5 +offset_bottom = -94.08 +grow_horizontal = 2 +grow_vertical = 0 +script = ExtResource("1_mx1e2") + +[node name="Button" type="Button" parent="HBoxContainer"] +layout_mode = 2 +text = "Shoot him +" + +[node name="Button2" type="Button" parent="HBoxContainer"] +layout_mode = 2 +text = "Shoot me" diff --git a/Scripts/game_manager.gd b/Scripts/game_manager.gd index 56f962f..1e30e3a 100644 --- a/Scripts/game_manager.gd +++ b/Scripts/game_manager.gd @@ -10,6 +10,8 @@ var bullets: Array var player1_revolver: Node3D var player2_revolver: Node3D +var is_player1_loaded: bool = false +var is_player2_loaded: bool = false var bullet_stack: Node3D func _ready() -> void: @@ -52,19 +54,37 @@ func check_unloaded_bullets(): else: return false +func check_loaded_bullets(revolver: Node3D): + if revolver.can_be_loaded(): + return true + else: + return false func end_player_turn(): - if check_unloaded_bullets(): + if !is_player2_loaded: set_state(GameState.PLAYER2_GUN_LOAD) + + end_turn() + +func end_enemy_turn(): + if is_player1_loaded == false: + print("Player Turn") + set_state(GameState.PLAYER1_GUN_LOAD) + end_turn() +func end_turn(): + if check_unloaded_bullets(): + if is_player1_loaded and is_player2_loaded: + print("Phase 2") + else: set_state(GameState.PLAYER2_UNLOAD) - print("End of Phase 1") -func end_enemy_turn(): - if check_unloaded_bullets(): - set_state(GameState.PLAYER1_GUN_LOAD) - else: - set_state(GameState.PLAYER1_UNLOAD) - print("End of Phase 1") func get_enemy_revolver() -> Node3D: return player2_revolver + +func get_phase2_player_start(): + var randNumb = randi_range(0,1) + if randNumb == 0: + set_state(GameState.PLAYER1_UNLOAD) + else: + set_state(GameState.PLAYER2_UNLOAD) diff --git a/Scripts/player_choice_box.gd b/Scripts/player_choice_box.gd new file mode 100644 index 0000000..d102700 --- /dev/null +++ b/Scripts/player_choice_box.gd @@ -0,0 +1,12 @@ +extends HBoxContainer +var start_pos: Vector2 + +func _ready() -> void: + start_pos = self.position + +func _input(event: InputEvent) -> void: + if event.is_action_released("left_mouse_click"): + self.position = Vector2(1000.0,1000.0) + +func on_state_changed(): + pass diff --git a/Scripts/player_choice_box.gd.uid b/Scripts/player_choice_box.gd.uid new file mode 100644 index 0000000..df092d4 --- /dev/null +++ b/Scripts/player_choice_box.gd.uid @@ -0,0 +1 @@ +uid://2ktulh0d67v0 diff --git a/Scripts/revolver.gd b/Scripts/revolver.gd index c9d2357..52ff1ba 100644 --- a/Scripts/revolver.gd +++ b/Scripts/revolver.gd @@ -4,7 +4,7 @@ var bullet_target_pos = Vector3(1.95,0.03,4.612) #2.231 var loaded_bullets = Array() var max_bullets: int = 6 -var current_round: int = 1 +var current_round: int = 0 var timer: Timer @export var is_player_revolver: bool = false @@ -12,7 +12,7 @@ var timer: Timer var is_cylinder_out: bool = false func _ready() -> void: - loaded_bullets.resize(max_bullets + 1) + loaded_bullets.resize(max_bullets) timer = $Timer if is_player_revolver: GameManager.set_player_revolver(self) @@ -27,6 +27,8 @@ func _process(delta: float) -> void: cylinder.rotation_degrees = lerp(cylinder.rotation_degrees,Vector3(30 + current_round*60,90,90), delta / 0.1 ) #cylinder.rotation_degrees = Vector3(30 + current_round*60,90,90) + + func load_bullet(bullet_object: Node3D): loaded_bullets[current_round] = bullet_object bullet_object.is_loaded = true @@ -39,15 +41,33 @@ func load_bullet(bullet_object: Node3D): #cylinder.rotation.x = 90.0 func on_load_anim_end(): + timer.timeout.disconnect(on_load_anim_end) + if !can_be_loaded(): + if is_player_revolver: + GameManager.is_player1_loaded = true + else: + GameManager.is_player2_loaded = true is_cylinder_out = false if is_player_revolver: GameManager.end_player_turn() else: GameManager.end_enemy_turn() - timer.timeout.disconnect(on_load_anim_end) + func on_bullet_reached(): current_round += 1 timer.start() func shoot(): pass + + +func can_be_loaded(): + var free: int = 0 + for bullet in loaded_bullets: + if bullet == null: + free += 1 + if free > 0: + return true + else: + return false + diff --git a/addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg b/addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg new file mode 100644 index 0000000..9890744 Binary files /dev/null and b/addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg differ diff --git a/addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg.import b/addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg.import new file mode 100644 index 0000000..99f30d8 --- /dev/null +++ b/addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ds1brgul327l0" +path="res://.godot/imported/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg-8631b2d80db4404b92f69470fd0c2315.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg" +dest_files=["res://.godot/imported/ANIME-PICTURES.NET_-_435314-1920x1080-senran+kagura-homura+(senran+kagura)-yomi+(senran+kagura)-hikage+(senran+kagura)-mirai+(senran+kagura)-haruka+(senran+kagura).jpeg-8631b2d80db4404b92f69470fd0c2315.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.avif b/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.avif new file mode 100644 index 0000000..9e97d69 Binary files /dev/null and b/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.avif differ diff --git a/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png b/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png new file mode 100644 index 0000000..8777a32 Binary files /dev/null and b/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png differ diff --git a/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png.import b/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png.import new file mode 100644 index 0000000..cb44c3f --- /dev/null +++ b/addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bqxwnlrkv6mft" +path="res://.godot/imported/bb4b32cd79fb85dfe85f00a17d634a44_bp.png-d1280714b7c0662815de28909bd20fbb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/bb4b32cd79fb85dfe85f00a17d634a44_bp.png" +dest_files=["res://.godot/imported/bb4b32cd79fb85dfe85f00a17d634a44_bp.png-d1280714b7c0662815de28909bd20fbb.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/addons/cba/.gitignore b/addons/cba/.gitignore new file mode 100644 index 0000000..4bdfdbe --- /dev/null +++ b/addons/cba/.gitignore @@ -0,0 +1,2 @@ +# Personal configuration file +config.json diff --git a/addons/cba/LICENSE b/addons/cba/LICENSE new file mode 100644 index 0000000..ba9019b --- /dev/null +++ b/addons/cba/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 peachey2k2 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/addons/cba/README.md b/addons/cba/README.md new file mode 100644 index 0000000..8d8d878 --- /dev/null +++ b/addons/cba/README.md @@ -0,0 +1,26 @@ +[![Discord](https://img.shields.io/discord/1146846558508302366.svg?colorB=7289DA&style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAABWAgMAAABnZYq0AAAACVBMVEUAAB38%2FPz%2F%2F%2F%2Bm8P%2F9AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfhBxwQJhxy2iqrAAABoElEQVRIx7WWzdGEIAyGgcMeKMESrMJ6rILZCiiBg4eYKr%2Fd1ZAfgXFm98sJfAyGNwno3G9sLucgYGpQ4OGVRxQTREMDZjF7ILSWjoiHo1n%2BE03Aw8p7CNY5IhkYd%2F%2F6MtO3f8BNhR1QWnarCH4tr6myl0cWgUVNcfMcXACP1hKrGMt8wcAyxide7Ymcgqale7hN6846uJCkQxw6GG7h2MH4Czz3cLqD1zHu0VOXMfZjHLoYvsdd0Q7ZvsOkafJ1P4QXxrWFd14wMc60h8JKCbyQvImzlFjyGoZTKzohwWR2UzSONHhYXBQOaKKsySsahwGGDnb%2FiYPJw22sCqzirSULYy1qtHhXGbtgrM0oagBV4XiTJok3GoLoDNH8ooTmBm7ZMsbpFzi2bgPGoXWXME6XT%2BRJ4GLddxJ4PpQy7tmfoU2HPN6cKg%2BledKHBKlF8oNSt5w5g5o8eXhu1IOlpl5kGerDxIVT%2BztzKepulD8utXqpChamkzzuo7xYGk%2FkpSYuviLXun5bzdRf0Krejzqyz7Z3p0I1v2d6HmA07dofmS48njAiuMgAAAAASUVORK5CYII%3D)](https://discord.gg/ZuUWPaSrHa) +# Chey's Background Addon +A simple plugin to put a background image behind your Godot editor. + +![image](https://github.com/peachey2k2/cheys-background-addon/assets/100072467/fe1286ab-337e-456c-9a2d-4d7a482f399c) + +# Installation +You can download it from the [asset library](https://godotengine.org/asset-library/asset/2933), which you can also use within the editor. + +Then enable the plugin from `Project > Project Settings > Plugins`. It will probably freeze for a couple seconds. That's intended. + + +# Configuration +Simply go to `Project > Tools > Backgrounds`. That should open up the configuration window. + +All the configuration is stored in `addons/cba/config.json`. + +> [!NOTE] +> Changing the UI color might freeze your editor for a second or two. Don't worry, that's normal. Godot just takes time to refresh all the theming. + +![image](https://github.com/peachey2k2/cheys-background-addon/assets/100072467/c6d28ac6-733e-4112-8511-ceb0f2cc5c5a) + +# Support +If you have a problem with the plugin, just come to my Discord server and I'll try to help. + +[![Discord](https://discordapp.com/api/guilds/1146846558508302366/widget.png?style=banner3)](https://discord.gg/ZuUWPaSrHa) diff --git a/addons/cba/images/.gdignore b/addons/cba/images/.gdignore new file mode 100644 index 0000000..e69de29 diff --git a/addons/cba/images/default.png b/addons/cba/images/default.png new file mode 100644 index 0000000..2c14bae Binary files /dev/null and b/addons/cba/images/default.png differ diff --git a/addons/cba/images/icon.png b/addons/cba/images/icon.png new file mode 100644 index 0000000..be02569 Binary files /dev/null and b/addons/cba/images/icon.png differ diff --git a/addons/cba/plugin.cfg b/addons/cba/plugin.cfg new file mode 100644 index 0000000..41e0d9f --- /dev/null +++ b/addons/cba/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Chey's Background Addon" +description="An addon that lets you add a background for your editor." +author="peachey2k2" +version="1.1.6" +script="plugin.gd" diff --git a/addons/cba/plugin.gd b/addons/cba/plugin.gd new file mode 100644 index 0000000..7bf076f --- /dev/null +++ b/addons/cba/plugin.gd @@ -0,0 +1,220 @@ +@tool +extends EditorPlugin + +var base:Control +var editor_settings:EditorSettings + +const TOOL = preload("res://addons/cba/tool.tscn") +var settings:Dictionary = {} +var bg:TextureRect +var tool:Window +var theme:Theme + +var accent_color:Color + +func _disable_plugin(): + bg.queue_free() + editor_settings.set("interface/theme/custom_theme", "") + editor_settings.set("interface/theme/preset", "Default") + remove_tool_menu_item("Backgrounds") + +func _enter_tree(): + #Benchmark.start("init") + if not Engine.is_editor_hint(): return + + base = EditorInterface.get_base_control() + editor_settings = EditorInterface.get_editor_settings() + editor_settings.settings_changed.connect(func(): + for setting in editor_settings.get_changed_settings(): + _setting_changed(setting) + ) + bg = TextureRect.new() + bg.name = "Editor Background" + bg.mouse_filter = Control.MOUSE_FILTER_IGNORE + bg.expand_mode = TextureRect.EXPAND_IGNORE_SIZE + bg.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + base.add_child.call_deferred(bg) + # move it to the top of the tree so it's behind all the UI + base.move_child.call_deferred(bg, 0) + await bg.ready + + theme = preload("res://addons/cba/theme.tres") + if editor_settings.get("interface/theme/custom_theme") != "res://addons/cba/theme.tres": + editor_settings.set("interface/theme/custom_theme", "res://addons/cba/theme.tres") + if editor_settings.get("interface/theme/preset") != "Custom": + editor_settings.set("interface/theme/preset", "Custom") + + await base.get_tree().physics_frame + load_settings() + + add_tool_menu_item("Backgrounds", func(): + if is_instance_valid(tool): printerr("There is already a background picker window open."); return + tool = TOOL.instantiate() + tool.main = self + base.add_child(tool) + tool.start() + tool.popup_centered() + ) + #Benchmark.end("init") + +func change_setting(value:Variant, setting:String, update_ui:bool = false, update_setting:bool = true): + var is_prev_ready := is_instance_valid(tool) + match setting: + "image": + var img := load_image(value) + if is_prev_ready: tool.preview.texture = img + if update_setting: bg.texture = img + "stretch": + if update_setting: bg.stretch_mode = value + if is_prev_ready: + tool.preview.stretch_mode = value + if update_ui: + tool.get_node("VBoxContainer/HBoxContainer/VBoxContainer/stretch mode").select(value) + "filter": + if update_setting: bg.texture_filter = value + if is_prev_ready: + tool.preview.texture_filter = value + if update_ui: + tool.get_node("VBoxContainer/HBoxContainer/VBoxContainer/filter mode").select(value) + "ui_color": + if is_prev_ready: + if update_ui: + value = Color(settings["ui_color"]) + tool.get_node("VBoxContainer/HBoxContainer/VBoxContainer2/ui_color").color = value + else: + value = tool.get_node("VBoxContainer/HBoxContainer/VBoxContainer2/ui_color").color + if not update_ui && update_setting: + if value == Color(settings["ui_color"]): return + change_theme_color(value) + settings["ui_color"] = value.to_html() + value = null + "bg_modulate": + if value is String: value = Color(value) + if update_setting: bg.modulate = value + if is_prev_ready: + tool.preview.modulate = value + if update_ui: + tool.get_node("VBoxContainer/HBoxContainer/VBoxContainer2/bg_modulate").color = value + value = value.to_html() + "edit_transparency": + if is_prev_ready: + if update_ui: + value = settings["edit_transparency"] + tool.get_node("VBoxContainer/edit_transparency").button_pressed = value + else: + value = tool.get_node("VBoxContainer/edit_transparency").button_pressed + if not update_ui && update_setting: + if value == settings["edit_transparency"]: return + settings["edit_transparency"] = value + change_theme_color(Color(settings["ui_color"])) + value = null + if value != null: settings[setting] = value + +func load_image(path:String) -> Texture2D: + var file := FileAccess.open(path, FileAccess.READ) + if file == null: printerr("file not found: ", path); return + var image = Image.load_from_file(path) + var out = ImageTexture.create_from_image(image) + return out + +func load_settings(): + if FileAccess.file_exists("res://addons/cba/config.json"): + var file := FileAccess.open("res://addons/cba/config.json", FileAccess.READ) + if file == null: + file = FileAccess.open("res://addons/cba/config.json", FileAccess.WRITE_READ) + assert(file != null, "Error opening file.") + return + else: + settings = JSON.parse_string(file.get_as_text()) + file.close() + else: + var file := FileAccess.open("res://addons/cba/config.json", FileAccess.WRITE) + var defaults := { + "filter": 0.0, + "image": ProjectSettings.globalize_path("res://addons/cba/images/default.png"), + "stretch": 1, + "ui_color": "00000088", + "bg_modulate": "ffffffb0", + "edit_transparency": false, + } + file.store_string(JSON.stringify(defaults, "\t")) + settings = defaults + file.close() + for s in settings.keys(): + change_setting(settings[s], s, true) + +func save_settings(): + var file := FileAccess.open("res://addons/cba/config.json", FileAccess.WRITE) + file.store_string(JSON.stringify(settings, "\t")) + +func _setting_changed(setting:String): + match setting: + "interface/theme/accent_color": + change_theme_color(Color(settings["ui_color"])) + +func change_theme_color(col:Color): + #Benchmark.start("change theme color") + + accent_color = editor_settings.get_setting("interface/theme/accent_color") + + var controls_list = get_all_controls([base]) + + var col2 := Color(col, col.a/2.0) + var col3 := Color(col, min(col.a/col.v, col.a/4.0)) + change_color("EditorStyles", "Background", col) + change_color("EditorStyles", "BottomPanel", col) + change_color("EditorStyles", "BottomPanelDebuggerOverride", col) + change_color("EditorStyles", "Content", col) + change_color("EditorStyles", "LaunchPadNormal", col) + + change_color("TabContainer", "panel", col) + change_color("TabContainer", "tab_selected", col, accent_color) + change_color("TabContainer", "tab_unselected", col2) + change_color("TabContainer", "tab_hovered", col2) + + change_color("TabBar", "tab_selected", col, accent_color) + change_color("TabBar", "tab_unselected", col2) + change_color("TabBar", "tab_hovered", col2) + + change_color("TabContainerOdd", "tab_selected", col, accent_color) + change_color("TabContainerOdd", "panel", col2) + + # bordered + change_color("Button", "normal", col3) + change_color("MenuButton", "normal", col3) + change_color("OptionButton", "normal", col3) + change_color("RichTextLabel", "normal", col3) + change_color("LineEdit", "normal", col3) + change_color("TextEdit", "normal", col3) + change_color("LineEdit", "read_only", col3) + change_color("TextEdit", "read_only", col3) + change_color("EditorProperty", "child_bg", col3) + + change_color("EditorInspectorCategory", "bg", col2) + + # fix to old values showing up in transparent preview + if settings["edit_transparency"]: + change_color("LineEdit", "focus", col3) + else: + change_color("LineEdit", "focus", Color.BLACK) + + # trigger an update + theme.get_stylebox("Background", "EditorStyles").emit_changed() + + #Benchmark.end("change theme color") + +func get_all_controls(nodes:Array[Node]) -> Array[Node]: + var out:Array[Node] = [] + for node in nodes: + if node is Control: out.append(node) + var children := node.get_children() as Array[Node] + out += get_all_controls(children) + return out + +func change_color(type:String, name:String, col:Color, border = null): + var box:StyleBoxFlat = theme.get_stylebox(name, type) + box.set_block_signals(true) + box.bg_color = col + if border != null: + box.border_color = border + box.set_block_signals(false) diff --git a/addons/cba/plugin.gd.uid b/addons/cba/plugin.gd.uid new file mode 100644 index 0000000..8ead86a --- /dev/null +++ b/addons/cba/plugin.gd.uid @@ -0,0 +1 @@ +uid://dpgybwvyhvqkx diff --git a/addons/cba/theme.tres b/addons/cba/theme.tres new file mode 100644 index 0000000..8950600 --- /dev/null +++ b/addons/cba/theme.tres @@ -0,0 +1,359 @@ +[gd_resource type="Theme" load_steps=39 format=3 uid="uid://cbdjaabpm8jfk"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6rrxc"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.47788, 0.47788, 0.47788, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4bdji"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_x4bf7"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0, 0, 0, 0) +border_color = Color(0.25098, 0.266667, 0.298039, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qm4uc"] +bg_color = Color(0, 0, 0, nan) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kmfvt"] +bg_color = Color(0, 0, 0, 0) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1tn6y"] +content_margin_left = 4.0 +content_margin_top = 6.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mfvec"] +content_margin_left = 4.0 +content_margin_top = 0.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yxe5q"] +bg_color = Color(0.617575, 0.626378, 0.219465, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wrepn"] +bg_color = Color(0, 0, 0, 0) + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4qoyy"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bae5w"] +bg_color = Color(0, 0, 0, 0) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hqa07"] +bg_color = Color(0.71993, 0.58247, 0.18956, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jbgu4"] +bg_color = Color(0.87666, 0.482054, 0.185217, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7xbe2"] +content_margin_left = 2.0 +content_margin_top = 0.0 +content_margin_right = 2.0 +content_margin_bottom = 0.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eag6m"] +bg_color = Color(0.266667, 0.647059, 0.819608, 0) + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_nn8ly"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yi1o1"] +bg_color = Color(0.6, 0.6, 0.6, 0) + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ebp5u"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7l2sj"] +bg_color = Color(0, 0, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cbyhm"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_width_bottom = 2 +border_color = Color(0.113725, 0.133333, 0.160784, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cjlww"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_width_bottom = 2 +border_color = Color(0.113725, 0.133333, 0.160784, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xi4cy"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_color = Color(0.501961, 0.501961, 0.501961, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_thgut"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_color = Color(0.501961, 0.501961, 0.501961, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4rkfj"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0, 0, 0, nan) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.301961, 0.301961, 0.301961, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jlb1y"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lvnv7"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +border_width_top = 2 +border_color = Color(0.44, 0.73, 0.98, 1) +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ve3ye"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kcmrn"] +content_margin_left = 4.0 +content_margin_top = 6.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0, 0, 0, 0) +border_color = Color(0.900808, 0.647855, 0.245012, 1) +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_e473q"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gir5j"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +border_width_top = 2 +border_color = Color(0.44, 0.73, 0.98, 1) +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_th0sh"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_og5m1"] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_prlgo"] +content_margin_left = 4.0 +content_margin_top = 6.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0, 0, 0, 0) +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4n6md"] +content_margin_left = 11.0 +content_margin_top = 5.0 +content_margin_right = 11.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 0) +border_width_top = 2 +border_color = Color(0.44, 0.73, 0.98, 1) +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4bdji"] +bg_color = Color(0, 0, 0, 0.12451) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1gbrb"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_width_bottom = 2 +border_color = Color(0.113725, 0.133333, 0.160784, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gfc5e"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, nan) +border_width_bottom = 2 +border_color = Color(0.113725, 0.133333, 0.160784, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_c0v5a"] + +[resource] +Button/styles/normal = SubResource("StyleBoxFlat_6rrxc") +CodeEdit/styles/normal = SubResource("StyleBoxEmpty_4bdji") +EditorInspectorCategory/styles/bg = SubResource("StyleBoxFlat_x4bf7") +EditorProperty/styles/child_bg = SubResource("StyleBoxFlat_qm4uc") +EditorStyles/styles/Background = SubResource("StyleBoxFlat_kmfvt") +EditorStyles/styles/BottomPanel = SubResource("StyleBoxFlat_1tn6y") +EditorStyles/styles/BottomPanelDebuggerOverride = SubResource("StyleBoxFlat_mfvec") +EditorStyles/styles/CanvasItemInfoOverlay = SubResource("StyleBoxFlat_yxe5q") +EditorStyles/styles/Content = SubResource("StyleBoxFlat_wrepn") +EditorStyles/styles/ContextualToolbar = SubResource("StyleBoxEmpty_4qoyy") +EditorStyles/styles/DebuggerPanel = SubResource("StyleBoxFlat_bae5w") +EditorStyles/styles/DictionaryAddItem = SubResource("StyleBoxFlat_hqa07") +EditorStyles/styles/Focus = SubResource("StyleBoxFlat_jbgu4") +EditorStyles/styles/LaunchPadNormal = SubResource("StyleBoxFlat_7xbe2") +EditorStyles/styles/MenuPanel = SubResource("StyleBoxFlat_eag6m") +EditorStyles/styles/PanelForeground = null +EditorStyles/styles/ScriptEditor = SubResource("StyleBoxEmpty_nn8ly") +EditorStyles/styles/ScriptEditorPanel = SubResource("StyleBoxFlat_yi1o1") +ItemList/styles/panel = SubResource("StyleBoxEmpty_ebp5u") +LineEdit/styles/focus = SubResource("StyleBoxFlat_7l2sj") +LineEdit/styles/normal = SubResource("StyleBoxFlat_cbyhm") +LineEdit/styles/read_only = SubResource("StyleBoxFlat_cjlww") +MenuButton/styles/normal = SubResource("StyleBoxFlat_xi4cy") +OptionButton/styles/normal = SubResource("StyleBoxFlat_thgut") +RichTextLabel/styles/normal = SubResource("StyleBoxFlat_4rkfj") +TabBar/styles/tab_hovered = SubResource("StyleBoxFlat_jlb1y") +TabBar/styles/tab_selected = SubResource("StyleBoxFlat_lvnv7") +TabBar/styles/tab_unselected = SubResource("StyleBoxFlat_ve3ye") +TabContainer/styles/panel = SubResource("StyleBoxFlat_kcmrn") +TabContainer/styles/tab_hovered = SubResource("StyleBoxFlat_e473q") +TabContainer/styles/tab_selected = SubResource("StyleBoxFlat_gir5j") +TabContainer/styles/tab_unselected = SubResource("StyleBoxFlat_th0sh") +TabContainer/styles/tabbar_background = SubResource("StyleBoxFlat_og5m1") +TabContainerOdd/styles/panel = SubResource("StyleBoxFlat_prlgo") +TabContainerOdd/styles/tab_selected = SubResource("StyleBoxFlat_4n6md") +TextEdit/styles/focus = SubResource("StyleBoxFlat_4bdji") +TextEdit/styles/normal = SubResource("StyleBoxFlat_1gbrb") +TextEdit/styles/read_only = SubResource("StyleBoxFlat_gfc5e") +Tree/styles/panel = SubResource("StyleBoxEmpty_c0v5a") diff --git a/addons/cba/tool.gd b/addons/cba/tool.gd new file mode 100644 index 0000000..3e35dbc --- /dev/null +++ b/addons/cba/tool.gd @@ -0,0 +1,38 @@ +@tool +extends Window + +var preview:TextureRect + +var main:EditorPlugin + +func start(): + if not Engine.is_editor_hint(): queue_free(); return + $"VBoxContainer/HBoxContainer/VBoxContainer/image picker".pressed.connect(_image_picker) + $"VBoxContainer/HBoxContainer/VBoxContainer/stretch mode".item_selected.connect(main.change_setting.bind("stretch")) + $"VBoxContainer/HBoxContainer/VBoxContainer/filter mode".item_selected.connect(main.change_setting.bind("filter")) + #$HBoxContainer/VBoxContainer2/ui_alpha.value_changed.connect(main.change_setting.bind("ui_alpha")) # too laggy + $VBoxContainer/HBoxContainer/VBoxContainer2/ui_color.popup_closed.connect(main.change_setting.bind(null, "ui_color")) + $VBoxContainer/HBoxContainer/VBoxContainer2/bg_modulate.color_changed.connect(main.change_setting.bind("bg_modulate")) + $VBoxContainer/edit_transparency.toggled.connect(main.change_setting.bind("edit_transparency")) + close_requested.connect(close) + preview = $VBoxContainer/PanelContainer/TextureRect # thank you onready + main.load_settings() + +func _input(event): + if event.is_action_pressed("ui_cancel"): + close() + +func close(): + main.save_settings() + queue_free() + +func _image_picker(): + var picker := EditorFileDialog.new() + picker.close_requested.connect(queue_free) + picker.file_selected.connect(main.change_setting.bind("image")) + picker.size = Vector2(700, 500) + picker.access = EditorFileDialog.ACCESS_FILESYSTEM + picker.file_mode = EditorFileDialog.FILE_MODE_OPEN_FILE + picker.filters = ["*.bmp, *.dds, *.exr, *.hdr, *.jpg, *.jpeg, *.png, *.tga, *.svg, *.svgz, *.webp; Supported Images"] + add_child(picker) + picker.popup_centered() diff --git a/addons/cba/tool.gd.uid b/addons/cba/tool.gd.uid new file mode 100644 index 0000000..8fc8023 --- /dev/null +++ b/addons/cba/tool.gd.uid @@ -0,0 +1 @@ +uid://ca766t2y66e16 diff --git a/addons/cba/tool.tscn b/addons/cba/tool.tscn new file mode 100644 index 0000000..e307594 --- /dev/null +++ b/addons/cba/tool.tscn @@ -0,0 +1,172 @@ +[gd_scene load_steps=6 format=3 uid="uid://cqkxegtagb5ts"] + +[ext_resource type="Script" uid="uid://d08kr32g2gva0" path="res://addons/cba/tool.gd" id="1_yg3st"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l27jc"] +content_margin_left = 6.0 +content_margin_right = 6.0 +bg_color = Color(0.423529, 0.266667, 0.215686, 1) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.691357, 0.691357, 0.691357, 1) +shadow_color = Color(0, 0, 0, 0.729412) +shadow_size = 2 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5s6hr"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p8vlj"] +bg_color = Color(0.177332, 0.180983, 0.215343, 1) + +[sub_resource type="Theme" id="Theme_csmr1"] +Button/font_sizes/font_size = 14 +Button/styles/normal = SubResource("StyleBoxFlat_l27jc") +ColorPickerButton/styles/normal = SubResource("StyleBoxEmpty_5s6hr") +Label/font_sizes/font_size = 14 +Panel/styles/panel = SubResource("StyleBoxFlat_p8vlj") + +[node name="Tool" type="Window"] +title = "Chey's Background Addon" +initial_position = 5 +size = Vector2i(400, 400) +min_size = Vector2i(400, 400) +max_size = Vector2i(400, 400) +script = ExtResource("1_yg3st") + +[node name="Panel" type="Panel" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = SubResource("Theme_csmr1") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +clip_contents = true +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_bottom = 32.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"] +clip_contents = true +custom_minimum_size = Vector2(0, 230) +layout_mode = 2 +theme = SubResource("Theme_csmr1") + +[node name="TextureRect" type="TextureRect" parent="VBoxContainer/PanelContainer"] +layout_mode = 2 +expand_mode = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme = SubResource("Theme_csmr1") + +[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 0 + +[node name="image picker" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer"] +custom_minimum_size = Vector2(0, 37) +layout_mode = 2 +size_flags_stretch_ratio = 0.0 +text = "Pick an image" + +[node name="stretch mode" type="OptionButton" parent="VBoxContainer/HBoxContainer/VBoxContainer"] +clip_contents = true +custom_minimum_size = Vector2(0, 37) +layout_mode = 2 +size_flags_stretch_ratio = 0.0 +clip_text = true +item_count = 7 +popup/item_0/text = "Scale" +popup/item_0/id = 0 +popup/item_1/text = "Tile" +popup/item_1/id = 1 +popup/item_2/text = "Keep" +popup/item_2/id = 2 +popup/item_3/text = "Keep Centered" +popup/item_3/id = 3 +popup/item_4/text = "Keep Aspect" +popup/item_4/id = 4 +popup/item_5/text = "Keep Aspect Centered" +popup/item_5/id = 5 +popup/item_6/text = "Keep Aspect Covered" +popup/item_6/id = 6 + +[node name="filter mode" type="OptionButton" parent="VBoxContainer/HBoxContainer/VBoxContainer"] +clip_contents = true +custom_minimum_size = Vector2(0, 37) +layout_mode = 2 +size_flags_stretch_ratio = 0.0 +clip_text = true +item_count = 6 +popup/item_0/text = "Nearest" +popup/item_0/id = 0 +popup/item_1/text = "Linear" +popup/item_1/id = 1 +popup/item_2/text = "Nearest Mipmap" +popup/item_2/id = 2 +popup/item_3/text = "Linear Mipmap" +popup/item_3/id = 3 +popup/item_4/text = "Nearest Mipmap Anisotropic" +popup/item_4/id = 4 +popup/item_5/text = "Linear Mipmap Anisotropic" +popup/item_5/id = 5 + +[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"] +clip_contents = true +layout_mode = 2 +size_flags_horizontal = 3 +theme = SubResource("Theme_csmr1") + +[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/VBoxContainer2"] +layout_mode = 2 +size_flags_vertical = 0 +theme_override_constants/line_spacing = -6 +text = "UI Color +(close picker to change)" +horizontal_alignment = 1 + +[node name="ui_color" type="ColorPickerButton" parent="VBoxContainer/HBoxContainer/VBoxContainer2"] +custom_minimum_size = Vector2(0, 20) +layout_mode = 2 +size_flags_vertical = 0 +size_flags_stretch_ratio = 0.0 + +[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer/VBoxContainer2"] +layout_mode = 2 +size_flags_vertical = 0 +text = "Background Modulate" +horizontal_alignment = 1 + +[node name="bg_modulate" type="ColorPickerButton" parent="VBoxContainer/HBoxContainer/VBoxContainer2"] +custom_minimum_size = Vector2(0, 20) +layout_mode = 2 +size_flags_vertical = 0 +size_flags_stretch_ratio = 0.0 + +[node name="edit_transparency" type="CheckBox" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 2 +size_flags_stretch_ratio = 0.38 +tooltip_text = "For some reason, when editing an inspector field, Godot +still displays the previous state of it behind the current one. +Also, for some reason, when renaming a node in the scene +tab, the rename box opens in a separate window, which +ruins the transparency and makes it more gray. So as a hack, +this plugin turns text boxes black when editing. If you think +the prior is a better alternative, you can switch to that here." +text = "Enable textbox transparency on edit (?)" + +[node name="Control" type="Control" parent="VBoxContainer"] +clip_contents = true +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +size_flags_vertical = 0 +size_flags_stretch_ratio = 1.21 diff --git a/project.godot b/project.godot index 5c86be9..d4b1be3 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,10 @@ config/icon="res://icon.svg" GameManager="*res://Scripts/game_manager.gd" +[editor_plugins] + +enabled=PackedStringArray("res://addons/cba/plugin.cfg") + [input] load={