mirror of
https://github.com/Relintai/props.git
synced 2025-02-04 16:05:54 +01:00
Updated register_types.h and cpp to the current godot 4 style.
This commit is contained in:
parent
983090d21a
commit
a0ba4f2cab
@ -24,11 +24,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
|
|
||||||
#if VERSION_MAJOR > 3
|
|
||||||
#include "core/config/engine.h"
|
#include "core/config/engine.h"
|
||||||
#else
|
|
||||||
#include "core/engine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "tiled_wall/tiled_wall.h"
|
#include "tiled_wall/tiled_wall.h"
|
||||||
#include "tiled_wall/tiled_wall_data.h"
|
#include "tiled_wall/tiled_wall_data.h"
|
||||||
@ -77,53 +73,54 @@ SOFTWARE.
|
|||||||
static PropUtils *prop_utils = NULL;
|
static PropUtils *prop_utils = NULL;
|
||||||
static PropCache *prop_texture_cache = NULL;
|
static PropCache *prop_texture_cache = NULL;
|
||||||
|
|
||||||
void register_props_types() {
|
void initialize_props_module(ModuleInitializationLevel p_level) {
|
||||||
ClassDB::register_class<TiledWall>();
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
ClassDB::register_class<TiledWallData>();
|
GDREGISTER_CLASS(TiledWall);
|
||||||
|
GDREGISTER_CLASS(TiledWallData);
|
||||||
|
|
||||||
ClassDB::register_class<PropLight>();
|
GDREGISTER_CLASS(PropLight);
|
||||||
|
|
||||||
ClassDB::register_class<PropData>();
|
GDREGISTER_CLASS(PropData);
|
||||||
ClassDB::register_class<PropDataEntry>();
|
GDREGISTER_CLASS(PropDataEntry);
|
||||||
ClassDB::register_class<PropDataScene>();
|
GDREGISTER_CLASS(PropDataScene);
|
||||||
ClassDB::register_class<PropDataLight>();
|
GDREGISTER_CLASS(PropDataLight);
|
||||||
ClassDB::register_class<PropDataProp>();
|
GDREGISTER_CLASS(PropDataProp);
|
||||||
ClassDB::register_class<PropDataTiledWall>();
|
GDREGISTER_CLASS(PropDataTiledWall);
|
||||||
|
|
||||||
#if VERSION_MINOR >= 4
|
#if VERSION_MINOR >= 4
|
||||||
ClassDB::register_class<PropDataPortal>();
|
GDREGISTER_CLASS(PropDataPortal);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ClassDB::register_class<GroundClutter>();
|
GDREGISTER_CLASS(GroundClutter);
|
||||||
ClassDB::register_class<GroundClutterFoliage>();
|
GDREGISTER_CLASS(GroundClutterFoliage);
|
||||||
|
|
||||||
ClassDB::register_class<PropMesher>();
|
GDREGISTER_CLASS(PropMesher);
|
||||||
ClassDB::register_class<PropMesherJobStep>();
|
GDREGISTER_CLASS(PropMesherJobStep);
|
||||||
|
|
||||||
ClassDB::register_class<PropInstance>();
|
GDREGISTER_CLASS(PropInstance);
|
||||||
ClassDB::register_class<PropInstanceMerger>();
|
GDREGISTER_CLASS(PropInstanceMerger);
|
||||||
|
|
||||||
ClassDB::register_class<PropESSEntity>();
|
GDREGISTER_CLASS(PropESSEntity);
|
||||||
|
|
||||||
ClassDB::register_class<PropInstanceJob>();
|
GDREGISTER_CLASS(PropInstanceJob);
|
||||||
ClassDB::register_class<PropInstancePropJob>();
|
GDREGISTER_CLASS(PropInstancePropJob);
|
||||||
|
|
||||||
ClassDB::register_class<PropTextureJob>();
|
GDREGISTER_CLASS(PropTextureJob);
|
||||||
|
|
||||||
ClassDB::register_class<PropSceneInstance>();
|
GDREGISTER_CLASS(PropSceneInstance);
|
||||||
|
|
||||||
ClassDB::register_class<PropMaterialCache>();
|
GDREGISTER_CLASS(PropMaterialCache);
|
||||||
|
|
||||||
#ifdef TEXTURE_PACKER_PRESENT
|
#ifdef TEXTURE_PACKER_PRESENT
|
||||||
ClassDB::register_class<PropMaterialCachePCM>();
|
GDREGISTER_CLASS(PropMaterialCachePCM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
prop_utils = memnew(PropUtils);
|
prop_utils = memnew(PropUtils);
|
||||||
ClassDB::register_class<PropUtils>();
|
GDREGISTER_CLASS(PropUtils);
|
||||||
Engine::get_singleton()->add_singleton(Engine::Singleton("PropUtils", PropUtils::get_singleton()));
|
Engine::get_singleton()->add_singleton(Engine::Singleton("PropUtils", PropUtils::get_singleton()));
|
||||||
|
|
||||||
prop_texture_cache = memnew(PropCache);
|
prop_texture_cache = memnew(PropCache);
|
||||||
ClassDB::register_class<PropCache>();
|
GDREGISTER_CLASS(PropCache);
|
||||||
Engine::get_singleton()->add_singleton(Engine::Singleton("PropCache", PropCache::get_singleton()));
|
Engine::get_singleton()->add_singleton(Engine::Singleton("PropCache", PropCache::get_singleton()));
|
||||||
|
|
||||||
Ref<PropDataLight> light_processor = Ref<PropDataLight>(memnew(PropDataLight));
|
Ref<PropDataLight> light_processor = Ref<PropDataLight>(memnew(PropDataLight));
|
||||||
@ -142,13 +139,17 @@ void register_props_types() {
|
|||||||
|
|
||||||
Ref<PropDataTiledWall> tiled_wall_processor = Ref<PropDataTiledWall>(memnew(PropDataTiledWall));
|
Ref<PropDataTiledWall> tiled_wall_processor = Ref<PropDataTiledWall>(memnew(PropDataTiledWall));
|
||||||
PropUtils::add_processor(tiled_wall_processor);
|
PropUtils::add_processor(tiled_wall_processor);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
EditorPlugins::add_by_type<PropEditorPlugin>();
|
EditorPlugins::add_by_type<PropEditorPlugin>();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_props_types() {
|
void uninitialize_props_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
if (prop_utils) {
|
if (prop_utils) {
|
||||||
memdelete(prop_utils);
|
memdelete(prop_utils);
|
||||||
}
|
}
|
||||||
@ -156,4 +157,5 @@ void unregister_props_types() {
|
|||||||
if (prop_texture_cache) {
|
if (prop_texture_cache) {
|
||||||
memdelete(prop_texture_cache);
|
memdelete(prop_texture_cache);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,9 @@ SOFTWARE.
|
|||||||
#ifndef PROPS_REGISTER_TYPES_H
|
#ifndef PROPS_REGISTER_TYPES_H
|
||||||
#define PROPS_REGISTER_TYPES_H
|
#define PROPS_REGISTER_TYPES_H
|
||||||
|
|
||||||
void register_props_types();
|
#include "modules/register_module_types.h"
|
||||||
void unregister_props_types();
|
|
||||||
|
void initialize_props_module(ModuleInitializationLevel p_level);
|
||||||
|
void uninitialize_props_module(ModuleInitializationLevel p_level);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user