tile_set.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. /*************************************************************************/
  2. /* tile_set.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "tile_set.h"
  31. bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
  32. String n = p_name;
  33. int slash = n.find("/");
  34. if (slash == -1)
  35. return false;
  36. int id = String::to_int(n.c_str(), slash);
  37. if (!tile_map.has(id))
  38. create_tile(id);
  39. String what = n.substr(slash + 1, n.length());
  40. if (what == "name")
  41. tile_set_name(id, p_value);
  42. else if (what == "texture")
  43. tile_set_texture(id, p_value);
  44. else if (what == "normal_map")
  45. tile_set_normal_map(id, p_value);
  46. else if (what == "tex_offset")
  47. tile_set_texture_offset(id, p_value);
  48. else if (what == "material")
  49. tile_set_material(id, p_value);
  50. else if (what == "modulate")
  51. tile_set_modulate(id, p_value);
  52. else if (what == "region")
  53. tile_set_region(id, p_value);
  54. else if (what == "shape")
  55. tile_set_shape(id, 0, p_value);
  56. else if (what == "shape_offset") {
  57. Transform2D xform = tile_get_shape_transform(id, 0);
  58. xform.set_origin(p_value);
  59. tile_set_shape_transform(id, 0, xform);
  60. } else if (what == "shape_transform")
  61. tile_set_shape_transform(id, 0, p_value);
  62. else if (what == "shape_one_way")
  63. tile_set_shape_one_way(id, 0, p_value);
  64. else if (what == "shapes")
  65. _tile_set_shapes(id, p_value);
  66. else if (what == "occluder")
  67. tile_set_light_occluder(id, p_value);
  68. else if (what == "occluder_offset")
  69. tile_set_occluder_offset(id, p_value);
  70. else if (what == "navigation")
  71. tile_set_navigation_polygon(id, p_value);
  72. else if (what == "navigation_offset")
  73. tile_set_navigation_polygon_offset(id, p_value);
  74. else
  75. return false;
  76. return true;
  77. }
  78. bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
  79. String n = p_name;
  80. int slash = n.find("/");
  81. if (slash == -1)
  82. return false;
  83. int id = String::to_int(n.c_str(), slash);
  84. ERR_FAIL_COND_V(!tile_map.has(id), false);
  85. String what = n.substr(slash + 1, n.length());
  86. if (what == "name")
  87. r_ret = tile_get_name(id);
  88. else if (what == "texture")
  89. r_ret = tile_get_texture(id);
  90. else if (what == "normal_map")
  91. r_ret = tile_get_normal_map(id);
  92. else if (what == "tex_offset")
  93. r_ret = tile_get_texture_offset(id);
  94. else if (what == "material")
  95. r_ret = tile_get_material(id);
  96. else if (what == "modulate")
  97. r_ret = tile_get_modulate(id);
  98. else if (what == "region")
  99. r_ret = tile_get_region(id);
  100. else if (what == "shape")
  101. r_ret = tile_get_shape(id, 0);
  102. else if (what == "shape_offset")
  103. r_ret = tile_get_shape_transform(id, 0).get_origin();
  104. else if (what == "shape_transform")
  105. r_ret = tile_get_shape_transform(id, 0);
  106. else if (what == "shape_one_way")
  107. r_ret = tile_get_shape_one_way(id, 0);
  108. else if (what == "shapes")
  109. r_ret = _tile_get_shapes(id);
  110. else if (what == "occluder")
  111. r_ret = tile_get_light_occluder(id);
  112. else if (what == "occluder_offset")
  113. r_ret = tile_get_occluder_offset(id);
  114. else if (what == "navigation")
  115. r_ret = tile_get_navigation_polygon(id);
  116. else if (what == "navigation_offset")
  117. r_ret = tile_get_navigation_polygon_offset(id);
  118. else
  119. return false;
  120. return true;
  121. }
  122. void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
  123. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  124. int id = E->key();
  125. String pre = itos(id) + "/";
  126. p_list->push_back(PropertyInfo(Variant::STRING, pre + "name"));
  127. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
  128. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
  129. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "tex_offset"));
  130. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"));
  131. p_list->push_back(PropertyInfo(Variant::COLOR, pre + "modulate"));
  132. p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region"));
  133. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "occluder_offset"));
  134. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D"));
  135. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "navigation_offset"));
  136. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "navigation", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"));
  137. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  138. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  139. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_EDITOR));
  140. p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  141. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
  142. }
  143. }
  144. void TileSet::create_tile(int p_id) {
  145. ERR_FAIL_COND(tile_map.has(p_id));
  146. tile_map[p_id] = TileData();
  147. _change_notify("");
  148. emit_changed();
  149. }
  150. void TileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) {
  151. ERR_FAIL_COND(!tile_map.has(p_id));
  152. tile_map[p_id].texture = p_texture;
  153. emit_changed();
  154. }
  155. Ref<Texture> TileSet::tile_get_texture(int p_id) const {
  156. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture>());
  157. return tile_map[p_id].texture;
  158. }
  159. void TileSet::tile_set_normal_map(int p_id, const Ref<Texture> &p_normal_map) {
  160. ERR_FAIL_COND(!tile_map.has(p_id));
  161. tile_map[p_id].normal_map = p_normal_map;
  162. emit_changed();
  163. }
  164. Ref<Texture> TileSet::tile_get_normal_map(int p_id) const {
  165. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture>());
  166. return tile_map[p_id].normal_map;
  167. }
  168. void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
  169. ERR_FAIL_COND(!tile_map.has(p_id));
  170. tile_map[p_id].material = p_material;
  171. emit_changed();
  172. }
  173. Ref<ShaderMaterial> TileSet::tile_get_material(int p_id) const {
  174. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<ShaderMaterial>());
  175. return tile_map[p_id].material;
  176. }
  177. void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
  178. ERR_FAIL_COND(!tile_map.has(p_id));
  179. tile_map[p_id].modulate = p_modulate;
  180. emit_changed();
  181. }
  182. Color TileSet::tile_get_modulate(int p_id) const {
  183. ERR_FAIL_COND_V(!tile_map.has(p_id), Color(1, 1, 1));
  184. return tile_map[p_id].modulate;
  185. }
  186. void TileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) {
  187. ERR_FAIL_COND(!tile_map.has(p_id));
  188. tile_map[p_id].offset = p_offset;
  189. emit_changed();
  190. }
  191. Vector2 TileSet::tile_get_texture_offset(int p_id) const {
  192. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  193. return tile_map[p_id].offset;
  194. }
  195. void TileSet::tile_set_region(int p_id, const Rect2 &p_region) {
  196. ERR_FAIL_COND(!tile_map.has(p_id));
  197. tile_map[p_id].region = p_region;
  198. emit_changed();
  199. }
  200. Rect2 TileSet::tile_get_region(int p_id) const {
  201. ERR_FAIL_COND_V(!tile_map.has(p_id), Rect2());
  202. return tile_map[p_id].region;
  203. }
  204. void TileSet::tile_set_name(int p_id, const String &p_name) {
  205. ERR_FAIL_COND(!tile_map.has(p_id));
  206. tile_map[p_id].name = p_name;
  207. emit_changed();
  208. }
  209. String TileSet::tile_get_name(int p_id) const {
  210. ERR_FAIL_COND_V(!tile_map.has(p_id), String());
  211. return tile_map[p_id].name;
  212. }
  213. void TileSet::tile_clear_shapes(int p_id) {
  214. tile_map[p_id].shapes_data.clear();
  215. }
  216. void TileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Transform2D &p_transform, bool p_one_way) {
  217. ERR_FAIL_COND(!tile_map.has(p_id));
  218. ShapeData new_data = ShapeData();
  219. new_data.shape = p_shape;
  220. new_data.shape_transform = p_transform;
  221. new_data.one_way_collision = p_one_way;
  222. tile_map[p_id].shapes_data.push_back(new_data);
  223. };
  224. int TileSet::tile_get_shape_count(int p_id) const {
  225. ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
  226. return tile_map[p_id].shapes_data.size();
  227. };
  228. void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
  229. ERR_FAIL_COND(!tile_map.has(p_id));
  230. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  231. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  232. tile_map[p_id].shapes_data[p_shape_id].shape = p_shape;
  233. emit_changed();
  234. }
  235. Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
  236. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Shape2D>());
  237. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  238. return tile_map[p_id].shapes_data[p_shape_id].shape;
  239. return Ref<Shape2D>();
  240. }
  241. void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
  242. ERR_FAIL_COND(!tile_map.has(p_id));
  243. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  244. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  245. tile_map[p_id].shapes_data[p_shape_id].shape_transform = p_offset;
  246. emit_changed();
  247. }
  248. Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
  249. ERR_FAIL_COND_V(!tile_map.has(p_id), Transform2D());
  250. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  251. return tile_map[p_id].shapes_data[p_shape_id].shape_transform;
  252. return Transform2D();
  253. }
  254. void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
  255. ERR_FAIL_COND(!tile_map.has(p_id));
  256. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  257. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  258. tile_map[p_id].shapes_data[p_shape_id].one_way_collision = p_one_way;
  259. emit_changed();
  260. }
  261. bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
  262. ERR_FAIL_COND_V(!tile_map.has(p_id), false);
  263. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  264. return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
  265. return false;
  266. }
  267. void TileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
  268. ERR_FAIL_COND(!tile_map.has(p_id));
  269. tile_map[p_id].occluder = p_light_occluder;
  270. }
  271. Ref<OccluderPolygon2D> TileSet::tile_get_light_occluder(int p_id) const {
  272. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
  273. return tile_map[p_id].occluder;
  274. }
  275. void TileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) {
  276. ERR_FAIL_COND(!tile_map.has(p_id));
  277. tile_map[p_id].navigation_polygon_offset = p_offset;
  278. }
  279. Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const {
  280. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  281. return tile_map[p_id].navigation_polygon_offset;
  282. }
  283. void TileSet::tile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon) {
  284. ERR_FAIL_COND(!tile_map.has(p_id));
  285. tile_map[p_id].navigation_polygon = p_navigation_polygon;
  286. }
  287. Ref<NavigationPolygon> TileSet::tile_get_navigation_polygon(int p_id) const {
  288. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<NavigationPolygon>());
  289. return tile_map[p_id].navigation_polygon;
  290. }
  291. void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) {
  292. ERR_FAIL_COND(!tile_map.has(p_id));
  293. tile_map[p_id].occluder_offset = p_offset;
  294. }
  295. Vector2 TileSet::tile_get_occluder_offset(int p_id) const {
  296. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  297. return tile_map[p_id].occluder_offset;
  298. }
  299. void TileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
  300. ERR_FAIL_COND(!tile_map.has(p_id));
  301. tile_map[p_id].shapes_data = p_shapes;
  302. emit_changed();
  303. }
  304. Vector<TileSet::ShapeData> TileSet::tile_get_shapes(int p_id) const {
  305. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector<ShapeData>());
  306. return tile_map[p_id].shapes_data;
  307. }
  308. void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
  309. ERR_FAIL_COND(!tile_map.has(p_id));
  310. Vector<ShapeData> shapes_data;
  311. Transform2D default_transform = tile_get_shape_transform(p_id, 0);
  312. bool default_one_way = tile_get_shape_one_way(p_id, 0);
  313. for (int i = 0; i < p_shapes.size(); i++) {
  314. ShapeData s = ShapeData();
  315. if (p_shapes[i].get_type() == Variant::OBJECT) {
  316. Ref<Shape2D> shape = p_shapes[i];
  317. if (shape.is_null()) continue;
  318. s.shape = shape;
  319. s.shape_transform = default_transform;
  320. s.one_way_collision = default_one_way;
  321. } else if (p_shapes[i].get_type() == Variant::DICTIONARY) {
  322. Dictionary d = p_shapes[i];
  323. if (d.has("shape") && d["shape"].get_type() == Variant::OBJECT)
  324. s.shape = d["shape"];
  325. else
  326. continue;
  327. if (d.has("shape_transform") && d["shape_transform"].get_type() == Variant::TRANSFORM2D)
  328. s.shape_transform = d["shape_transform"];
  329. else if (d.has("shape_offset") && d["shape_offset"].get_type() == Variant::VECTOR2)
  330. s.shape_transform = Transform2D(0, (Vector2)d["shape_offset"]);
  331. else
  332. s.shape_transform = default_transform;
  333. if (d.has("one_way") && d["one_way"].get_type() == Variant::BOOL)
  334. s.one_way_collision = d["one_way"];
  335. else
  336. s.one_way_collision = default_one_way;
  337. } else {
  338. ERR_EXPLAIN("Expected an array of objects or dictionaries for tile_set_shapes");
  339. ERR_CONTINUE(true);
  340. }
  341. shapes_data.push_back(s);
  342. }
  343. tile_map[p_id].shapes_data = shapes_data;
  344. }
  345. Array TileSet::_tile_get_shapes(int p_id) const {
  346. ERR_FAIL_COND_V(!tile_map.has(p_id), Array());
  347. Array arr;
  348. Vector<ShapeData> data = tile_map[p_id].shapes_data;
  349. for (int i = 0; i < data.size(); i++) {
  350. Dictionary shape_data;
  351. shape_data["shape"] = data[i].shape;
  352. shape_data["shape_transform"] = data[i].shape_transform;
  353. shape_data["one_way"] = data[i].one_way_collision;
  354. arr.push_back(shape_data);
  355. }
  356. return arr;
  357. }
  358. Array TileSet::_get_tiles_ids() const {
  359. Array arr;
  360. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  361. arr.push_back(E->key());
  362. }
  363. return arr;
  364. }
  365. void TileSet::get_tile_list(List<int> *p_tiles) const {
  366. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  367. p_tiles->push_back(E->key());
  368. }
  369. }
  370. bool TileSet::has_tile(int p_id) const {
  371. return tile_map.has(p_id);
  372. }
  373. void TileSet::remove_tile(int p_id) {
  374. ERR_FAIL_COND(!tile_map.has(p_id));
  375. tile_map.erase(p_id);
  376. _change_notify("");
  377. emit_changed();
  378. }
  379. int TileSet::get_last_unused_tile_id() const {
  380. if (tile_map.size())
  381. return tile_map.back()->key() + 1;
  382. else
  383. return 0;
  384. }
  385. int TileSet::find_tile_by_name(const String &p_name) const {
  386. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  387. if (p_name == E->get().name)
  388. return E->key();
  389. }
  390. return -1;
  391. }
  392. void TileSet::clear() {
  393. tile_map.clear();
  394. _change_notify("");
  395. emit_changed();
  396. }
  397. void TileSet::_bind_methods() {
  398. ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile);
  399. ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name);
  400. ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
  401. ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture);
  402. ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture);
  403. ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map);
  404. ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map);
  405. ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material);
  406. ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material);
  407. ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset);
  408. ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset);
  409. ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region);
  410. ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region);
  411. ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape);
  412. ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape);
  413. ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform);
  414. ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform);
  415. ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way);
  416. ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way);
  417. ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way"), &TileSet::tile_add_shape, DEFVAL(false));
  418. ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count);
  419. ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes);
  420. ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes);
  421. ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon);
  422. ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon);
  423. ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset);
  424. ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset);
  425. ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder);
  426. ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder);
  427. ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset);
  428. ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset);
  429. ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile);
  430. ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear);
  431. ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id);
  432. ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name);
  433. ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids);
  434. }
  435. TileSet::TileSet() {
  436. }