mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Moved around more code in mesh data resource editor's gizmo.
This commit is contained in:
parent
ef7ed3848b
commit
612ee7936a
@ -20,6 +20,9 @@ var plugin : EditorPlugin
|
||||
var vertices : PoolVector3Array
|
||||
var indices : PoolIntArray
|
||||
|
||||
var handle_points : PoolVector3Array
|
||||
var handle_to_vertex_map : Array
|
||||
|
||||
var selected_indices : PoolIntArray
|
||||
var selected_vertices : PoolVector3Array
|
||||
var selected_vertices_original : PoolVector3Array
|
||||
@ -44,19 +47,18 @@ func set_handle(index: int, camera: Camera, point: Vector2):
|
||||
if edit_mode == EditMode.NONE:
|
||||
return
|
||||
elif edit_mode == EditMode.TRANSLATE:
|
||||
for i in selected_indices:
|
||||
var v : Vector3 = vertices[i]
|
||||
var ofs : Vector3 = Vector3()
|
||||
|
||||
if (axis_constraint & AxisConstraint.X) != 0:
|
||||
v.x += relative.x * 0.001 * sign(camera.get_global_transform().basis.z.z)
|
||||
if (axis_constraint & AxisConstraint.X) != 0:
|
||||
ofs.x = relative.x * 0.001 * sign(camera.get_global_transform().basis.z.z)
|
||||
|
||||
if (axis_constraint & AxisConstraint.Y) != 0:
|
||||
v.y += relative.y * -0.001
|
||||
if (axis_constraint & AxisConstraint.Y) != 0:
|
||||
ofs.y = relative.y * -0.001
|
||||
|
||||
if (axis_constraint & AxisConstraint.Z) != 0:
|
||||
v.z += relative.x * 0.001 * -sign(camera.get_global_transform().basis.z.x)
|
||||
if (axis_constraint & AxisConstraint.Z) != 0:
|
||||
ofs.z = relative.x * 0.001 * -sign(camera.get_global_transform().basis.z.x)
|
||||
|
||||
vertices.set(i, v)
|
||||
add_to_all_selected(ofs)
|
||||
|
||||
redraw()
|
||||
apply()
|
||||
@ -76,12 +78,7 @@ func set_handle(index: int, camera: Camera, point: Vector2):
|
||||
|
||||
var b : Basis = Basis().scaled(vs)
|
||||
|
||||
for i in selected_indices:
|
||||
var v : Vector3 = vertices[i]
|
||||
|
||||
v = b * v
|
||||
|
||||
vertices.set(i, v)
|
||||
mul_all_selected_with_basis(b)
|
||||
|
||||
redraw()
|
||||
apply()
|
||||
@ -236,6 +233,18 @@ func forward_spatial_gui_input(index, camera, event):
|
||||
|
||||
return false
|
||||
|
||||
func add_to_all_selected(ofs : Vector3) -> void:
|
||||
for i in selected_indices:
|
||||
var v : Vector3 = vertices[i]
|
||||
v += ofs
|
||||
vertices.set(i, v)
|
||||
|
||||
func mul_all_selected_with_basis(b : Basis) -> void:
|
||||
for i in selected_indices:
|
||||
var v : Vector3 = vertices[i]
|
||||
v = b * v
|
||||
vertices.set(i, v)
|
||||
|
||||
func set_translate(on : bool) -> void:
|
||||
if on:
|
||||
edit_mode = EditMode.TRANSLATE
|
||||
|
@ -1,13 +1,13 @@
|
||||
tool
|
||||
extends Object
|
||||
|
||||
static func get_vertex_to_vertex_map() -> Array:
|
||||
static func get_handle_vertex_to_vertex_map() -> Array:
|
||||
return Array()
|
||||
|
||||
static func get_edge_to_vertex_map() -> Array:
|
||||
static func get_handle_edge_to_vertex_map() -> Array:
|
||||
return Array()
|
||||
|
||||
static func get_face_to_vertex_map() -> Array:
|
||||
static func get_handle_face_to_vertex_map() -> Array:
|
||||
return Array()
|
||||
|
||||
static func calculate_map_midpoints(mesh : Array, vertex_map : Array) -> PoolVector3Array:
|
||||
|
Loading…
Reference in New Issue
Block a user