Now the mesh data resource addon actually shows uvs in the uv editor.

This commit is contained in:
Relintai 2021-09-13 12:32:33 +02:00
parent de97b132a2
commit 74b35246c8
3 changed files with 20 additions and 8 deletions

View File

@ -7,8 +7,12 @@ export var uv_editor_path : NodePath
var uv_editor : Node
func _init():
func _enter_tree():
uv_editor = get_node(uv_editor_path)
func set_mesh_data_resource(a : MeshDataResource) -> void:
if uv_editor:
uv_editor.set_mesh_data_resource(a)
func _unhandled_key_input(event : InputEventKey) -> void:
if event.echo:

View File

@ -3,7 +3,7 @@ extends Control
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource
func set_mesh_data_resource(a):
func set_mesh_data_resource(a : MeshDataResource):
if mesh_data_resource:
mesh_data_resource.disconnect("changed", self, "on_mdr_changed")
@ -11,7 +11,7 @@ func set_mesh_data_resource(a):
if mesh_data_resource:
mesh_data_resource.connect("changed", self, "on_mdr_changed")
update()
func on_mdr_changed():
@ -31,3 +31,4 @@ func _draw():
draw_line(uvs[indices[i + 2]] * get_size(), uvs[indices[i]] * get_size(), Color(1, 1, 1, 1), 1, false)

View File

@ -10,7 +10,7 @@ var mdi_ed_gui : Control
var active_gizmos : Array
func _enter_tree():
print("_enter_tree")
#print("_enter_tree")
gizmo_plugin = MdiGizmoPlugin.new()
mdi_ed_gui = MDIEdGui.instance()
@ -27,7 +27,7 @@ func _enter_tree():
set_input_event_forwarding_always_enabled()
func _exit_tree():
print("_exit_tree")
#print("_exit_tree")
remove_spatial_gizmo_plugin(gizmo_plugin)
#remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
@ -45,15 +45,21 @@ func _exit_tree():
# mdi_ed_gui.queue_free()
func handles(object):
print("disable_plugin")
#print("disable_plugin")
if object is MeshDataInstance:
return true
return false
func edit(object):
var mdi : MeshDataInstance = object as MeshDataInstance
if mdi:
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
func make_visible(visible):
print("make_visible")
#print("make_visible")
if visible:
mdi_ed_gui.show()
@ -61,9 +67,10 @@ func make_visible(visible):
#mdi_ed_gui.hide()
#figure out how to hide it when something else gets selected, don't hide on unselect
pass
func get_plugin_name():
return "mesh_data_resource_editor"
#func forward_spatial_gui_input(camera, event):
# return forward_spatial_gui_input(0, camera, event)