2021-11-23 16:53:47 +01:00
|
|
|
/*
|
|
|
|
Copyright (c) 2019-2021 Péter Magyar
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "register_types.h"
|
|
|
|
|
|
|
|
#include "core/version.h"
|
|
|
|
|
|
|
|
#if VERSION_MAJOR > 3
|
|
|
|
#include "core/config/engine.h"
|
|
|
|
#else
|
|
|
|
#include "core/engine.h"
|
|
|
|
#endif
|
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "tiled_wall/tiled_wall_2d.h"
|
|
|
|
#include "tiled_wall/tiled_wall_data_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "props/prop_data_2d.h"
|
|
|
|
#include "props/prop_data_entry_2d.h"
|
|
|
|
#include "props/prop_data_light_2d.h"
|
|
|
|
#include "props/prop_data_prop_2d.h"
|
|
|
|
#include "props/prop_data_scene_2d.h"
|
|
|
|
#include "props/prop_data_tiled_wall_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
|
|
|
#if VERSION_MINOR >= 4
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "props/prop_data_portal_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "clutter/ground_clutter_2d.h"
|
|
|
|
#include "clutter/ground_clutter_foliage_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "prop_ess_entity_2d.h"
|
|
|
|
#include "prop_instance_2d.h"
|
|
|
|
#include "prop_instance_merger_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "prop_instance_job_2d.h"
|
|
|
|
#include "prop_instance_prop_job_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "jobs/prop_mesher_job_step_2d.h"
|
|
|
|
#include "jobs/prop_texture_job_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "prop_scene_instance_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "singleton/prop_cache_2d.h"
|
|
|
|
#include "singleton/prop_utils_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "lights/prop_light_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "./editor/prop_editor_plugin_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "prop_mesher_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "material_cache/prop_material_cache_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
|
|
|
|
#ifdef TEXTURE_PACKER_PRESENT
|
2021-11-23 18:19:01 +01:00
|
|
|
#include "material_cache/prop_material_cache_pcm_2d.h"
|
2021-11-23 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
static PropUtils2D *prop_utils = NULL;
|
|
|
|
static PropCache2D *prop_texture_cache = NULL;
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-23 17:11:38 +01:00
|
|
|
void register_props_2d_types() {
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<TiledWall2D>();
|
|
|
|
ClassDB::register_class<TiledWallData2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropLight2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropData2D>();
|
|
|
|
ClassDB::register_class<PropDataEntry2D>();
|
|
|
|
ClassDB::register_class<PropDataScene2D>();
|
|
|
|
ClassDB::register_class<PropDataLight2D>();
|
|
|
|
ClassDB::register_class<PropDataProp2D>();
|
|
|
|
ClassDB::register_class<PropDataTiledWall2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
|
|
|
#if VERSION_MINOR >= 4
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropDataPortal2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<GroundClutter2D>();
|
|
|
|
ClassDB::register_class<GroundClutterFoliage2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropMesher2D>();
|
|
|
|
ClassDB::register_class<PropMesherJobStep2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropInstance2D>();
|
|
|
|
ClassDB::register_class<PropInstanceMerger2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropESSEntity2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropInstanceJob2D>();
|
|
|
|
ClassDB::register_class<PropInstancePropJob2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropTextureJob2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropSceneInstance2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropMaterialCache2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
|
|
|
|
#ifdef TEXTURE_PACKER_PRESENT
|
2021-11-24 14:00:16 +01:00
|
|
|
ClassDB::register_class<PropMaterialCachePCM2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
prop_utils = memnew(PropUtils2D);
|
|
|
|
ClassDB::register_class<PropUtils2D>();
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("PropUtils2D", PropUtils2D::get_singleton()));
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
prop_texture_cache = memnew(PropCache2D);
|
|
|
|
ClassDB::register_class<PropCache2D>();
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("PropCache2D", PropCache2D::get_singleton()));
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
Ref<PropDataLight2D> light_processor = Ref<PropDataLight2D>(memnew(PropDataLight2D));
|
|
|
|
PropUtils2D::add_processor(light_processor);
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
Ref<PropDataProp2D> prop_processor = Ref<PropDataProp2D>(memnew(PropDataProp2D));
|
|
|
|
PropUtils2D::add_processor(prop_processor);
|
2021-11-23 16:53:47 +01:00
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
Ref<PropDataScene2D> scene_processor = Ref<PropDataScene2D>(memnew(PropDataScene2D));
|
|
|
|
PropUtils2D::add_processor(scene_processor);
|
2021-11-23 16:53:47 +01:00
|
|
|
|
|
|
|
#if VERSION_MINOR >= 4
|
2021-11-24 14:00:16 +01:00
|
|
|
Ref<PropDataPortal2D> portal_processor = Ref<PropDataPortal2D>(memnew(PropDataPortal2D));
|
|
|
|
PropUtils2D::add_processor(portal_processor);
|
2021-11-23 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
|
2021-11-24 14:00:16 +01:00
|
|
|
Ref<PropDataTiledWall2D> tiled_wall_processor = Ref<PropDataTiledWall2D>(memnew(PropDataTiledWall2D));
|
|
|
|
PropUtils2D::add_processor(tiled_wall_processor);
|
2021-11-23 16:53:47 +01:00
|
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
2021-11-24 14:00:16 +01:00
|
|
|
EditorPlugins::add_by_type<PropEditorPlugin2D>();
|
2021-11-23 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-11-23 17:11:38 +01:00
|
|
|
void unregister_props_2d_types() {
|
2021-11-23 16:53:47 +01:00
|
|
|
if (prop_utils) {
|
|
|
|
memdelete(prop_utils);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prop_texture_cache) {
|
|
|
|
memdelete(prop_texture_cache);
|
|
|
|
}
|
|
|
|
}
|