Exemple #1
0
        public void Unregister(IPoissonDataHolder obj)
        {
            // Destroy visual and detach onSceneGUIDelegate + undoRedoPerformed listeners
            Remove(obj);

            obj.EditorData.DestroyVisual(obj.ModeData);
        }
Exemple #2
0
        public PoissonHelper(IPoissonDataHolder dataHolder)
        {
            DataHolder = dataHolder;
            EditorData = dataHolder.EditorData;

            IsPrefab = !DataHolder.IsWindow && (PrefabUtility.GetPrefabType((Object)dataHolder) == PrefabType.Prefab);
        }
Exemple #3
0
        public void RemoveUndoRedoTracking(IPoissonDataHolder obj)
        {
            int index = _placers.IndexOf(obj);

            if (index >= 0)
            {
                Undo.undoRedoPerformed -= _helpers[index].OnUndoRedoPerformedPlacer;
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
 public void Register(IPoissonDataHolder obj)
 {
     // Create visual and attach onSceneGUIDelegate + undoRedoPerformed listeners
     new PoissonHelper(obj).Init();
 }