From 6b18c51391799b90670c3b5f96a4ab9e7182e441 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Thu, 3 Jun 2021 23:21:05 +0200 Subject: [PATCH] create export plugin to make window default size 16x16, while still allowing for easy overlay editing --- ovr-utils/addons/ovr_utils/ovr_utils.gd | 14 ++++++++++++++ ovr-utils/addons/ovr_utils/ovr_utils_exporter.gd | 12 ++++++++++++ ovr-utils/addons/ovr_utils/plugin.cfg | 7 +++++++ ovr-utils/project.godot | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 ovr-utils/addons/ovr_utils/ovr_utils.gd create mode 100644 ovr-utils/addons/ovr_utils/ovr_utils_exporter.gd create mode 100644 ovr-utils/addons/ovr_utils/plugin.cfg diff --git a/ovr-utils/addons/ovr_utils/ovr_utils.gd b/ovr-utils/addons/ovr_utils/ovr_utils.gd new file mode 100644 index 0000000..b000527 --- /dev/null +++ b/ovr-utils/addons/ovr_utils/ovr_utils.gd @@ -0,0 +1,14 @@ +tool +extends EditorPlugin + +var export_plugin + + +func _enter_tree(): + export_plugin = preload("res://addons/ovr_utils/ovr_utils_exporter.gd").new() + add_export_plugin(export_plugin) + + +func _exit_tree(): + if export_plugin: + remove_export_plugin(export_plugin) diff --git a/ovr-utils/addons/ovr_utils/ovr_utils_exporter.gd b/ovr-utils/addons/ovr_utils/ovr_utils_exporter.gd new file mode 100644 index 0000000..e968c6a --- /dev/null +++ b/ovr-utils/addons/ovr_utils/ovr_utils_exporter.gd @@ -0,0 +1,12 @@ +tool +extends EditorExportPlugin + +func _export_begin(features: PoolStringArray, is_debug: bool, path: String, flags: int) -> void: + ProjectSettings.set_setting("display/window/size/height", 16) + ProjectSettings.set_setting("display/window/size/width", 16) + ProjectSettings.save() + +func _export_end() -> void: + ProjectSettings.set_setting("display/window/size/height", 2048) + ProjectSettings.set_setting("display/window/size/width", 2048) + ProjectSettings.save() diff --git a/ovr-utils/addons/ovr_utils/plugin.cfg b/ovr-utils/addons/ovr_utils/plugin.cfg new file mode 100644 index 0000000..bd29ae1 --- /dev/null +++ b/ovr-utils/addons/ovr_utils/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="OVR Utils" +description="OVR Utils exporter" +author="CrispyPin" +version="" +script="ovr_utils.gd" diff --git a/ovr-utils/project.godot b/ovr-utils/project.godot index e639af3..55b23e9 100644 --- a/ovr-utils/project.godot +++ b/ovr-utils/project.godot @@ -29,7 +29,7 @@ window/size/height=2048 [editor_plugins] -enabled=PoolStringArray( "res://addons/godot-openvr/plugin.cfg", "res://addons/openvr_overlay/plugin.cfg", "res://addons/settings-manager/plugin.cfg" ) +enabled=PoolStringArray( "res://addons/godot-openvr/plugin.cfg", "res://addons/openvr_overlay/plugin.cfg", "res://addons/ovr_utils/plugin.cfg", "res://addons/settings-manager/plugin.cfg" ) [gdnative]