mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-22 02:17:18 +01:00
Implemented the ok and cancel buttons for the uv editor.
This commit is contained in:
parent
1bec27b886
commit
42918bc5fc
@ -1,10 +1,11 @@
|
|||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=7 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/MDIEd.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/vertex_position_operation_bg.tres" type="ButtonGroup" id=2]
|
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/vertex_position_operation_bg.tres" type="ButtonGroup" id=2]
|
||||||
[ext_resource path="res://addons/mesh_data_resource_editor/UVEditor.gd" type="Script" id=3]
|
[ext_resource path="res://addons/mesh_data_resource_editor/UVEditor.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/UVEditor.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/UVEditor.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/edit_mode_button_group.tres" type="ButtonGroup" id=5]
|
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/edit_mode_button_group.tres" type="ButtonGroup" id=5]
|
||||||
|
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/UVEditorPopup.gd" type="Script" id=6]
|
||||||
|
|
||||||
[node name="MDIEd" type="PanelContainer"]
|
[node name="MDIEd" type="PanelContainer"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -527,6 +528,7 @@ margin_right = 901.0
|
|||||||
margin_bottom = 803.0
|
margin_bottom = 803.0
|
||||||
window_title = "UV Editor"
|
window_title = "UV Editor"
|
||||||
resizable = true
|
resizable = true
|
||||||
|
script = ExtResource( 6 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
@ -10,3 +10,9 @@ func set_mesh_data_resource(a : MeshDataResource) -> void:
|
|||||||
|
|
||||||
func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
||||||
$ScrollContainer/MarginContainer/RectView.set_mesh_data_instance(a)
|
$ScrollContainer/MarginContainer/RectView.set_mesh_data_instance(a)
|
||||||
|
|
||||||
|
func ok_pressed() -> void:
|
||||||
|
$ScrollContainer/MarginContainer/RectView.ok_pressed()
|
||||||
|
|
||||||
|
func cancel_pressed() -> void:
|
||||||
|
$ScrollContainer/MarginContainer/RectView.cancel_pressed()
|
||||||
|
@ -15,6 +15,8 @@ var _background_texture : Texture = null
|
|||||||
var base_rect : Rect2 = Rect2(0, 0, 600, 600)
|
var base_rect : Rect2 = Rect2(0, 0, 600, 600)
|
||||||
var edited_resource_current_size : Vector2 = Vector2()
|
var edited_resource_current_size : Vector2 = Vector2()
|
||||||
|
|
||||||
|
var _stored_uvs : PoolVector2Array = PoolVector2Array()
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
var zoom_widget : Node = get_node_or_null(zoom_widget_path)
|
var zoom_widget : Node = get_node_or_null(zoom_widget_path)
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ func _enter_tree():
|
|||||||
|
|
||||||
func on_visibility_changed() -> void:
|
func on_visibility_changed() -> void:
|
||||||
if is_visible_in_tree():
|
if is_visible_in_tree():
|
||||||
|
store_uvs()
|
||||||
call_deferred("refresh")
|
call_deferred("refresh")
|
||||||
|
|
||||||
func apply_zoom() -> void:
|
func apply_zoom() -> void:
|
||||||
@ -106,3 +109,43 @@ func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
|||||||
|
|
||||||
func on_edited_resource_changed() -> void:
|
func on_edited_resource_changed() -> void:
|
||||||
call_deferred("refresh")
|
call_deferred("refresh")
|
||||||
|
|
||||||
|
func store_uvs() -> void:
|
||||||
|
_stored_uvs.resize(0)
|
||||||
|
|
||||||
|
if !_mdr:
|
||||||
|
return
|
||||||
|
|
||||||
|
var arrays : Array = _mdr.get_array()
|
||||||
|
|
||||||
|
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||||
|
return
|
||||||
|
|
||||||
|
if arrays[ArrayMesh.ARRAY_TEX_UV] == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Make sure it gets copied
|
||||||
|
_stored_uvs.append_array(arrays[ArrayMesh.ARRAY_TEX_UV])
|
||||||
|
|
||||||
|
|
||||||
|
func ok_pressed() -> void:
|
||||||
|
#todo undo redo
|
||||||
|
pass
|
||||||
|
|
||||||
|
func cancel_pressed() -> void:
|
||||||
|
if !_mdr:
|
||||||
|
return
|
||||||
|
|
||||||
|
var arrays : Array = _mdr.get_array()
|
||||||
|
|
||||||
|
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Make sure it gets copied
|
||||||
|
var uvs : PoolVector2Array = PoolVector2Array()
|
||||||
|
uvs.append_array(_stored_uvs)
|
||||||
|
arrays[ArrayMesh.ARRAY_TEX_UV] = uvs
|
||||||
|
|
||||||
|
_mdr.array = arrays
|
||||||
|
|
||||||
|
_stored_uvs.resize(0)
|
||||||
|
@ -19,18 +19,19 @@ margin_right = 1017.0
|
|||||||
margin_bottom = 593.0
|
margin_bottom = 593.0
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="ScrollContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="ScrollContainer"]
|
||||||
margin_right = 400.0
|
margin_right = 700.0
|
||||||
margin_bottom = 400.0
|
margin_bottom = 700.0
|
||||||
custom_constants/margin_right = 200
|
custom_constants/margin_right = 50
|
||||||
custom_constants/margin_top = 200
|
custom_constants/margin_top = 50
|
||||||
custom_constants/margin_left = 200
|
custom_constants/margin_left = 50
|
||||||
custom_constants/margin_bottom = 200
|
custom_constants/margin_bottom = 50
|
||||||
|
|
||||||
[node name="RectView" type="Control" parent="ScrollContainer/MarginContainer"]
|
[node name="RectView" type="Control" parent="ScrollContainer/MarginContainer"]
|
||||||
margin_left = 200.0
|
margin_left = 50.0
|
||||||
margin_top = 200.0
|
margin_top = 50.0
|
||||||
margin_right = 200.0
|
margin_right = 650.0
|
||||||
margin_bottom = 200.0
|
margin_bottom = 650.0
|
||||||
|
rect_min_size = Vector2( 600, 600 )
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
zoom_widget_path = NodePath("../../../Control/EditorZoomWidget")
|
zoom_widget_path = NodePath("../../../Control/EditorZoomWidget")
|
||||||
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
tool
|
||||||
|
extends ConfirmationDialog
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
connect("confirmed", self, "on_ok_pressed")
|
||||||
|
get_cancel().connect("pressed", self, "on_cancel_pressed")
|
||||||
|
|
||||||
|
func on_ok_pressed() -> void:
|
||||||
|
$UVEditor.ok_pressed()
|
||||||
|
|
||||||
|
func on_cancel_pressed() -> void:
|
||||||
|
$UVEditor.cancel_pressed()
|
Loading…
Reference in New Issue
Block a user