From eb5cd105fb60ef1085a14e913a99b811de1fde57 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 8 Jan 2023 15:55:44 +0100 Subject: [PATCH] Updated register_types.h and cpp to the current godot 4 style. --- register_types.cpp | 20 +++++++++++++------- register_types.h | 11 +++++++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/register_types.cpp b/register_types.cpp index 1409948..915820b 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "register_types.h" +#include "core/object/class_db.h" + #include "texture_merger.h" #include "texture_packer.h" @@ -35,18 +37,22 @@ SOFTWARE. #include "texture_resource/editor_plugin_packer_image_resource.h" #endif -void register_texture_packer_types() { - ClassDB::register_class(); - ClassDB::register_class(); +void register_texture_packer_types(ModuleInitializationLevel p_level) { + if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { + GDREGISTER_CLASS(TexturePacker); + GDREGISTER_CLASS(TextureMerger); - ClassDB::register_class(); + GDREGISTER_CLASS(PackerImageResource); - ClassDB::register_class(); + GDREGISTER_CLASS(TextureLayerMerger); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } -void unregister_texture_packer_types() { +void unregister_texture_packer_types(ModuleInitializationLevel p_level) { } diff --git a/register_types.h b/register_types.h index 58c8440..9063d1c 100644 --- a/register_types.h +++ b/register_types.h @@ -20,5 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -void register_texture_packer_types(); -void unregister_texture_packer_types(); +#ifndef TEXTURE_PACKER_REGISTER_TYPES_H +#define TEXTURE_PACKER_REGISTER_TYPES_H + +#include "modules/register_module_types.h" + +void initialize_texture_packer_module(ModuleInitializationLevel p_level); +void uninitialize_texture_packer_module(ModuleInitializationLevel p_level); + +#endif \ No newline at end of file