mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 20:23:53 +00:00
Merge pull request #82937 from Calinou/editor-primitivemesh-unwrap-uv2
Enable UV2 on primitive meshes when using the MeshInstance3D context menu
This commit is contained in:
commit
50620c7361
@ -44,6 +44,7 @@
|
||||
#include "scene/gui/spin_box.h"
|
||||
#include "scene/resources/concave_polygon_shape_3d.h"
|
||||
#include "scene/resources/convex_polygon_shape_3d.h"
|
||||
#include "scene/resources/primitive_meshes.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void MeshInstance3DEditor::_node_removed(Node *p_node) {
|
||||
@ -300,6 +301,14 @@ void MeshInstance3DEditor::_menu_option(int p_option) {
|
||||
ur->commit_action();
|
||||
} break;
|
||||
case MENU_OPTION_CREATE_UV2: {
|
||||
Ref<PrimitiveMesh> primitive_mesh = Object::cast_to<PrimitiveMesh>(*node->get_mesh());
|
||||
if (primitive_mesh.is_valid()) {
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
ur->create_action(TTR("Unwrap UV2"));
|
||||
ur->add_do_method(*primitive_mesh, "set_add_uv2", true);
|
||||
ur->add_undo_method(*primitive_mesh, "set_add_uv2", primitive_mesh->get_add_uv2());
|
||||
ur->commit_action();
|
||||
} else {
|
||||
Ref<ArrayMesh> mesh2 = node->get_mesh();
|
||||
if (!mesh2.is_valid()) {
|
||||
err_dialog->set_text(TTR("Contained Mesh is not of type ArrayMesh."));
|
||||
@ -352,7 +361,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) {
|
||||
ur->add_undo_reference(unwrapped_mesh.ptr());
|
||||
|
||||
ur->commit_action();
|
||||
|
||||
}
|
||||
} break;
|
||||
case MENU_OPTION_DEBUG_UV1: {
|
||||
Ref<Mesh> mesh2 = node->get_mesh();
|
||||
|
Loading…
Reference in New Issue
Block a user