forked from SaracenOne/entity_manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity_manager_plugin.gd
40 lines (25 loc) · 1.17 KB
/
entity_manager_plugin.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright (c) 2018-present. This file is part of V-Sekai https://v-sekai.org/.
# SaracenOne & K. S. Ernest (Fire) Lee & Lyuma & MMMaellon & Contributors
# entity_manager_plugin.gd
# SPDX-License-Identifier: MIT
@tool
extends EditorPlugin
var editor_interface: EditorInterface = null
const entity_const = preload("res://addons/entity_manager/entity.gd")
func _init():
print("Initialising EntityManager plugin")
func _notification(p_notification: int):
match p_notification:
NOTIFICATION_PREDELETE:
print("Destroying EntityManager plugin")
func _get_plugin_name() -> String:
return "EntityManager"
func _enter_tree() -> void:
editor_interface = get_editor_interface()
add_autoload_singleton("EntityManager", "res://addons/entity_manager/entity_manager.gd")
add_custom_type("Node3DEntity", "Node3D", entity_const, editor_interface.get_base_control().get_theme_icon("Node3D", "EditorIcons"))
add_custom_type("Node2DEntity", "Node2D", entity_const, editor_interface.get_base_control().get_theme_icon("Node2D", "EditorIcons"))
func _exit_tree() -> void:
remove_custom_type("SpatialEntity")
remove_custom_type("Node2DEntity")
remove_autoload_singleton("EntityManager")