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,9 +7,13 @@ export var uv_editor_path : NodePath
var uv_editor : Node var uv_editor : Node
func _init(): func _enter_tree():
uv_editor = get_node(uv_editor_path) 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: func _unhandled_key_input(event : InputEventKey) -> void:
if event.echo: if event.echo:
return return

View File

@ -3,7 +3,7 @@ extends Control
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource 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: if mesh_data_resource:
mesh_data_resource.disconnect("changed", self, "on_mdr_changed") mesh_data_resource.disconnect("changed", self, "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) 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 var active_gizmos : Array
func _enter_tree(): func _enter_tree():
print("_enter_tree") #print("_enter_tree")
gizmo_plugin = MdiGizmoPlugin.new() gizmo_plugin = MdiGizmoPlugin.new()
mdi_ed_gui = MDIEdGui.instance() mdi_ed_gui = MDIEdGui.instance()
@ -27,7 +27,7 @@ func _enter_tree():
set_input_event_forwarding_always_enabled() set_input_event_forwarding_always_enabled()
func _exit_tree(): func _exit_tree():
print("_exit_tree") #print("_exit_tree")
remove_spatial_gizmo_plugin(gizmo_plugin) remove_spatial_gizmo_plugin(gizmo_plugin)
#remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui) #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() # mdi_ed_gui.queue_free()
func handles(object): func handles(object):
print("disable_plugin") #print("disable_plugin")
if object is MeshDataInstance: if object is MeshDataInstance:
return true return true
return false 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): func make_visible(visible):
print("make_visible") #print("make_visible")
if visible: if visible:
mdi_ed_gui.show() mdi_ed_gui.show()
@ -65,6 +71,7 @@ func make_visible(visible):
func get_plugin_name(): func get_plugin_name():
return "mesh_data_resource_editor" return "mesh_data_resource_editor"
#func forward_spatial_gui_input(camera, event): #func forward_spatial_gui_input(camera, event):
# return forward_spatial_gui_input(0, camera, event) # return forward_spatial_gui_input(0, camera, event)