mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-29 02:29:18 +01:00
Started work on a uv editor.
This commit is contained in:
parent
131369ed71
commit
382d1079f6
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/MDIEd.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/vertex_position_operation_bg.tres" type="ButtonGroup" id=2]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/UVEditor.gd" type="Script" id=3]
|
||||
|
||||
[node name="MDIEd" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
@ -16,6 +17,9 @@ margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_right = 1010.0
|
||||
@ -115,3 +119,19 @@ margin_left = 59.0
|
||||
margin_right = 78.0
|
||||
margin_bottom = 20.0
|
||||
text = "F"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 586.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="UVEditor" type="Control" parent="VBoxContainer/ScrollContainer"]
|
||||
margin_right = 100.0
|
||||
margin_bottom = 100.0
|
||||
rect_min_size = Vector2( 100, 100 )
|
||||
script = ExtResource( 3 )
|
||||
|
33
game/addons/mesh_data_resource_editor/UVEditor.gd
Normal file
33
game/addons/mesh_data_resource_editor/UVEditor.gd
Normal file
@ -0,0 +1,33 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource
|
||||
|
||||
func set_mesh_data_resource(a):
|
||||
if mesh_data_resource:
|
||||
mesh_data_resource.disconnect("changed", self, "on_mdr_changed")
|
||||
|
||||
mesh_data_resource = a
|
||||
|
||||
if mesh_data_resource:
|
||||
mesh_data_resource.connect("changed", self, "on_mdr_changed")
|
||||
|
||||
update()
|
||||
|
||||
func on_mdr_changed():
|
||||
update()
|
||||
|
||||
func _draw():
|
||||
if !mesh_data_resource:
|
||||
return
|
||||
|
||||
var uvs : PoolVector2Array = mesh_data_resource.array[ArrayMesh.ARRAY_TEX_UV]
|
||||
var indices : PoolIntArray = mesh_data_resource.array[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
if indices.size() % 3 == 0:
|
||||
for i in range(0, len(indices), 3):
|
||||
draw_line(uvs[indices[i]] * get_size(), uvs[indices[i + 1]] * get_size(), Color(1, 1, 1, 1), 1, false)
|
||||
draw_line(uvs[indices[i + 1]] * get_size(), uvs[indices[i + 2]] * get_size(), Color(1, 1, 1, 1), 1, false)
|
||||
draw_line(uvs[indices[i + 2]] * get_size(), uvs[indices[i]] * get_size(), Color(1, 1, 1, 1), 1, false)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user