IsDestroyScriptableObject() private method

private IsDestroyScriptableObject ( ScriptableObject target ) : bool
target UnityEngine.ScriptableObject
return bool
        public virtual void OnDisable()
        {
            AssetImporter target = this.target as AssetImporter;

            if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this) && this.m_MightHaveModified && ((Object)target != (Object)null && !InternalEditorUtility.ignoreInspectorChanges) && (this.HasModified() && !this.AssetWasUpdated()))
            {
                string message = "Unapplied import settings for '" + target.assetPath + "'";
                if (this.targets.Length > 1)
                {
                    message = "Unapplied import settings for '" + (object)this.targets.Length + "' files";
                }
                if (EditorUtility.DisplayDialog("Unapplied import settings", message, "Apply", "Revert"))
                {
                    this.Apply();
                    this.m_MightHaveModified = false;
                    AssetImporterInspector.ImportAssets(this.GetAssetPaths());
                }
            }
            if (this.m_SerializedObject == null || !this.m_SerializedObject.hasModifiedProperties)
            {
                return;
            }
            this.m_SerializedObject.Cache(this.GetInstanceID());
            this.m_SerializedObject = (SerializedObject)null;
        }
Exemplo n.º 2
0
 internal void SwitchToAssetMode()
 {
     foreach (SceneStateCache cache in this.m_SceneStates)
     {
         if (cache.view != null)
         {
             cache.view.m_SceneViewState.showFog            = cache.state.showFog;
             cache.view.m_SceneViewState.showFlares         = cache.state.showFlares;
             cache.view.m_SceneViewState.showMaterialUpdate = cache.state.showMaterialUpdate;
             cache.view.m_SceneViewState.showSkybox         = cache.state.showSkybox;
             cache.view.m_SceneViewState.showImageEffects   = cache.state.showImageEffects;
         }
     }
     this.m_EditMode = EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject(this))
     {
         if (SceneManager.GetActiveScene().path.Length <= 0)
         {
             if ((this.sceneSetup != null) && (this.sceneSetup.Length > 0))
             {
                 EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
                 this.sceneSetup = null;
             }
             else
             {
                 EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
             }
         }
     }
     else if (Unsupported.IsDestroyScriptableObject(this))
     {
Exemplo n.º 3
0
 internal void SwitchToAssetMode()
 {
     foreach (SceneStateCache cache in this.m_SceneStates)
     {
         if (cache.view != null)
         {
             cache.view.m_SceneViewState.showFog            = cache.state.showFog;
             cache.view.m_SceneViewState.showFlares         = cache.state.showFlares;
             cache.view.m_SceneViewState.showMaterialUpdate = cache.state.showMaterialUpdate;
             cache.view.m_SceneViewState.showSkybox         = cache.state.showSkybox;
         }
     }
     this.m_EditMode = EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject(this))
     {
         if (EditorApplication.currentScene.Length <= 0)
         {
             if (this.m_UserFileName.Length > 0)
             {
                 EditorApplication.OpenScene(this.m_UserFileName);
             }
             else
             {
                 EditorApplication.NewScene();
             }
         }
     }
     else if (Unsupported.IsDestroyScriptableObject(this))
     {
Exemplo n.º 4
0
 internal void SwitchToAssetMode()
 {
     using (List <AvatarEditor.SceneStateCache> .Enumerator enumerator = this.m_SceneStates.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             AvatarEditor.SceneStateCache current = enumerator.Current;
             if (!((UnityEngine.Object)current.view == (UnityEngine.Object)null))
             {
                 current.view.m_SceneViewState.showFog            = current.state.showFog;
                 current.view.m_SceneViewState.showFlares         = current.state.showFlares;
                 current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
                 current.view.m_SceneViewState.showSkybox         = current.state.showSkybox;
             }
         }
     }
     this.m_EditMode = AvatarEditor.EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
     {
         if (SceneManager.GetActiveScene().path.Length <= 0)
         {
             if (this.sceneSetup != null && this.sceneSetup.Length > 0)
             {
                 EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
                 this.sceneSetup = (SceneSetup[])null;
             }
             else
             {
                 EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
             }
         }
     }
     else if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
     {
         // ISSUE: object of a compiler-generated type is created
         // ISSUE: variable of a compiler-generated type
         AvatarEditor.\u003CSwitchToAssetMode\u003Ec__AnonStorey9C modeCAnonStorey9C = new AvatarEditor.\u003CSwitchToAssetMode\u003Ec__AnonStorey9C();
         // ISSUE: reference to a compiler-generated field
         modeCAnonStorey9C.\u003C\u003Ef__this = this;
         // ISSUE: reference to a compiler-generated field
         modeCAnonStorey9C.CleanUpSceneOnDestroy = (EditorApplication.CallbackFunction)null;
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated method
         modeCAnonStorey9C.CleanUpSceneOnDestroy = new EditorApplication.CallbackFunction(modeCAnonStorey9C.\u003C\u003Em__1C9);
         // ISSUE: reference to a compiler-generated field
         EditorApplication.update += modeCAnonStorey9C.CleanUpSceneOnDestroy;
     }
     this.m_GameObject = (GameObject)null;
     this.m_ModelBones = (Dictionary <Transform, bool>)null;
     this.SelectAsset();
     if (this.m_CameFromImportSettings)
     {
         return;
     }
     this.m_EditMode = AvatarEditor.EditMode.NotEditing;
 }
Exemplo n.º 5
0
 internal void SwitchToAssetMode()
 {
     foreach (AvatarEditor.SceneStateCache current in this.m_SceneStates)
     {
         if (!(current.view == null))
         {
             current.view.m_SceneViewState.showFog            = current.state.showFog;
             current.view.m_SceneViewState.showFlares         = current.state.showFlares;
             current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
             current.view.m_SceneViewState.showSkybox         = current.state.showSkybox;
         }
     }
     this.m_EditMode = AvatarEditor.EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject(this))
     {
         string currentScene = EditorApplication.currentScene;
         if (currentScene.Length <= 0)
         {
             if (this.m_UserFileName.Length > 0)
             {
                 EditorApplication.OpenScene(this.m_UserFileName);
             }
             else
             {
                 EditorApplication.NewScene();
             }
         }
     }
     else
     {
         if (Unsupported.IsDestroyScriptableObject(this))
         {
             EditorApplication.CallbackFunction CleanUpSceneOnDestroy = null;
             string userFileName = this.m_UserFileName;
             CleanUpSceneOnDestroy = delegate
             {
                 string currentScene2 = EditorApplication.currentScene;
                 if (currentScene2.Length <= 0)
                 {
                     if (userFileName.Length > 0)
                     {
                         EditorApplication.OpenScene(userFileName);
                     }
                     else
                     {
                         EditorApplication.NewScene();
                     }
                 }
                 EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, CleanUpSceneOnDestroy);
             };
             EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, CleanUpSceneOnDestroy);
         }
     }
     this.m_GameObject = null;
     this.m_ModelBones = null;
     this.SelectAsset();
     if (!this.m_CameFromImportSettings)
     {
         this.m_EditMode = AvatarEditor.EditMode.NotEditing;
     }
 }
