mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Move the code for the uv unwrapping action from the plugin to the gizmo.
This commit is contained in:
parent
0aa0342d3f
commit
1a38232d51
@ -1024,3 +1024,23 @@ func apply_seam():
|
|||||||
|
|
||||||
_mdr.connect("changed", self, "on_mdr_changed")
|
_mdr.connect("changed", self, "on_mdr_changed")
|
||||||
on_mdr_changed()
|
on_mdr_changed()
|
||||||
|
|
||||||
|
func uv_unwrap() -> void:
|
||||||
|
if !_mdr:
|
||||||
|
return
|
||||||
|
|
||||||
|
var mdr_arr : Array = _mdr.array
|
||||||
|
|
||||||
|
if mdr_arr.size() != ArrayMesh.ARRAY_MAX || mdr_arr[ArrayMesh.ARRAY_VERTEX] == null || mdr_arr[ArrayMesh.ARRAY_VERTEX].size() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
var mesh : Array = _mdr.get_array()
|
||||||
|
|
||||||
|
var uvs : PoolVector2Array = MeshUtils.uv_unwrap(mesh)
|
||||||
|
|
||||||
|
if uvs.size() != mdr_arr[ArrayMesh.ARRAY_VERTEX]:
|
||||||
|
print("Error: Could not unwrap mesh!")
|
||||||
|
return
|
||||||
|
|
||||||
|
mesh[ArrayMesh.ARRAY_TEX_UV] = uvs
|
||||||
|
_mdr.set_array(mesh)
|
||||||
|
@ -132,27 +132,6 @@ func get_mdr() -> MeshDataResource:
|
|||||||
|
|
||||||
return null
|
return null
|
||||||
|
|
||||||
func uv_unwrap() -> void:
|
|
||||||
var mdr : MeshDataResource = null
|
|
||||||
|
|
||||||
if current_mesh_data_instance && current_mesh_data_instance.mesh_data:
|
|
||||||
#current_mesh_data_instance.mesh_data.uv_unwrap()
|
|
||||||
mdr = current_mesh_data_instance.mesh_data
|
|
||||||
|
|
||||||
if !mdr:
|
|
||||||
return
|
|
||||||
|
|
||||||
var mesh : Array = mdr.get_array()
|
|
||||||
|
|
||||||
var uvs : PoolVector2Array = MeshUtils.uv_unwrap(mesh)
|
|
||||||
|
|
||||||
mesh[ArrayMesh.ARRAY_TEX_UV] = uvs
|
|
||||||
|
|
||||||
mdr.set_array(mesh)
|
|
||||||
|
|
||||||
if mdr:
|
|
||||||
mdi_ed_gui.set_mesh_data_resource(mdr)
|
|
||||||
|
|
||||||
|
|
||||||
#func forward_spatial_gui_input(camera, event):
|
#func forward_spatial_gui_input(camera, event):
|
||||||
# for g in active_gizmos:
|
# for g in active_gizmos:
|
||||||
@ -249,3 +228,8 @@ func unmark_seam():
|
|||||||
func apply_seam():
|
func apply_seam():
|
||||||
for g in active_gizmos:
|
for g in active_gizmos:
|
||||||
g.apply_seam()
|
g.apply_seam()
|
||||||
|
|
||||||
|
func uv_unwrap() -> void:
|
||||||
|
for g in active_gizmos:
|
||||||
|
g.apply_seam()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user