Updated register_types.h and cpp to the current godot 4 style.

This commit is contained in:
Relintai 2023-01-08 15:55:44 +01:00
parent ae4d222fba
commit eb5cd105fb
2 changed files with 22 additions and 9 deletions

View File

@ -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<TexturePacker>();
ClassDB::register_class<TextureMerger>();
void register_texture_packer_types(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
GDREGISTER_CLASS(TexturePacker);
GDREGISTER_CLASS(TextureMerger);
ClassDB::register_class<PackerImageResource>();
GDREGISTER_CLASS(PackerImageResource);
ClassDB::register_class<TextureLayerMerger>();
GDREGISTER_CLASS(TextureLayerMerger);
}
#ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<EditorPluginPackerImageResource>();
}
#endif
}
void unregister_texture_packer_types() {
void unregister_texture_packer_types(ModuleInitializationLevel p_level) {
}

View File

@ -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