commit
3d100d5904
@ -0,0 +1,3 @@
|
||||
/.gitattributes export-ignore
|
||||
/Readme.md export-ignore
|
||||
/License.txt export-ignore
|
@ -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.
|
@ -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.
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="TBLoader"
|
||||
description="TrenchBroom map loader."
|
||||
author="Codecat"
|
||||
version="0.0.3"
|
||||
script="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")
|
@ -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"
|
Loading…
Reference in new issue