2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* tile_set.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2020-01-01 10:16:22 +00:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 01:10:30 +00:00
|
|
|
/* */
|
|
|
|
/* 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. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "tile_set.h"
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/array.h"
|
2019-03-04 02:05:43 +00:00
|
|
|
#include "core/engine.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
String n = p_name;
|
|
|
|
int slash = n.find("/");
|
2017-03-05 15:44:50 +00:00
|
|
|
if (slash == -1)
|
2014-02-10 01:10:30 +00:00
|
|
|
return false;
|
2017-03-05 15:44:50 +00:00
|
|
|
int id = String::to_int(n.c_str(), slash);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
if (!tile_map.has(id))
|
|
|
|
create_tile(id);
|
2017-03-05 15:44:50 +00:00
|
|
|
String what = n.substr(slash + 1, n.length());
|
|
|
|
|
|
|
|
if (what == "name")
|
|
|
|
tile_set_name(id, p_value);
|
|
|
|
else if (what == "texture")
|
|
|
|
tile_set_texture(id, p_value);
|
2017-06-22 15:15:50 +00:00
|
|
|
else if (what == "normal_map")
|
|
|
|
tile_set_normal_map(id, p_value);
|
2017-03-05 15:44:50 +00:00
|
|
|
else if (what == "tex_offset")
|
|
|
|
tile_set_texture_offset(id, p_value);
|
|
|
|
else if (what == "material")
|
|
|
|
tile_set_material(id, p_value);
|
|
|
|
else if (what == "modulate")
|
|
|
|
tile_set_modulate(id, p_value);
|
|
|
|
else if (what == "region")
|
|
|
|
tile_set_region(id, p_value);
|
2018-02-17 11:08:44 +00:00
|
|
|
else if (what == "tile_mode")
|
|
|
|
tile_set_tile_mode(id, (TileMode)((int)p_value));
|
2018-08-25 01:56:03 +00:00
|
|
|
else if (what == "is_autotile") {
|
|
|
|
// backward compatibility for Godot 3.0.x
|
|
|
|
// autotile used to be a bool, it's now an enum
|
|
|
|
bool is_autotile = p_value;
|
|
|
|
if (is_autotile)
|
|
|
|
tile_set_tile_mode(id, AUTO_TILE);
|
|
|
|
} else if (what.left(9) == "autotile/") {
|
2017-10-22 01:42:23 +00:00
|
|
|
what = what.right(9);
|
|
|
|
if (what == "bitmask_mode")
|
|
|
|
autotile_set_bitmask_mode(id, (BitmaskMode)((int)p_value));
|
|
|
|
else if (what == "icon_coordinate")
|
|
|
|
autotile_set_icon_coordinate(id, p_value);
|
|
|
|
else if (what == "tile_size")
|
|
|
|
autotile_set_size(id, p_value);
|
|
|
|
else if (what == "spacing")
|
|
|
|
autotile_set_spacing(id, p_value);
|
|
|
|
else if (what == "bitmask_flags") {
|
|
|
|
tile_map[id].autotile_data.flags.clear();
|
|
|
|
if (p_value.is_array()) {
|
|
|
|
Array p = p_value;
|
|
|
|
Vector2 last_coord;
|
|
|
|
while (p.size() > 0) {
|
|
|
|
if (p[0].get_type() == Variant::VECTOR2) {
|
|
|
|
last_coord = p[0];
|
|
|
|
} else if (p[0].get_type() == Variant::INT) {
|
|
|
|
autotile_set_bitmask(id, last_coord, p[0]);
|
|
|
|
}
|
|
|
|
p.pop_front();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (what == "occluder_map") {
|
2017-12-08 19:38:36 +00:00
|
|
|
tile_map[id].autotile_data.occluder_map.clear();
|
2017-10-22 01:42:23 +00:00
|
|
|
Array p = p_value;
|
|
|
|
Vector2 last_coord;
|
|
|
|
while (p.size() > 0) {
|
|
|
|
if (p[0].get_type() == Variant::VECTOR2) {
|
|
|
|
last_coord = p[0];
|
|
|
|
} else if (p[0].get_type() == Variant::OBJECT) {
|
|
|
|
autotile_set_light_occluder(id, p[0], last_coord);
|
|
|
|
}
|
|
|
|
p.pop_front();
|
|
|
|
}
|
|
|
|
} else if (what == "navpoly_map") {
|
|
|
|
tile_map[id].autotile_data.navpoly_map.clear();
|
|
|
|
Array p = p_value;
|
|
|
|
Vector2 last_coord;
|
|
|
|
while (p.size() > 0) {
|
|
|
|
if (p[0].get_type() == Variant::VECTOR2) {
|
|
|
|
last_coord = p[0];
|
|
|
|
} else if (p[0].get_type() == Variant::OBJECT) {
|
|
|
|
autotile_set_navigation_polygon(id, p[0], last_coord);
|
|
|
|
}
|
|
|
|
p.pop_front();
|
|
|
|
}
|
|
|
|
} else if (what == "priority_map") {
|
|
|
|
tile_map[id].autotile_data.priority_map.clear();
|
|
|
|
Array p = p_value;
|
|
|
|
Vector3 val;
|
|
|
|
Vector2 v;
|
|
|
|
int priority;
|
|
|
|
while (p.size() > 0) {
|
|
|
|
val = p[0];
|
|
|
|
if (val.z > 1) {
|
|
|
|
v.x = val.x;
|
|
|
|
v.y = val.y;
|
|
|
|
priority = (int)val.z;
|
|
|
|
tile_map[id].autotile_data.priority_map[v] = priority;
|
|
|
|
}
|
|
|
|
p.pop_front();
|
|
|
|
}
|
2018-07-02 13:39:39 +00:00
|
|
|
} else if (what == "z_index_map") {
|
|
|
|
tile_map[id].autotile_data.z_index_map.clear();
|
|
|
|
Array p = p_value;
|
|
|
|
Vector3 val;
|
|
|
|
Vector2 v;
|
|
|
|
int z_index;
|
|
|
|
while (p.size() > 0) {
|
|
|
|
val = p[0];
|
2018-12-08 00:00:54 +00:00
|
|
|
if (val.z != 0) {
|
2018-07-02 13:39:39 +00:00
|
|
|
v.x = val.x;
|
|
|
|
v.y = val.y;
|
|
|
|
z_index = (int)val.z;
|
|
|
|
tile_map[id].autotile_data.z_index_map[v] = z_index;
|
|
|
|
}
|
|
|
|
p.pop_front();
|
|
|
|
}
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
} else if (what == "shape")
|
2019-11-08 16:57:51 +00:00
|
|
|
if (tile_get_shape_count(id) > 0) {
|
|
|
|
for (int i = 0; i < tile_get_shape_count(id); i++) {
|
|
|
|
tile_set_shape(id, i, p_value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tile_set_shape(id, 0, p_value);
|
|
|
|
}
|
2017-11-13 07:42:49 +00:00
|
|
|
else if (what == "shape_offset")
|
2019-11-08 16:57:51 +00:00
|
|
|
if (tile_get_shape_count(id) > 0) {
|
|
|
|
for (int i = 0; i < tile_get_shape_count(id); i++) {
|
|
|
|
tile_set_shape_offset(id, i, p_value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tile_set_shape_offset(id, 0, p_value);
|
|
|
|
}
|
2017-11-13 07:42:49 +00:00
|
|
|
else if (what == "shape_transform")
|
2019-11-08 16:57:51 +00:00
|
|
|
if (tile_get_shape_count(id) > 0) {
|
|
|
|
for (int i = 0; i < tile_get_shape_count(id); i++) {
|
|
|
|
tile_set_shape_transform(id, i, p_value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tile_set_shape_transform(id, 0, p_value);
|
|
|
|
}
|
2017-06-25 18:47:30 +00:00
|
|
|
else if (what == "shape_one_way")
|
2019-11-08 16:57:51 +00:00
|
|
|
if (tile_get_shape_count(id) > 0) {
|
|
|
|
for (int i = 0; i < tile_get_shape_count(id); i++) {
|
|
|
|
tile_set_shape_one_way(id, i, p_value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tile_set_shape_one_way(id, 0, p_value);
|
|
|
|
}
|
2019-01-18 17:15:05 +00:00
|
|
|
else if (what == "shape_one_way_margin")
|
2019-11-08 16:57:51 +00:00
|
|
|
if (tile_get_shape_count(id) > 0) {
|
|
|
|
for (int i = 0; i < tile_get_shape_count(id); i++) {
|
|
|
|
tile_set_shape_one_way_margin(id, i, p_value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tile_set_shape_one_way_margin(id, 0, p_value);
|
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
else if (what == "shapes")
|
|
|
|
_tile_set_shapes(id, p_value);
|
|
|
|
else if (what == "occluder")
|
|
|
|
tile_set_light_occluder(id, p_value);
|
|
|
|
else if (what == "occluder_offset")
|
|
|
|
tile_set_occluder_offset(id, p_value);
|
|
|
|
else if (what == "navigation")
|
|
|
|
tile_set_navigation_polygon(id, p_value);
|
|
|
|
else if (what == "navigation_offset")
|
|
|
|
tile_set_navigation_polygon_offset(id, p_value);
|
2018-02-17 10:58:07 +00:00
|
|
|
else if (what == "z_index")
|
|
|
|
tile_set_z_index(id, p_value);
|
2014-02-10 01:10:30 +00:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
String n = p_name;
|
|
|
|
int slash = n.find("/");
|
2017-03-05 15:44:50 +00:00
|
|
|
if (slash == -1)
|
2014-02-10 01:10:30 +00:00
|
|
|
return false;
|
2017-03-05 15:44:50 +00:00
|
|
|
int id = String::to_int(n.c_str(), slash);
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(id), false);
|
|
|
|
|
|
|
|
String what = n.substr(slash + 1, n.length());
|
|
|
|
|
|
|
|
if (what == "name")
|
|
|
|
r_ret = tile_get_name(id);
|
|
|
|
else if (what == "texture")
|
|
|
|
r_ret = tile_get_texture(id);
|
2017-06-22 15:15:50 +00:00
|
|
|
else if (what == "normal_map")
|
|
|
|
r_ret = tile_get_normal_map(id);
|
2017-03-05 15:44:50 +00:00
|
|
|
else if (what == "tex_offset")
|
|
|
|
r_ret = tile_get_texture_offset(id);
|
|
|
|
else if (what == "material")
|
|
|
|
r_ret = tile_get_material(id);
|
|
|
|
else if (what == "modulate")
|
|
|
|
r_ret = tile_get_modulate(id);
|
|
|
|
else if (what == "region")
|
|
|
|
r_ret = tile_get_region(id);
|
2018-02-17 11:08:44 +00:00
|
|
|
else if (what == "tile_mode")
|
|
|
|
r_ret = tile_get_tile_mode(id);
|
2017-10-22 01:42:23 +00:00
|
|
|
else if (what.left(9) == "autotile/") {
|
|
|
|
what = what.right(9);
|
|
|
|
if (what == "bitmask_mode")
|
|
|
|
r_ret = autotile_get_bitmask_mode(id);
|
|
|
|
else if (what == "icon_coordinate")
|
|
|
|
r_ret = autotile_get_icon_coordinate(id);
|
|
|
|
else if (what == "tile_size")
|
|
|
|
r_ret = autotile_get_size(id);
|
|
|
|
else if (what == "spacing")
|
|
|
|
r_ret = autotile_get_spacing(id);
|
|
|
|
else if (what == "bitmask_flags") {
|
|
|
|
Array p;
|
2019-03-31 17:28:42 +00:00
|
|
|
for (Map<Vector2, uint32_t>::Element *E = tile_map[id].autotile_data.flags.front(); E; E = E->next()) {
|
2017-10-22 01:42:23 +00:00
|
|
|
p.push_back(E->key());
|
|
|
|
p.push_back(E->value());
|
|
|
|
}
|
|
|
|
r_ret = p;
|
|
|
|
} else if (what == "occluder_map") {
|
|
|
|
Array p;
|
2017-12-08 19:38:36 +00:00
|
|
|
for (Map<Vector2, Ref<OccluderPolygon2D> >::Element *E = tile_map[id].autotile_data.occluder_map.front(); E; E = E->next()) {
|
2017-10-22 01:42:23 +00:00
|
|
|
p.push_back(E->key());
|
|
|
|
p.push_back(E->value());
|
|
|
|
}
|
|
|
|
r_ret = p;
|
|
|
|
} else if (what == "navpoly_map") {
|
|
|
|
Array p;
|
|
|
|
for (Map<Vector2, Ref<NavigationPolygon> >::Element *E = tile_map[id].autotile_data.navpoly_map.front(); E; E = E->next()) {
|
|
|
|
p.push_back(E->key());
|
|
|
|
p.push_back(E->value());
|
|
|
|
}
|
|
|
|
r_ret = p;
|
|
|
|
} else if (what == "priority_map") {
|
|
|
|
Array p;
|
|
|
|
Vector3 v;
|
|
|
|
for (Map<Vector2, int>::Element *E = tile_map[id].autotile_data.priority_map.front(); E; E = E->next()) {
|
|
|
|
if (E->value() > 1) {
|
2018-01-18 20:37:17 +00:00
|
|
|
//Don't save default value
|
2017-10-22 01:42:23 +00:00
|
|
|
v.x = E->key().x;
|
|
|
|
v.y = E->key().y;
|
|
|
|
v.z = E->value();
|
|
|
|
p.push_back(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
r_ret = p;
|
2018-07-02 13:39:39 +00:00
|
|
|
} else if (what == "z_index_map") {
|
|
|
|
Array p;
|
|
|
|
Vector3 v;
|
|
|
|
for (Map<Vector2, int>::Element *E = tile_map[id].autotile_data.z_index_map.front(); E; E = E->next()) {
|
|
|
|
if (E->value() != 0) {
|
|
|
|
//Don't save default value
|
|
|
|
v.x = E->key().x;
|
|
|
|
v.y = E->key().y;
|
|
|
|
v.z = E->value();
|
|
|
|
p.push_back(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
r_ret = p;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
} else if (what == "shape")
|
2017-06-25 18:47:30 +00:00
|
|
|
r_ret = tile_get_shape(id, 0);
|
2017-07-01 17:43:27 +00:00
|
|
|
else if (what == "shape_offset")
|
2017-11-13 07:42:49 +00:00
|
|
|
r_ret = tile_get_shape_offset(id, 0);
|
2017-07-01 17:56:51 +00:00
|
|
|
else if (what == "shape_transform")
|
|
|
|
r_ret = tile_get_shape_transform(id, 0);
|
2017-06-25 18:47:30 +00:00
|
|
|
else if (what == "shape_one_way")
|
|
|
|
r_ret = tile_get_shape_one_way(id, 0);
|
2019-01-18 17:15:05 +00:00
|
|
|
else if (what == "shape_one_way_margin")
|
|
|
|
r_ret = tile_get_shape_one_way_margin(id, 0);
|
2017-03-05 15:44:50 +00:00
|
|
|
else if (what == "shapes")
|
|
|
|
r_ret = _tile_get_shapes(id);
|
|
|
|
else if (what == "occluder")
|
|
|
|
r_ret = tile_get_light_occluder(id);
|
|
|
|
else if (what == "occluder_offset")
|
|
|
|
r_ret = tile_get_occluder_offset(id);
|
|
|
|
else if (what == "navigation")
|
|
|
|
r_ret = tile_get_navigation_polygon(id);
|
|
|
|
else if (what == "navigation_offset")
|
|
|
|
r_ret = tile_get_navigation_polygon_offset(id);
|
2018-02-17 10:58:07 +00:00
|
|
|
else if (what == "z_index")
|
|
|
|
r_ret = tile_get_z_index(id);
|
2014-02-10 01:10:30 +00:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
int id = E->key();
|
2017-03-05 15:44:50 +00:00
|
|
|
String pre = itos(id) + "/";
|
2020-02-04 19:09:59 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::STRING, pre + "name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
2019-06-11 18:43:37 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_NOEDITOR));
|
2020-02-04 19:09:59 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "tex_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::COLOR, pre + "modulate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::INT, pre + "tile_mode", PROPERTY_HINT_ENUM, "SINGLE_TILE,AUTO_TILE,ATLAS_TILE", PROPERTY_USAGE_NOEDITOR));
|
2018-02-17 11:08:44 +00:00
|
|
|
if (tile_get_tile_mode(id) == AUTO_TILE) {
|
2018-05-17 03:39:43 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/bitmask_mode", PROPERTY_HINT_ENUM, "2X2,3X3 (minimal),3X3", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2018-02-17 11:08:44 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/bitmask_flags", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2018-01-11 22:35:12 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/icon_coordinate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2018-07-02 13:39:39 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/z_index_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2018-07-29 21:54:12 +00:00
|
|
|
} else if (tile_get_tile_mode(id) == ATLAS_TILE) {
|
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/icon_coordinate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2018-12-23 13:06:53 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2018-12-17 12:03:50 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/z_index_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
2020-02-04 19:09:59 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "occluder_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "navigation_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "navigation", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_NOEDITOR));
|
|
|
|
p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 18:20:53 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::FLOAT, pre + "shape_one_way_margin", PROPERTY_HINT_RANGE, "0,128,0.01", PROPERTY_USAGE_NOEDITOR));
|
2017-03-05 15:44:50 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
|
2020-02-04 19:09:59 +00:00
|
|
|
p_list->push_back(PropertyInfo(Variant::INT, pre + "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1", PROPERTY_USAGE_NOEDITOR));
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::create_tile(int p_id) {
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND(tile_map.has(p_id));
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id] = TileData();
|
2017-10-22 01:42:23 +00:00
|
|
|
tile_map[p_id].autotile_data = AutotileData();
|
|
|
|
_change_notify("");
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_set_bitmask_mode(int p_id, BitmaskMode p_mode) {
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map[p_id].autotile_data.bitmask_mode = p_mode;
|
2014-02-10 01:10:30 +00:00
|
|
|
_change_notify("");
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
TileSet::BitmaskMode TileSet::autotile_get_bitmask_mode(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), BITMASK_2X2);
|
|
|
|
return tile_map[p_id].autotile_data.bitmask_mode;
|
|
|
|
}
|
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
void TileSet::tile_set_texture(int p_id, const Ref<Texture2D> &p_texture) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].texture = p_texture;
|
2014-02-10 01:10:30 +00:00
|
|
|
emit_changed();
|
2018-01-10 22:45:14 +00:00
|
|
|
_change_notify("texture");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
Ref<Texture2D> TileSet::tile_get_texture(int p_id) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture2D>());
|
2014-02-10 01:10:30 +00:00
|
|
|
return tile_map[p_id].texture;
|
|
|
|
}
|
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
void TileSet::tile_set_normal_map(int p_id, const Ref<Texture2D> &p_normal_map) {
|
2017-06-22 15:15:50 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map[p_id].normal_map = p_normal_map;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
Ref<Texture2D> TileSet::tile_get_normal_map(int p_id) const {
|
2017-06-22 15:15:50 +00:00
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture2D>());
|
2017-06-22 15:15:50 +00:00
|
|
|
return tile_map[p_id].normal_map;
|
|
|
|
}
|
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].material = p_material;
|
2015-03-09 05:34:56 +00:00
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
Ref<ShaderMaterial> TileSet::tile_get_material(int p_id) const {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
2017-04-07 02:36:37 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<ShaderMaterial>());
|
2015-03-09 05:34:56 +00:00
|
|
|
return tile_map[p_id].material;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
|
2016-11-30 13:33:39 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].modulate = p_modulate;
|
2016-11-30 13:33:39 +00:00
|
|
|
emit_changed();
|
2018-03-11 14:59:50 +00:00
|
|
|
_change_notify("modulate");
|
2016-11-30 13:33:39 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Color TileSet::tile_get_modulate(int p_id) const {
|
2016-11-30 13:33:39 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Color(1, 1, 1));
|
2016-11-30 13:33:39 +00:00
|
|
|
return tile_map[p_id].modulate;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].offset = p_offset;
|
2014-02-10 01:10:30 +00:00
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2014-02-19 14:57:14 +00:00
|
|
|
Vector2 TileSet::tile_get_texture_offset(int p_id) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
|
2014-02-10 01:10:30 +00:00
|
|
|
return tile_map[p_id].offset;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_region(int p_id, const Rect2 &p_region) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].region = p_region;
|
2014-02-10 01:10:30 +00:00
|
|
|
emit_changed();
|
2018-02-17 11:08:44 +00:00
|
|
|
_change_notify("region");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Rect2 TileSet::tile_get_region(int p_id) const {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Rect2());
|
2014-02-10 01:10:30 +00:00
|
|
|
return tile_map[p_id].region;
|
|
|
|
}
|
|
|
|
|
2018-02-17 11:08:44 +00:00
|
|
|
void TileSet::tile_set_tile_mode(int p_id, TileMode p_tile_mode) {
|
2017-10-22 01:42:23 +00:00
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2018-02-17 11:08:44 +00:00
|
|
|
tile_map[p_id].tile_mode = p_tile_mode;
|
2017-10-22 01:42:23 +00:00
|
|
|
emit_changed();
|
2018-02-17 11:08:44 +00:00
|
|
|
_change_notify("tile_mode");
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
|
2018-02-17 11:08:44 +00:00
|
|
|
TileSet::TileMode TileSet::tile_get_tile_mode(int p_id) const {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
2018-02-17 11:08:44 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), SINGLE_TILE);
|
|
|
|
return tile_map[p_id].tile_mode;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_set_icon_coordinate(int p_id, Vector2 coord) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map[p_id].autotile_data.icon_coord = coord;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector2 TileSet::autotile_get_icon_coordinate(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
|
|
|
|
return tile_map[p_id].autotile_data.icon_coord;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_set_spacing(int p_id, int p_spacing) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
ERR_FAIL_COND(p_spacing < 0);
|
|
|
|
tile_map[p_id].autotile_data.spacing = p_spacing;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
int TileSet::autotile_get_spacing(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
|
|
|
|
return tile_map[p_id].autotile_data.spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_set_size(int p_id, Size2 p_size) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
ERR_FAIL_COND(p_size.x <= 0 || p_size.y <= 0);
|
|
|
|
tile_map[p_id].autotile_data.size = p_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
Size2 TileSet::autotile_get_size(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Size2());
|
|
|
|
return tile_map[p_id].autotile_data.size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_clear_bitmask_map(int p_id) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map[p_id].autotile_data.flags.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_set_subtile_priority(int p_id, const Vector2 &p_coord, int p_priority) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
ERR_FAIL_COND(p_priority <= 0);
|
|
|
|
tile_map[p_id].autotile_data.priority_map[p_coord] = p_priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
int TileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 1);
|
|
|
|
if (tile_map[p_id].autotile_data.priority_map.has(p_coord)) {
|
|
|
|
return tile_map[p_id].autotile_data.priority_map[p_coord];
|
|
|
|
}
|
|
|
|
//When not custom priority set return the default value
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-12-19 16:20:49 +00:00
|
|
|
const Map<Vector2, int> &TileSet::autotile_get_priority_map(int p_id) const {
|
|
|
|
|
|
|
|
static Map<Vector2, int> dummy;
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
|
|
|
|
return tile_map[p_id].autotile_data.priority_map;
|
|
|
|
}
|
|
|
|
|
2018-07-02 13:39:39 +00:00
|
|
|
void TileSet::autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map[p_id].autotile_data.z_index_map[p_coord] = p_z_index;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
int TileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 1);
|
|
|
|
if (tile_map[p_id].autotile_data.z_index_map.has(p_coord)) {
|
|
|
|
return tile_map[p_id].autotile_data.z_index_map[p_coord];
|
|
|
|
}
|
|
|
|
//When not custom z index set return the default value
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-12-19 16:20:49 +00:00
|
|
|
const Map<Vector2, int> &TileSet::autotile_get_z_index_map(int p_id) const {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
|
|
|
static Map<Vector2, int> dummy;
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
|
2018-12-19 16:20:49 +00:00
|
|
|
return tile_map[p_id].autotile_data.z_index_map;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
|
2019-03-31 17:28:42 +00:00
|
|
|
void TileSet::autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag) {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
if (p_flag == 0) {
|
|
|
|
if (tile_map[p_id].autotile_data.flags.has(p_coord))
|
|
|
|
tile_map[p_id].autotile_data.flags.erase(p_coord);
|
|
|
|
} else {
|
|
|
|
tile_map[p_id].autotile_data.flags[p_coord] = p_flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-31 17:28:42 +00:00
|
|
|
uint32_t TileSet::autotile_get_bitmask(int p_id, Vector2 p_coord) {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
|
|
|
|
if (!tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return tile_map[p_id].autotile_data.flags[p_coord];
|
|
|
|
}
|
|
|
|
|
2019-03-31 17:28:42 +00:00
|
|
|
const Map<Vector2, uint32_t> &TileSet::autotile_get_bitmask_map(int p_id) {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
2019-03-31 17:28:42 +00:00
|
|
|
static Map<Vector2, uint32_t> dummy;
|
|
|
|
static Map<Vector2, uint32_t> dummy_atlas;
|
2017-10-22 01:42:23 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
|
2018-07-29 21:54:12 +00:00
|
|
|
if (tile_get_tile_mode(p_id) == ATLAS_TILE) {
|
2019-03-31 17:28:42 +00:00
|
|
|
dummy_atlas = Map<Vector2, uint32_t>();
|
2018-07-29 21:54:12 +00:00
|
|
|
Rect2 region = tile_get_region(p_id);
|
|
|
|
Size2 size = autotile_get_size(p_id);
|
|
|
|
float spacing = autotile_get_spacing(p_id);
|
|
|
|
for (int x = 0; x < (region.size.x / (size.x + spacing)); x++) {
|
|
|
|
for (int y = 0; y < (region.size.y / (size.y + spacing)); y++) {
|
|
|
|
dummy_atlas.insert(Vector2(x, y), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dummy_atlas;
|
|
|
|
} else
|
|
|
|
return tile_map[p_id].autotile_data.flags;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
|
|
|
|
//First try to forward selection to script
|
|
|
|
if (p_tilemap_node->get_class_name() == "TileMap") {
|
|
|
|
if (get_script_instance() != NULL) {
|
|
|
|
if (get_script_instance()->has_method("_forward_subtile_selection")) {
|
|
|
|
Variant ret = get_script_instance()->call("_forward_subtile_selection", p_id, p_bitmask, p_tilemap_node, p_tile_location);
|
|
|
|
if (ret.get_type() == Variant::VECTOR2) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Vector2> coords;
|
2019-04-07 11:09:38 +00:00
|
|
|
List<uint32_t> priorities;
|
|
|
|
uint32_t priority_sum = 0;
|
2019-03-31 17:28:42 +00:00
|
|
|
uint32_t mask;
|
|
|
|
uint16_t mask_;
|
|
|
|
uint16_t mask_ignore;
|
|
|
|
for (Map<Vector2, uint32_t>::Element *E = tile_map[p_id].autotile_data.flags.front(); E; E = E->next()) {
|
2017-10-22 01:42:23 +00:00
|
|
|
mask = E->get();
|
|
|
|
if (tile_map[p_id].autotile_data.bitmask_mode == BITMASK_2X2) {
|
2019-03-31 17:28:42 +00:00
|
|
|
mask |= (BIND_IGNORE_TOP | BIND_IGNORE_LEFT | BIND_IGNORE_CENTER | BIND_IGNORE_RIGHT | BIND_IGNORE_BOTTOM);
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
2019-03-31 17:28:42 +00:00
|
|
|
|
|
|
|
mask_ = mask & 0xFFFF;
|
|
|
|
mask_ignore = mask >> 16;
|
|
|
|
|
|
|
|
if (((mask_ & (~mask_ignore)) == (p_bitmask & (~mask_ignore))) && (((~mask_) | mask_ignore) == ((~p_bitmask) | mask_ignore))) {
|
2019-04-07 11:09:38 +00:00
|
|
|
uint32_t priority = autotile_get_subtile_priority(p_id, E->key());
|
|
|
|
priority_sum += priority;
|
|
|
|
priorities.push_back(priority);
|
|
|
|
coords.push_back(E->key());
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-31 17:28:42 +00:00
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
if (coords.size() == 0) {
|
|
|
|
return autotile_get_icon_coordinate(p_id);
|
|
|
|
} else {
|
2019-04-07 11:09:38 +00:00
|
|
|
uint32_t picked_value = Math::rand() % priority_sum;
|
|
|
|
uint32_t upper_bound;
|
|
|
|
uint32_t lower_bound = 0;
|
|
|
|
Vector2 result = coords.front()->get();
|
|
|
|
List<Vector2>::Element *coords_E = coords.front();
|
|
|
|
List<uint32_t>::Element *priorities_E = priorities.front();
|
|
|
|
while (priorities_E) {
|
|
|
|
upper_bound = lower_bound + priorities_E->get();
|
|
|
|
if (lower_bound <= picked_value && picked_value < upper_bound) {
|
|
|
|
result = coords_E->get();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lower_bound = upper_bound;
|
|
|
|
priorities_E = priorities_E->next();
|
|
|
|
coords_E = coords_E->next();
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-23 13:06:53 +00:00
|
|
|
Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
|
|
|
|
//First try to forward selection to script
|
|
|
|
if (get_script_instance() != NULL) {
|
|
|
|
if (get_script_instance()->has_method("_forward_atlas_subtile_selection")) {
|
|
|
|
Variant ret = get_script_instance()->call("_forward_atlas_subtile_selection", p_id, p_tilemap_node, p_tile_location);
|
|
|
|
if (ret.get_type() == Variant::VECTOR2) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector2 coord = tile_get_region(p_id).size / autotile_get_size(p_id);
|
|
|
|
|
|
|
|
List<Vector2> coords;
|
|
|
|
for (int x = 0; x < coord.x; x++) {
|
|
|
|
for (int y = 0; y < coord.y; y++) {
|
|
|
|
for (int i = 0; i < autotile_get_subtile_priority(p_id, Vector2(x, y)); i++) {
|
|
|
|
coords.push_back(Vector2(x, y));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (coords.size() == 0) {
|
|
|
|
return autotile_get_icon_coordinate(p_id);
|
|
|
|
} else {
|
|
|
|
return coords[Math::random(0, (int)coords.size())];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_name(int p_id, const String &p_name) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].name = p_name;
|
2014-02-10 01:10:30 +00:00
|
|
|
emit_changed();
|
2018-02-17 11:08:44 +00:00
|
|
|
_change_notify("name");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String TileSet::tile_get_name(int p_id) const {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), String());
|
2014-02-10 01:10:30 +00:00
|
|
|
return tile_map[p_id].name;
|
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
void TileSet::tile_clear_shapes(int p_id) {
|
2019-06-21 09:34:32 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id].shapes_data.clear();
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
void TileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Transform2D &p_transform, bool p_one_way, const Vector2 &p_autotile_coord) {
|
2017-06-25 18:47:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
|
|
|
|
ShapeData new_data = ShapeData();
|
|
|
|
new_data.shape = p_shape;
|
2017-07-01 17:56:51 +00:00
|
|
|
new_data.shape_transform = p_transform;
|
2017-06-25 18:47:30 +00:00
|
|
|
new_data.one_way_collision = p_one_way;
|
2017-10-22 01:42:23 +00:00
|
|
|
new_data.autotile_coord = p_autotile_coord;
|
2017-06-25 18:47:30 +00:00
|
|
|
|
|
|
|
tile_map[p_id].shapes_data.push_back(new_data);
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
int TileSet::tile_get_shape_count(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
|
|
|
|
return tile_map[p_id].shapes_data.size();
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
2017-06-25 18:47:30 +00:00
|
|
|
|
|
|
|
void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2019-06-21 09:34:32 +00:00
|
|
|
ERR_FAIL_COND(p_shape_id < 0);
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id >= tile_map[p_id].shapes_data.size())
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
|
2018-07-25 01:11:03 +00:00
|
|
|
tile_map[p_id].shapes_data.write[p_shape_id].shape = p_shape;
|
2019-03-04 02:05:43 +00:00
|
|
|
_decompose_convex_shape(p_shape);
|
2014-02-10 01:10:30 +00:00
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Shape2D>());
|
2019-07-03 15:18:36 +00:00
|
|
|
ERR_FAIL_COND_V(p_shape_id < 0, Ref<Shape2D>());
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id < tile_map[p_id].shapes_data.size())
|
|
|
|
return tile_map[p_id].shapes_data[p_shape_id].shape;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
return Ref<Shape2D>();
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-07-01 17:56:51 +00:00
|
|
|
void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
|
2017-06-25 18:47:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2019-07-03 15:18:36 +00:00
|
|
|
ERR_FAIL_COND(p_shape_id < 0);
|
2019-06-21 09:34:32 +00:00
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id >= tile_map[p_id].shapes_data.size())
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
|
2018-07-25 01:11:03 +00:00
|
|
|
tile_map[p_id].shapes_data.write[p_shape_id].shape_transform = p_offset;
|
2017-06-25 18:47:30 +00:00
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2017-07-01 17:56:51 +00:00
|
|
|
Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
|
2017-06-25 18:47:30 +00:00
|
|
|
|
2017-07-01 17:56:51 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Transform2D());
|
2019-07-03 15:18:36 +00:00
|
|
|
ERR_FAIL_COND_V(p_shape_id < 0, Transform2D());
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id < tile_map[p_id].shapes_data.size())
|
|
|
|
return tile_map[p_id].shapes_data[p_shape_id].shape_transform;
|
2017-06-25 18:47:30 +00:00
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
return Transform2D();
|
2017-06-25 18:47:30 +00:00
|
|
|
}
|
|
|
|
|
2017-11-13 07:42:49 +00:00
|
|
|
void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
|
|
|
|
Transform2D transform = tile_get_shape_transform(p_id, p_shape_id);
|
|
|
|
transform.set_origin(p_offset);
|
|
|
|
tile_set_shape_transform(p_id, p_shape_id, transform);
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
|
|
|
|
return tile_get_shape_transform(p_id, p_shape_id).get_origin();
|
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2019-06-21 09:34:32 +00:00
|
|
|
ERR_FAIL_COND(p_shape_id < 0);
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id >= tile_map[p_id].shapes_data.size())
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
|
2018-07-25 01:11:03 +00:00
|
|
|
tile_map[p_id].shapes_data.write[p_shape_id].one_way_collision = p_one_way;
|
2017-06-25 18:47:30 +00:00
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), false);
|
2019-07-03 15:18:36 +00:00
|
|
|
ERR_FAIL_COND_V(p_shape_id < 0, false);
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id < tile_map[p_id].shapes_data.size())
|
|
|
|
return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
|
2017-06-25 18:47:30 +00:00
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
return false;
|
2017-06-25 18:47:30 +00:00
|
|
|
}
|
|
|
|
|
2019-01-18 17:15:05 +00:00
|
|
|
void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) {
|
2019-06-21 09:34:32 +00:00
|
|
|
|
2019-01-18 17:15:05 +00:00
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2019-06-21 09:34:32 +00:00
|
|
|
ERR_FAIL_COND(p_shape_id < 0);
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id >= tile_map[p_id].shapes_data.size())
|
2019-01-18 17:15:05 +00:00
|
|
|
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
|
|
|
|
tile_map[p_id].shapes_data.write[p_shape_id].one_way_collision_margin = p_margin;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
float TileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const {
|
2019-06-21 09:34:32 +00:00
|
|
|
|
2019-01-18 17:15:05 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
|
2019-07-03 15:18:36 +00:00
|
|
|
ERR_FAIL_COND_V(p_shape_id < 0, 0);
|
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
if (p_shape_id < tile_map[p_id].shapes_data.size())
|
|
|
|
return tile_map[p_id].shapes_data[p_shape_id].one_way_collision_margin;
|
2019-01-18 17:15:05 +00:00
|
|
|
|
2019-06-23 11:56:44 +00:00
|
|
|
return 0;
|
2019-01-18 17:15:05 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].occluder = p_light_occluder;
|
2015-03-09 05:34:56 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<OccluderPolygon2D> TileSet::tile_get_light_occluder(int p_id) const {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
|
2015-03-09 05:34:56 +00:00
|
|
|
return tile_map[p_id].occluder;
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
void TileSet::autotile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder, const Vector2 &p_coord) {
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
if (p_light_occluder.is_null()) {
|
2017-12-08 19:38:36 +00:00
|
|
|
if (tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
|
|
|
|
tile_map[p_id].autotile_data.occluder_map.erase(p_coord);
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
2017-12-08 19:38:36 +00:00
|
|
|
tile_map[p_id].autotile_data.occluder_map[p_coord] = p_light_occluder;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<OccluderPolygon2D> TileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const {
|
2019-06-21 09:34:32 +00:00
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
|
2019-06-21 09:34:32 +00:00
|
|
|
|
2017-12-08 19:38:36 +00:00
|
|
|
if (!tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
|
2017-10-22 01:42:23 +00:00
|
|
|
return Ref<OccluderPolygon2D>();
|
|
|
|
} else {
|
2017-12-08 19:38:36 +00:00
|
|
|
return tile_map[p_id].autotile_data.occluder_map[p_coord];
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].navigation_polygon_offset = p_offset;
|
2015-03-09 05:34:56 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
|
2015-03-09 05:34:56 +00:00
|
|
|
return tile_map[p_id].navigation_polygon_offset;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon) {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].navigation_polygon = p_navigation_polygon;
|
2015-03-09 05:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Ref<NavigationPolygon> TileSet::tile_get_navigation_polygon(int p_id) const {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<NavigationPolygon>());
|
2015-03-09 05:34:56 +00:00
|
|
|
return tile_map[p_id].navigation_polygon;
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
const Map<Vector2, Ref<OccluderPolygon2D> > &TileSet::autotile_get_light_oclusion_map(int p_id) const {
|
|
|
|
|
|
|
|
static Map<Vector2, Ref<OccluderPolygon2D> > dummy;
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
|
2017-12-08 19:38:36 +00:00
|
|
|
return tile_map[p_id].autotile_data.occluder_map;
|
2017-10-22 01:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::autotile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon, const Vector2 &p_coord) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
if (p_navigation_polygon.is_null()) {
|
|
|
|
if (tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) {
|
|
|
|
tile_map[p_id].autotile_data.navpoly_map.erase(p_coord);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tile_map[p_id].autotile_data.navpoly_map[p_coord] = p_navigation_polygon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<NavigationPolygon> TileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<NavigationPolygon>());
|
|
|
|
if (!tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) {
|
|
|
|
return Ref<NavigationPolygon>();
|
|
|
|
} else {
|
|
|
|
return tile_map[p_id].autotile_data.navpoly_map[p_coord];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const Map<Vector2, Ref<NavigationPolygon> > &TileSet::autotile_get_navigation_map(int p_id) const {
|
|
|
|
|
|
|
|
static Map<Vector2, Ref<NavigationPolygon> > dummy;
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
|
|
|
|
return tile_map[p_id].autotile_data.navpoly_map;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) {
|
2015-03-09 05:34:56 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-03-05 15:44:50 +00:00
|
|
|
tile_map[p_id].occluder_offset = p_offset;
|
2015-03-09 05:34:56 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector2 TileSet::tile_get_occluder_offset(int p_id) const {
|
2017-10-22 01:42:23 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
|
2015-03-09 05:34:56 +00:00
|
|
|
return tile_map[p_id].occluder_offset;
|
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
void TileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id].shapes_data = p_shapes;
|
2019-03-04 02:05:43 +00:00
|
|
|
for (int i = 0; i < p_shapes.size(); i++) {
|
|
|
|
_decompose_convex_shape(p_shapes[i].shape);
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
Vector<TileSet::ShapeData> TileSet::tile_get_shapes(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector<ShapeData>());
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
return tile_map[p_id].shapes_data;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2018-02-17 10:58:07 +00:00
|
|
|
int TileSet::tile_get_z_index(int p_id) const {
|
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
|
|
|
|
return tile_map[p_id].z_index;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::tile_set_z_index(int p_id, int p_z_index) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map[p_id].z_index = p_z_index;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
2017-06-25 18:47:30 +00:00
|
|
|
Vector<ShapeData> shapes_data;
|
2017-07-01 17:56:51 +00:00
|
|
|
Transform2D default_transform = tile_get_shape_transform(p_id, 0);
|
2017-06-25 18:47:30 +00:00
|
|
|
bool default_one_way = tile_get_shape_one_way(p_id, 0);
|
2017-10-22 01:42:23 +00:00
|
|
|
Vector2 default_autotile_coord = Vector2();
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < p_shapes.size(); i++) {
|
2017-06-25 18:47:30 +00:00
|
|
|
ShapeData s = ShapeData();
|
|
|
|
|
|
|
|
if (p_shapes[i].get_type() == Variant::OBJECT) {
|
|
|
|
Ref<Shape2D> shape = p_shapes[i];
|
|
|
|
if (shape.is_null()) continue;
|
|
|
|
|
|
|
|
s.shape = shape;
|
2017-07-01 17:56:51 +00:00
|
|
|
s.shape_transform = default_transform;
|
2017-06-25 18:47:30 +00:00
|
|
|
s.one_way_collision = default_one_way;
|
2017-10-22 01:42:23 +00:00
|
|
|
s.autotile_coord = default_autotile_coord;
|
2017-06-25 18:47:30 +00:00
|
|
|
} else if (p_shapes[i].get_type() == Variant::DICTIONARY) {
|
|
|
|
Dictionary d = p_shapes[i];
|
|
|
|
|
2019-03-04 02:05:43 +00:00
|
|
|
if (d.has("shape") && d["shape"].get_type() == Variant::OBJECT) {
|
2017-06-25 18:47:30 +00:00
|
|
|
s.shape = d["shape"];
|
2019-03-04 02:05:43 +00:00
|
|
|
_decompose_convex_shape(s.shape);
|
|
|
|
} else
|
2017-06-25 18:47:30 +00:00
|
|
|
continue;
|
|
|
|
|
2017-07-01 17:56:51 +00:00
|
|
|
if (d.has("shape_transform") && d["shape_transform"].get_type() == Variant::TRANSFORM2D)
|
|
|
|
s.shape_transform = d["shape_transform"];
|
|
|
|
else if (d.has("shape_offset") && d["shape_offset"].get_type() == Variant::VECTOR2)
|
|
|
|
s.shape_transform = Transform2D(0, (Vector2)d["shape_offset"]);
|
2017-06-25 18:47:30 +00:00
|
|
|
else
|
2017-07-01 17:56:51 +00:00
|
|
|
s.shape_transform = default_transform;
|
2017-06-25 18:47:30 +00:00
|
|
|
|
|
|
|
if (d.has("one_way") && d["one_way"].get_type() == Variant::BOOL)
|
|
|
|
s.one_way_collision = d["one_way"];
|
|
|
|
else
|
|
|
|
s.one_way_collision = default_one_way;
|
|
|
|
|
2019-01-18 17:15:05 +00:00
|
|
|
if (d.has("one_way_margin") && d["one_way_margin"].is_num())
|
|
|
|
s.one_way_collision_margin = d["one_way_margin"];
|
|
|
|
else
|
2019-01-22 13:14:43 +00:00
|
|
|
s.one_way_collision_margin = 1.0;
|
2019-01-18 17:15:05 +00:00
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
if (d.has("autotile_coord") && d["autotile_coord"].get_type() == Variant::VECTOR2)
|
|
|
|
s.autotile_coord = d["autotile_coord"];
|
|
|
|
else
|
|
|
|
s.autotile_coord = default_autotile_coord;
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
} else {
|
2019-08-08 20:11:48 +00:00
|
|
|
ERR_CONTINUE_MSG(true, "Expected an array of objects or dictionaries for tile_set_shapes.");
|
2017-06-25 18:47:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
shapes_data.push_back(s);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
tile_map[p_id].shapes_data = shapes_data;
|
2020-01-23 14:48:38 +00:00
|
|
|
emit_changed();
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Array TileSet::_tile_get_shapes(int p_id) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!tile_map.has(p_id), Array());
|
2014-02-10 01:10:30 +00:00
|
|
|
Array arr;
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
Vector<ShapeData> data = tile_map[p_id].shapes_data;
|
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
|
Dictionary shape_data;
|
|
|
|
shape_data["shape"] = data[i].shape;
|
2017-07-01 17:56:51 +00:00
|
|
|
shape_data["shape_transform"] = data[i].shape_transform;
|
2017-06-25 18:47:30 +00:00
|
|
|
shape_data["one_way"] = data[i].one_way_collision;
|
2019-01-18 17:15:05 +00:00
|
|
|
shape_data["one_way_margin"] = data[i].one_way_collision_margin;
|
2017-10-22 01:42:23 +00:00
|
|
|
shape_data["autotile_coord"] = data[i].autotile_coord;
|
2017-06-25 18:47:30 +00:00
|
|
|
arr.push_back(shape_data);
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Array TileSet::_get_tiles_ids() const {
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-18 09:49:34 +00:00
|
|
|
Array arr;
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
2016-03-08 23:00:52 +00:00
|
|
|
arr.push_back(E->key());
|
2014-02-18 09:49:34 +00:00
|
|
|
}
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-18 09:49:34 +00:00
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
|
2019-03-04 02:05:43 +00:00
|
|
|
void TileSet::_decompose_convex_shape(Ref<Shape2D> p_shape) {
|
|
|
|
if (Engine::get_singleton()->is_editor_hint())
|
|
|
|
return;
|
|
|
|
Ref<ConvexPolygonShape2D> convex = p_shape;
|
|
|
|
if (!convex.is_valid())
|
|
|
|
return;
|
|
|
|
Vector<Vector<Vector2> > decomp = Geometry::decompose_polygon_in_convex(convex->get_points());
|
|
|
|
if (decomp.size() > 1) {
|
|
|
|
Array sub_shapes;
|
|
|
|
for (int i = 0; i < decomp.size(); i++) {
|
|
|
|
Ref<ConvexPolygonShape2D> _convex = memnew(ConvexPolygonShape2D);
|
|
|
|
_convex->set_points(decomp[i]);
|
|
|
|
sub_shapes.append(_convex);
|
|
|
|
}
|
|
|
|
convex->set_meta("decomposed", sub_shapes);
|
|
|
|
} else {
|
|
|
|
convex->set_meta("decomposed", Variant());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void TileSet::get_tile_list(List<int> *p_tiles) const {
|
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
p_tiles->push_back(E->key());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TileSet::has_tile(int p_id) const {
|
|
|
|
|
|
|
|
return tile_map.has(p_id);
|
|
|
|
}
|
|
|
|
|
2017-10-22 01:42:23 +00:00
|
|
|
bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) {
|
|
|
|
|
|
|
|
if (p_drawn_id == p_neighbor_id) {
|
|
|
|
return true;
|
|
|
|
} else if (get_script_instance() != NULL) {
|
|
|
|
if (get_script_instance()->has_method("_is_tile_bound")) {
|
|
|
|
Variant ret = get_script_instance()->call("_is_tile_bound", p_drawn_id, p_neighbor_id);
|
|
|
|
if (ret.get_type() == Variant::BOOL) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void TileSet::remove_tile(int p_id) {
|
|
|
|
|
|
|
|
ERR_FAIL_COND(!tile_map.has(p_id));
|
|
|
|
tile_map.erase(p_id);
|
|
|
|
_change_notify("");
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
int TileSet::get_last_unused_tile_id() const {
|
|
|
|
|
|
|
|
if (tile_map.size())
|
2017-03-05 15:44:50 +00:00
|
|
|
return tile_map.back()->key() + 1;
|
2014-02-10 01:10:30 +00:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
int TileSet::find_tile_by_name(const String &p_name) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-06-25 18:47:30 +00:00
|
|
|
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (p_name == E->get().name)
|
2014-02-10 01:10:30 +00:00
|
|
|
return E->key();
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::clear() {
|
|
|
|
|
|
|
|
tile_map.clear();
|
|
|
|
_change_notify("");
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TileSet::_bind_methods() {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile);
|
2018-12-19 16:20:49 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("autotile_clear_bitmask_map", "id"), &TileSet::autotile_clear_bitmask_map);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_icon_coordinate", "id", "coord"), &TileSet::autotile_set_icon_coordinate);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_icon_coordinate", "id"), &TileSet::autotile_get_icon_coordinate);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_subtile_priority", "id", "coord", "priority"), &TileSet::autotile_set_subtile_priority);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_subtile_priority", "id", "coord"), &TileSet::autotile_get_subtile_priority);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_z_index", "id", "coord", "z_index"), &TileSet::autotile_set_z_index);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_z_index", "id", "coord"), &TileSet::autotile_get_z_index);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_light_occluder", "id", "light_occluder", "coord"), &TileSet::autotile_set_light_occluder);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_light_occluder", "id", "coord"), &TileSet::autotile_get_light_occluder);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_navigation_polygon", "id", "navigation_polygon", "coord"), &TileSet::autotile_set_navigation_polygon);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_navigation_polygon", "id", "coord"), &TileSet::autotile_get_navigation_polygon);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_bitmask", "id", "bitmask", "flag"), &TileSet::autotile_set_bitmask);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_bitmask", "id", "coord"), &TileSet::autotile_get_bitmask);
|
2017-12-25 14:19:56 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &TileSet::autotile_set_bitmask_mode);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &TileSet::autotile_get_bitmask_mode);
|
2018-12-19 16:20:49 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_spacing", "id", "spacing"), &TileSet::autotile_set_spacing);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_spacing", "id"), &TileSet::autotile_get_spacing);
|
2018-08-30 18:56:38 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &TileSet::autotile_set_size);
|
|
|
|
ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &TileSet::autotile_get_size);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material);
|
2018-07-23 21:32:20 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &TileSet::tile_set_modulate);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_modulate", "id"), &TileSet::tile_get_modulate);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape);
|
2018-08-27 09:09:11 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &TileSet::tile_set_shape_offset);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &TileSet::tile_get_shape_offset);
|
2017-07-01 17:56:51 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform);
|
2017-06-25 18:47:30 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way);
|
2019-01-18 17:15:05 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way_margin", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way_margin);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shape_one_way_margin", "id", "shape_id"), &TileSet::tile_get_shape_one_way_margin);
|
2017-11-24 04:43:15 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &TileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2()));
|
2017-06-25 18:47:30 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes);
|
2018-04-08 20:54:02 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &TileSet::tile_set_tile_mode);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &TileSet::tile_get_tile_mode);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder);
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset);
|
2018-02-17 10:58:07 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &TileSet::tile_set_z_index);
|
|
|
|
ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &TileSet::tile_get_z_index);
|
2017-03-05 15:44:50 +00:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile);
|
|
|
|
ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id);
|
|
|
|
ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name);
|
2017-08-09 11:54:55 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids);
|
2017-10-22 01:42:23 +00:00
|
|
|
|
2017-12-10 14:10:54 +00:00
|
|
|
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_tile_bound", PropertyInfo(Variant::INT, "drawn_id"), PropertyInfo(Variant::INT, "neighbor_id")));
|
|
|
|
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
|
2018-12-23 13:06:53 +00:00
|
|
|
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_atlas_subtile_selection", PropertyInfo(Variant::INT, "atlastile_id"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
|
2017-10-22 01:42:23 +00:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(BITMASK_2X2);
|
2018-05-17 03:39:43 +00:00
|
|
|
BIND_ENUM_CONSTANT(BITMASK_3X3_MINIMAL);
|
2017-10-22 01:42:23 +00:00
|
|
|
BIND_ENUM_CONSTANT(BITMASK_3X3);
|
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(BIND_TOPLEFT);
|
|
|
|
BIND_ENUM_CONSTANT(BIND_TOP);
|
|
|
|
BIND_ENUM_CONSTANT(BIND_TOPRIGHT);
|
|
|
|
BIND_ENUM_CONSTANT(BIND_LEFT);
|
2020-01-27 14:07:32 +00:00
|
|
|
BIND_ENUM_CONSTANT(BIND_CENTER);
|
2017-10-22 01:42:23 +00:00
|
|
|
BIND_ENUM_CONSTANT(BIND_RIGHT);
|
|
|
|
BIND_ENUM_CONSTANT(BIND_BOTTOMLEFT);
|
|
|
|
BIND_ENUM_CONSTANT(BIND_BOTTOM);
|
|
|
|
BIND_ENUM_CONSTANT(BIND_BOTTOMRIGHT);
|
2018-04-08 20:54:02 +00:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(SINGLE_TILE);
|
|
|
|
BIND_ENUM_CONSTANT(AUTO_TILE);
|
2018-07-29 21:54:12 +00:00
|
|
|
BIND_ENUM_CONSTANT(ATLAS_TILE);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TileSet::TileSet() {
|
|
|
|
}
|