mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Now the uv preview will show the mesh data instance's active texture as a background.
This commit is contained in:
parent
b2e6c037f4
commit
1f48d44a5f
@ -3,16 +3,20 @@ extends Control
|
|||||||
|
|
||||||
var plugin : EditorPlugin
|
var plugin : EditorPlugin
|
||||||
|
|
||||||
export var uv_editor_path : NodePath
|
export var uv_preview_path : NodePath
|
||||||
|
|
||||||
var uv_editor : Node
|
var uv_preview : Node
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
uv_editor = get_node(uv_editor_path)
|
uv_preview = get_node(uv_preview_path)
|
||||||
|
|
||||||
func set_mesh_data_resource(a : MeshDataResource) -> void:
|
func set_mesh_data_resource(a : MeshDataResource) -> void:
|
||||||
if uv_editor:
|
if uv_preview:
|
||||||
uv_editor.set_mesh_data_resource(a)
|
uv_preview.set_mesh_data_resource(a)
|
||||||
|
|
||||||
|
func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
||||||
|
if uv_preview:
|
||||||
|
uv_preview.set_mesh_data_instance(a)
|
||||||
|
|
||||||
func _unhandled_key_input(event : InputEventKey) -> void:
|
func _unhandled_key_input(event : InputEventKey) -> void:
|
||||||
if event.echo:
|
if event.echo:
|
||||||
|
@ -12,7 +12,7 @@ script = ExtResource( 1 )
|
|||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
uv_editor_path = NodePath("VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/UVDisplay")
|
uv_preview_path = NodePath("VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/UVDisplay")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
margin_left = 7.0
|
margin_left = 7.0
|
||||||
|
@ -2,6 +2,7 @@ tool
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource
|
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource
|
||||||
|
var background_texture : Texture = null
|
||||||
|
|
||||||
func set_mesh_data_resource(a : MeshDataResource):
|
func set_mesh_data_resource(a : MeshDataResource):
|
||||||
if mesh_data_resource:
|
if mesh_data_resource:
|
||||||
@ -13,17 +14,26 @@ func set_mesh_data_resource(a : MeshDataResource):
|
|||||||
mesh_data_resource.connect("changed", self, "on_mdr_changed")
|
mesh_data_resource.connect("changed", self, "on_mdr_changed")
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
|
||||||
|
func set_mesh_data_instance(a : MeshDataInstance):
|
||||||
|
if !a:
|
||||||
|
background_texture = null
|
||||||
|
|
||||||
|
background_texture = a.texture
|
||||||
|
|
||||||
func on_mdr_changed():
|
func on_mdr_changed():
|
||||||
update()
|
update()
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
|
if background_texture:
|
||||||
|
draw_texture_rect_region(background_texture, Rect2(Vector2(), get_size()), Rect2(Vector2(), background_texture.get_size()))
|
||||||
|
|
||||||
if !mesh_data_resource:
|
if !mesh_data_resource:
|
||||||
return
|
return
|
||||||
|
|
||||||
if mesh_data_resource.array.size() != ArrayMesh.ARRAY_MAX:
|
if mesh_data_resource.array.size() != ArrayMesh.ARRAY_MAX:
|
||||||
return
|
return
|
||||||
|
|
||||||
var uvs : PoolVector2Array = mesh_data_resource.array[ArrayMesh.ARRAY_TEX_UV]
|
var uvs : PoolVector2Array = mesh_data_resource.array[ArrayMesh.ARRAY_TEX_UV]
|
||||||
var indices : PoolIntArray = mesh_data_resource.array[ArrayMesh.ARRAY_INDEX]
|
var indices : PoolIntArray = mesh_data_resource.array[ArrayMesh.ARRAY_INDEX]
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ func edit(object):
|
|||||||
|
|
||||||
if mdi:
|
if mdi:
|
||||||
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
||||||
|
mdi_ed_gui.set_mesh_data_instance(mdi)
|
||||||
|
|
||||||
func make_visible(visible):
|
func make_visible(visible):
|
||||||
#print("make_visible")
|
#print("make_visible")
|
||||||
|
Loading…
Reference in New Issue
Block a user