private void InvalidateSpriteMeshCache()
 {
     if (m_SpriteMeshCache)
     {
         Undo.ClearUndo(m_SpriteMeshCache);
         UnityEngine.Object.DestroyImmediate(m_SpriteMeshCache);
     }
 }
 public static void InvalidateCache()
 {
     if (m_Instance)
     {
         Undo.ClearUndo(m_Instance);
         DestroyImmediate(m_Instance);
     }
 }
 /// <summary>
 /// Undo는 "같은 메뉴"에서만 가능하다. 메뉴를 전환할 때에는 Undo를
 /// </summary>
 public static void ResetUndo(apEditor editor)
 {
     //apUndoManager.I.Clear();
     if (editor._portrait != null)
     {
         Undo.ClearUndo(editor._portrait);
     }
 }
Beispiel #4
0
 private void OnDestroy()
 {
     if (tree)
     {
         EditorUtility.SetDirty(tree);
         Undo.ClearUndo(tree);
     }
 }
        private void UpdateSelectedRenderer()
        {
            //Return if no new object was selected
            if (Selection.activeGameObject == null)
            {
                return;
            }

            //Return if the new object is not a grass object
            var newGrassObject = Selection.activeGameObject;

            Selection.activeGameObject = null;

            if (newGrassObject == grassObject)
            {
                return;
            }

            //Get the grass material, if non was found, return.
            var newGrassMaterial = GetGrassMaterial(newGrassObject);

            if (newGrassMaterial == null)
            {
                return;
            }

            //A new object was selected. If another object was selected before, tell the user that this will make changes permanent.
            if (grassObject != null && !ShowUndoLossWarning(false))
            {
                return;
            }

            //Clear undo history for current texture
            Undo.ClearUndo(grassPainter.DensityTexture);

            //Reset the previously selected grass object
            ResetRenderer(false);

            //Assign new grass object
            grassObject   = newGrassObject;
            grassMaterial = newGrassMaterial;
            grassPainter.ColorHeightTexture = grassMaterial.GetTexture("_ColorMap") as Texture2D;
            grassPainter.DensityTexture     = grassMaterial.GetTexture("_Density") as Texture2D;

            if (searchRoot)
            {
                grassPainter.GrassColliders = GetGrassObjectsInChildren(grassObject.transform.root.gameObject)
                                              .Select(x => GetColliderOrAddTemp(x))
                                              .ToArray();
            }
            else
            {
                var collider = GetColliderOrAddTemp(grassObject);

                grassPainter.GrassColliders = new[] { collider };
            }
        }
        public void ClearUndo(object o)
        {
            var obj = o as Object;

            if (obj != null)
            {
                Undo.ClearUndo(obj);
            }
        }
Beispiel #7
0
        public override void OnInspectorGUI()
        {
            m_MaterialSlider.OnBeforeValidate();

            serializedObject.Update();

            EditorGUI.BeginChangeCheck();
            {
                Undo.RecordObject(serializedObject.targetObject, "");
                LayoutStyle_PropertyField(m_Interactable);
            }
            if (EditorGUI.EndChangeCheck())
            {
                m_MaterialSlider.interactable = m_Interactable.boolValue;
            }
            else
            {
                Undo.ClearUndo(serializedObject.targetObject);
            }

            EditorGUILayout.Space();
            LayoutStyle_PropertyField(m_AnimationDuration);
            EditorGUILayout.Space();

            LayoutStyle_PropertyField(m_HasPopup);

            using (new DisabledScope(!m_MaterialSlider.slider.wholeNumbers))
            {
                LayoutStyle_PropertyField(m_HasDots);
            }

            using (new GUILayout.HorizontalScope())
            {
                LayoutStyle_PropertyField(m_HasManualPreferredWidth, new GUIContent("Manual Preferred Width"));
                if (m_HasManualPreferredWidth.boolValue)
                {
                    LayoutStyle_PropertyField(m_ManualPreferredWidth, new GUIContent(""));
                }
            }

            if (m_LeftContentTransform.objectReferenceValue != null)
            {
                LayoutStyle_PropertyField(m_LowLeftDisabledOpacity);
            }

            if (m_RightContentTransform.objectReferenceValue != null)
            {
                LayoutStyle_PropertyField(m_LowRightDisabledOpacity);
            }

            DrawFoldoutColors(ColorsSection);
            DrawFoldoutComponents(ComponentsSection);

            DrawStyleGUIFolder();

            serializedObject.ApplyModifiedProperties();
        }
 private void OnDestroy()
 {
     Save();
     foreach (var view in OpenList)
     {
         OnCloseView(view);
     }
     Undo.ClearUndo(this);
 }
