mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-22 02:17:18 +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 vertices : PoolVector3Array
|
||||||
var indices : PoolIntArray
|
var indices : PoolIntArray
|
||||||
|
|
||||||
|
var handle_points : PoolVector3Array
|
||||||
|
var handle_to_vertex_map : Array
|
||||||
|
|
||||||
var selected_indices : PoolIntArray
|
var selected_indices : PoolIntArray
|
||||||
var selected_vertices : PoolVector3Array
|
var selected_vertices : PoolVector3Array
|
||||||
var selected_vertices_original : PoolVector3Array
|
var selected_vertices_original : PoolVector3Array
|
||||||
@ -44,19 +47,18 @@ func set_handle(index: int, camera: Camera, point: Vector2):
|
|||||||
if edit_mode == EditMode.NONE:
|
if edit_mode == EditMode.NONE:
|
||||||
return
|
return
|
||||||
elif edit_mode == EditMode.TRANSLATE:
|
elif edit_mode == EditMode.TRANSLATE:
|
||||||
for i in selected_indices:
|
var ofs : Vector3 = Vector3()
|
||||||
var v : Vector3 = vertices[i]
|
|
||||||
|
|
||||||
if (axis_constraint & AxisConstraint.X) != 0:
|
if (axis_constraint & AxisConstraint.X) != 0:
|
||||||
v.x += relative.x * 0.001 * sign(camera.get_global_transform().basis.z.z)
|
ofs.x = relative.x * 0.001 * sign(camera.get_global_transform().basis.z.z)
|
||||||
|
|
||||||
if (axis_constraint & AxisConstraint.Y) != 0:
|
if (axis_constraint & AxisConstraint.Y) != 0:
|
||||||
v.y += relative.y * -0.001
|
ofs.y = relative.y * -0.001
|
||||||
|
|
||||||
if (axis_constraint & AxisConstraint.Z) != 0:
|
if (axis_constraint & AxisConstraint.Z) != 0:
|
||||||
v.z += relative.x * 0.001 * -sign(camera.get_global_transform().basis.z.x)
|
ofs.z = relative.x * 0.001 * -sign(camera.get_global_transform().basis.z.x)
|
||||||
|
|
||||||
vertices.set(i, v)
|
add_to_all_selected(ofs)
|
||||||
|
|
||||||
redraw()
|
redraw()
|
||||||
apply()
|
apply()
|
||||||
@ -76,12 +78,7 @@ func set_handle(index: int, camera: Camera, point: Vector2):
|
|||||||
|
|
||||||
var b : Basis = Basis().scaled(vs)
|
var b : Basis = Basis().scaled(vs)
|
||||||
|
|
||||||
for i in selected_indices:
|
mul_all_selected_with_basis(b)
|
||||||
var v : Vector3 = vertices[i]
|
|
||||||
|
|
||||||
v = b * v
|
|
||||||
|
|
||||||
vertices.set(i, v)
|
|
||||||
|
|
||||||
redraw()
|
redraw()
|
||||||
apply()
|
apply()
|
||||||
@ -236,6 +233,18 @@ func forward_spatial_gui_input(index, camera, event):
|
|||||||
|
|
||||||
return false
|
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:
|
func set_translate(on : bool) -> void:
|
||||||
if on:
|
if on:
|
||||||
edit_mode = EditMode.TRANSLATE
|
edit_mode = EditMode.TRANSLATE
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
tool
|
tool
|
||||||
extends Object
|
extends Object
|
||||||
|
|
||||||
static func get_vertex_to_vertex_map() -> Array:
|
static func get_handle_vertex_to_vertex_map() -> Array:
|
||||||
return Array()
|
return Array()
|
||||||
|
|
||||||
static func get_edge_to_vertex_map() -> Array:
|
static func get_handle_edge_to_vertex_map() -> Array:
|
||||||
return Array()
|
return Array()
|
||||||
|
|
||||||
static func get_face_to_vertex_map() -> Array:
|
static func get_handle_face_to_vertex_map() -> Array:
|
||||||
return Array()
|
return Array()
|
||||||
|
|
||||||
static func calculate_map_midpoints(mesh : Array, vertex_map : Array) -> PoolVector3Array:
|
static func calculate_map_midpoints(mesh : Array, vertex_map : Array) -> PoolVector3Array:
|
||||||
|
Loading…
Reference in New Issue
Block a user