2018-09-03 21:35:44 +02:00
|
|
|
tool
|
|
|
|
extends EditorPlugin
|
|
|
|
|
|
|
|
var mm_button = null
|
|
|
|
var material_maker = null
|
|
|
|
|
|
|
|
func _enter_tree():
|
2019-04-13 19:44:37 +02:00
|
|
|
add_tool_menu_item("Material Maker", self, "open_material_maker")
|
2018-09-03 21:35:44 +02:00
|
|
|
|
|
|
|
func _exit_tree():
|
2019-04-13 19:44:37 +02:00
|
|
|
remove_tool_menu_item("Material Maker")
|
2018-09-03 21:35:44 +02:00
|
|
|
if material_maker != null:
|
|
|
|
material_maker.hide()
|
|
|
|
material_maker.queue_free()
|
|
|
|
material_maker = null
|
|
|
|
|
|
|
|
func _get_state():
|
|
|
|
var s = { mm_button=mm_button, material_maker=material_maker }
|
|
|
|
return s
|
|
|
|
|
|
|
|
func _set_state(s):
|
|
|
|
mm_button = s.mm_button
|
|
|
|
material_maker = s.material_maker
|
|
|
|
|
2019-04-13 19:44:37 +02:00
|
|
|
func open_material_maker(foo = null):
|
2018-09-03 21:35:44 +02:00
|
|
|
if material_maker == null:
|
2018-09-04 21:45:14 +02:00
|
|
|
material_maker = preload("res://addons/material_maker/window_dialog.tscn").instance()
|
|
|
|
var panel = material_maker.get_node("MainWindow")
|
|
|
|
panel.editor_interface = get_editor_interface()
|
|
|
|
panel.connect("quit", self, "close_material_maker")
|
2018-09-03 21:35:44 +02:00
|
|
|
add_child(material_maker)
|
|
|
|
material_maker.popup_centered()
|
2018-09-04 21:45:14 +02:00
|
|
|
|
|
|
|
func close_material_maker():
|
|
|
|
if material_maker != null:
|
|
|
|
material_maker.hide()
|
|
|
|
material_maker.queue_free()
|
|
|
|
material_maker = null
|