Beispiel #9
0
        public void ClearUndo(IUndoableObject obj)
        {
            ScriptableObject scriptableObject = this.CheckUndoObjectType(obj);

            if (scriptableObject != null)
            {
                Undo.ClearUndo(scriptableObject);
            }
        }
        public static void ClearUndo(this StyleSheet styleSheet)
        {
            if (styleSheet == null)
            {
                return;
            }

            Undo.ClearUndo(styleSheet);
        }
        public void ClearUndo(object o)
        {
            var obj = o as UnityEngine.Object;

            if (obj != null)
            {
                Undo.ClearUndo(obj);
            }
        }
Beispiel #12
0
        public override void EditItem(Quest quest)
        {
            base.EditItem(quest);

            Undo.ClearUndo(_previousItem);
            Undo.RecordObject(quest, QuestSystemPro.ProductName + "_item");

            _previousItem = quest;
        }
Beispiel #13
0
 public static void ClearHistory()
 {
     GBackupFile.ClearHistory();
     Undo.ClearUndo(GUndoCompatibleBuffer.Instance);
     if (Changed != null)
     {
         Changed.Invoke();
     }
 }
Beispiel #14
0
        public override void EditItem(Achievement achievement, int index)
        {
            base.EditItem(achievement, index);

            Undo.ClearUndo(_previousItem);
            Undo.RecordObject(achievement, QuestSystemPro.ProductName + "_item");

            _previousItem = achievement;
        }
        public override void EditItem(T item)
        {
            base.EditItem(item);

            Undo.ClearUndo(previousItem);
            Undo.RecordObject(item, RucksackConstants.ProductName + "_item");

            previousItem = item;
        }
Beispiel #16
0
            public IEnumerator SetLayer(LandLayers layer, int topology = 0)
            {
                yield return(EditorCoroutineUtility.StartCoroutineOwnerless(SetLayerCoroutine(layer, topology)));

                LayerSet = true;
                foreach (var item in Land.terrainData.alphamapTextures)
                {
                    Undo.ClearUndo(item);
                }
            }
Beispiel #17
0
    private void UpdateSelectedRenderer()
    {
        //Return if no new object was selected
        if (Selection.activeGameObject == null)
        {
            return;
        }

        //Return if the new object is not a grass object
        var newGrassObject = Selection.activeGameObject;

        Selection.activeGameObject = null;

        if (newGrassObject == grassObject)
        {
            return;
        }

        //Get the grass material, if non was found, return.
        var newGrassMaterial = GetGrassMaterial(newGrassObject);

        if (newGrassMaterial == null)
        {
            return;
        }

        //A new object was selected. If another object was selected before, tell the user that this will make changes permanent.
        if (grassObject != null && !ShowUndoLossWarning(false))
        {
            return;
        }

        //Clear undo history for current texture
        Undo.ClearUndo(GrassPainter.Texture);

        //Reset the previously selected grass object
        ResetRenderer(false);

        //Assign new grass object
        grassObject          = newGrassObject;
        grassMaterial        = newGrassMaterial;
        GrassPainter.Texture = grassMaterial.GetTexture("_Density") as Texture2D;

        GrassPainter.GrassCollider = grassObject.GetComponent <Collider>();
        startedWithCollider        = GrassPainter.GrassCollider != null;

        //If the object had no collider, add one. It will be destroyed when deselected.
        if (!startedWithCollider)
        {
            AddTempCollider();
        }

        Repaint();
    }
Beispiel #18
0
        public static void ClearUndo(this VisualTreeAsset vta)
        {
            if (vta == null)
                return;

            Undo.ClearUndo(vta);

            if (vta.inlineSheet == null)
                return;

            Undo.ClearUndo(vta.inlineSheet);
        }
Beispiel #19
0
 private void OnDestroy()
 {
     Undo.undoRedoPerformed -= RefreshModules;
     if (selectedItem)
     {
         Undo.ClearUndo(selectedItem);
     }
     if (selectedTemplate)
     {
         Undo.ClearUndo(selectedTemplate);
     }
     AssetDatabase.SaveAssets();
 }
Beispiel #20
0
 void OnDestroy()
 {
     if (graphObject != null)
     {
         if (graphObject.isDirty && EditorUtility.DisplayDialog("Shader Graph Has Been Modified", "Do you want to save the changes you made in the shader graph?\n\nYour changes will be lost if you don't save them.", "Save", "Don't Save"))
         {
             UpdateAsset();
         }
         Undo.ClearUndo(graphObject);
         DestroyImmediate(graphObject);
     }
     graphEditorView = null;
 }
