This commit is contained in:
Melissa 2022-03-04 14:03:18 +01:00
commit 3d100d5904
9 changed files with 122 additions and 0 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
/.gitattributes export-ignore
/Readme.md export-ignore
/License.txt export-ignore

21
License.txt Normal file
View File

@ -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.

4
Readme.md Normal file
View File

@ -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

Binary file not shown.

BIN
addons/tbloader/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>TBLoader</title>
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:title>TBLoader</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="matrix(.23996 0 0 .24633 -15.301 -26.547)" fill="none">
<path d="m97.213 109.57-30.357 8.4385-5.37e-4 -5.6e-4 8.3597 29.977 21.989 21.198v8.6e-4l9.36e-4 -5.5e-4 5.35e-4 5.5e-4v-8.6e-4l21.99-21.198 8.356-29.965 0.0192-0.0115zm0 25.412 0.0083 0.5401-0.01402 9e-3zm-0.0083 0.54822 0.0022 8.5e-4 -9.37e-4 0.94463z" stop-color="#000000" style="-inkscape-stroke:none;font-variation-settings:normal"/>
<path transform="translate(-6.7616,1.2332)" d="m103.97 109.62-29.045 8.0742 29.039 16.766 6e-3 -0.52539 8e-3 0.52539 29.039-16.766z" stop-color="#000000" stroke="#fb8080" stroke-miterlimit="3" stroke-width="3.3" style="-inkscape-stroke:none;font-variation-settings:normal;paint-order:normal"/>
<path d="m68.168 118.93 29.038 16.766 0.01581 32.214-21.055-20.297zm58.077 0-29.038 16.766-0.01581 32.214 21.055-20.297z" stop-color="#000000" stroke="#fb8080" stroke-miterlimit="3" stroke-width="3.3" style="-inkscape-stroke:none;font-variation-settings:normal;paint-order:normal"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,7 @@
[plugin]
name="TBLoader"
description="TrenchBroom map loader."
author="Codecat"
version="0.0.3"
script="src/plugin.gd"

View File

@ -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")

View File

@ -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"