0.0.3
This commit is contained in:
BIN
addons/tbloader/bin/tbloader.windows.64.dll
Normal file
BIN
addons/tbloader/bin/tbloader.windows.64.dll
Normal file
Binary file not shown.
BIN
addons/tbloader/icon.png
Normal file
BIN
addons/tbloader/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
16
addons/tbloader/icons/tbloader.svg
Normal file
16
addons/tbloader/icons/tbloader.svg
Normal 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 |
7
addons/tbloader/plugin.cfg
Normal file
7
addons/tbloader/plugin.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="TBLoader"
|
||||
description="TrenchBroom map loader."
|
||||
author="Codecat"
|
||||
version="0.0.3"
|
||||
script="src/plugin.gd"
|
64
addons/tbloader/src/plugin.gd
Normal file
64
addons/tbloader/src/plugin.gd
Normal 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")
|
7
addons/tbloader/tbloader.gdextension
Normal file
7
addons/tbloader/tbloader.gdextension
Normal 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"
|
Reference in New Issue
Block a user