You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Enable UV2 on primitive meshes when using the MeshInstance3D context menu
This makes it easier to discover the UV2 generation functionality on primitive meshes.
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
#include "scene/gui/spin_box.h"
|
#include "scene/gui/spin_box.h"
|
||||||
#include "scene/resources/concave_polygon_shape_3d.h"
|
#include "scene/resources/concave_polygon_shape_3d.h"
|
||||||
#include "scene/resources/convex_polygon_shape_3d.h"
|
#include "scene/resources/convex_polygon_shape_3d.h"
|
||||||
|
#include "scene/resources/primitive_meshes.h"
|
||||||
#include "scene/scene_string_names.h"
|
#include "scene/scene_string_names.h"
|
||||||
|
|
||||||
void MeshInstance3DEditor::_node_removed(Node *p_node) {
|
void MeshInstance3DEditor::_node_removed(Node *p_node) {
|
||||||
@@ -300,6 +301,14 @@ void MeshInstance3DEditor::_menu_option(int p_option) {
|
|||||||
ur->commit_action();
|
ur->commit_action();
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_CREATE_UV2: {
|
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();
|
Ref<ArrayMesh> mesh2 = node->get_mesh();
|
||||||
if (!mesh2.is_valid()) {
|
if (!mesh2.is_valid()) {
|
||||||
err_dialog->set_text(TTR("Contained Mesh is not of type ArrayMesh."));
|
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->add_undo_reference(unwrapped_mesh.ptr());
|
||||||
|
|
||||||
ur->commit_action();
|
ur->commit_action();
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case MENU_OPTION_DEBUG_UV1: {
|
case MENU_OPTION_DEBUG_UV1: {
|
||||||
Ref<Mesh> mesh2 = node->get_mesh();
|
Ref<Mesh> mesh2 = node->get_mesh();
|
||||||
|
|||||||
Reference in New Issue
Block a user