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
|
||||
|
||||
export var uv_editor_path : NodePath
|
||||
export var uv_preview_path : NodePath
|
||||
|
||||
var uv_editor : Node
|
||||
var uv_preview : Node
|
||||
|
||||
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:
|
||||
if uv_editor:
|
||||
uv_editor.set_mesh_data_resource(a)
|
||||
if uv_preview:
|
||||
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:
|
||||
if event.echo:
|
||||
|
@ -12,7 +12,7 @@ script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_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="."]
|
||||
margin_left = 7.0
|
||||
|
@ -2,6 +2,7 @@ tool
|
||||
extends Control
|
||||
|
||||
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource
|
||||
var background_texture : Texture = null
|
||||
|
||||
func set_mesh_data_resource(a : MeshDataResource):
|
||||
if mesh_data_resource:
|
||||
@ -14,10 +15,19 @@ func set_mesh_data_resource(a : MeshDataResource):
|
||||
|
||||
update()
|
||||
|
||||
func set_mesh_data_instance(a : MeshDataInstance):
|
||||
if !a:
|
||||
background_texture = null
|
||||
|
||||
background_texture = a.texture
|
||||
|
||||
func on_mdr_changed():
|
||||
update()
|
||||
|
||||
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:
|
||||
return
|
||||
|
||||
|
@ -63,6 +63,7 @@ func edit(object):
|
||||
|
||||
if mdi:
|
||||
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
||||
mdi_ed_gui.set_mesh_data_instance(mdi)
|
||||
|
||||
func make_visible(visible):
|
||||
#print("make_visible")
|
||||
|
Loading…
Reference in New Issue
Block a user