Beispiel #21
0
 private bool PromptSaveIfDirtyOnQuit()
 {
     if (graphObject != null)
     {
         string nameOfFile = AssetDatabase.GUIDToAssetPath(selectedGuid);
         if (IsDirty() && EditorUtility.DisplayDialog("Shader Graph Has Been Modified", "Do you want to save the changes you made in the Shader Graph?\n" + nameOfFile + "\n\nYour changes will be lost if you don't save them.", "Save", "Don't Save"))
         {
             UpdateAsset();
         }
         Undo.ClearUndo(graphObject);
         graphObject = null;
     }
     return(true);
 }
Beispiel #22
0
        public void DestroyWidgetStates()
        {
            if (m_WidgetStates != null)
            {
                // Clear all the states from memory
                foreach (var state in m_WidgetStates)
                {
                    var s = state.Value;
                    Undo.ClearUndo(s); // Don't leave dangling states in the global undo/redo stack
                    DestroyImmediate(s);
                }

                m_WidgetStates.Clear();
            }
        }
Beispiel #23
0
        public override void EditItem(InventoryItemBase item, int i)
        {
            base.EditItem(item, i);

            Undo.ClearUndo(_previousItem);
            Undo.RecordObject(item, "INV_PRO_item");

            itemEditorInspector = GetEditor(item, i);
            GUI.changed         = false;

            selectedIndex = i;
            selectedItem  = ItemManager.database.items[selectedIndex];

            _previousItem = item;
        }
Beispiel #24
0
 public static void DestroyImmediate(object o)
 {
     if (o is BaseObject)
     {
         var obj = o as BaseObject;
         obj.OnDestroy();
         s_Objects.Remove(obj.GetInstanceID());
     }
     else if (o is UnityEngine.Object)
     {
         var obj = o as UnityEngine.Object;
         Undo.ClearUndo(obj);
         UnityEngine.Object.DestroyImmediate(obj);
     }
 }
        void OnDestroy()
        {
            if (graphObject != null)
            {
                string nameOfFile = AssetDatabase.GUIDToAssetPath(selectedGuid);
                if (graphObject.isDirty && EditorUtility.DisplayDialog("Shader Graph Has Been Modified", "Do you want to save the changes you made in the Shader Graph?\n" + nameOfFile + "\n\nYour changes will be lost if you don't save them.", "Save", "Don't Save"))
                {
                    UpdateAsset();
                }
                Undo.ClearUndo(graphObject);
                DestroyImmediate(graphObject);
            }

            graphEditorView = null;
        }
Beispiel #26
0
    void OnDestroy()
    {
        SceneView.onSceneGUIDelegate -= OnSceneGUI;
        Undo.undoRedoPerformed       -= SaveTexture;
        ResetRenderer(true);

        if (ShowUndoLossWarning(true))
        {
            Undo.ClearUndo(GrassPainter.Texture);
        }
        else
        {
            RecreateWindow();
        }
    }
            protected void ClearObjects()
            {
                foreach (SerializedObjectEditorGUI <T> editorGUI in _editableObjects)
                {
                    Undo.ClearUndo(editorGUI);
                    GetEditorWindow().OnDeselectObject(editorGUI);
                }

                _editableObjects.Clear();
                _selectedObjects.Clear();
                _draggedObject = null;

                Undo.ClearUndo(this);

                ClearDirtyFlag();
            }
Beispiel #28
0
        public override void EditItem(InventoryItemBase item)
        {
            base.EditItem(item);

            Undo.ClearUndo(_previousItem);

            Undo.RecordObject(item, "INV_PRO_item");

            if (item != null)
            {
                itemEditorInspector = Editor.CreateEditor(item);
            }


            _previousItem = item;
        }
Beispiel #29
0
        private void DestroyCache()
        {
            foreach (var pair in m_Paths)
            {
                var path = pair.Value;

                if (path != null)
                {
                    Undo.ClearUndo(path);
                    UnityObject.DestroyImmediate(path);
                }
            }
            m_Paths.Clear();
            m_Controller.ClearPaths();
            m_GUISystems.Clear();
            m_SerializedObjects.Clear();
        }
Beispiel #30
0
        // Note: this won't get called if the window is opened when the editor itself is closed
        void OnDestroy()
        {
            DebugManager.instance.onSetDirty -= MarkDirty;

            if (m_WidgetStates != null)
            {
                // Clear all the states from memory
                foreach (var state in m_WidgetStates)
                {
                    var s = state.Value;
                    Undo.ClearUndo(s); // Don't leave dangling states in the global undo/redo stack
                    DestroyImmediate(s);
                }

                m_WidgetStates.Clear();
            }
        }