tile_set.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /*************************************************************************/
  2. /* tile_set.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.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. tile_set_shape_offset(id, 0, p_value);
  58. else if (what == "shape_one_way")
  59. tile_set_shape_one_way(id, 0, p_value);
  60. else if (what == "shapes")
  61. _tile_set_shapes(id, p_value);
  62. else if (what == "occluder")
  63. tile_set_light_occluder(id, p_value);
  64. else if (what == "occluder_offset")
  65. tile_set_occluder_offset(id, p_value);
  66. else if (what == "navigation")
  67. tile_set_navigation_polygon(id, p_value);
  68. else if (what == "navigation_offset")
  69. tile_set_navigation_polygon_offset(id, p_value);
  70. else
  71. return false;
  72. return true;
  73. }
  74. bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
  75. String n = p_name;
  76. int slash = n.find("/");
  77. if (slash == -1)
  78. return false;
  79. int id = String::to_int(n.c_str(), slash);
  80. ERR_FAIL_COND_V(!tile_map.has(id), false);
  81. String what = n.substr(slash + 1, n.length());
  82. if (what == "name")
  83. r_ret = tile_get_name(id);
  84. else if (what == "texture")
  85. r_ret = tile_get_texture(id);
  86. else if (what == "normal_map")
  87. r_ret = tile_get_normal_map(id);
  88. else if (what == "tex_offset")
  89. r_ret = tile_get_texture_offset(id);
  90. else if (what == "material")
  91. r_ret = tile_get_material(id);
  92. else if (what == "modulate")
  93. r_ret = tile_get_modulate(id);
  94. else if (what == "region")
  95. r_ret = tile_get_region(id);
  96. else if (what == "shape")
  97. r_ret = tile_get_shape(id, 0);
  98. else if (what == "shape_offset")
  99. r_ret = tile_get_shape_offset(id, 0);
  100. else if (what == "shape_one_way")
  101. r_ret = tile_get_shape_one_way(id, 0);
  102. else if (what == "shapes")
  103. r_ret = _tile_get_shapes(id);
  104. else if (what == "occluder")
  105. r_ret = tile_get_light_occluder(id);
  106. else if (what == "occluder_offset")
  107. r_ret = tile_get_occluder_offset(id);
  108. else if (what == "navigation")
  109. r_ret = tile_get_navigation_polygon(id);
  110. else if (what == "navigation_offset")
  111. r_ret = tile_get_navigation_polygon_offset(id);
  112. else
  113. return false;
  114. return true;
  115. }
  116. void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
  117. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  118. int id = E->key();
  119. String pre = itos(id) + "/";
  120. p_list->push_back(PropertyInfo(Variant::STRING, pre + "name"));
  121. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
  122. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
  123. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "tex_offset"));
  124. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"));
  125. p_list->push_back(PropertyInfo(Variant::COLOR, pre + "modulate"));
  126. p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region"));
  127. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "occluder_offset"));
  128. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D"));
  129. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "navigation_offset"));
  130. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "navigation", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"));
  131. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  132. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_EDITOR));
  133. p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  134. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
  135. }
  136. }
  137. void TileSet::create_tile(int p_id) {
  138. ERR_FAIL_COND(tile_map.has(p_id));
  139. tile_map[p_id] = TileData();
  140. _change_notify("");
  141. emit_changed();
  142. }
  143. void TileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) {
  144. ERR_FAIL_COND(!tile_map.has(p_id));
  145. tile_map[p_id].texture = p_texture;
  146. emit_changed();
  147. }
  148. Ref<Texture> TileSet::tile_get_texture(int p_id) const {
  149. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture>());
  150. return tile_map[p_id].texture;
  151. }
  152. void TileSet::tile_set_normal_map(int p_id, const Ref<Texture> &p_normal_map) {
  153. ERR_FAIL_COND(!tile_map.has(p_id));
  154. tile_map[p_id].normal_map = p_normal_map;
  155. emit_changed();
  156. }
  157. Ref<Texture> TileSet::tile_get_normal_map(int p_id) const {
  158. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture>());
  159. return tile_map[p_id].normal_map;
  160. }
  161. void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
  162. ERR_FAIL_COND(!tile_map.has(p_id));
  163. tile_map[p_id].material = p_material;
  164. emit_changed();
  165. }
  166. Ref<ShaderMaterial> TileSet::tile_get_material(int p_id) const {
  167. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<ShaderMaterial>());
  168. return tile_map[p_id].material;
  169. }
  170. void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
  171. ERR_FAIL_COND(!tile_map.has(p_id));
  172. tile_map[p_id].modulate = p_modulate;
  173. emit_changed();
  174. }
  175. Color TileSet::tile_get_modulate(int p_id) const {
  176. ERR_FAIL_COND_V(!tile_map.has(p_id), Color(1, 1, 1));
  177. return tile_map[p_id].modulate;
  178. }
  179. void TileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) {
  180. ERR_FAIL_COND(!tile_map.has(p_id));
  181. tile_map[p_id].offset = p_offset;
  182. emit_changed();
  183. }
  184. Vector2 TileSet::tile_get_texture_offset(int p_id) const {
  185. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  186. return tile_map[p_id].offset;
  187. }
  188. void TileSet::tile_set_region(int p_id, const Rect2 &p_region) {
  189. ERR_FAIL_COND(!tile_map.has(p_id));
  190. tile_map[p_id].region = p_region;
  191. emit_changed();
  192. }
  193. Rect2 TileSet::tile_get_region(int p_id) const {
  194. ERR_FAIL_COND_V(!tile_map.has(p_id), Rect2());
  195. return tile_map[p_id].region;
  196. }
  197. void TileSet::tile_set_name(int p_id, const String &p_name) {
  198. ERR_FAIL_COND(!tile_map.has(p_id));
  199. tile_map[p_id].name = p_name;
  200. emit_changed();
  201. }
  202. String TileSet::tile_get_name(int p_id) const {
  203. ERR_FAIL_COND_V(!tile_map.has(p_id), String());
  204. return tile_map[p_id].name;
  205. }
  206. void TileSet::tile_clear_shapes(int p_id) {
  207. tile_map[p_id].shapes_data.clear();
  208. }
  209. void TileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Vector2 &p_offset, bool p_one_way) {
  210. ERR_FAIL_COND(!tile_map.has(p_id));
  211. ShapeData new_data = ShapeData();
  212. new_data.shape = p_shape;
  213. new_data.shape_offset = p_offset;
  214. new_data.one_way_collision = p_one_way;
  215. tile_map[p_id].shapes_data.push_back(new_data);
  216. };
  217. int TileSet::tile_get_shape_count(int p_id) const {
  218. ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
  219. return tile_map[p_id].shapes_data.size();
  220. };
  221. void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
  222. ERR_FAIL_COND(!tile_map.has(p_id));
  223. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  224. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  225. tile_map[p_id].shapes_data[p_shape_id].shape = p_shape;
  226. emit_changed();
  227. }
  228. Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
  229. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Shape2D>());
  230. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  231. return tile_map[p_id].shapes_data[p_shape_id].shape;
  232. return Ref<Shape2D>();
  233. }
  234. void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
  235. ERR_FAIL_COND(!tile_map.has(p_id));
  236. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  237. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  238. tile_map[p_id].shapes_data[p_shape_id].shape_offset = p_offset;
  239. emit_changed();
  240. }
  241. Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
  242. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  243. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  244. return tile_map[p_id].shapes_data[p_shape_id].shape_offset;
  245. return Vector2();
  246. }
  247. void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
  248. ERR_FAIL_COND(!tile_map.has(p_id));
  249. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  250. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  251. tile_map[p_id].shapes_data[p_shape_id].one_way_collision = p_one_way;
  252. emit_changed();
  253. }
  254. bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
  255. ERR_FAIL_COND_V(!tile_map.has(p_id), false);
  256. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  257. return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
  258. return false;
  259. }
  260. void TileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
  261. ERR_FAIL_COND(!tile_map.has(p_id));
  262. tile_map[p_id].occluder = p_light_occluder;
  263. }
  264. Ref<OccluderPolygon2D> TileSet::tile_get_light_occluder(int p_id) const {
  265. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
  266. return tile_map[p_id].occluder;
  267. }
  268. void TileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) {
  269. ERR_FAIL_COND(!tile_map.has(p_id));
  270. tile_map[p_id].navigation_polygon_offset = p_offset;
  271. }
  272. Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const {
  273. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  274. return tile_map[p_id].navigation_polygon_offset;
  275. }
  276. void TileSet::tile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon) {
  277. ERR_FAIL_COND(!tile_map.has(p_id));
  278. tile_map[p_id].navigation_polygon = p_navigation_polygon;
  279. }
  280. Ref<NavigationPolygon> TileSet::tile_get_navigation_polygon(int p_id) const {
  281. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<NavigationPolygon>());
  282. return tile_map[p_id].navigation_polygon;
  283. }
  284. void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) {
  285. ERR_FAIL_COND(!tile_map.has(p_id));
  286. tile_map[p_id].occluder_offset = p_offset;
  287. }
  288. Vector2 TileSet::tile_get_occluder_offset(int p_id) const {
  289. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  290. return tile_map[p_id].occluder_offset;
  291. }
  292. void TileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
  293. ERR_FAIL_COND(!tile_map.has(p_id));
  294. tile_map[p_id].shapes_data = p_shapes;
  295. emit_changed();
  296. }
  297. Vector<TileSet::ShapeData> TileSet::tile_get_shapes(int p_id) const {
  298. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector<ShapeData>());
  299. return tile_map[p_id].shapes_data;
  300. }
  301. void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
  302. ERR_FAIL_COND(!tile_map.has(p_id));
  303. Vector<ShapeData> shapes_data;
  304. Vector2 default_offset = tile_get_shape_offset(p_id, 0);
  305. bool default_one_way = tile_get_shape_one_way(p_id, 0);
  306. for (int i = 0; i < p_shapes.size(); i++) {
  307. ShapeData s = ShapeData();
  308. if (p_shapes[i].get_type() == Variant::OBJECT) {
  309. Ref<Shape2D> shape = p_shapes[i];
  310. if (shape.is_null()) continue;
  311. s.shape = shape;
  312. s.shape_offset = default_offset;
  313. s.one_way_collision = default_one_way;
  314. } else if (p_shapes[i].get_type() == Variant::DICTIONARY) {
  315. Dictionary d = p_shapes[i];
  316. if (d.has("shape") && d["shape"].get_type() == Variant::OBJECT)
  317. s.shape = d["shape"];
  318. else
  319. continue;
  320. if (d.has("shape_offset") && d["shape_offset"].get_type() == Variant::VECTOR2)
  321. s.shape_offset = d["shape_offset"];
  322. else
  323. s.shape_offset = default_offset;
  324. if (d.has("one_way") && d["one_way"].get_type() == Variant::BOOL)
  325. s.one_way_collision = d["one_way"];
  326. else
  327. s.one_way_collision = default_one_way;
  328. } else {
  329. ERR_EXPLAIN("Expected an array of objects or dictionaries for tile_set_shapes");
  330. ERR_CONTINUE(true);
  331. }
  332. shapes_data.push_back(s);
  333. }
  334. tile_map[p_id].shapes_data = shapes_data;
  335. }
  336. Array TileSet::_tile_get_shapes(int p_id) const {
  337. ERR_FAIL_COND_V(!tile_map.has(p_id), Array());
  338. Array arr;
  339. Vector<ShapeData> data = tile_map[p_id].shapes_data;
  340. for (int i = 0; i < data.size(); i++) {
  341. Dictionary shape_data;
  342. shape_data["shape"] = data[i].shape;
  343. shape_data["shape_offset"] = data[i].shape_offset;
  344. shape_data["one_way"] = data[i].one_way_collision;
  345. arr.push_back(shape_data);
  346. }
  347. return arr;
  348. }
  349. Array TileSet::_get_tiles_ids() const {
  350. Array arr;
  351. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  352. arr.push_back(E->key());
  353. }
  354. return arr;
  355. }
  356. void TileSet::get_tile_list(List<int> *p_tiles) const {
  357. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  358. p_tiles->push_back(E->key());
  359. }
  360. }
  361. bool TileSet::has_tile(int p_id) const {
  362. return tile_map.has(p_id);
  363. }
  364. void TileSet::remove_tile(int p_id) {
  365. ERR_FAIL_COND(!tile_map.has(p_id));
  366. tile_map.erase(p_id);
  367. _change_notify("");
  368. emit_changed();
  369. }
  370. int TileSet::get_last_unused_tile_id() const {
  371. if (tile_map.size())
  372. return tile_map.back()->key() + 1;
  373. else
  374. return 0;
  375. }
  376. int TileSet::find_tile_by_name(const String &p_name) const {
  377. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  378. if (p_name == E->get().name)
  379. return E->key();
  380. }
  381. return -1;
  382. }
  383. void TileSet::clear() {
  384. tile_map.clear();
  385. _change_notify("");
  386. emit_changed();
  387. }
  388. void TileSet::_bind_methods() {
  389. ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile);
  390. ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name);
  391. ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
  392. ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture:Texture"), &TileSet::tile_set_texture);
  393. ClassDB::bind_method(D_METHOD("tile_get_texture:Texture", "id"), &TileSet::tile_get_texture);
  394. ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map:Texture"), &TileSet::tile_set_normal_map);
  395. ClassDB::bind_method(D_METHOD("tile_get_normal_map:Texture", "id"), &TileSet::tile_get_normal_map);
  396. ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material:ShaderMaterial"), &TileSet::tile_set_material);
  397. ClassDB::bind_method(D_METHOD("tile_get_material:ShaderMaterial", "id"), &TileSet::tile_get_material);
  398. ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset);
  399. ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset);
  400. ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region);
  401. ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region);
  402. ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape:Shape2D"), &TileSet::tile_set_shape);
  403. ClassDB::bind_method(D_METHOD("tile_get_shape:Shape2D", "id", "shape_id"), &TileSet::tile_get_shape);
  404. ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &TileSet::tile_set_shape_offset);
  405. ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &TileSet::tile_get_shape_offset);
  406. ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way);
  407. ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way);
  408. ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape:Shape2D", "shape_offset", "one_way"), &TileSet::tile_add_shape, DEFVAL(false));
  409. ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count);
  410. ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes);
  411. ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes);
  412. ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon:NavigationPolygon"), &TileSet::tile_set_navigation_polygon);
  413. ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon:NavigationPolygon", "id"), &TileSet::tile_get_navigation_polygon);
  414. ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset);
  415. ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset);
  416. ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder:OccluderPolygon2D"), &TileSet::tile_set_light_occluder);
  417. ClassDB::bind_method(D_METHOD("tile_get_light_occluder:OccluderPolygon2D", "id"), &TileSet::tile_get_light_occluder);
  418. ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset);
  419. ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset);
  420. ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile);
  421. ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear);
  422. ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id);
  423. ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name);
  424. ClassDB::bind_method(D_METHOD("get_tiles_ids", "name"), &TileSet::_get_tiles_ids);
  425. }
  426. TileSet::TileSet() {
  427. }