2021-10-01 00:54:13 +02:00
|
|
|
tool
|
|
|
|
extends EditorPlugin
|
|
|
|
|
2021-10-03 19:56:35 +02:00
|
|
|
var MMNode = preload("res://addons/mat_maker_gd/nodes/mm_node.gd")
|
|
|
|
var MMMaterial = preload("res://addons/mat_maker_gd/nodes/mm_material.gd")
|
2021-10-01 00:54:13 +02:00
|
|
|
|
2021-10-03 19:56:35 +02:00
|
|
|
var editor_packed_scene = preload("res://addons/mat_maker_gd/editor/MatMakerGDEditor.tscn")
|
|
|
|
var editor_scene = null
|
2021-10-01 00:54:13 +02:00
|
|
|
|
2021-10-03 19:56:35 +02:00
|
|
|
var tool_button : ToolButton = null
|
2021-10-01 00:54:13 +02:00
|
|
|
|
2021-10-03 19:56:35 +02:00
|
|
|
func _enter_tree():
|
|
|
|
add_custom_type("MMNode", "Resource", MMNode, null)
|
2021-10-04 11:24:02 +02:00
|
|
|
add_custom_type("MMMaterial", "Resource", MMMaterial, null)
|
2021-10-03 19:56:35 +02:00
|
|
|
|
|
|
|
editor_scene = editor_packed_scene.instance()
|
|
|
|
|
|
|
|
tool_button = add_control_to_bottom_panel(editor_scene, "MMGD")
|
|
|
|
tool_button.hide()
|
|
|
|
|
2021-10-01 00:54:13 +02:00
|
|
|
func _exit_tree():
|
2021-10-03 19:56:35 +02:00
|
|
|
remove_custom_type("MMNode")
|
2021-10-04 11:24:02 +02:00
|
|
|
remove_custom_type("MMMaterial")
|
2021-10-03 19:56:35 +02:00
|
|
|
|
|
|
|
remove_control_from_bottom_panel(editor_scene)
|
|
|
|
|
|
|
|
if editor_scene:
|
|
|
|
editor_scene.queue_free()
|
|
|
|
|
|
|
|
editor_scene = null
|
|
|
|
tool_button = null
|
|
|
|
|
|
|
|
func handles(object):
|
|
|
|
return object is MMMateial
|
|
|
|
|
|
|
|
func edit(object):
|
|
|
|
#if editor_scene:
|
|
|
|
# make_bottom_panel_item_visible(editor_scene)
|
2021-10-01 00:54:13 +02:00
|
|
|
pass
|
2021-10-03 19:56:35 +02:00
|
|
|
|
|
|
|
func make_visible(visible):
|
|
|
|
if tool_button:
|
|
|
|
if visible:
|
|
|
|
tool_button.show()
|
|
|
|
else:
|
|
|
|
#if tool_button.pressed:
|
|
|
|
# tool_button.pressed = false
|
|
|
|
|
|
|
|
if !tool_button.pressed:
|
|
|
|
tool_button.hide()
|
|
|
|
|
|
|
|
func get_plugin_icon():
|
|
|
|
return null
|
|
|
|
|
|
|
|
func get_plugin_name():
|
|
|
|
return "MatMakerGD"
|
|
|
|
|
|
|
|
func has_main_screen():
|
|
|
|
return false
|
|
|
|
|
|
|
|
|