commit 3d100d5904d5becea6f5a3a1827a0dbe8b17fccf Author: Melissa Geels Date: Fri Mar 4 14:03:18 2022 +0100 0.0.3 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1f8e844 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +/.gitattributes export-ignore +/Readme.md export-ignore +/License.txt export-ignore diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..b629a06 --- /dev/null +++ b/License.txt @@ -0,0 +1,21 @@ +Copyright 2022 Melissa "Codecat" Geels +Copyright 2021 Álex "EIREXE" Román +Copyright 2019 Josh "Shifty" Palmer + +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/Readme.md b/Readme.md new file mode 100644 index 0000000..0167ad1 --- /dev/null +++ b/Readme.md @@ -0,0 +1,4 @@ +# TrenchBroom Loader for Godot +This repository only exists for AssetLib! + +The actual source code of TBLoader is maintained here: https://github.com/codecat/godot-tbloader diff --git a/addons/tbloader/bin/tbloader.windows.64.dll b/addons/tbloader/bin/tbloader.windows.64.dll new file mode 100644 index 0000000..ae154db Binary files /dev/null and b/addons/tbloader/bin/tbloader.windows.64.dll differ diff --git a/addons/tbloader/icon.png b/addons/tbloader/icon.png new file mode 100644 index 0000000..9a120f9 Binary files /dev/null and b/addons/tbloader/icon.png differ diff --git a/addons/tbloader/icons/tbloader.svg b/addons/tbloader/icons/tbloader.svg new file mode 100644 index 0000000..4d81a6c --- /dev/null +++ b/addons/tbloader/icons/tbloader.svg @@ -0,0 +1,16 @@ + + +TBLoader + + + +TBLoader + + + + + + + + + diff --git a/addons/tbloader/plugin.cfg b/addons/tbloader/plugin.cfg new file mode 100644 index 0000000..e2ab2cf --- /dev/null +++ b/addons/tbloader/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="TBLoader" +description="TrenchBroom map loader." +author="Codecat" +version="0.0.3" +script="src/plugin.gd" diff --git a/addons/tbloader/src/plugin.gd b/addons/tbloader/src/plugin.gd new file mode 100644 index 0000000..3aaff1b --- /dev/null +++ b/addons/tbloader/src/plugin.gd @@ -0,0 +1,64 @@ +@tool +extends EditorPlugin +class_name TBPlugin + +var map_control: Control = null +var editing_loader: WeakRef = weakref(null) + +func _enter_tree(): + set_icons(true) + + map_control = create_map_control() + map_control.set_visible(false) + add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_MENU, map_control) + +func _exit_tree(): + set_icons(false) + + remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_MENU, map_control) + map_control.queue_free() + map_control = null + +func _handles(object): + return object is TBLoader + +func _make_visible(visible: bool): + map_control.set_visible(visible) + +func _edit(object): + editing_loader = weakref(object) + +func create_map_control() -> Control: + var button_build_meshes = Button.new() + button_build_meshes.flat = true + button_build_meshes.text = "Build Meshes" + button_build_meshes.connect("pressed", Callable(self, "build_meshes")) + + var button_build_csg = Button.new() + button_build_csg.flat = true + button_build_csg.text = "Build Combined CSG" + button_build_csg.connect("pressed", Callable(self, "build_combined_csg")) + + var ret = HBoxContainer.new() + ret.add_child(button_build_meshes) + ret.add_child(button_build_csg) + return ret + +func build_meshes(): + var loader = editing_loader.get_ref() + loader.build_meshes() + +func build_combined_csg(): + var loader = editing_loader.get_ref() + loader.build_combined_csg() + +func set_icons(on): + var editor_interface = get_editor_interface() + var base_control = editor_interface.get_base_control() + var theme = base_control.theme + + if on: + var texture = ResourceLoader.load("res://addons/tbloader/icons/tbloader.svg") + theme.set_icon("TBLoader", "EditorIcons", texture) + else: + theme.clear_icon("TBLoader", "EditorIcons") diff --git a/addons/tbloader/tbloader.gdextension b/addons/tbloader/tbloader.gdextension new file mode 100644 index 0000000..d4635e5 --- /dev/null +++ b/addons/tbloader/tbloader.gdextension @@ -0,0 +1,7 @@ +[configuration] +entry_symbol = "tbloader_init" + +[libraries] +windows.64 = "bin/tbloader.windows.64.dll" +linux.64 = "bin/tbloader.linux.64.so" +macos.64 = "bin/libtbloader.framework"