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

This commit is contained in:
Relintai 2023-01-08 15:55:50 +01:00
parent a062d871d4
commit 1b9fb57a73
2 changed files with 27 additions and 16 deletions

View File

@ -45,31 +45,35 @@ SOFTWARE.
#include "props_2d/prop_2d_data_mesh_data.h" #include "props_2d/prop_2d_data_mesh_data.h"
#endif #endif
void register_mesh_data_resource_types() { void initialize_mesh_data_resource_module(ModuleInitializationLevel p_level) {
ClassDB::register_class<MeshDataResource>(); if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
ClassDB::register_class<MeshDataResourceCollection>(); GDREGISTER_CLASS(MeshDataResource);
GDREGISTER_CLASS(MeshDataResourceCollection);
ClassDB::register_class<MeshDataInstance>(); GDREGISTER_CLASS(MeshDataInstance);
ClassDB::register_class<MeshDataInstance2D>(); GDREGISTER_CLASS(MeshDataInstance2D);
#if PROPS_PRESENT #if PROPS_PRESENT
ClassDB::register_class<PropDataMeshData>(); GDREGISTER_CLASS(PropDataMeshData);
Ref<PropDataMeshData> processor = Ref<PropDataMeshData>(memnew(PropDataMeshData)); Ref<PropDataMeshData> processor = Ref<PropDataMeshData>(memnew(PropDataMeshData));
PropUtils::add_processor(processor); PropUtils::add_processor(processor);
#endif #endif
#if PROPS_2D_PRESENT #if PROPS_2D_PRESENT
ClassDB::register_class<Prop2DDataMeshData>(); GDREGISTER_CLASS(Prop2DDataMeshData);
Ref<Prop2DDataMeshData> prop_2d_processor = Ref<Prop2DDataMeshData>(memnew(Prop2DDataMeshData)); Ref<Prop2DDataMeshData> prop_2d_processor = Ref<Prop2DDataMeshData>(memnew(Prop2DDataMeshData));
Prop2DUtils::add_processor(prop_2d_processor); Prop2DUtils::add_processor(prop_2d_processor);
#endif #endif
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<EditorPluginColladaMdr>(); if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<EditorPluginColladaMdr>();
EditorPlugins::add_by_type<EditorPluginGLTFMdr>(); EditorPlugins::add_by_type<EditorPluginGLTFMdr>();
}
#endif #endif
} }
void unregister_mesh_data_resource_types() { void initialize_mesh_data_resource_module(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. SOFTWARE.
*/ */
void register_mesh_data_resource_types(); #ifndef MESH_DATA_RESOURCE_REGISTER_TYPES_H
void unregister_mesh_data_resource_types(); #define MESH_DATA_RESOURCE_REGISTER_TYPES_H
#include "modules/register_module_types.h"
void initialize_mesh_data_resource_module(ModuleInitializationLevel p_level);
void uninitialize_mesh_data_resource_module(ModuleInitializationLevel p_level);
#endif