mirror of
https://github.com/Relintai/props.git
synced 2024-11-12 10:15:25 +01:00
Added the PropUtils singleton. Removed PropMeshUtils.
This commit is contained in:
parent
6c8391ea17
commit
e274c2d4f6
4
SCsub
4
SCsub
@ -26,11 +26,11 @@ sources = [
|
|||||||
"clutter/ground_clutter.cpp",
|
"clutter/ground_clutter.cpp",
|
||||||
"clutter/ground_clutter_foliage.cpp",
|
"clutter/ground_clutter_foliage.cpp",
|
||||||
|
|
||||||
"prop_mesh_utils.cpp",
|
|
||||||
|
|
||||||
"prop_instance.cpp",
|
"prop_instance.cpp",
|
||||||
"prop_ess_entity.cpp",
|
"prop_ess_entity.cpp",
|
||||||
"prop_instance_job.cpp",
|
"prop_instance_job.cpp",
|
||||||
|
|
||||||
|
"singleton/prop_utils.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#include "prop_mesh_utils.h"
|
|
||||||
|
|
||||||
PropMeshUtils::PropMeshUtils() {
|
|
||||||
}
|
|
||||||
PropMeshUtils::~PropMeshUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropMeshUtils::_bind_methods() {
|
|
||||||
}
|
|
@ -33,13 +33,16 @@ SOFTWARE.
|
|||||||
#include "clutter/ground_clutter.h"
|
#include "clutter/ground_clutter.h"
|
||||||
#include "clutter/ground_clutter_foliage.h"
|
#include "clutter/ground_clutter_foliage.h"
|
||||||
|
|
||||||
#include "prop_mesh_utils.h"
|
|
||||||
|
|
||||||
#include "prop_ess_entity.h"
|
#include "prop_ess_entity.h"
|
||||||
#include "prop_instance.h"
|
#include "prop_instance.h"
|
||||||
|
|
||||||
#include "prop_instance_job.h"
|
#include "prop_instance_job.h"
|
||||||
|
|
||||||
|
#include "core/engine.h"
|
||||||
|
#include "singleton/prop_utils.h"
|
||||||
|
|
||||||
|
static PropUtils *prop_utils = NULL;
|
||||||
|
|
||||||
void register_props_types() {
|
void register_props_types() {
|
||||||
ClassDB::register_class<PropData>();
|
ClassDB::register_class<PropData>();
|
||||||
ClassDB::register_class<PropDataEntry>();
|
ClassDB::register_class<PropDataEntry>();
|
||||||
@ -52,14 +55,19 @@ void register_props_types() {
|
|||||||
ClassDB::register_class<GroundClutter>();
|
ClassDB::register_class<GroundClutter>();
|
||||||
ClassDB::register_class<GroundClutterFoliage>();
|
ClassDB::register_class<GroundClutterFoliage>();
|
||||||
|
|
||||||
ClassDB::register_class<PropMeshUtils>();
|
|
||||||
|
|
||||||
ClassDB::register_class<PropInstance>();
|
ClassDB::register_class<PropInstance>();
|
||||||
|
|
||||||
ClassDB::register_class<PropESSEntity>();
|
ClassDB::register_class<PropESSEntity>();
|
||||||
|
|
||||||
ClassDB::register_class<PropInstanceJob>();
|
ClassDB::register_class<PropInstanceJob>();
|
||||||
|
|
||||||
|
prop_utils = memnew(PropUtils);
|
||||||
|
ClassDB::register_class<PropUtils>();
|
||||||
|
Engine::get_singleton()->add_singleton(Engine::Singleton("PropUtils", PropUtils::get_singleton()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_props_types() {
|
void unregister_props_types() {
|
||||||
|
if (prop_utils) {
|
||||||
|
memdelete(prop_utils);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
40
singleton/prop_utils.cpp
Normal file
40
singleton/prop_utils.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2020 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 "prop_utils.h"
|
||||||
|
|
||||||
|
PropUtils *PropUtils::_instance;
|
||||||
|
|
||||||
|
PropUtils *PropUtils::get_singleton() {
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropUtils::PropUtils() {
|
||||||
|
_instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropUtils::~PropUtils() {
|
||||||
|
_instance = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropUtils::_bind_methods() {
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2020 Péter Magyar
|
Copyright (c) 2019-2020 Péter Magyar
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -20,22 +20,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PROP_MESH_UTILS_H
|
#ifndef PROP_UTILS_H
|
||||||
#define PROP_MESH_UTILS_H
|
#define PROP_UTILS_H
|
||||||
|
|
||||||
#include "core/reference.h"
|
#include "core/object.h"
|
||||||
|
|
||||||
#include "core/math/vector3.h"
|
class PropUtils : public Object {
|
||||||
|
GDCLASS(PropUtils, Object);
|
||||||
class PropMeshUtils : public Reference {
|
|
||||||
GDCLASS(PropMeshUtils, Reference);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PropMeshUtils();
|
static PropUtils *get_singleton();
|
||||||
~PropMeshUtils();
|
|
||||||
|
PropUtils();
|
||||||
|
~PropUtils();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static PropUtils *_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user