public void Unregister(IPoissonDataHolder obj) { // Destroy visual and detach onSceneGUIDelegate + undoRedoPerformed listeners Remove(obj); obj.EditorData.DestroyVisual(obj.ModeData); }
public PoissonHelper(IPoissonDataHolder dataHolder) { DataHolder = dataHolder; EditorData = dataHolder.EditorData; IsPrefab = !DataHolder.IsWindow && (PrefabUtility.GetPrefabType((Object)dataHolder) == PrefabType.Prefab); }
public void RemoveUndoRedoTracking(IPoissonDataHolder obj) { int index = _placers.IndexOf(obj); if (index >= 0) { Undo.undoRedoPerformed -= _helpers[index].OnUndoRedoPerformedPlacer; } }
public void Reset(IPoissonDataHolder obj) { int index = _placers.IndexOf(obj); if (index >= 0) { _helpers[index].Reset(); _helpers[index].EditorData.RefreshVisual(_helpers[index].ModeData, _helpers[index].SelectedData, _helpers[index].DataHolder.IsWindow); } }
public bool RemoveAndAdd(IPoissonDataHolder obj, PoissonHelper helper) { bool existed = Remove(obj); SceneView.onSceneGUIDelegate += helper.OnSceneGUI; if (!helper.DataHolder.IsWindow) { Undo.undoRedoPerformed += helper.OnUndoRedoPerformedPlacer; } _helpers.Add(helper); _placers.Add(obj); return(existed); }
public bool Remove(IPoissonDataHolder obj) { int index = _placers.IndexOf(obj); if (index >= 0) { SceneView.onSceneGUIDelegate -= _helpers[index].OnSceneGUI; if (!_helpers[index].DataHolder.IsWindow) { Undo.undoRedoPerformed -= _helpers[index].OnUndoRedoPerformedPlacer; } _helpers.RemoveAt(index); _placers.RemoveAt(index); return(true); } return(false); }
public void Register(IPoissonDataHolder obj) { // Create visual and attach onSceneGUIDelegate + undoRedoPerformed listeners new PoissonHelper(obj).Init(); }