mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-25 14:19:19 +01:00
Now the mesh data resource addon actually shows uvs in the uv editor.
This commit is contained in:
parent
de97b132a2
commit
74b35246c8
@ -7,8 +7,12 @@ 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:
|
||||||
|
@ -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")
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ func set_mesh_data_resource(a):
|
|||||||
|
|
||||||
if mesh_data_resource:
|
if mesh_data_resource:
|
||||||
mesh_data_resource.connect("changed", self, "on_mdr_changed")
|
mesh_data_resource.connect("changed", self, "on_mdr_changed")
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
|
||||||
func on_mdr_changed():
|
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)
|
draw_line(uvs[indices[i + 2]] * get_size(), uvs[indices[i]] * get_size(), Color(1, 1, 1, 1), 1, false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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()
|
||||||
@ -61,9 +67,10 @@ func make_visible(visible):
|
|||||||
#mdi_ed_gui.hide()
|
#mdi_ed_gui.hide()
|
||||||
#figure out how to hide it when something else gets selected, don't hide on unselect
|
#figure out how to hide it when something else gets selected, don't hide on unselect
|
||||||
pass
|
pass
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user