material_plugin.gd 964 B

12345678910111213141516171819202122232425
  1. # A simple (and silly) material resource plugin. Allows you to make a really simple material
  2. # from a custom dock, that you can save and load, and apply to selected MeshInstances.
  3. #
  4. # SPECIAL NOTE: This technically should be using EditorImportPlugin and EditorExportPlugin
  5. # to handle the input and output of the silly material. However, currently you cannot export
  6. # custom resources in Godot, so instead we're using JSON files instead.
  7. #
  8. # This example should be replaced when EditorImportPlugin and EditorExportPlugin are both
  9. # fully working and you can save custom resources.
  10. @tool
  11. extends EditorPlugin
  12. var io_material_dialog: Panel
  13. func _enter_tree() -> void:
  14. io_material_dialog = preload("res://addons/material_creator/material_dock.tscn").instantiate()
  15. io_material_dialog.editor_interface = get_editor_interface()
  16. add_control_to_dock(DOCK_SLOT_LEFT_UL, io_material_dialog)
  17. func _exit_tree() -> void:
  18. remove_control_from_docks(io_material_dialog)