Exemplo n.º 6
0
        /// clean up this view & propagate down
        public void Cleanup()
        {
            // if I'm a one-view splitview, I can propagate my child up and kill myself

            SplitView sp = parent as SplitView;

            if (children.Length == 1 && sp != null)
            {
                View c = children[0];
                c.position = position;
                if (parent != null)
                {
                    parent.AddChild(c, parent.IndexOfChild(this));
                    parent.RemoveChild(this);
                    if (sp)
                    {
                        sp.Cleanup();
                    }
                    c.position = position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        DestroyImmediate(this);
                    }
                    return;
                }
                else if (c is SplitView)
                {
                    RemoveChild(c);
                    window.rootView = c;
                    c.position      = new Rect(0, 0, c.window.position.width, window.position.height);
                    c.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        DestroyImmediate(this);
                    }
                    return;
                }
            }

            if (sp)
            {
                sp.Cleanup();
                // the parent might have moved US up and gotten rid of itself
                sp = parent as SplitView;
                if (sp)
                {
                    // If the parent has the same orientation as us, we can move our views up and kill ourselves
                    if (sp.vertical == vertical)
                    {
                        int idx = new List <View>(parent.children).IndexOf(this);
                        foreach (View child in children)
                        {
                            sp.AddChild(child, idx++);
                            child.position = new Rect(position.x + child.position.x, position.y + child.position.y, child.position.width, child.position.height);
                        }
                    }
                }
            }
            if (children.Length == 0)
            {
                if (parent == null && window != null)
                {
                    // if we're root in the window, we'll remove ourselves
                    window.Close();
                }
                else
                {
                    ICleanuppable ic = parent as ICleanuppable;
                    if (parent is SplitView)
                    {
                        ((SplitView)parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            DestroyImmediate(this, true);
                        }
                    }
                    else
                    {
                        // This is we're root in the main window.
                        // We want to stay, but tell the parent (MainWindow) to Cleanup, so he can reduce us to zero-size
                        /*                  parent.RemoveChild (this);*/
                    }
                    ic.Cleanup();
                }
                return;
            }
            else
            {
                splitState = null;
                Reflow();
            }
        }
