tile_set.cpp 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. /*************************************************************************/
  2. /* tile_set.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2018 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. #include "array.h"
  32. bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
  33. String n = p_name;
  34. int slash = n.find("/");
  35. if (slash == -1)
  36. return false;
  37. int id = String::to_int(n.c_str(), slash);
  38. if (!tile_map.has(id))
  39. create_tile(id);
  40. String what = n.substr(slash + 1, n.length());
  41. if (what == "name")
  42. tile_set_name(id, p_value);
  43. else if (what == "texture")
  44. tile_set_texture(id, p_value);
  45. else if (what == "normal_map")
  46. tile_set_normal_map(id, p_value);
  47. else if (what == "tex_offset")
  48. tile_set_texture_offset(id, p_value);
  49. else if (what == "material")
  50. tile_set_material(id, p_value);
  51. else if (what == "modulate")
  52. tile_set_modulate(id, p_value);
  53. else if (what == "region")
  54. tile_set_region(id, p_value);
  55. else if (what == "tile_mode")
  56. tile_set_tile_mode(id, (TileMode)((int)p_value));
  57. else if (what.left(9) == "autotile/") {
  58. what = what.right(9);
  59. if (what == "bitmask_mode")
  60. autotile_set_bitmask_mode(id, (BitmaskMode)((int)p_value));
  61. else if (what == "icon_coordinate")
  62. autotile_set_icon_coordinate(id, p_value);
  63. else if (what == "tile_size")
  64. autotile_set_size(id, p_value);
  65. else if (what == "spacing")
  66. autotile_set_spacing(id, p_value);
  67. else if (what == "bitmask_flags") {
  68. tile_map[id].autotile_data.flags.clear();
  69. if (p_value.is_array()) {
  70. Array p = p_value;
  71. Vector2 last_coord;
  72. while (p.size() > 0) {
  73. if (p[0].get_type() == Variant::VECTOR2) {
  74. last_coord = p[0];
  75. } else if (p[0].get_type() == Variant::INT) {
  76. autotile_set_bitmask(id, last_coord, p[0]);
  77. }
  78. p.pop_front();
  79. }
  80. }
  81. } else if (what == "occluder_map") {
  82. tile_map[id].autotile_data.occluder_map.clear();
  83. Array p = p_value;
  84. Vector2 last_coord;
  85. while (p.size() > 0) {
  86. if (p[0].get_type() == Variant::VECTOR2) {
  87. last_coord = p[0];
  88. } else if (p[0].get_type() == Variant::OBJECT) {
  89. autotile_set_light_occluder(id, p[0], last_coord);
  90. }
  91. p.pop_front();
  92. }
  93. } else if (what == "navpoly_map") {
  94. tile_map[id].autotile_data.navpoly_map.clear();
  95. Array p = p_value;
  96. Vector2 last_coord;
  97. while (p.size() > 0) {
  98. if (p[0].get_type() == Variant::VECTOR2) {
  99. last_coord = p[0];
  100. } else if (p[0].get_type() == Variant::OBJECT) {
  101. autotile_set_navigation_polygon(id, p[0], last_coord);
  102. }
  103. p.pop_front();
  104. }
  105. } else if (what == "priority_map") {
  106. tile_map[id].autotile_data.priority_map.clear();
  107. Array p = p_value;
  108. Vector3 val;
  109. Vector2 v;
  110. int priority;
  111. while (p.size() > 0) {
  112. val = p[0];
  113. if (val.z > 1) {
  114. v.x = val.x;
  115. v.y = val.y;
  116. priority = (int)val.z;
  117. tile_map[id].autotile_data.priority_map[v] = priority;
  118. }
  119. p.pop_front();
  120. }
  121. }
  122. } else if (what == "shape")
  123. tile_set_shape(id, 0, p_value);
  124. else if (what == "shape_offset")
  125. tile_set_shape_offset(id, 0, p_value);
  126. else if (what == "shape_transform")
  127. tile_set_shape_transform(id, 0, p_value);
  128. else if (what == "shape_one_way")
  129. tile_set_shape_one_way(id, 0, p_value);
  130. else if (what == "shapes")
  131. _tile_set_shapes(id, p_value);
  132. else if (what == "occluder")
  133. tile_set_light_occluder(id, p_value);
  134. else if (what == "occluder_offset")
  135. tile_set_occluder_offset(id, p_value);
  136. else if (what == "navigation")
  137. tile_set_navigation_polygon(id, p_value);
  138. else if (what == "navigation_offset")
  139. tile_set_navigation_polygon_offset(id, p_value);
  140. else if (what == "z_index")
  141. tile_set_z_index(id, p_value);
  142. else
  143. return false;
  144. return true;
  145. }
  146. bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
  147. String n = p_name;
  148. int slash = n.find("/");
  149. if (slash == -1)
  150. return false;
  151. int id = String::to_int(n.c_str(), slash);
  152. ERR_FAIL_COND_V(!tile_map.has(id), false);
  153. String what = n.substr(slash + 1, n.length());
  154. if (what == "name")
  155. r_ret = tile_get_name(id);
  156. else if (what == "texture")
  157. r_ret = tile_get_texture(id);
  158. else if (what == "normal_map")
  159. r_ret = tile_get_normal_map(id);
  160. else if (what == "tex_offset")
  161. r_ret = tile_get_texture_offset(id);
  162. else if (what == "material")
  163. r_ret = tile_get_material(id);
  164. else if (what == "modulate")
  165. r_ret = tile_get_modulate(id);
  166. else if (what == "region")
  167. r_ret = tile_get_region(id);
  168. else if (what == "tile_mode")
  169. r_ret = tile_get_tile_mode(id);
  170. else if (what.left(9) == "autotile/") {
  171. what = what.right(9);
  172. if (what == "bitmask_mode")
  173. r_ret = autotile_get_bitmask_mode(id);
  174. else if (what == "icon_coordinate")
  175. r_ret = autotile_get_icon_coordinate(id);
  176. else if (what == "tile_size")
  177. r_ret = autotile_get_size(id);
  178. else if (what == "spacing")
  179. r_ret = autotile_get_spacing(id);
  180. else if (what == "bitmask_flags") {
  181. Array p;
  182. for (Map<Vector2, uint16_t>::Element *E = tile_map[id].autotile_data.flags.front(); E; E = E->next()) {
  183. p.push_back(E->key());
  184. p.push_back(E->value());
  185. }
  186. r_ret = p;
  187. } else if (what == "occluder_map") {
  188. Array p;
  189. for (Map<Vector2, Ref<OccluderPolygon2D> >::Element *E = tile_map[id].autotile_data.occluder_map.front(); E; E = E->next()) {
  190. p.push_back(E->key());
  191. p.push_back(E->value());
  192. }
  193. r_ret = p;
  194. } else if (what == "navpoly_map") {
  195. Array p;
  196. for (Map<Vector2, Ref<NavigationPolygon> >::Element *E = tile_map[id].autotile_data.navpoly_map.front(); E; E = E->next()) {
  197. p.push_back(E->key());
  198. p.push_back(E->value());
  199. }
  200. r_ret = p;
  201. } else if (what == "priority_map") {
  202. Array p;
  203. Vector3 v;
  204. for (Map<Vector2, int>::Element *E = tile_map[id].autotile_data.priority_map.front(); E; E = E->next()) {
  205. if (E->value() > 1) {
  206. //Don't save default value
  207. v.x = E->key().x;
  208. v.y = E->key().y;
  209. v.z = E->value();
  210. p.push_back(v);
  211. }
  212. }
  213. r_ret = p;
  214. }
  215. } else if (what == "shape")
  216. r_ret = tile_get_shape(id, 0);
  217. else if (what == "shape_offset")
  218. r_ret = tile_get_shape_offset(id, 0);
  219. else if (what == "shape_transform")
  220. r_ret = tile_get_shape_transform(id, 0);
  221. else if (what == "shape_one_way")
  222. r_ret = tile_get_shape_one_way(id, 0);
  223. else if (what == "shapes")
  224. r_ret = _tile_get_shapes(id);
  225. else if (what == "occluder")
  226. r_ret = tile_get_light_occluder(id);
  227. else if (what == "occluder_offset")
  228. r_ret = tile_get_occluder_offset(id);
  229. else if (what == "navigation")
  230. r_ret = tile_get_navigation_polygon(id);
  231. else if (what == "navigation_offset")
  232. r_ret = tile_get_navigation_polygon_offset(id);
  233. else if (what == "z_index")
  234. r_ret = tile_get_z_index(id);
  235. else
  236. return false;
  237. return true;
  238. }
  239. void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
  240. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  241. int id = E->key();
  242. String pre = itos(id) + "/";
  243. p_list->push_back(PropertyInfo(Variant::STRING, pre + "name"));
  244. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
  245. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
  246. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "tex_offset"));
  247. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"));
  248. p_list->push_back(PropertyInfo(Variant::COLOR, pre + "modulate"));
  249. p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region"));
  250. p_list->push_back(PropertyInfo(Variant::INT, pre + "tile_mode", PROPERTY_HINT_ENUM, "SINGLE_TILE,AUTO_TILE"));
  251. if (tile_get_tile_mode(id) == AUTO_TILE) {
  252. p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/bitmask_mode", PROPERTY_HINT_ENUM, "2X2,3X3 (minimal),3X3", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  253. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/bitmask_flags", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  254. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/icon_coordinate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  255. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  256. p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  257. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  258. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  259. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
  260. }
  261. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "occluder_offset"));
  262. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D"));
  263. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "navigation_offset"));
  264. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "navigation", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"));
  265. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  266. p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  267. p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_EDITOR));
  268. p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
  269. p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
  270. 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"));
  271. }
  272. }
  273. void TileSet::create_tile(int p_id) {
  274. ERR_FAIL_COND(tile_map.has(p_id));
  275. tile_map[p_id] = TileData();
  276. tile_map[p_id].autotile_data = AutotileData();
  277. _change_notify("");
  278. emit_changed();
  279. }
  280. void TileSet::autotile_set_bitmask_mode(int p_id, BitmaskMode p_mode) {
  281. ERR_FAIL_COND(!tile_map.has(p_id));
  282. tile_map[p_id].autotile_data.bitmask_mode = p_mode;
  283. _change_notify("");
  284. emit_changed();
  285. }
  286. TileSet::BitmaskMode TileSet::autotile_get_bitmask_mode(int p_id) const {
  287. ERR_FAIL_COND_V(!tile_map.has(p_id), BITMASK_2X2);
  288. return tile_map[p_id].autotile_data.bitmask_mode;
  289. }
  290. void TileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) {
  291. ERR_FAIL_COND(!tile_map.has(p_id));
  292. tile_map[p_id].texture = p_texture;
  293. emit_changed();
  294. _change_notify("texture");
  295. }
  296. Ref<Texture> TileSet::tile_get_texture(int p_id) const {
  297. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture>());
  298. return tile_map[p_id].texture;
  299. }
  300. void TileSet::tile_set_normal_map(int p_id, const Ref<Texture> &p_normal_map) {
  301. ERR_FAIL_COND(!tile_map.has(p_id));
  302. tile_map[p_id].normal_map = p_normal_map;
  303. emit_changed();
  304. }
  305. Ref<Texture> TileSet::tile_get_normal_map(int p_id) const {
  306. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture>());
  307. return tile_map[p_id].normal_map;
  308. }
  309. void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
  310. ERR_FAIL_COND(!tile_map.has(p_id));
  311. tile_map[p_id].material = p_material;
  312. emit_changed();
  313. }
  314. Ref<ShaderMaterial> TileSet::tile_get_material(int p_id) const {
  315. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<ShaderMaterial>());
  316. return tile_map[p_id].material;
  317. }
  318. void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
  319. ERR_FAIL_COND(!tile_map.has(p_id));
  320. tile_map[p_id].modulate = p_modulate;
  321. emit_changed();
  322. _change_notify("modulate");
  323. }
  324. Color TileSet::tile_get_modulate(int p_id) const {
  325. ERR_FAIL_COND_V(!tile_map.has(p_id), Color(1, 1, 1));
  326. return tile_map[p_id].modulate;
  327. }
  328. void TileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) {
  329. ERR_FAIL_COND(!tile_map.has(p_id));
  330. tile_map[p_id].offset = p_offset;
  331. emit_changed();
  332. }
  333. Vector2 TileSet::tile_get_texture_offset(int p_id) const {
  334. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  335. return tile_map[p_id].offset;
  336. }
  337. void TileSet::tile_set_region(int p_id, const Rect2 &p_region) {
  338. ERR_FAIL_COND(!tile_map.has(p_id));
  339. tile_map[p_id].region = p_region;
  340. emit_changed();
  341. _change_notify("region");
  342. }
  343. Rect2 TileSet::tile_get_region(int p_id) const {
  344. ERR_FAIL_COND_V(!tile_map.has(p_id), Rect2());
  345. return tile_map[p_id].region;
  346. }
  347. void TileSet::tile_set_tile_mode(int p_id, TileMode p_tile_mode) {
  348. ERR_FAIL_COND(!tile_map.has(p_id));
  349. tile_map[p_id].tile_mode = p_tile_mode;
  350. emit_changed();
  351. _change_notify("tile_mode");
  352. }
  353. TileSet::TileMode TileSet::tile_get_tile_mode(int p_id) const {
  354. ERR_FAIL_COND_V(!tile_map.has(p_id), SINGLE_TILE);
  355. return tile_map[p_id].tile_mode;
  356. }
  357. void TileSet::autotile_set_icon_coordinate(int p_id, Vector2 coord) {
  358. ERR_FAIL_COND(!tile_map.has(p_id));
  359. tile_map[p_id].autotile_data.icon_coord = coord;
  360. emit_changed();
  361. }
  362. Vector2 TileSet::autotile_get_icon_coordinate(int p_id) const {
  363. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  364. return tile_map[p_id].autotile_data.icon_coord;
  365. }
  366. void TileSet::autotile_set_spacing(int p_id, int p_spacing) {
  367. ERR_FAIL_COND(!tile_map.has(p_id));
  368. ERR_FAIL_COND(p_spacing < 0);
  369. tile_map[p_id].autotile_data.spacing = p_spacing;
  370. emit_changed();
  371. }
  372. int TileSet::autotile_get_spacing(int p_id) const {
  373. ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
  374. return tile_map[p_id].autotile_data.spacing;
  375. }
  376. void TileSet::autotile_set_size(int p_id, Size2 p_size) {
  377. ERR_FAIL_COND(!tile_map.has(p_id));
  378. ERR_FAIL_COND(p_size.x <= 0 || p_size.y <= 0);
  379. tile_map[p_id].autotile_data.size = p_size;
  380. }
  381. Size2 TileSet::autotile_get_size(int p_id) const {
  382. ERR_FAIL_COND_V(!tile_map.has(p_id), Size2());
  383. return tile_map[p_id].autotile_data.size;
  384. }
  385. void TileSet::autotile_clear_bitmask_map(int p_id) {
  386. ERR_FAIL_COND(!tile_map.has(p_id));
  387. tile_map[p_id].autotile_data.flags.clear();
  388. }
  389. void TileSet::autotile_set_subtile_priority(int p_id, const Vector2 &p_coord, int p_priority) {
  390. ERR_FAIL_COND(!tile_map.has(p_id));
  391. ERR_FAIL_COND(p_priority <= 0);
  392. tile_map[p_id].autotile_data.priority_map[p_coord] = p_priority;
  393. }
  394. int TileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) {
  395. ERR_FAIL_COND_V(!tile_map.has(p_id), 1);
  396. if (tile_map[p_id].autotile_data.priority_map.has(p_coord)) {
  397. return tile_map[p_id].autotile_data.priority_map[p_coord];
  398. }
  399. //When not custom priority set return the default value
  400. return 1;
  401. }
  402. const Map<Vector2, int> &TileSet::autotile_get_priority_map(int p_id) const {
  403. static Map<Vector2, int> dummy;
  404. ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
  405. return tile_map[p_id].autotile_data.priority_map;
  406. }
  407. void TileSet::autotile_set_bitmask(int p_id, Vector2 p_coord, uint16_t p_flag) {
  408. ERR_FAIL_COND(!tile_map.has(p_id));
  409. if (p_flag == 0) {
  410. if (tile_map[p_id].autotile_data.flags.has(p_coord))
  411. tile_map[p_id].autotile_data.flags.erase(p_coord);
  412. } else {
  413. tile_map[p_id].autotile_data.flags[p_coord] = p_flag;
  414. }
  415. }
  416. uint16_t TileSet::autotile_get_bitmask(int p_id, Vector2 p_coord) {
  417. ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
  418. if (!tile_map[p_id].autotile_data.flags.has(p_coord)) {
  419. return 0;
  420. }
  421. return tile_map[p_id].autotile_data.flags[p_coord];
  422. }
  423. const Map<Vector2, uint16_t> &TileSet::autotile_get_bitmask_map(int p_id) {
  424. static Map<Vector2, uint16_t> dummy;
  425. ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
  426. return tile_map[p_id].autotile_data.flags;
  427. }
  428. Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
  429. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  430. //First try to forward selection to script
  431. if (p_tilemap_node->get_class_name() == "TileMap") {
  432. if (get_script_instance() != NULL) {
  433. if (get_script_instance()->has_method("_forward_subtile_selection")) {
  434. Variant ret = get_script_instance()->call("_forward_subtile_selection", p_id, p_bitmask, p_tilemap_node, p_tile_location);
  435. if (ret.get_type() == Variant::VECTOR2) {
  436. return ret;
  437. }
  438. }
  439. }
  440. }
  441. List<Vector2> coords;
  442. uint16_t mask;
  443. for (Map<Vector2, uint16_t>::Element *E = tile_map[p_id].autotile_data.flags.front(); E; E = E->next()) {
  444. mask = E->get();
  445. if (tile_map[p_id].autotile_data.bitmask_mode == BITMASK_2X2) {
  446. mask &= (BIND_BOTTOMLEFT | BIND_BOTTOMRIGHT | BIND_TOPLEFT | BIND_TOPRIGHT);
  447. }
  448. if (mask == p_bitmask) {
  449. for (int i = 0; i < autotile_get_subtile_priority(p_id, E->key()); i++) {
  450. coords.push_back(E->key());
  451. }
  452. }
  453. }
  454. if (coords.size() == 0) {
  455. return autotile_get_icon_coordinate(p_id);
  456. } else {
  457. return coords[Math::random(0, (int)coords.size())];
  458. }
  459. }
  460. void TileSet::tile_set_name(int p_id, const String &p_name) {
  461. ERR_FAIL_COND(!tile_map.has(p_id));
  462. tile_map[p_id].name = p_name;
  463. emit_changed();
  464. _change_notify("name");
  465. }
  466. String TileSet::tile_get_name(int p_id) const {
  467. ERR_FAIL_COND_V(!tile_map.has(p_id), String());
  468. return tile_map[p_id].name;
  469. }
  470. void TileSet::tile_clear_shapes(int p_id) {
  471. tile_map[p_id].shapes_data.clear();
  472. }
  473. 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) {
  474. ERR_FAIL_COND(!tile_map.has(p_id));
  475. ShapeData new_data = ShapeData();
  476. new_data.shape = p_shape;
  477. new_data.shape_transform = p_transform;
  478. new_data.one_way_collision = p_one_way;
  479. new_data.autotile_coord = p_autotile_coord;
  480. tile_map[p_id].shapes_data.push_back(new_data);
  481. }
  482. int TileSet::tile_get_shape_count(int p_id) const {
  483. ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
  484. return tile_map[p_id].shapes_data.size();
  485. }
  486. void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
  487. ERR_FAIL_COND(!tile_map.has(p_id));
  488. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  489. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  490. tile_map[p_id].shapes_data[p_shape_id].shape = p_shape;
  491. emit_changed();
  492. }
  493. Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
  494. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Shape2D>());
  495. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  496. return tile_map[p_id].shapes_data[p_shape_id].shape;
  497. return Ref<Shape2D>();
  498. }
  499. void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
  500. ERR_FAIL_COND(!tile_map.has(p_id));
  501. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  502. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  503. tile_map[p_id].shapes_data[p_shape_id].shape_transform = p_offset;
  504. emit_changed();
  505. }
  506. Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
  507. ERR_FAIL_COND_V(!tile_map.has(p_id), Transform2D());
  508. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  509. return tile_map[p_id].shapes_data[p_shape_id].shape_transform;
  510. return Transform2D();
  511. }
  512. void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
  513. Transform2D transform = tile_get_shape_transform(p_id, p_shape_id);
  514. transform.set_origin(p_offset);
  515. tile_set_shape_transform(p_id, p_shape_id, transform);
  516. }
  517. Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
  518. return tile_get_shape_transform(p_id, p_shape_id).get_origin();
  519. }
  520. void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
  521. ERR_FAIL_COND(!tile_map.has(p_id));
  522. if (tile_map[p_id].shapes_data.size() <= p_shape_id)
  523. tile_map[p_id].shapes_data.resize(p_shape_id + 1);
  524. tile_map[p_id].shapes_data[p_shape_id].one_way_collision = p_one_way;
  525. emit_changed();
  526. }
  527. bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
  528. ERR_FAIL_COND_V(!tile_map.has(p_id), false);
  529. if (tile_map[p_id].shapes_data.size() > p_shape_id)
  530. return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
  531. return false;
  532. }
  533. void TileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
  534. ERR_FAIL_COND(!tile_map.has(p_id));
  535. tile_map[p_id].occluder = p_light_occluder;
  536. }
  537. Ref<OccluderPolygon2D> TileSet::tile_get_light_occluder(int p_id) const {
  538. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
  539. return tile_map[p_id].occluder;
  540. }
  541. void TileSet::autotile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder, const Vector2 &p_coord) {
  542. ERR_FAIL_COND(!tile_map.has(p_id));
  543. if (p_light_occluder.is_null()) {
  544. if (tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
  545. tile_map[p_id].autotile_data.occluder_map.erase(p_coord);
  546. }
  547. } else {
  548. tile_map[p_id].autotile_data.occluder_map[p_coord] = p_light_occluder;
  549. }
  550. }
  551. Ref<OccluderPolygon2D> TileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const {
  552. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
  553. if (!tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
  554. return Ref<OccluderPolygon2D>();
  555. } else {
  556. return tile_map[p_id].autotile_data.occluder_map[p_coord];
  557. }
  558. }
  559. void TileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) {
  560. ERR_FAIL_COND(!tile_map.has(p_id));
  561. tile_map[p_id].navigation_polygon_offset = p_offset;
  562. }
  563. Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const {
  564. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  565. return tile_map[p_id].navigation_polygon_offset;
  566. }
  567. void TileSet::tile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon) {
  568. ERR_FAIL_COND(!tile_map.has(p_id));
  569. tile_map[p_id].navigation_polygon = p_navigation_polygon;
  570. }
  571. Ref<NavigationPolygon> TileSet::tile_get_navigation_polygon(int p_id) const {
  572. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<NavigationPolygon>());
  573. return tile_map[p_id].navigation_polygon;
  574. }
  575. const Map<Vector2, Ref<OccluderPolygon2D> > &TileSet::autotile_get_light_oclusion_map(int p_id) const {
  576. static Map<Vector2, Ref<OccluderPolygon2D> > dummy;
  577. ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
  578. return tile_map[p_id].autotile_data.occluder_map;
  579. }
  580. void TileSet::autotile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon, const Vector2 &p_coord) {
  581. ERR_FAIL_COND(!tile_map.has(p_id));
  582. if (p_navigation_polygon.is_null()) {
  583. if (tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) {
  584. tile_map[p_id].autotile_data.navpoly_map.erase(p_coord);
  585. }
  586. } else {
  587. tile_map[p_id].autotile_data.navpoly_map[p_coord] = p_navigation_polygon;
  588. }
  589. }
  590. Ref<NavigationPolygon> TileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const {
  591. ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<NavigationPolygon>());
  592. if (!tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) {
  593. return Ref<NavigationPolygon>();
  594. } else {
  595. return tile_map[p_id].autotile_data.navpoly_map[p_coord];
  596. }
  597. }
  598. const Map<Vector2, Ref<NavigationPolygon> > &TileSet::autotile_get_navigation_map(int p_id) const {
  599. static Map<Vector2, Ref<NavigationPolygon> > dummy;
  600. ERR_FAIL_COND_V(!tile_map.has(p_id), dummy);
  601. return tile_map[p_id].autotile_data.navpoly_map;
  602. }
  603. void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) {
  604. ERR_FAIL_COND(!tile_map.has(p_id));
  605. tile_map[p_id].occluder_offset = p_offset;
  606. }
  607. Vector2 TileSet::tile_get_occluder_offset(int p_id) const {
  608. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
  609. return tile_map[p_id].occluder_offset;
  610. }
  611. void TileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
  612. ERR_FAIL_COND(!tile_map.has(p_id));
  613. tile_map[p_id].shapes_data = p_shapes;
  614. emit_changed();
  615. }
  616. Vector<TileSet::ShapeData> TileSet::tile_get_shapes(int p_id) const {
  617. ERR_FAIL_COND_V(!tile_map.has(p_id), Vector<ShapeData>());
  618. return tile_map[p_id].shapes_data;
  619. }
  620. int TileSet::tile_get_z_index(int p_id) const {
  621. ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
  622. return tile_map[p_id].z_index;
  623. }
  624. void TileSet::tile_set_z_index(int p_id, int p_z_index) {
  625. ERR_FAIL_COND(!tile_map.has(p_id));
  626. tile_map[p_id].z_index = p_z_index;
  627. emit_changed();
  628. }
  629. void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
  630. ERR_FAIL_COND(!tile_map.has(p_id));
  631. Vector<ShapeData> shapes_data;
  632. Transform2D default_transform = tile_get_shape_transform(p_id, 0);
  633. bool default_one_way = tile_get_shape_one_way(p_id, 0);
  634. Vector2 default_autotile_coord = Vector2();
  635. for (int i = 0; i < p_shapes.size(); i++) {
  636. ShapeData s = ShapeData();
  637. if (p_shapes[i].get_type() == Variant::OBJECT) {
  638. Ref<Shape2D> shape = p_shapes[i];
  639. if (shape.is_null()) continue;
  640. s.shape = shape;
  641. s.shape_transform = default_transform;
  642. s.one_way_collision = default_one_way;
  643. s.autotile_coord = default_autotile_coord;
  644. } else if (p_shapes[i].get_type() == Variant::DICTIONARY) {
  645. Dictionary d = p_shapes[i];
  646. if (d.has("shape") && d["shape"].get_type() == Variant::OBJECT)
  647. s.shape = d["shape"];
  648. else
  649. continue;
  650. if (d.has("shape_transform") && d["shape_transform"].get_type() == Variant::TRANSFORM2D)
  651. s.shape_transform = d["shape_transform"];
  652. else if (d.has("shape_offset") && d["shape_offset"].get_type() == Variant::VECTOR2)
  653. s.shape_transform = Transform2D(0, (Vector2)d["shape_offset"]);
  654. else
  655. s.shape_transform = default_transform;
  656. if (d.has("one_way") && d["one_way"].get_type() == Variant::BOOL)
  657. s.one_way_collision = d["one_way"];
  658. else
  659. s.one_way_collision = default_one_way;
  660. if (d.has("autotile_coord") && d["autotile_coord"].get_type() == Variant::VECTOR2)
  661. s.autotile_coord = d["autotile_coord"];
  662. else
  663. s.autotile_coord = default_autotile_coord;
  664. } else {
  665. ERR_EXPLAIN("Expected an array of objects or dictionaries for tile_set_shapes");
  666. ERR_CONTINUE(true);
  667. }
  668. shapes_data.push_back(s);
  669. }
  670. tile_map[p_id].shapes_data = shapes_data;
  671. }
  672. Array TileSet::_tile_get_shapes(int p_id) const {
  673. ERR_FAIL_COND_V(!tile_map.has(p_id), Array());
  674. Array arr;
  675. Vector<ShapeData> data = tile_map[p_id].shapes_data;
  676. for (int i = 0; i < data.size(); i++) {
  677. Dictionary shape_data;
  678. shape_data["shape"] = data[i].shape;
  679. shape_data["shape_transform"] = data[i].shape_transform;
  680. shape_data["one_way"] = data[i].one_way_collision;
  681. shape_data["autotile_coord"] = data[i].autotile_coord;
  682. arr.push_back(shape_data);
  683. }
  684. return arr;
  685. }
  686. Array TileSet::_get_tiles_ids() const {
  687. Array arr;
  688. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  689. arr.push_back(E->key());
  690. }
  691. return arr;
  692. }
  693. void TileSet::get_tile_list(List<int> *p_tiles) const {
  694. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  695. p_tiles->push_back(E->key());
  696. }
  697. }
  698. bool TileSet::has_tile(int p_id) const {
  699. return tile_map.has(p_id);
  700. }
  701. bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) {
  702. if (p_drawn_id == p_neighbor_id) {
  703. return true;
  704. } else if (get_script_instance() != NULL) {
  705. if (get_script_instance()->has_method("_is_tile_bound")) {
  706. Variant ret = get_script_instance()->call("_is_tile_bound", p_drawn_id, p_neighbor_id);
  707. if (ret.get_type() == Variant::BOOL) {
  708. return ret;
  709. }
  710. }
  711. }
  712. return false;
  713. }
  714. void TileSet::remove_tile(int p_id) {
  715. ERR_FAIL_COND(!tile_map.has(p_id));
  716. tile_map.erase(p_id);
  717. _change_notify("");
  718. emit_changed();
  719. }
  720. int TileSet::get_last_unused_tile_id() const {
  721. if (tile_map.size())
  722. return tile_map.back()->key() + 1;
  723. else
  724. return 0;
  725. }
  726. int TileSet::find_tile_by_name(const String &p_name) const {
  727. for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
  728. if (p_name == E->get().name)
  729. return E->key();
  730. }
  731. return -1;
  732. }
  733. void TileSet::clear() {
  734. tile_map.clear();
  735. _change_notify("");
  736. emit_changed();
  737. }
  738. void TileSet::_bind_methods() {
  739. ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile);
  740. ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &TileSet::autotile_set_bitmask_mode);
  741. ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &TileSet::autotile_get_bitmask_mode);
  742. ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name);
  743. ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
  744. ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture);
  745. ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture);
  746. ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map);
  747. ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map);
  748. ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material);
  749. ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material);
  750. ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &TileSet::tile_set_modulate);
  751. ClassDB::bind_method(D_METHOD("tile_get_modulate", "id"), &TileSet::tile_get_modulate);
  752. ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset);
  753. ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset);
  754. ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region);
  755. ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region);
  756. ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape);
  757. ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape);
  758. ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform);
  759. ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform);
  760. ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way);
  761. ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way);
  762. ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &TileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2()));
  763. ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count);
  764. ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes);
  765. ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes);
  766. ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &TileSet::tile_set_tile_mode);
  767. ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &TileSet::tile_get_tile_mode);
  768. ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon);
  769. ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon);
  770. ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset);
  771. ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset);
  772. ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder);
  773. ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder);
  774. ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset);
  775. ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset);
  776. ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &TileSet::tile_set_z_index);
  777. ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &TileSet::tile_get_z_index);
  778. ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile);
  779. ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear);
  780. ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id);
  781. ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name);
  782. ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids);
  783. BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_tile_bound", PropertyInfo(Variant::INT, "drawn_id"), PropertyInfo(Variant::INT, "neighbor_id")));
  784. 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")));
  785. BIND_ENUM_CONSTANT(BITMASK_2X2);
  786. BIND_ENUM_CONSTANT(BITMASK_3X3_MINIMAL);
  787. BIND_ENUM_CONSTANT(BITMASK_3X3);
  788. BIND_ENUM_CONSTANT(BIND_TOPLEFT);
  789. BIND_ENUM_CONSTANT(BIND_TOP);
  790. BIND_ENUM_CONSTANT(BIND_TOPRIGHT);
  791. BIND_ENUM_CONSTANT(BIND_LEFT);
  792. BIND_ENUM_CONSTANT(BIND_RIGHT);
  793. BIND_ENUM_CONSTANT(BIND_BOTTOMLEFT);
  794. BIND_ENUM_CONSTANT(BIND_BOTTOM);
  795. BIND_ENUM_CONSTANT(BIND_BOTTOMRIGHT);
  796. BIND_ENUM_CONSTANT(SINGLE_TILE);
  797. BIND_ENUM_CONSTANT(AUTO_TILE);
  798. BIND_ENUM_CONSTANT(ANIMATED_TILE);
  799. }
  800. TileSet::TileSet() {
  801. }