mesh_instance_3d_editor_plugin.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /*************************************************************************/
  2. /* mesh_instance_3d_editor_plugin.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 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 "mesh_instance_3d_editor_plugin.h"
  31. #include "editor/editor_scale.h"
  32. #include "node_3d_editor_plugin.h"
  33. #include "scene/3d/collision_shape_3d.h"
  34. #include "scene/3d/navigation_region_3d.h"
  35. #include "scene/3d/physics_body_3d.h"
  36. #include "scene/gui/box_container.h"
  37. void MeshInstance3DEditor::_node_removed(Node *p_node) {
  38. if (p_node == node) {
  39. node = nullptr;
  40. options->hide();
  41. }
  42. }
  43. void MeshInstance3DEditor::edit(MeshInstance3D *p_mesh) {
  44. node = p_mesh;
  45. }
  46. void MeshInstance3DEditor::_menu_option(int p_option) {
  47. Ref<Mesh> mesh = node->get_mesh();
  48. if (mesh.is_null()) {
  49. err_dialog->set_text(TTR("Mesh is empty!"));
  50. err_dialog->popup_centered();
  51. return;
  52. }
  53. switch (p_option) {
  54. case MENU_OPTION_CREATE_STATIC_TRIMESH_BODY: {
  55. EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
  56. UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
  57. List<Node *> selection = editor_selection->get_selected_node_list();
  58. if (selection.is_empty()) {
  59. Ref<Shape3D> shape = mesh->create_trimesh_shape();
  60. if (shape.is_null()) {
  61. err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape."));
  62. err_dialog->popup_centered();
  63. return;
  64. }
  65. CollisionShape3D *cshape = memnew(CollisionShape3D);
  66. cshape->set_shape(shape);
  67. StaticBody3D *body = memnew(StaticBody3D);
  68. body->add_child(cshape);
  69. Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
  70. ur->create_action(TTR("Create Static Trimesh Body"));
  71. ur->add_do_method(node, "add_child", body);
  72. ur->add_do_method(body, "set_owner", owner);
  73. ur->add_do_method(cshape, "set_owner", owner);
  74. ur->add_do_reference(body);
  75. ur->add_undo_method(node, "remove_child", body);
  76. ur->commit_action();
  77. return;
  78. }
  79. ur->create_action(TTR("Create Static Trimesh Body"));
  80. for (Node *E : selection) {
  81. MeshInstance3D *instance = Object::cast_to<MeshInstance3D>(E);
  82. if (!instance) {
  83. continue;
  84. }
  85. Ref<Mesh> m = instance->get_mesh();
  86. if (m.is_null()) {
  87. continue;
  88. }
  89. Ref<Shape3D> shape = m->create_trimesh_shape();
  90. if (shape.is_null()) {
  91. continue;
  92. }
  93. CollisionShape3D *cshape = memnew(CollisionShape3D);
  94. cshape->set_shape(shape);
  95. StaticBody3D *body = memnew(StaticBody3D);
  96. body->add_child(cshape);
  97. Node *owner = instance == get_tree()->get_edited_scene_root() ? instance : instance->get_owner();
  98. ur->add_do_method(instance, "add_child", body);
  99. ur->add_do_method(body, "set_owner", owner);
  100. ur->add_do_method(cshape, "set_owner", owner);
  101. ur->add_do_reference(body);
  102. ur->add_undo_method(instance, "remove_child", body);
  103. }
  104. ur->commit_action();
  105. } break;
  106. case MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE: {
  107. if (node == get_tree()->get_edited_scene_root()) {
  108. err_dialog->set_text(TTR("This doesn't work on scene root!"));
  109. err_dialog->popup_centered();
  110. return;
  111. }
  112. Ref<Shape3D> shape = mesh->create_trimesh_shape();
  113. if (shape.is_null()) {
  114. return;
  115. }
  116. CollisionShape3D *cshape = memnew(CollisionShape3D);
  117. cshape->set_shape(shape);
  118. cshape->set_transform(node->get_transform());
  119. Node *owner = node->get_owner();
  120. UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
  121. ur->create_action(TTR("Create Trimesh Static Shape"));
  122. ur->add_do_method(node->get_parent(), "add_child", cshape);
  123. ur->add_do_method(node->get_parent(), "move_child", cshape, node->get_index() + 1);
  124. ur->add_do_method(cshape, "set_owner", owner);
  125. ur->add_do_reference(cshape);
  126. ur->add_undo_method(node->get_parent(), "remove_child", cshape);
  127. ur->commit_action();
  128. } break;
  129. case MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE:
  130. case MENU_OPTION_CREATE_SIMPLIFIED_CONVEX_COLLISION_SHAPE: {
  131. if (node == get_tree()->get_edited_scene_root()) {
  132. err_dialog->set_text(TTR("Can't create a single convex collision shape for the scene root."));
  133. err_dialog->popup_centered();
  134. return;
  135. }
  136. bool simplify = (p_option == MENU_OPTION_CREATE_SIMPLIFIED_CONVEX_COLLISION_SHAPE);
  137. Ref<Shape3D> shape = mesh->create_convex_shape(true, simplify);
  138. if (shape.is_null()) {
  139. err_dialog->set_text(TTR("Couldn't create a single convex collision shape."));
  140. err_dialog->popup_centered();
  141. return;
  142. }
  143. UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
  144. if (simplify) {
  145. ur->create_action(TTR("Create Simplified Convex Shape"));
  146. } else {
  147. ur->create_action(TTR("Create Single Convex Shape"));
  148. }
  149. CollisionShape3D *cshape = memnew(CollisionShape3D);
  150. cshape->set_shape(shape);
  151. cshape->set_transform(node->get_transform());
  152. Node *owner = node->get_owner();
  153. ur->add_do_method(node->get_parent(), "add_child", cshape);
  154. ur->add_do_method(node->get_parent(), "move_child", cshape, node->get_index() + 1);
  155. ur->add_do_method(cshape, "set_owner", owner);
  156. ur->add_do_reference(cshape);
  157. ur->add_undo_method(node->get_parent(), "remove_child", cshape);
  158. ur->commit_action();
  159. } break;
  160. case MENU_OPTION_CREATE_MULTIPLE_CONVEX_COLLISION_SHAPES: {
  161. if (node == get_tree()->get_edited_scene_root()) {
  162. err_dialog->set_text(TTR("Can't create multiple convex collision shapes for the scene root."));
  163. err_dialog->popup_centered();
  164. return;
  165. }
  166. Mesh::ConvexDecompositionSettings settings;
  167. Vector<Ref<Shape3D>> shapes = mesh->convex_decompose(settings);
  168. if (!shapes.size()) {
  169. err_dialog->set_text(TTR("Couldn't create any collision shapes."));
  170. err_dialog->popup_centered();
  171. return;
  172. }
  173. UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
  174. ur->create_action(TTR("Create Multiple Convex Shapes"));
  175. for (int i = 0; i < shapes.size(); i++) {
  176. CollisionShape3D *cshape = memnew(CollisionShape3D);
  177. cshape->set_shape(shapes[i]);
  178. cshape->set_transform(node->get_transform());
  179. Node *owner = node->get_owner();
  180. ur->add_do_method(node->get_parent(), "add_child", cshape);
  181. ur->add_do_method(node->get_parent(), "move_child", cshape, node->get_index() + 1);
  182. ur->add_do_method(cshape, "set_owner", owner);
  183. ur->add_do_reference(cshape);
  184. ur->add_undo_method(node->get_parent(), "remove_child", cshape);
  185. }
  186. ur->commit_action();
  187. } break;
  188. case MENU_OPTION_CREATE_NAVMESH: {
  189. Ref<NavigationMesh> nmesh = memnew(NavigationMesh);
  190. if (nmesh.is_null()) {
  191. return;
  192. }
  193. nmesh->create_from_mesh(mesh);
  194. NavigationRegion3D *nmi = memnew(NavigationRegion3D);
  195. nmi->set_navigation_mesh(nmesh);
  196. Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
  197. UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
  198. ur->create_action(TTR("Create Navigation Mesh"));
  199. ur->add_do_method(node, "add_child", nmi);
  200. ur->add_do_method(nmi, "set_owner", owner);
  201. ur->add_do_reference(nmi);
  202. ur->add_undo_method(node, "remove_child", nmi);
  203. ur->commit_action();
  204. } break;
  205. case MENU_OPTION_CREATE_OUTLINE_MESH: {
  206. outline_dialog->popup_centered(Vector2(200, 90));
  207. } break;
  208. case MENU_OPTION_CREATE_UV2: {
  209. Ref<ArrayMesh> mesh2 = node->get_mesh();
  210. if (!mesh2.is_valid()) {
  211. err_dialog->set_text(TTR("Contained Mesh is not of type ArrayMesh."));
  212. err_dialog->popup_centered();
  213. return;
  214. }
  215. Error err = mesh2->lightmap_unwrap(node->get_global_transform());
  216. if (err != OK) {
  217. err_dialog->set_text(TTR("UV Unwrap failed, mesh may not be manifold?"));
  218. err_dialog->popup_centered();
  219. return;
  220. }
  221. } break;
  222. case MENU_OPTION_DEBUG_UV1: {
  223. Ref<Mesh> mesh2 = node->get_mesh();
  224. if (!mesh2.is_valid()) {
  225. err_dialog->set_text(TTR("No mesh to debug."));
  226. err_dialog->popup_centered();
  227. return;
  228. }
  229. _create_uv_lines(0);
  230. } break;
  231. case MENU_OPTION_DEBUG_UV2: {
  232. Ref<Mesh> mesh2 = node->get_mesh();
  233. if (!mesh2.is_valid()) {
  234. err_dialog->set_text(TTR("No mesh to debug."));
  235. err_dialog->popup_centered();
  236. return;
  237. }
  238. _create_uv_lines(1);
  239. } break;
  240. }
  241. }
  242. struct MeshInstance3DEditorEdgeSort {
  243. Vector2 a;
  244. Vector2 b;
  245. bool operator<(const MeshInstance3DEditorEdgeSort &p_b) const {
  246. if (a == p_b.a) {
  247. return b < p_b.b;
  248. } else {
  249. return a < p_b.a;
  250. }
  251. }
  252. MeshInstance3DEditorEdgeSort() {}
  253. MeshInstance3DEditorEdgeSort(const Vector2 &p_a, const Vector2 &p_b) {
  254. if (p_a < p_b) {
  255. a = p_a;
  256. b = p_b;
  257. } else {
  258. b = p_a;
  259. a = p_b;
  260. }
  261. }
  262. };
  263. void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
  264. Ref<Mesh> mesh = node->get_mesh();
  265. ERR_FAIL_COND(!mesh.is_valid());
  266. Set<MeshInstance3DEditorEdgeSort> edges;
  267. uv_lines.clear();
  268. for (int i = 0; i < mesh->get_surface_count(); i++) {
  269. if (mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
  270. continue;
  271. }
  272. Array a = mesh->surface_get_arrays(i);
  273. Vector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2];
  274. if (uv.size() == 0) {
  275. err_dialog->set_text(vformat(TTR("Mesh has no UV in layer %d."), p_layer + 1));
  276. err_dialog->popup_centered();
  277. return;
  278. }
  279. const Vector2 *r = uv.ptr();
  280. Vector<int> indices = a[Mesh::ARRAY_INDEX];
  281. const int *ri = nullptr;
  282. int ic;
  283. if (indices.size()) {
  284. ic = indices.size();
  285. ri = indices.ptr();
  286. } else {
  287. ic = uv.size();
  288. }
  289. for (int j = 0; j < ic; j += 3) {
  290. for (int k = 0; k < 3; k++) {
  291. MeshInstance3DEditorEdgeSort edge;
  292. if (ri) {
  293. edge.a = r[ri[j + k]];
  294. edge.b = r[ri[j + ((k + 1) % 3)]];
  295. } else {
  296. edge.a = r[j + k];
  297. edge.b = r[j + ((k + 1) % 3)];
  298. }
  299. if (edges.has(edge)) {
  300. continue;
  301. }
  302. uv_lines.push_back(edge.a);
  303. uv_lines.push_back(edge.b);
  304. edges.insert(edge);
  305. }
  306. }
  307. }
  308. debug_uv_dialog->popup_centered();
  309. }
  310. void MeshInstance3DEditor::_debug_uv_draw() {
  311. if (uv_lines.size() == 0) {
  312. return;
  313. }
  314. debug_uv->set_clip_contents(true);
  315. debug_uv->draw_rect(Rect2(Vector2(), debug_uv->get_size()), get_theme_color(SNAME("dark_color_3"), SNAME("Editor")));
  316. debug_uv->draw_set_transform(Vector2(), 0, debug_uv->get_size());
  317. // Use a translucent color to allow overlapping triangles to be visible.
  318. debug_uv->draw_multiline(uv_lines, get_theme_color(SNAME("mono_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5), Math::round(EDSCALE));
  319. }
  320. void MeshInstance3DEditor::_create_outline_mesh() {
  321. Ref<Mesh> mesh = node->get_mesh();
  322. if (mesh.is_null()) {
  323. err_dialog->set_text(TTR("MeshInstance3D lacks a Mesh."));
  324. err_dialog->popup_centered();
  325. return;
  326. }
  327. if (mesh->get_surface_count() == 0) {
  328. err_dialog->set_text(TTR("Mesh has not surface to create outlines from."));
  329. err_dialog->popup_centered();
  330. return;
  331. } else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) {
  332. err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES."));
  333. err_dialog->popup_centered();
  334. return;
  335. }
  336. Ref<Mesh> mesho = mesh->create_outline(outline_size->get_value());
  337. if (mesho.is_null()) {
  338. err_dialog->set_text(TTR("Could not create outline."));
  339. err_dialog->popup_centered();
  340. return;
  341. }
  342. MeshInstance3D *mi = memnew(MeshInstance3D);
  343. mi->set_mesh(mesho);
  344. Node *owner = node->get_owner();
  345. if (get_tree()->get_edited_scene_root() == node) {
  346. owner = node;
  347. }
  348. UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
  349. ur->create_action(TTR("Create Outline"));
  350. ur->add_do_method(node, "add_child", mi);
  351. ur->add_do_method(mi, "set_owner", owner);
  352. ur->add_do_reference(mi);
  353. ur->add_undo_method(node, "remove_child", mi);
  354. ur->commit_action();
  355. }
  356. void MeshInstance3DEditor::_bind_methods() {
  357. }
  358. MeshInstance3DEditor::MeshInstance3DEditor() {
  359. options = memnew(MenuButton);
  360. options->set_switch_on_hover(true);
  361. Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
  362. options->set_text(TTR("Mesh"));
  363. options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("MeshInstance3D"), SNAME("EditorIcons")));
  364. options->get_popup()->add_item(TTR("Create Trimesh Static Body"), MENU_OPTION_CREATE_STATIC_TRIMESH_BODY);
  365. options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody3D and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection."));
  366. options->get_popup()->add_separator();
  367. options->get_popup()->add_item(TTR("Create Trimesh Collision Sibling"), MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE);
  368. options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a polygon-based collision shape.\nThis is the most accurate (but slowest) option for collision detection."));
  369. options->get_popup()->add_item(TTR("Create Single Convex Collision Sibling"), MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE);
  370. options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a single convex collision shape.\nThis is the fastest (but least accurate) option for collision detection."));
  371. options->get_popup()->add_item(TTR("Create Simplified Convex Collision Sibling"), MENU_OPTION_CREATE_SIMPLIFIED_CONVEX_COLLISION_SHAPE);
  372. options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a simplified convex collision shape.\nThis is similar to single collision shape, but can result in a simpler geometry in some cases, at the cost of accuracy."));
  373. options->get_popup()->add_item(TTR("Create Multiple Convex Collision Siblings"), MENU_OPTION_CREATE_MULTIPLE_CONVEX_COLLISION_SHAPES);
  374. options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a polygon-based collision shape.\nThis is a performance middle-ground between a single convex collision and a polygon-based collision."));
  375. options->get_popup()->add_separator();
  376. options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH);
  377. options->get_popup()->add_separator();
  378. options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH);
  379. options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the StandardMaterial Grow property when using that property isn't possible."));
  380. options->get_popup()->add_separator();
  381. options->get_popup()->add_item(TTR("View UV1"), MENU_OPTION_DEBUG_UV1);
  382. options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2);
  383. options->get_popup()->add_item(TTR("Unwrap UV2 for Lightmap/AO"), MENU_OPTION_CREATE_UV2);
  384. options->get_popup()->connect("id_pressed", callable_mp(this, &MeshInstance3DEditor::_menu_option));
  385. outline_dialog = memnew(ConfirmationDialog);
  386. outline_dialog->set_title(TTR("Create Outline Mesh"));
  387. outline_dialog->get_ok_button()->set_text(TTR("Create"));
  388. VBoxContainer *outline_dialog_vbc = memnew(VBoxContainer);
  389. outline_dialog->add_child(outline_dialog_vbc);
  390. //outline_dialog->set_child_rect(outline_dialog_vbc);
  391. outline_size = memnew(SpinBox);
  392. outline_size->set_min(0.001);
  393. outline_size->set_max(1024);
  394. outline_size->set_step(0.001);
  395. outline_size->set_value(0.05);
  396. outline_dialog_vbc->add_margin_child(TTR("Outline Size:"), outline_size);
  397. add_child(outline_dialog);
  398. outline_dialog->connect("confirmed", callable_mp(this, &MeshInstance3DEditor::_create_outline_mesh));
  399. err_dialog = memnew(AcceptDialog);
  400. add_child(err_dialog);
  401. debug_uv_dialog = memnew(AcceptDialog);
  402. debug_uv_dialog->set_title(TTR("UV Channel Debug"));
  403. add_child(debug_uv_dialog);
  404. debug_uv = memnew(Control);
  405. debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE);
  406. debug_uv->connect("draw", callable_mp(this, &MeshInstance3DEditor::_debug_uv_draw));
  407. debug_uv_dialog->add_child(debug_uv);
  408. }
  409. void MeshInstance3DEditorPlugin::edit(Object *p_object) {
  410. mesh_editor->edit(Object::cast_to<MeshInstance3D>(p_object));
  411. }
  412. bool MeshInstance3DEditorPlugin::handles(Object *p_object) const {
  413. return p_object->is_class("MeshInstance3D");
  414. }
  415. void MeshInstance3DEditorPlugin::make_visible(bool p_visible) {
  416. if (p_visible) {
  417. mesh_editor->options->show();
  418. } else {
  419. mesh_editor->options->hide();
  420. mesh_editor->edit(nullptr);
  421. }
  422. }
  423. MeshInstance3DEditorPlugin::MeshInstance3DEditorPlugin(EditorNode *p_node) {
  424. editor = p_node;
  425. mesh_editor = memnew(MeshInstance3DEditor);
  426. editor->get_main_control()->add_child(mesh_editor);
  427. mesh_editor->options->hide();
  428. }
  429. MeshInstance3DEditorPlugin::~MeshInstance3DEditorPlugin() {
  430. }