Exemplo n.º 7
0
        public void Cleanup()
        {
            SplitView parent1 = this.parent as SplitView;

            if (this.children.Length == 1 && (Object)parent1 != (Object)null)
            {
                View child = this.children[0];
                child.position = this.position;
                if ((Object)this.parent != (Object)null)
                {
                    this.parent.AddChild(child, this.parent.IndexOfChild((View)this));
                    this.parent.RemoveChild((View)this);
                    if ((bool)((Object)parent1))
                    {
                        parent1.Cleanup();
                    }
                    child.position = this.position;
                    if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
                    {
                        return;
                    }
                    Object.DestroyImmediate((Object)this);
                    return;
                }
                if (child is SplitView)
                {
                    this.RemoveChild(child);
                    this.window.mainView = child;
                    child.position       = new Rect(0.0f, 0.0f, child.window.position.width, this.window.position.height);
                    child.Reflow();
                    if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
                    {
                        return;
                    }
                    Object.DestroyImmediate((Object)this);
                    return;
                }
            }
            if ((bool)((Object)parent1))
            {
                parent1.Cleanup();
                SplitView parent2 = this.parent as SplitView;
                if ((bool)((Object)parent2) && parent2.vertical == this.vertical)
                {
                    int num = new List <View>((IEnumerable <View>) this.parent.children).IndexOf((View)this);
                    foreach (View child in this.children)
                    {
                        parent2.AddChild(child, num++);
                        child.position = new Rect(this.position.x + child.position.x, this.position.y + child.position.y, child.position.width, child.position.height);
                    }
                }
            }
            if (this.children.Length == 0)
            {
                if ((Object)this.parent == (Object)null && (Object)this.window != (Object)null)
                {
                    this.window.Close();
                }
                else
                {
                    ICleanuppable parent2 = this.parent as ICleanuppable;
                    if (this.parent is SplitView)
                    {
                        ((SplitView)this.parent).RemoveChildNice((View)this);
                        if (!Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
                        {
                            Object.DestroyImmediate((Object)this, true);
                        }
                    }
                    parent2.Cleanup();
                }
            }
            else
            {
                this.splitState = (SplitterState)null;
                this.Reflow();
            }
        }
Exemplo n.º 8
0
        public void Cleanup()
        {
            SplitView parent = base.parent as SplitView;

            if ((base.children.Length == 1) && (parent != null))
            {
                View child = base.children[0];
                child.position = base.position;
                if (base.parent != null)
                {
                    base.parent.AddChild(child, base.parent.IndexOfChild(this));
                    base.parent.RemoveChild(this);
                    if (parent != null)
                    {
                        parent.Cleanup();
                    }
                    child.position = base.position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
                if (child is SplitView)
                {
                    this.RemoveChild(child);
                    base.window.rootView = child;
                    child.position       = new Rect(0f, 0f, child.window.position.width, base.window.position.height);
                    child.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
            }
            if (parent != null)
            {
                parent.Cleanup();
                parent = base.parent as SplitView;
                if ((parent != null) && (parent.vertical == this.vertical))
                {
                    int index = new List <View>(base.parent.children).IndexOf(this);
                    foreach (View view3 in base.children)
                    {
                        parent.AddChild(view3, index++);
                        view3.position = new Rect(base.position.x + view3.position.x, base.position.y + view3.position.y, view3.position.width, view3.position.height);
                    }
                }
            }
            if (base.children.Length == 0)
            {
                if ((base.parent == null) && (base.window != null))
                {
                    base.window.Close();
                }
                else
                {
                    ICleanuppable cleanuppable = base.parent as ICleanuppable;
                    if (base.parent is SplitView)
                    {
                        ((SplitView)base.parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            UnityEngine.Object.DestroyImmediate(this, true);
                        }
                    }
                    cleanuppable.Cleanup();
                }
            }
            else
            {
                this.splitState = null;
                this.Reflow();
            }
        }
Exemplo n.º 9
0
        public void Cleanup()
        {
            SplitView splitView = base.parent as SplitView;

            if (base.children.Length == 1 && splitView != null)
            {
                View view = base.children[0];
                view.position = base.position;
                if (base.parent != null)
                {
                    base.parent.AddChild(view, base.parent.IndexOfChild(this));
                    base.parent.RemoveChild(this);
                    if (splitView)
                    {
                        splitView.Cleanup();
                    }
                    view.position = base.position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
                if (view is SplitView)
                {
                    this.RemoveChild(view);
                    base.window.rootView = view;
                    view.position        = new Rect(0f, 0f, view.window.position.width, base.window.position.height);
                    view.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
            }
            if (splitView)
            {
                splitView.Cleanup();
                splitView = (base.parent as SplitView);
                if (splitView)
                {
                    if (splitView.vertical == this.vertical)
                    {
                        int    num      = new List <View>(base.parent.children).IndexOf(this);
                        View[] children = base.children;
                        for (int i = 0; i < children.Length; i++)
                        {
                            View view2 = children[i];
                            splitView.AddChild(view2, num++);
                            view2.position = new Rect(base.position.x + view2.position.x, base.position.y + view2.position.y, view2.position.width, view2.position.height);
                        }
                    }
                }
            }
            if (base.children.Length == 0)
            {
                if (base.parent == null && base.window != null)
                {
                    base.window.Close();
                }
                else
                {
                    ICleanuppable cleanuppable = base.parent as ICleanuppable;
                    if (base.parent is SplitView)
                    {
                        ((SplitView)base.parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            UnityEngine.Object.DestroyImmediate(this, true);
                        }
                    }
                    cleanuppable.Cleanup();
                }
            }
            else
            {
                this.splitState = null;
                this.Reflow();
            }
        }
Exemplo n.º 10
0
 internal void SwitchToAssetMode()
 {
     foreach (AvatarEditor.SceneStateCache current in this.m_SceneStates)
     {
         if (!(current.view == null))
         {
             current.view.m_SceneViewState.showFog            = current.state.showFog;
             current.view.m_SceneViewState.showFlares         = current.state.showFlares;
             current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
             current.view.m_SceneViewState.showSkybox         = current.state.showSkybox;
         }
     }
     this.m_EditMode = AvatarEditor.EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject(this))
     {
         string path = SceneManager.GetActiveScene().path;
         if (path.Length <= 0)
         {
             if (this.sceneSetup != null && this.sceneSetup.Length > 0)
             {
                 EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
                 this.sceneSetup = null;
             }
             else
             {
                 EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
             }
         }
     }
     else if (Unsupported.IsDestroyScriptableObject(this))
     {
         EditorApplication.CallbackFunction CleanUpSceneOnDestroy = null;
         CleanUpSceneOnDestroy = delegate
         {
             string path2 = SceneManager.GetActiveScene().path;
             if (path2.Length <= 0)
             {
                 if (this.sceneSetup != null && this.sceneSetup.Length > 0)
                 {
                     EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
                     this.sceneSetup = null;
                 }
                 else
                 {
                     EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
                 }
             }
             EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, CleanUpSceneOnDestroy);
         };
         EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, CleanUpSceneOnDestroy);
     }
     this.m_GameObject = null;
     this.m_ModelBones = null;
     this.SelectAsset();
     if (!this.m_CameFromImportSettings)
     {
         this.m_EditMode = AvatarEditor.EditMode.NotEditing;
     }
 }