You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Register editor classes normally, rather than via ClassDB::set_current_api()
This commit is contained in:
@@ -61,10 +61,6 @@ void initialize_fbx_module(ModuleInitializationLevel p_level) {
|
|||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
// Editor-specific API.
|
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
GDREGISTER_CLASS(EditorSceneFormatImporterUFBX);
|
GDREGISTER_CLASS(EditorSceneFormatImporterUFBX);
|
||||||
|
|
||||||
GLOBAL_DEF_RST_BASIC("filesystem/import/fbx2gltf/enabled", true);
|
GLOBAL_DEF_RST_BASIC("filesystem/import/fbx2gltf/enabled", true);
|
||||||
@@ -72,7 +68,6 @@ void initialize_fbx_module(ModuleInitializationLevel p_level) {
|
|||||||
GLOBAL_DEF_RST("filesystem/import/fbx2gltf/enabled.android", false);
|
GLOBAL_DEF_RST("filesystem/import/fbx2gltf/enabled.android", false);
|
||||||
GLOBAL_DEF_RST("filesystem/import/fbx2gltf/enabled.web", false);
|
GLOBAL_DEF_RST("filesystem/import/fbx2gltf/enabled.web", false);
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
EditorNode::add_init_callback(_editor_init);
|
EditorNode::add_init_callback(_editor_init);
|
||||||
}
|
}
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
|
|||||||
@@ -162,12 +162,7 @@ void initialize_gdscript_module(ModuleInitializationLevel p_level) {
|
|||||||
gdscript_translation_parser_plugin.instantiate();
|
gdscript_translation_parser_plugin.instantiate();
|
||||||
EditorTranslationParser::get_singleton()->add_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
|
EditorTranslationParser::get_singleton()->add_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
|
||||||
} else if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
} else if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
GDREGISTER_CLASS(GDScriptSyntaxHighlighter);
|
GDREGISTER_CLASS(GDScriptSyntaxHighlighter);
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
}
|
}
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,10 +135,6 @@ void initialize_gltf_module(ModuleInitializationLevel p_level) {
|
|||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
// Editor-specific API.
|
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
GDREGISTER_CLASS(EditorSceneFormatImporterGLTF);
|
GDREGISTER_CLASS(EditorSceneFormatImporterGLTF);
|
||||||
EditorPlugins::add_by_type<SceneExporterGLTFPlugin>();
|
EditorPlugins::add_by_type<SceneExporterGLTFPlugin>();
|
||||||
|
|
||||||
@@ -149,10 +145,8 @@ void initialize_gltf_module(ModuleInitializationLevel p_level) {
|
|||||||
GLOBAL_DEF_RST("filesystem/import/blender/enabled.android", false);
|
GLOBAL_DEF_RST("filesystem/import/blender/enabled.android", false);
|
||||||
GLOBAL_DEF_RST("filesystem/import/blender/enabled.web", false);
|
GLOBAL_DEF_RST("filesystem/import/blender/enabled.web", false);
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
EditorNode::add_init_callback(_editor_init);
|
EditorNode::add_init_callback(_editor_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,40 +32,31 @@
|
|||||||
|
|
||||||
#include "audio_stream_mp3.h"
|
#include "audio_stream_mp3.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
#include "resource_importer_mp3.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "core/config/engine.h"
|
#include "core/config/engine.h"
|
||||||
#endif
|
#include "editor/editor_node.h"
|
||||||
|
#include "resource_importer_mp3.h"
|
||||||
|
|
||||||
void initialize_minimp3_module(ModuleInitializationLevel p_level) {
|
static void _editor_init() {
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
Ref<ResourceImporterMP3> mp3_import;
|
Ref<ResourceImporterMP3> mp3_import;
|
||||||
mp3_import.instantiate();
|
mp3_import.instantiate();
|
||||||
ResourceFormatImporter::get_singleton()->add_importer(mp3_import);
|
ResourceFormatImporter::get_singleton()->add_importer(mp3_import);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
// Required to document import options in the class reference.
|
|
||||||
GDREGISTER_CLASS(ResourceImporterMP3);
|
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void initialize_minimp3_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
GDREGISTER_CLASS(AudioStreamMP3);
|
GDREGISTER_CLASS(AudioStreamMP3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
|
GDREGISTER_CLASS(ResourceImporterMP3);
|
||||||
|
|
||||||
|
EditorNode::add_init_callback(_editor_init);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void uninitialize_minimp3_module(ModuleInitializationLevel p_level) {
|
void uninitialize_minimp3_module(ModuleInitializationLevel p_level) {
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,21 +225,17 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) {
|
|||||||
openxr_interface->initialize();
|
openxr_interface->initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
// Register as "editor", not "core".
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
GDREGISTER_ABSTRACT_CLASS(OpenXRInteractionProfileEditorBase);
|
GDREGISTER_ABSTRACT_CLASS(OpenXRInteractionProfileEditorBase);
|
||||||
GDREGISTER_CLASS(OpenXRInteractionProfileEditor);
|
GDREGISTER_CLASS(OpenXRInteractionProfileEditor);
|
||||||
GDREGISTER_CLASS(OpenXRBindingModifierEditor);
|
GDREGISTER_CLASS(OpenXRBindingModifierEditor);
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
|
|
||||||
EditorNode::add_init_callback(_editor_init);
|
EditorNode::add_init_callback(_editor_init);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitialize_openxr_module(ModuleInitializationLevel p_level) {
|
void uninitialize_openxr_module(ModuleInitializationLevel p_level) {
|
||||||
|
|||||||
@@ -33,36 +33,30 @@
|
|||||||
#include "audio_stream_ogg_vorbis.h"
|
#include "audio_stream_ogg_vorbis.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
#include "editor/editor_node.h"
|
||||||
#include "resource_importer_ogg_vorbis.h"
|
#include "resource_importer_ogg_vorbis.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
void initialize_vorbis_module(ModuleInitializationLevel p_level) {
|
static void _editor_init() {
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
Ref<ResourceImporterOggVorbis> ogg_vorbis_importer;
|
Ref<ResourceImporterOggVorbis> ogg_vorbis_importer;
|
||||||
ogg_vorbis_importer.instantiate();
|
ogg_vorbis_importer.instantiate();
|
||||||
ResourceFormatImporter::get_singleton()->add_importer(ogg_vorbis_importer);
|
ResourceFormatImporter::get_singleton()->add_importer(ogg_vorbis_importer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
// Required to document import options in the class reference.
|
|
||||||
GDREGISTER_CLASS(ResourceImporterOggVorbis);
|
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void initialize_vorbis_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
GDREGISTER_CLASS(AudioStreamOggVorbis);
|
GDREGISTER_CLASS(AudioStreamOggVorbis);
|
||||||
GDREGISTER_CLASS(AudioStreamPlaybackOggVorbis);
|
GDREGISTER_CLASS(AudioStreamPlaybackOggVorbis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
|
GDREGISTER_CLASS(ResourceImporterOggVorbis);
|
||||||
|
|
||||||
|
EditorNode::add_init_callback(_editor_init);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void uninitialize_vorbis_module(ModuleInitializationLevel p_level) {
|
void uninitialize_vorbis_module(ModuleInitializationLevel p_level) {
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user