3using System.Collections;
4using System.Collections.Generic;
15 readonly
static System.Type[] BuiltinGizmos =
new System.Type[]
21 private static Dictionary<Type, Type> gizmoLookup =
null;
23 private static void RebuildGizmoLookup()
25 gizmoLookup =
new Dictionary<Type, Type>();
27 foreach(Type t
in BuiltinGizmos)
34 gizmoLookup.Add(attrib.
type, t);
61 void OnObjectInstantiated(GameObject go)
66 void OnSelectionChange(IEnumerable<GameObject> selection)
68 SetIsSelected(selection,
true);
71 void OnRemovedFromSelection(IEnumerable<GameObject> selection)
73 SetIsSelected(selection,
false);
76 void SetIsSelected(IEnumerable<GameObject> selection,
bool isSelected)
80 foreach(GameObject go
in selection)
82 pb_Gizmo[] gizmos = go.GetComponentsInChildren<pb_Gizmo>();
84 foreach(pb_Gizmo g
in gizmos)
85 g.isSelected = isSelected;
96 foreach(GameObject go
in pb_Scene.Children())
98 pb_Gizmo gizmo = AssociateGizmos(go);
100 if(gizmo !=
null && pb_Selection.gameObjects !=
null && pb_Selection.gameObjects.Contains(go))
102 gizmo.isSelected =
true;
107 pb_Gizmo AssociateGizmos(GameObject go)
109 pb_Gizmo[] existing = go.GetComponents<pb_Gizmo>();
111 foreach(pb_Gizmo g
in existing)
112 pb_ObjectUtility.Destroy(g);
116 if(component ==
null)
123 return (pb_Gizmo) go.AddComponent(gizmo);
132 if(gizmoLookup ==
null)
133 RebuildGizmoLookup();
137 gizmoLookup.TryGetValue(type, out result);
UnityEngine.Component Component
Type type
The type for which this class is providing an editor.
static System.Type FindGizmoForType(Type type)
static void AddOnLevelLoadedListener(Callback listener)
static void AddOnObjectInstantiatedListener(Callback< GameObject > listener)
static void AddOnSelectionChangeListener(Callback< IEnumerable< GameObject > > del)
static void AddOnRemovedFromSelectionListener(Callback< IEnumerable< GameObject > > del)