collision_polygon_editor_plugin.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /**************************************************************************/
  2. /* collision_polygon_editor_plugin.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  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 "collision_polygon_editor_plugin.h"
  31. #include "canvas_item_editor_plugin.h"
  32. #include "core/os/file_access.h"
  33. #include "core/os/input.h"
  34. #include "core/os/keyboard.h"
  35. #include "editor/editor_settings.h"
  36. #include "scene/3d/camera.h"
  37. #include "spatial_editor_plugin.h"
  38. void Polygon3DEditor::_notification(int p_what) {
  39. switch (p_what) {
  40. case NOTIFICATION_READY: {
  41. button_create->set_icon(get_icon("Edit", "EditorIcons"));
  42. button_edit->set_icon(get_icon("MovePoint", "EditorIcons"));
  43. button_edit->set_pressed(true);
  44. get_tree()->connect("node_removed", this, "_node_removed");
  45. } break;
  46. case NOTIFICATION_PROCESS: {
  47. if (!node) {
  48. return;
  49. }
  50. if (_get_depth() != prev_depth) {
  51. _polygon_draw();
  52. prev_depth = _get_depth();
  53. }
  54. } break;
  55. }
  56. }
  57. void Polygon3DEditor::_node_removed(Node *p_node) {
  58. if (p_node == node) {
  59. node = nullptr;
  60. if (imgeom->get_parent() == p_node) {
  61. p_node->remove_child(imgeom);
  62. }
  63. hide();
  64. set_process(false);
  65. }
  66. }
  67. void Polygon3DEditor::_menu_option(int p_option) {
  68. switch (p_option) {
  69. case MODE_CREATE: {
  70. mode = MODE_CREATE;
  71. button_create->set_pressed(true);
  72. button_edit->set_pressed(false);
  73. } break;
  74. case MODE_EDIT: {
  75. mode = MODE_EDIT;
  76. button_create->set_pressed(false);
  77. button_edit->set_pressed(true);
  78. } break;
  79. }
  80. }
  81. void Polygon3DEditor::_wip_close() {
  82. undo_redo->create_action(TTR("Create Polygon3D"));
  83. undo_redo->add_undo_method(node, "set_polygon", node->call("get_polygon"));
  84. undo_redo->add_do_method(node, "set_polygon", wip);
  85. undo_redo->add_do_method(this, "_polygon_draw");
  86. undo_redo->add_undo_method(this, "_polygon_draw");
  87. wip.clear();
  88. wip_active = false;
  89. mode = MODE_EDIT;
  90. button_edit->set_pressed(true);
  91. button_create->set_pressed(false);
  92. edited_point = -1;
  93. undo_redo->commit_action();
  94. }
  95. bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
  96. if (!node) {
  97. return false;
  98. }
  99. Transform gt = node->get_global_transform();
  100. Transform gi = gt.affine_inverse();
  101. float depth = _get_depth() * 0.5;
  102. Vector3 n = gt.basis.get_axis(2).normalized();
  103. Plane p(gt.origin + n * depth, n);
  104. Ref<InputEventMouseButton> mb = p_event;
  105. if (mb.is_valid()) {
  106. Vector2 gpoint = mb->get_position();
  107. Vector3 ray_from = p_camera->project_ray_origin(gpoint);
  108. Vector3 ray_dir = p_camera->project_ray_normal(gpoint);
  109. Vector3 spoint;
  110. if (!p.intersects_ray(ray_from, ray_dir, &spoint)) {
  111. return false;
  112. }
  113. spoint = gi.xform(spoint);
  114. Vector2 cpoint(spoint.x, spoint.y);
  115. //DO NOT snap here, it's confusing in 3D for adding points.
  116. //Let the snap happen when the point is being moved, instead.
  117. //cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint);
  118. Vector<Vector2> poly = node->call("get_polygon");
  119. //first check if a point is to be added (segment split)
  120. real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");
  121. switch (mode) {
  122. case MODE_CREATE: {
  123. if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
  124. if (!wip_active) {
  125. wip.clear();
  126. wip.push_back(cpoint);
  127. wip_active = true;
  128. edited_point_pos = cpoint;
  129. snap_ignore = false;
  130. _polygon_draw();
  131. edited_point = 1;
  132. return true;
  133. } else {
  134. if (wip.size() > 1 && p_camera->unproject_position(gt.xform(Vector3(wip[0].x, wip[0].y, depth))).distance_to(gpoint) < grab_threshold) {
  135. //wip closed
  136. _wip_close();
  137. return true;
  138. } else {
  139. wip.push_back(cpoint);
  140. edited_point = wip.size();
  141. snap_ignore = false;
  142. _polygon_draw();
  143. return true;
  144. }
  145. }
  146. } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
  147. _wip_close();
  148. }
  149. } break;
  150. case MODE_EDIT: {
  151. if (mb->get_button_index() == BUTTON_LEFT) {
  152. if (mb->is_pressed()) {
  153. if (mb->get_control()) {
  154. if (poly.size() < 3) {
  155. undo_redo->create_action(TTR("Edit Poly"));
  156. undo_redo->add_undo_method(node, "set_polygon", poly);
  157. poly.push_back(cpoint);
  158. undo_redo->add_do_method(node, "set_polygon", poly);
  159. undo_redo->add_do_method(this, "_polygon_draw");
  160. undo_redo->add_undo_method(this, "_polygon_draw");
  161. undo_redo->commit_action();
  162. return true;
  163. }
  164. //search edges
  165. int closest_idx = -1;
  166. Vector2 closest_pos;
  167. real_t closest_dist = 1e10;
  168. for (int i = 0; i < poly.size(); i++) {
  169. Vector2 points[2] = {
  170. p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth))),
  171. p_camera->unproject_position(gt.xform(Vector3(poly[(i + 1) % poly.size()].x, poly[(i + 1) % poly.size()].y, depth)))
  172. };
  173. Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
  174. if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2) {
  175. continue; //not valid to reuse point
  176. }
  177. real_t d = cp.distance_to(gpoint);
  178. if (d < closest_dist && d < grab_threshold) {
  179. closest_dist = d;
  180. closest_pos = cp;
  181. closest_idx = i;
  182. }
  183. }
  184. if (closest_idx >= 0) {
  185. pre_move_edit = poly;
  186. poly.insert(closest_idx + 1, cpoint);
  187. edited_point = closest_idx + 1;
  188. edited_point_pos = cpoint;
  189. node->call("set_polygon", poly);
  190. _polygon_draw();
  191. snap_ignore = true;
  192. return true;
  193. }
  194. } else {
  195. //look for points to move
  196. int closest_idx = -1;
  197. Vector2 closest_pos;
  198. real_t closest_dist = 1e10;
  199. for (int i = 0; i < poly.size(); i++) {
  200. Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth)));
  201. real_t d = cp.distance_to(gpoint);
  202. if (d < closest_dist && d < grab_threshold) {
  203. closest_dist = d;
  204. closest_pos = cp;
  205. closest_idx = i;
  206. }
  207. }
  208. if (closest_idx >= 0) {
  209. pre_move_edit = poly;
  210. edited_point = closest_idx;
  211. edited_point_pos = poly[closest_idx];
  212. _polygon_draw();
  213. snap_ignore = false;
  214. return true;
  215. }
  216. }
  217. } else {
  218. snap_ignore = false;
  219. if (edited_point != -1) {
  220. //apply
  221. ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
  222. poly.write[edited_point] = edited_point_pos;
  223. undo_redo->create_action(TTR("Edit Poly"));
  224. undo_redo->add_do_method(node, "set_polygon", poly);
  225. undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
  226. undo_redo->add_do_method(this, "_polygon_draw");
  227. undo_redo->add_undo_method(this, "_polygon_draw");
  228. undo_redo->commit_action();
  229. edited_point = -1;
  230. return true;
  231. }
  232. }
  233. }
  234. if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
  235. int closest_idx = -1;
  236. Vector2 closest_pos;
  237. real_t closest_dist = 1e10;
  238. for (int i = 0; i < poly.size(); i++) {
  239. Vector2 cp = p_camera->unproject_position(gt.xform(Vector3(poly[i].x, poly[i].y, depth)));
  240. real_t d = cp.distance_to(gpoint);
  241. if (d < closest_dist && d < grab_threshold) {
  242. closest_dist = d;
  243. closest_pos = cp;
  244. closest_idx = i;
  245. }
  246. }
  247. if (closest_idx >= 0) {
  248. undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
  249. undo_redo->add_undo_method(node, "set_polygon", poly);
  250. poly.remove(closest_idx);
  251. undo_redo->add_do_method(node, "set_polygon", poly);
  252. undo_redo->add_do_method(this, "_polygon_draw");
  253. undo_redo->add_undo_method(this, "_polygon_draw");
  254. undo_redo->commit_action();
  255. return true;
  256. }
  257. }
  258. } break;
  259. }
  260. }
  261. Ref<InputEventMouseMotion> mm = p_event;
  262. if (mm.is_valid()) {
  263. if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
  264. Vector2 gpoint = mm->get_position();
  265. Vector3 ray_from = p_camera->project_ray_origin(gpoint);
  266. Vector3 ray_dir = p_camera->project_ray_normal(gpoint);
  267. Vector3 spoint;
  268. if (!p.intersects_ray(ray_from, ray_dir, &spoint)) {
  269. return false;
  270. }
  271. spoint = gi.xform(spoint);
  272. Vector2 cpoint(spoint.x, spoint.y);
  273. if (snap_ignore && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
  274. snap_ignore = false;
  275. }
  276. if (!snap_ignore && SpatialEditor::get_singleton()->is_snap_enabled()) {
  277. cpoint = cpoint.snapped(Vector2(
  278. SpatialEditor::get_singleton()->get_translate_snap(),
  279. SpatialEditor::get_singleton()->get_translate_snap()));
  280. }
  281. edited_point_pos = cpoint;
  282. _polygon_draw();
  283. }
  284. }
  285. return false;
  286. }
  287. float Polygon3DEditor::_get_depth() {
  288. if (bool(node->call("_has_editable_3d_polygon_no_depth"))) {
  289. return 0;
  290. }
  291. return float(node->call("get_depth"));
  292. }
  293. void Polygon3DEditor::_polygon_draw() {
  294. if (!node) {
  295. return;
  296. }
  297. Vector<Vector2> poly;
  298. if (wip_active) {
  299. poly = wip;
  300. } else {
  301. poly = node->call("get_polygon");
  302. }
  303. float depth = _get_depth() * 0.5;
  304. imgeom->clear();
  305. imgeom->set_material_override(line_material);
  306. imgeom->begin(Mesh::PRIMITIVE_LINES, Ref<Texture>());
  307. Rect2 rect;
  308. for (int i = 0; i < poly.size(); i++) {
  309. Vector2 p, p2;
  310. p = i == edited_point ? edited_point_pos : poly[i];
  311. if ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point)) {
  312. p2 = edited_point_pos;
  313. } else {
  314. p2 = poly[(i + 1) % poly.size()];
  315. }
  316. if (i == 0) {
  317. rect.position = p;
  318. } else {
  319. rect.expand_to(p);
  320. }
  321. Vector3 point = Vector3(p.x, p.y, depth);
  322. Vector3 next_point = Vector3(p2.x, p2.y, depth);
  323. imgeom->set_color(Color(1, 0.3, 0.1, 0.8));
  324. imgeom->add_vertex(point);
  325. imgeom->set_color(Color(1, 0.3, 0.1, 0.8));
  326. imgeom->add_vertex(next_point);
  327. //Color col=Color(1,0.3,0.1,0.8);
  328. //vpc->draw_line(point,next_point,col,2);
  329. //vpc->draw_texture(handle,point-handle->get_size()*0.5);
  330. }
  331. rect = rect.grow(1);
  332. AABB r;
  333. r.position.x = rect.position.x;
  334. r.position.y = rect.position.y;
  335. r.position.z = depth;
  336. r.size.x = rect.size.x;
  337. r.size.y = rect.size.y;
  338. r.size.z = 0;
  339. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  340. imgeom->add_vertex(r.position);
  341. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  342. imgeom->add_vertex(r.position + Vector3(0.3, 0, 0));
  343. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  344. imgeom->add_vertex(r.position);
  345. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  346. imgeom->add_vertex(r.position + Vector3(0.0, 0.3, 0));
  347. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  348. imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0));
  349. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  350. imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0) - Vector3(0.3, 0, 0));
  351. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  352. imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0));
  353. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  354. imgeom->add_vertex(r.position + Vector3(r.size.x, 0, 0) + Vector3(0, 0.3, 0));
  355. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  356. imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0));
  357. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  358. imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0) - Vector3(0, 0.3, 0));
  359. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  360. imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0));
  361. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  362. imgeom->add_vertex(r.position + Vector3(0, r.size.y, 0) + Vector3(0.3, 0, 0));
  363. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  364. imgeom->add_vertex(r.position + r.size);
  365. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  366. imgeom->add_vertex(r.position + r.size - Vector3(0.3, 0, 0));
  367. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  368. imgeom->add_vertex(r.position + r.size);
  369. imgeom->set_color(Color(0.8, 0.8, 0.8, 0.2));
  370. imgeom->add_vertex(r.position + r.size - Vector3(0.0, 0.3, 0));
  371. imgeom->end();
  372. while (m->get_surface_count()) {
  373. m->surface_remove(0);
  374. }
  375. if (poly.size() == 0) {
  376. return;
  377. }
  378. Array a;
  379. a.resize(Mesh::ARRAY_MAX);
  380. PoolVector<Vector3> va;
  381. {
  382. va.resize(poly.size());
  383. PoolVector<Vector3>::Write w = va.write();
  384. for (int i = 0; i < poly.size(); i++) {
  385. Vector2 p, p2;
  386. p = i == edited_point ? edited_point_pos : poly[i];
  387. Vector3 point = Vector3(p.x, p.y, depth);
  388. w[i] = point;
  389. }
  390. }
  391. a[Mesh::ARRAY_VERTEX] = va;
  392. m->add_surface_from_arrays(Mesh::PRIMITIVE_POINTS, a);
  393. m->surface_set_material(0, handle_material);
  394. }
  395. void Polygon3DEditor::edit(Node *p_collision_polygon) {
  396. if (p_collision_polygon) {
  397. node = Object::cast_to<Spatial>(p_collision_polygon);
  398. //Enable the pencil tool if the polygon is empty
  399. if (Vector<Vector2>(node->call("get_polygon")).size() == 0) {
  400. _menu_option(MODE_CREATE);
  401. }
  402. wip.clear();
  403. wip_active = false;
  404. edited_point = -1;
  405. p_collision_polygon->add_child(imgeom);
  406. _polygon_draw();
  407. set_process(true);
  408. prev_depth = -1;
  409. } else {
  410. node = nullptr;
  411. if (imgeom->get_parent()) {
  412. imgeom->get_parent()->remove_child(imgeom);
  413. }
  414. set_process(false);
  415. }
  416. }
  417. void Polygon3DEditor::_bind_methods() {
  418. ClassDB::bind_method(D_METHOD("_menu_option"), &Polygon3DEditor::_menu_option);
  419. ClassDB::bind_method(D_METHOD("_polygon_draw"), &Polygon3DEditor::_polygon_draw);
  420. ClassDB::bind_method(D_METHOD("_node_removed"), &Polygon3DEditor::_node_removed);
  421. }
  422. Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
  423. node = nullptr;
  424. editor = p_editor;
  425. undo_redo = EditorNode::get_undo_redo();
  426. add_child(memnew(VSeparator));
  427. button_create = memnew(ToolButton);
  428. add_child(button_create);
  429. button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE));
  430. button_create->set_toggle_mode(true);
  431. button_edit = memnew(ToolButton);
  432. add_child(button_edit);
  433. button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT));
  434. button_edit->set_toggle_mode(true);
  435. mode = MODE_EDIT;
  436. wip_active = false;
  437. imgeom = memnew(ImmediateGeometry);
  438. imgeom->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
  439. line_material = Ref<Material3D>(memnew(SpatialMaterial));
  440. line_material->set_flag(Material3D::FLAG_UNSHADED, true);
  441. line_material->set_line_width(3.0);
  442. line_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
  443. line_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
  444. line_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
  445. line_material->set_albedo(Color(1, 1, 1));
  446. handle_material = Ref<Material3D>(memnew(SpatialMaterial));
  447. handle_material->set_flag(Material3D::FLAG_UNSHADED, true);
  448. handle_material->set_flag(Material3D::FLAG_USE_POINT_SIZE, true);
  449. handle_material->set_feature(Material3D::FEATURE_TRANSPARENT, true);
  450. handle_material->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
  451. handle_material->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
  452. Ref<Texture> handle = editor->get_gui_base()->get_icon("Editor3DHandle", "EditorIcons");
  453. handle_material->set_point_size(handle->get_width());
  454. handle_material->set_texture(Material3D::TEXTURE_ALBEDO, handle);
  455. pointsm = memnew(MeshInstance);
  456. imgeom->add_child(pointsm);
  457. m.instance();
  458. pointsm->set_mesh(m);
  459. pointsm->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
  460. snap_ignore = false;
  461. }
  462. Polygon3DEditor::~Polygon3DEditor() {
  463. memdelete(imgeom);
  464. }
  465. void Polygon3DEditorPlugin::edit(Object *p_object) {
  466. collision_polygon_editor->edit(Object::cast_to<Node>(p_object));
  467. }
  468. bool Polygon3DEditorPlugin::handles(Object *p_object) const {
  469. return Object::cast_to<Spatial>(p_object) && bool(p_object->call("_is_editable_3d_polygon"));
  470. }
  471. void Polygon3DEditorPlugin::make_visible(bool p_visible) {
  472. if (p_visible) {
  473. collision_polygon_editor->show();
  474. } else {
  475. collision_polygon_editor->hide();
  476. collision_polygon_editor->edit(nullptr);
  477. }
  478. }
  479. Polygon3DEditorPlugin::Polygon3DEditorPlugin(EditorNode *p_node) {
  480. editor = p_node;
  481. collision_polygon_editor = memnew(Polygon3DEditor(p_node));
  482. SpatialEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
  483. collision_polygon_editor->hide();
  484. }
  485. Polygon3DEditorPlugin::~Polygon3DEditorPlugin() {
  486. }