Skip to content

Commit

Permalink
Port EditorExportPlugin from GDScript to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofama committed Aug 30, 2023
1 parent bbd1d75 commit 6a638c1
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 50 deletions.
51 changes: 1 addition & 50 deletions addons/Wwise/editor/ak_build_export.gd
Original file line number Diff line number Diff line change
@@ -1,51 +1,2 @@
class AkBuildExport:
extends EditorExportPlugin

func _get_name() -> String:
return "AkBuildExport"

func _export_file(path: String, type: String, features: PackedStringArray):
var base_path: String = ProjectSettings.get_setting("wwise/common_user_settings/base_path")
if !base_path.is_empty():
for i in features.size():
if path.findn(base_path) != -1:
if features[i] == "windows":
if (
path.findn("Linux") != -1
|| path.findn("Mac") != -1
|| path.findn("Android") != -1
|| path.findn("iOS") != -1
):
skip()
if features[i] == "macos":
if (
path.findn("Windows") != -1
|| path.findn("Linux") != -1
|| path.findn("Android") != -1
|| path.findn("iOS") != -1
):
skip()
if features[i] == "linux":
if (
path.findn("Windows") != -1
|| path.findn("Mac") != -1
|| path.findn("Android") != -1
|| path.findn("iOS") != -1
):
skip()
if features[i] == "android":
if (
path.findn("Windows") != -1
|| path.findn("Mac") != -1
|| path.findn("Linux") != -1
|| path.findn("iOS") != -1
):
skip()
if features[i] == "ios":
if (
path.findn("Windows") != -1
|| path.findn("Mac") != -1
|| path.findn("Linux") != -1
|| path.findn("Android") != -1
):
skip()
extends AkEditorExportPlugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#ifndef AK_EDITOR_EXPORT_PLUGIN
#define AK_EDITOR_EXPORT_PLUGIN

#include <godot_cpp/classes/editor_export_plugin.hpp>
#include <godot_cpp/classes/project_settings.hpp>

namespace godot
{
class AkEditorExportPlugin : public EditorExportPlugin
{
GDCLASS(AkEditorExportPlugin, EditorExportPlugin);

protected:
static void _bind_methods() {}

private:
public:
virtual String _get_name() const override { return "AkEditorExportPlugin"; }
virtual void _export_file(const String& path, const String& type, const PackedStringArray& features) override
{
String base_path = ProjectSettings::get_singleton()->get_setting("wwise/common_user_settings/base_path");

if (!base_path.is_empty())
{
for (int i = 0; i < features.size(); ++i)
{
if (path.findn(base_path) != -1)
{
if (features[i] == "windows")
{
if (path.findn("Linux") != -1 || path.findn("Mac") != -1 || path.findn("Android") != -1 ||
path.findn("iOS") != -1)
{
skip();
}
}
else if (features[i] == "macos")
{
if (path.findn("Windows") != -1 || path.findn("Linux") != -1 || path.findn("Android") != -1 ||
path.findn("iOS") != -1)
{
skip();
}
}
else if (features[i] == "linux")
{
if (path.findn("Windows") != -1 || path.findn("Mac") != -1 || path.findn("Android") != -1 ||
path.findn("iOS") != -1)
{
skip();
}
}
else if (features[i] == "android")
{
if (path.findn("Windows") != -1 || path.findn("Mac") != -1 || path.findn("Linux") != -1 ||
path.findn("iOS") != -1)
{
skip();
}
}
else if (features[i] == "ios")
{
if (path.findn("Windows") != -1 || path.findn("Mac") != -1 || path.findn("Linux") != -1 ||
path.findn("Android") != -1)
{
skip();
}
}
}
}
}
}
};

} //namespace godot

#endif

0 comments on commit 6a638c1

Please sign in to comment.