2021-08-16 17:44:28 +02:00
|
|
|
#include "tiled_wall.h"
|
|
|
|
|
|
|
|
#include "core/version.h"
|
|
|
|
|
|
|
|
#include "scene/resources/texture.h"
|
|
|
|
|
|
|
|
#if VERSION_MAJOR < 4
|
|
|
|
#include "core/image.h"
|
|
|
|
|
|
|
|
#define GET_WORLD get_world
|
|
|
|
#else
|
|
|
|
#include "core/io/image.h"
|
|
|
|
|
|
|
|
#define GET_WORLD get_world_3d
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if TEXTURE_PACKER_PRESENT
|
|
|
|
#include "../../texture_packer/texture_resource/packer_image_resource.h"
|
|
|
|
#endif
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
#include "../material_cache/prop_material_cache.h"
|
|
|
|
#include "../prop_mesher.h"
|
|
|
|
#include "../singleton/prop_cache.h"
|
|
|
|
|
|
|
|
#include "core/core_string_names.h"
|
|
|
|
#include "tiled_wall_data.h"
|
2021-08-16 17:44:28 +02:00
|
|
|
|
|
|
|
int TiledWall::get_width() const {
|
|
|
|
return _width;
|
|
|
|
}
|
|
|
|
void TiledWall::set_width(const int value) {
|
|
|
|
_width = value;
|
2021-08-17 17:41:22 +02:00
|
|
|
|
2021-08-18 16:28:36 +02:00
|
|
|
clear_mesh();
|
2021-08-17 17:41:22 +02:00
|
|
|
generate_mesh();
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
int TiledWall::get_heigth() const {
|
2021-08-16 17:44:28 +02:00
|
|
|
return _height;
|
|
|
|
}
|
2021-08-17 17:41:22 +02:00
|
|
|
void TiledWall::set_heigth(const int value) {
|
2021-08-16 17:44:28 +02:00
|
|
|
_height = value;
|
|
|
|
|
2021-08-18 16:28:36 +02:00
|
|
|
clear_mesh();
|
2021-08-17 17:41:22 +02:00
|
|
|
generate_mesh();
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
Ref<TiledWallData> TiledWall::get_data() {
|
|
|
|
return _data;
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
2021-08-17 17:41:22 +02:00
|
|
|
void TiledWall::set_data(const Ref<TiledWallData> &data) {
|
|
|
|
if (_data.is_valid()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
_data->disconnect(CoreStringNames::get_singleton()->changed, Callable(this, "refresh"));
|
2021-08-17 17:41:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_data = data;
|
|
|
|
|
|
|
|
if (_data.is_valid()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
_data->connect(CoreStringNames::get_singleton()->changed, Callable(this, "refresh"));
|
2021-08-17 17:41:22 +02:00
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
call_deferred("refresh");
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
bool TiledWall::get_collision() const {
|
|
|
|
return _collision;
|
|
|
|
}
|
|
|
|
void TiledWall::set_collision(const int value) {
|
|
|
|
_collision = value;
|
2021-08-18 21:16:58 +02:00
|
|
|
|
2021-08-25 22:29:49 +02:00
|
|
|
/*
|
2021-08-18 21:16:58 +02:00
|
|
|
if (!is_inside_tree()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_collision) {
|
|
|
|
create_colliders();
|
|
|
|
} else {
|
|
|
|
free_colliders();
|
|
|
|
}*/
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-25 22:29:49 +02:00
|
|
|
uint32_t TiledWall::get_collision_layer() const {
|
|
|
|
return _collision_layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TiledWall::set_collision_layer(uint32_t p_layer) {
|
|
|
|
_collision_layer = p_layer;
|
|
|
|
|
|
|
|
if (_physics_body_rid != RID()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->area_set_collision_layer(_physics_body_rid, p_layer);
|
2021-08-25 22:29:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t TiledWall::get_collision_mask() const {
|
|
|
|
return _collision_mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TiledWall::set_collision_mask(uint32_t p_mask) {
|
|
|
|
_collision_mask = p_mask;
|
|
|
|
|
|
|
|
if (_physics_body_rid != RID()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->area_set_collision_mask(_physics_body_rid, p_mask);
|
2021-08-25 22:29:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-16 17:44:28 +02:00
|
|
|
AABB TiledWall::get_aabb() const {
|
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
Vector<Face3> TiledWall::get_faces(uint32_t p_usage_flags) const {
|
|
|
|
Vector<Face3> faces;
|
2021-08-17 17:41:22 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
if (_mesh_array.size() != Mesh::ARRAY_MAX) {
|
|
|
|
return faces;
|
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
Vector<Vector3> vertices = _mesh_array[Mesh::ARRAY_VERTEX];
|
|
|
|
Vector<int> indices = _mesh_array[Mesh::ARRAY_INDEX];
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
int ts = indices.size() / 3;
|
|
|
|
faces.resize(ts);
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
Face3 *w = faces.ptrw();
|
|
|
|
const Vector3 *rv = vertices.ptr();
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
for (int i = 0; i < ts; i++) {
|
|
|
|
int im3 = (i * 3);
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
for (int j = 0; j < 3; j++) {
|
|
|
|
w[i].vertex[j] = rv[indices[im3 + j]];
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
}
|
2021-08-17 18:07:17 +02:00
|
|
|
|
2021-08-16 17:44:28 +02:00
|
|
|
return faces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TiledWall::refresh() {
|
|
|
|
if (!is_inside_tree()) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-17 17:41:22 +02:00
|
|
|
|
|
|
|
clear_mesh();
|
2021-08-25 22:29:49 +02:00
|
|
|
/*
|
2021-08-18 21:16:58 +02:00
|
|
|
if (_physics_shape_rid != RID()) {
|
|
|
|
PhysicsServer::get_singleton()->shape_set_data(_physics_shape_rid, Vector3(_width / 2.0, _height / 2.0, 0.01));
|
2021-08-17 17:41:22 +02:00
|
|
|
|
2021-08-18 21:16:58 +02:00
|
|
|
Transform t = get_global_transform();
|
|
|
|
t.translate(Vector3(_width / 2.0, _height / 2.0, 0));
|
|
|
|
PhysicsServer::get_singleton()->body_set_state(_physics_body_rid, PhysicsServer::BODY_STATE_TRANSFORM, t);
|
|
|
|
}
|
|
|
|
*/
|
2021-08-17 17:41:22 +02:00
|
|
|
if (!_data.is_valid()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-16 17:44:28 +02:00
|
|
|
if (_mesh_rid == RID()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
_mesh_rid = RenderingServer::get_singleton()->mesh_create();
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
RS::get_singleton()->instance_set_base(get_instance(), _mesh_rid);
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
Ref<PropMaterialCache> old_cache;
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
old_cache = _cache;
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
_cache = PropCache::get_singleton()->tiled_wall_material_cache_get(_data);
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
if (old_cache.is_valid() && old_cache != _cache) {
|
|
|
|
PropCache::get_singleton()->tiled_wall_material_cache_unref(old_cache);
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
if (!_cache->get_initialized()) {
|
|
|
|
_cache->mutex_lock();
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
//An anouther thread could have initialized it before wo got the mutex!
|
|
|
|
if (!_cache->get_initialized()) {
|
2021-08-25 17:24:25 +02:00
|
|
|
//can only be called from the main thread!
|
2021-08-18 17:24:48 +02:00
|
|
|
_cache->initial_setup_default();
|
2021-08-18 18:06:09 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
_data->setup_cache(_cache);
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
_cache->refresh_rects();
|
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
_cache->mutex_unlock();
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
2021-08-17 17:41:22 +02:00
|
|
|
|
|
|
|
generate_mesh();
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
void TiledWall::generate_mesh() {
|
|
|
|
if (!_data.is_valid()) {
|
2021-08-16 17:44:28 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
if (!_cache.is_valid()) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-25 22:29:49 +02:00
|
|
|
/*
|
2021-08-18 21:16:58 +02:00
|
|
|
if (_physics_shape_rid != RID()) {
|
|
|
|
PhysicsServer::get_singleton()->shape_set_data(_physics_shape_rid, Vector3(_width / 2.0, _height / 2.0, 0.01));
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-18 21:16:58 +02:00
|
|
|
Transform t = get_global_transform();
|
|
|
|
t.translate(Vector3(_width / 2.0, _height / 2.0, 0));
|
|
|
|
PhysicsServer::get_singleton()->body_set_state(_physics_body_rid, PhysicsServer::BODY_STATE_TRANSFORM, t);
|
|
|
|
}
|
|
|
|
*/
|
2021-08-18 16:07:03 +02:00
|
|
|
_mesher->add_tiled_wall_simple(_width, _height, Transform(), _data, _cache);
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
_mesh_array = _mesher->build_mesh();
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
if (_mesh_array.size() != Mesh::ARRAY_MAX) {
|
2021-08-16 17:44:28 +02:00
|
|
|
return;
|
2021-08-17 17:41:22 +02:00
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
PoolVector<Vector3> vertices = _mesh_array[Mesh::ARRAY_VERTEX];
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
if (vertices.size() == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(_mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, _mesh_array);
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
Ref<Material> material = _cache->material_lod_get(0);
|
|
|
|
|
|
|
|
if (material.is_valid()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
RenderingServer::get_singleton()->mesh_surface_set_material(_mesh_rid, 0, material->get_rid());
|
2021-08-17 18:07:17 +02:00
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 18:07:17 +02:00
|
|
|
_aabb.size = Vector3(_width, _height, 0);
|
2021-08-17 17:41:22 +02:00
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
void TiledWall::clear_mesh() {
|
|
|
|
_mesher->reset();
|
|
|
|
_aabb = AABB();
|
2021-08-17 18:07:17 +02:00
|
|
|
_mesh_array.clear();
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
if (_mesh_rid != RID()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
if (RS::get_singleton()->mesh_get_surface_count(_mesh_rid) > 0)
|
2021-08-17 20:03:57 +02:00
|
|
|
#if VERSION_MAJOR < 4
|
2021-08-17 17:41:22 +02:00
|
|
|
VS::get_singleton()->mesh_remove_surface(_mesh_rid, 0);
|
|
|
|
#else
|
2023-01-09 14:10:10 +01:00
|
|
|
RS::get_singleton()->mesh_clear(_mesh_rid);
|
2021-08-17 17:41:22 +02:00
|
|
|
#endif
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
void TiledWall::free_mesh() {
|
2021-08-16 17:44:28 +02:00
|
|
|
if (_mesh_rid != RID()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
RS::get_singleton()->instance_set_base(get_instance(), RID());
|
|
|
|
RS::get_singleton()->free(_mesh_rid);
|
2021-08-16 17:44:28 +02:00
|
|
|
_mesh_rid = RID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-18 21:16:58 +02:00
|
|
|
void TiledWall::create_colliders() {
|
|
|
|
if (!is_inside_tree()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
free_colliders();
|
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
ERR_FAIL_COND(!get_world_3d().is_valid() && get_world_3d()->get_space() == RID());
|
2021-08-18 21:16:58 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
_physics_shape_rid = PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_BOX);
|
2021-08-18 21:16:58 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->shape_set_data(_physics_shape_rid, Vector3(_width / 2.0, _height / 2.0, 0.01));
|
|
|
|
PhysicsServer3D::get_singleton()->body_add_shape(_physics_body_rid, _physics_shape_rid);
|
2021-08-18 21:16:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TiledWall::free_colliders() {
|
|
|
|
if (_physics_shape_rid != RID()) {
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->free(_physics_shape_rid);
|
2021-08-18 21:16:58 +02:00
|
|
|
|
|
|
|
_physics_shape_rid = RID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-16 17:44:28 +02:00
|
|
|
TiledWall::TiledWall() {
|
|
|
|
_width = 1;
|
|
|
|
_height = 1;
|
2021-08-18 18:06:09 +02:00
|
|
|
_collision = true;
|
2021-08-25 22:29:49 +02:00
|
|
|
_collision_layer = 1;
|
|
|
|
_collision_mask = 1;
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
_physics_body_rid = PhysicsServer3D::get_singleton()->body_create();
|
|
|
|
PhysicsServer3D::get_singleton()->body_set_mode(_physics_body_rid, PhysicsServer3D::BODY_MODE_STATIC);
|
2021-08-25 22:54:00 +02:00
|
|
|
|
2021-08-29 18:55:51 +02:00
|
|
|
#if VERSION_MINOR >= 4
|
2021-08-16 17:44:28 +02:00
|
|
|
//temporary
|
|
|
|
set_portal_mode(PORTAL_MODE_GLOBAL);
|
2021-08-29 18:55:51 +02:00
|
|
|
#endif
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2023-01-09 01:16:33 +01:00
|
|
|
_mesher.instantiate();
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
TiledWall::~TiledWall() {
|
2021-08-17 17:41:22 +02:00
|
|
|
_data.unref();
|
|
|
|
_cache.unref();
|
|
|
|
_mesher.unref();
|
2021-08-25 22:54:00 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->free(_physics_body_rid);
|
2021-08-25 22:54:00 +02:00
|
|
|
|
|
|
|
_physics_body_rid = RID();
|
|
|
|
|
|
|
|
free_mesh();
|
|
|
|
free_colliders();
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TiledWall::_notification(int p_what) {
|
|
|
|
switch (p_what) {
|
2021-08-25 22:54:00 +02:00
|
|
|
case NOTIFICATION_ENTER_WORLD: {
|
|
|
|
Transform t = get_global_transform();
|
2023-01-09 14:10:10 +01:00
|
|
|
t.translate_local(Vector3(_width / 2.0, _height / 2.0, 0));
|
2021-08-25 22:54:00 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->body_set_state(_physics_body_rid, PhysicsServer3D::BODY_STATE_TRANSFORM, t);
|
2021-08-25 22:54:00 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
RID space = get_world_3d()->get_space();
|
|
|
|
PhysicsServer3D::get_singleton()->body_set_space(_physics_body_rid, space);
|
2021-08-18 21:16:58 +02:00
|
|
|
|
2021-08-16 17:44:28 +02:00
|
|
|
refresh();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-08-25 22:54:00 +02:00
|
|
|
case NOTIFICATION_EXIT_WORLD: {
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->body_set_space(_physics_body_rid, RID());
|
2021-08-16 17:44:28 +02:00
|
|
|
break;
|
2021-08-17 17:41:22 +02:00
|
|
|
}
|
2021-08-25 22:54:00 +02:00
|
|
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
|
|
|
if (_collision) {
|
2021-08-18 21:16:58 +02:00
|
|
|
Transform t = get_global_transform();
|
2023-01-09 14:10:10 +01:00
|
|
|
t.translate_local(Vector3(_width / 2.0, _height / 2.0, 0));
|
2021-08-18 21:16:58 +02:00
|
|
|
|
2023-01-09 14:10:10 +01:00
|
|
|
PhysicsServer3D::get_singleton()->body_set_state(_physics_body_rid, PhysicsServer3D::BODY_STATE_TRANSFORM, t);
|
2021-08-18 21:16:58 +02:00
|
|
|
}
|
2021-08-25 22:54:00 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TiledWall::_bind_methods() {
|
|
|
|
ClassDB::bind_method(D_METHOD("get_width"), &TiledWall::get_width);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_width", "value"), &TiledWall::set_width);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "width"), "set_width", "get_width");
|
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_heigth"), &TiledWall::get_heigth);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_heigth", "value"), &TiledWall::set_heigth);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "heigth"), "set_heigth", "get_heigth");
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-17 17:41:22 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_data"), &TiledWall::get_data);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_data", "value"), &TiledWall::set_data);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "TiledWallData"), "set_data", "get_data");
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-18 16:09:56 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_collision"), &TiledWall::get_collision);
|
2021-08-17 17:41:22 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("set_collision", "value"), &TiledWall::set_collision);
|
2021-08-18 16:09:56 +02:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collision"), "set_collision", "get_collision");
|
2021-08-16 17:44:28 +02:00
|
|
|
|
2021-08-25 22:29:49 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_collision_layer"), &TiledWall::get_collision_layer);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_collision_layer", "value"), &TiledWall::set_collision_layer);
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_collision_mask"), &TiledWall::get_collision_mask);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_collision_mask", "value"), &TiledWall::set_collision_mask);
|
|
|
|
|
|
|
|
ADD_GROUP("Collision", "collision_");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
|
|
|
|
|
2021-08-16 17:44:28 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("refresh"), &TiledWall::refresh);
|
2021-08-17 17:41:22 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("generate_mesh"), &TiledWall::generate_mesh);
|
|
|
|
ClassDB::bind_method(D_METHOD("clear_mesh"), &TiledWall::clear_mesh);
|
|
|
|
ClassDB::bind_method(D_METHOD("free_mesh"), &TiledWall::free_mesh);
|
2021-08-18 21:16:58 +02:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("create_colliders"), &TiledWall::create_colliders);
|
|
|
|
ClassDB::bind_method(D_METHOD("free_colliders"), &TiledWall::free_colliders);
|
2021-08-16 17:44:28 +02:00
|
|
|
}
|