Registered the tilemap data classes and started fixing the new errors.

This commit is contained in:
Relintai 2021-12-11 11:50:06 +01:00
parent cc798a101b
commit fd650f9d17
6 changed files with 36 additions and 20 deletions

2
SCsub
View File

@ -3,6 +3,8 @@ Import('env')
env.add_source_files(env.modules_sources,"register_types.cpp") env.add_source_files(env.modules_sources,"register_types.cpp")
env.add_source_files(env.modules_sources,"vector3i.cpp") env.add_source_files(env.modules_sources,"vector3i.cpp")
env.add_source_files(env.modules_sources,"polypartition.cpp") env.add_source_files(env.modules_sources,"polypartition.cpp")
env.add_source_files(env.modules_sources,"geometry_2d.cpp")
env.add_source_files(env.modules_sources,"array_lt_op.cpp")
env.add_source_files(env.modules_sources,"rtile_set.cpp") env.add_source_files(env.modules_sources,"rtile_set.cpp")
#if env["tools"]: #if env["tools"]:

20
array_lt_op.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "array_lt_op.h"
bool operator<(const Array &p_array_a, const Array &p_array_b) {
int a_len = p_array_a.size();
int b_len = p_array_b.size();
int min_cmp = MIN(a_len, b_len);
for (int i = 0; i < min_cmp; i++) {
if (p_array_a.operator[](i) < p_array_b[i]) {
return true;
} else if (p_array_b[i] < p_array_a.operator[](i)) {
return false;
}
}
return a_len < b_len;
}

View File

@ -6,22 +6,6 @@
#include "core/math/math_defs.h" #include "core/math/math_defs.h"
#include "core/variant.h" #include "core/variant.h"
bool operator<(const Array &p_array_a, const Array &p_array_b) { bool operator<(const Array &p_array_a, const Array &p_array_b);
int a_len = p_array_a.size();
int b_len = p_array_b.size();
int min_cmp = MIN(a_len, b_len);
for (int i = 0; i < min_cmp; i++) {
if (p_array_a.operator[](i) < p_array_b[i]) {
return true;
} else if (p_array_b[i] < p_array_a.operator[](i)) {
return false;
}
}
return a_len < b_len;
}
#endif #endif

View File

@ -31,9 +31,9 @@
#include "geometry_2d.h" #include "geometry_2d.h"
#include "thirdparty/misc/clipper.hpp" #include "thirdparty/misc/clipper.hpp"
#include "thirdparty/misc/polypartition.h" #include "polypartition.h"
#define STB_RECT_PACK_IMPLEMENTATION #define STB_RECT_PACK_IMPLEMENTATION
#include "stb_rect_pack.h" #include "thirdparty/stb_rect_pack/stb_rect_pack.h"
#define SCALE_FACTOR 100000.0 // Based on CMP_EPSILON. #define SCALE_FACTOR 100000.0 // Based on CMP_EPSILON.

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "register_types.h" #include "register_types.h"
#include "rtile_set.h"
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
#endif #endif
@ -29,6 +31,13 @@ void register_rtile_map_types() {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
// EditorPlugins::add_by_type<ModuleSkeletonEditorPlugin>(); // EditorPlugins::add_by_type<ModuleSkeletonEditorPlugin>();
#endif #endif
ClassDB::register_class<RTileMapPattern>();
ClassDB::register_class<RTileSet>();
ClassDB::register_virtual_class<RTileSetSource>();
ClassDB::register_class<RTileSetAtlasSource>();
ClassDB::register_class<RTileSetScenesCollectionSource>();
ClassDB::register_class<RTileData>();
} }
void unregister_rtile_map_types() { void unregister_rtile_map_types() {

View File

@ -31,7 +31,6 @@
#ifndef RTILE_SET_H #ifndef RTILE_SET_H
#define RTILE_SET_H #define RTILE_SET_H
#include "array_lt_op.h"
#include "core/resource.h" #include "core/resource.h"
#include "core/object.h" #include "core/object.h"
#include "core/vector.h" #include "core/vector.h"
@ -53,6 +52,8 @@
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
#endif #endif
#include "array_lt_op.h"
class RTileMap; class RTileMap;
struct RTileMapQuadrant; struct RTileMapQuadrant;
class RTileSetSource; class RTileSetSource;