From 93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 5 Jul 2023 12:06:39 -0700 Subject: Update the directory structure for the Android plugin addon The addon directory now contains two subfolders: - "addons//export": - should contain the editor plugin script and the editor export plugin script. as well as any binaries needed for export - `plugin.cfg` must point to the editor plugin script in this directory - must contain a `.gdignore` file to exclude this directory from the export process - "addons//interface": - optional directory - can contain helper gdscript files used by the project to interface with the functionality exposed by the plugin --- .../demo/addons/hello_signals_plugin/.gdignore | 1 - .../hello_signals_plugin/HelloSignals.debug.aar | Bin 6825 -> 0 bytes .../hello_signals_plugin/HelloSignals.release.aar | Bin 6647 -> 0 bytes .../addons/hello_signals_plugin/export/.gdignore | 1 + .../export/HelloSignals.debug.aar | Bin 0 -> 6826 bytes .../export/HelloSignals.release.aar | Bin 0 -> 6644 bytes .../export/hello_signals_editor_export_plugin.gd | 16 ++++++++++++ .../export/hello_signals_editor_plugin.gd | 17 +++++++++++++ .../hello_signals_export_plugin.gd | 16 ------------ .../hello_signals_plugin/hello_signals_plugin.gd | 17 ------------- .../interface/hello_signals_plugin.gd | 27 +++++++++++++++++++++ .../demo/addons/hello_signals_plugin/plugin.cfg | 2 +- 12 files changed, 62 insertions(+), 35 deletions(-) delete mode 100644 hello_signals/demo/addons/hello_signals_plugin/.gdignore delete mode 100644 hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar delete mode 100644 hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar create mode 100644 hello_signals/demo/addons/hello_signals_plugin/export/.gdignore create mode 100644 hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar create mode 100644 hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar create mode 100644 hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd create mode 100644 hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd delete mode 100644 hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd delete mode 100644 hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd create mode 100644 hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd (limited to 'hello_signals/demo/addons') diff --git a/hello_signals/demo/addons/hello_signals_plugin/.gdignore b/hello_signals/demo/addons/hello_signals_plugin/.gdignore deleted file mode 100644 index 8b13789..0000000 --- a/hello_signals/demo/addons/hello_signals_plugin/.gdignore +++ /dev/null @@ -1 +0,0 @@ - diff --git a/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar b/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar deleted file mode 100644 index 3e445c6..0000000 Binary files a/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar and /dev/null differ diff --git a/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar b/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar deleted file mode 100644 index 6440048..0000000 Binary files a/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar and /dev/null differ diff --git a/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore b/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore @@ -0,0 +1 @@ + diff --git a/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar b/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar new file mode 100644 index 0000000..d241ab1 Binary files /dev/null and b/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar differ diff --git a/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar b/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar new file mode 100644 index 0000000..6dae345 Binary files /dev/null and b/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar differ diff --git a/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd new file mode 100644 index 0000000..f0f3288 --- /dev/null +++ b/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd @@ -0,0 +1,16 @@ +@tool +extends EditorExportPlugin + +func _supports_platform(platform): + if platform is EditorExportPlatformAndroid: + return true + return false + +func _get_android_libraries(platform, debug): + if debug: + return PackedStringArray(["hello_signals_plugin/export/HelloSignals.debug.aar"]) + else: + return PackedStringArray(["hello_signals_plugin/export/HelloSignals.release.aar"]) + +func _get_name(): + return "Hello Signals plugin" diff --git a/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd new file mode 100644 index 0000000..5c71083 --- /dev/null +++ b/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd @@ -0,0 +1,17 @@ +@tool +extends EditorPlugin + +# A class member to hold the export plugin during its lifecycle +var export_plugin : EditorExportPlugin + +func _enter_tree(): + # Initialization of the plugin goes here. + export_plugin = preload("hello_signals_editor_export_plugin.gd").new() + add_export_plugin(export_plugin) + pass + + +func _exit_tree(): + # Clean-up of the plugin goes here. + remove_export_plugin(export_plugin) + export_plugin = null diff --git a/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd deleted file mode 100644 index afc4162..0000000 --- a/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd +++ /dev/null @@ -1,16 +0,0 @@ -@tool -extends EditorExportPlugin - -func _supports_platform(platform): - if platform is EditorExportPlatformAndroid: - return true - return false - -func _get_android_libraries(platform, debug): - if debug: - return PackedStringArray(["hello_signals_plugin/HelloSignals.debug.aar"]) - else: - return PackedStringArray(["hello_signals_plugin/HelloSignals.release.aar"]) - -func _get_name(): - return "Hello Signals plugin" diff --git a/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd deleted file mode 100644 index 65d8034..0000000 --- a/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd +++ /dev/null @@ -1,17 +0,0 @@ -@tool -extends EditorPlugin - -# A class member to hold the export plugin during its lifecycle -var export_plugin : EditorExportPlugin - -func _enter_tree(): - # Initialization of the plugin goes here. - export_plugin = preload("hello_signals_export_plugin.gd").new() - add_export_plugin(export_plugin) - pass - - -func _exit_tree(): - # Clean-up of the plugin goes here. - remove_export_plugin(export_plugin) - export_plugin = null diff --git a/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd new file mode 100644 index 0000000..0cc9c1d --- /dev/null +++ b/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd @@ -0,0 +1,27 @@ +class_name HelloSignalsPlugin extends Object + +## Interface used to access the functionality provided by the HelloSignals plugin + +var _hello_signals_singleton + +func _init(): + if Engine.has_singleton("HelloSignals"): + _hello_signals_singleton = Engine.get_singleton("HelloSignals") + else: + printerr("Couldn't find HelloSignals singleton") + + +## Register for the tiktok signals emitted +func registerForTikTok(callback: Callable) -> void: + if _hello_signals_singleton: + _hello_signals_singleton.connect("TikTok", callback) + else: + printerr("Unable to register for tiktok") + + +## Start tiktok if not started, otherwise stop it +func toggleTikTok(): + if _hello_signals_singleton: + _hello_signals_singleton.onButtonPressed() + else: + printerr("Unable to toggle tiktok") diff --git a/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg b/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg index 8fb2c37..b32555f 100644 --- a/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg +++ b/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg @@ -4,4 +4,4 @@ name="Hello Signals plugin" description="Showcases how to package a sample Android plugin" author="Fredia Huya-Kouadio" version="" -script="hello_signals_plugin.gd" +script="export/hello_signals_editor_plugin.gd" -- cgit v1.2.3