Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Code cleanup for the export logic #118

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change history for the Godot OpenXR loaders asset

## 2.0.4
- Fix misc crash when reloading project on Godot 4.3
- Fix issue with only the first permission being requested

## 2.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ void KhronosEditorPlugin::_bind_methods() {}

void KhronosEditorPlugin::_enter_tree() {
// Initialize the editor export plugin
khronos_export_plugin = memnew(KhronosEditorExportPlugin);
khronos_export_plugin.instantiate();
add_export_plugin(khronos_export_plugin);
}

void KhronosEditorPlugin::_exit_tree() {
// Clean up the editor export plugin
remove_export_plugin(khronos_export_plugin);

memfree(khronos_export_plugin);
khronos_export_plugin = nullptr;
khronos_export_plugin.unref();
}

KhronosEditorExportPlugin::KhronosEditorExportPlugin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ class KhronosEditorPlugin : public EditorPlugin {
static void _bind_methods();

private:
KhronosEditorExportPlugin *khronos_export_plugin = nullptr;
Ref<KhronosEditorExportPlugin> khronos_export_plugin;
};
5 changes: 2 additions & 3 deletions godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void LynxEditorPlugin::_bind_methods() {}

void LynxEditorPlugin::_enter_tree() {
// Initialize the editor export plugin
lynx_export_plugin = memnew(OpenXREditorExportPlugin);
lynx_export_plugin.instantiate();
lynx_export_plugin->set_vendor_name(LYNX_VENDOR_NAME);
add_export_plugin(lynx_export_plugin);
}
Expand All @@ -44,6 +44,5 @@ void LynxEditorPlugin::_exit_tree() {
// Clean up the editor export plugin
remove_export_plugin(lynx_export_plugin);

memfree(lynx_export_plugin);
lynx_export_plugin = nullptr;
lynx_export_plugin.unref();
}
2 changes: 1 addition & 1 deletion godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ class LynxEditorPlugin : public EditorPlugin {
static void _bind_methods();

private:
OpenXREditorExportPlugin *lynx_export_plugin = nullptr;
Ref<OpenXREditorExportPlugin> lynx_export_plugin;
};
5 changes: 2 additions & 3 deletions godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ void MetaEditorPlugin::_bind_methods() {}

void MetaEditorPlugin::_enter_tree() {
// Initialize the editor export plugin
meta_export_plugin = memnew(MetaEditorExportPlugin);
meta_export_plugin.instantiate();
add_export_plugin(meta_export_plugin);
}

void MetaEditorPlugin::_exit_tree() {
// Clean up the editor export plugin
remove_export_plugin(meta_export_plugin);

memfree(meta_export_plugin);
meta_export_plugin = nullptr;
meta_export_plugin.unref();
}

MetaEditorExportPlugin::MetaEditorExportPlugin() {
Expand Down
3 changes: 1 addition & 2 deletions godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,5 @@ class MetaEditorPlugin : public EditorPlugin {
static void _bind_methods();

private:
MetaEditorExportPlugin *meta_export_plugin = nullptr;

Ref<MetaEditorExportPlugin> meta_export_plugin;
};
5 changes: 2 additions & 3 deletions godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void PicoEditorPlugin::_bind_methods() {}

void PicoEditorPlugin::_enter_tree() {
// Initialize the editor export plugin
pico_export_plugin = memnew(OpenXREditorExportPlugin);
pico_export_plugin.instantiate();
pico_export_plugin->set_vendor_name(PICO_VENDOR_NAME);
add_export_plugin(pico_export_plugin);
}
Expand All @@ -44,6 +44,5 @@ void PicoEditorPlugin::_exit_tree() {
// Clean up the editor export plugin
remove_export_plugin(pico_export_plugin);

memfree(pico_export_plugin);
pico_export_plugin = nullptr;
pico_export_plugin.unref();
}
2 changes: 1 addition & 1 deletion godotopenxrpico/src/main/cpp/export/pico_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ class PicoEditorPlugin : public EditorPlugin {
static void _bind_methods();

private:
OpenXREditorExportPlugin *pico_export_plugin = nullptr;
Ref<OpenXREditorExportPlugin> pico_export_plugin;
};
Loading