Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void Update(float deltaTime)
        {
            base.Update(deltaTime);

            if (_tmpAssetIsDirty)
            {
                _tmpAssetIsDirty = false;

                RefreshTempAsset();
            }

            if (_isWaitingForSurfaceLoad && _asset.IsLoaded)
            {
                _isWaitingForSurfaceLoad = false;

                if (LoadSurface())
                {
                    Close();
                    return;
                }

                // Setup
                _undo.Clear();
                _surface.Enabled = true;
                _propertiesEditor.BuildLayout();
                ClearEditedFlag();
            }
            else if (_refreshPropertiesOnLoad && _asset.IsLoaded)
            {
                _refreshPropertiesOnLoad = false;

                _propertiesEditor.BuildLayout();
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public override void Update(float deltaTime)
        {
            base.Update(deltaTime);

            if (_tmpAssetIsDirty)
            {
                _tmpAssetIsDirty = false;

                RefreshTempAsset();
            }

            if (_isWaitingForSurfaceLoad && _asset.IsLoaded)
            {
                _isWaitingForSurfaceLoad = false;

                if (LoadSurface())
                {
                    Close();
                    return;
                }

                // Setup
                _undo.Clear();
                _surface.Enabled = true;
                ClearEditedFlag();
                if (_showWholeGraphOnLoad)
                {
                    _showWholeGraphOnLoad = false;
                    _surface.ShowWholeGraph();
                }
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        protected override void OnAssetLoaded()
        {
            _undo.Clear();
            _proxy.Init(this);
            _propertiesEditor.BuildLayoutOnUpdate();
            UpdateToolstrip();

            base.OnAssetLoaded();
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public override void Update(float deltaTime)
        {
            base.Update(deltaTime);

            if (_isWaitingForTimelineLoad && _asset.IsLoaded)
            {
                _isWaitingForTimelineLoad = false;
                _timeline.Load(_asset);
                _undo.Clear();
                _timeline.Enabled = true;
                ClearEditedFlag();
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Clears references to the scene objects by the editor. Deselects objects. Clear undo history.
 /// </summary>
 public void ClearRefsToSceneObjects()
 {
     // Clear Editor's data
     Editor.SceneEditing.Deselect();
     // TODO: test using editor (scripts reload, play enter/leave) without clearing the undo - current design is good and should handle this
     Undo.Clear(); // note: undo actions serialize ids to the objects (not direct refs) but cache reflection meta so we need to clean it
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Clears references to the scene objects by the editor. Deselects objects.
        /// </summary>
        /// <param name="fullCleanup">True if cleanup all data (including serialized and cached data). Otherwise will just clear living references to the scene objects.</param>
        public void ClearRefsToSceneObjects(bool fullCleanup = false)
        {
            Editor.SceneEditing.Deselect();

            if (fullCleanup)
            {
                Undo.Clear();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Clears references to the scene objects by the editor. Deselects objects.
        /// </summary>
        /// <param name="fullCleanup">True if cleanup all data (including serialized and cached data). Otherwise will just clear living references to the scene objects.</param>
        public void ClearRefsToSceneObjects(bool fullCleanup = false)
        {
            Editor.SceneEditing.Deselect();

            // TODO: this works in most cases fine but we still need to handle the case when assembly gets reloaded and type references are invalid
            // TODO: To solve this: serialize type reference as 'namespace.name' in undo data storage
            //if (fullCleanup)
            {
                Undo.Clear();
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Clears references to the scene objects by the editor. Deselects objects.
        /// </summary>
        /// <param name="fullCleanup">True if cleanup all data (including serialized and cached data). Otherwise will just clear living references to the scene objects.</param>
        public void ClearRefsToSceneObjects(bool fullCleanup = false)
        {
            Profiler.BeginEvent("SceneModule.ClearRefsToSceneObjects");
            Editor.SceneEditing.Deselect();

            if (fullCleanup)
            {
                Undo.Clear();
            }
            Profiler.EndEvent();
        }
Ejemplo n.º 9
0
        /// <inheritdoc />
        protected override void OnAssetLoaded()
        {
            _proxy = new Proxy
            {
                Locale  = _asset.Locale,
                Entries = _asset.Entries,
            };
            _presenter.Select(_proxy);
            _undo.Clear();
            ClearEditedFlag();

            base.OnAssetLoaded();
        }
Ejemplo n.º 10
0
        /// <inheritdoc />
        protected override void OnAssetLoaded()
        {
            _object = Asset.CreateInstance();
            _presenter.Select(_object);
            _undo.Clear();
            ClearEditedFlag();

            // Auto-close on scripting reload if json asset is from game scripts (it might be reloaded)
            if (_object != null && FlaxEngine.Scripting.IsTypeFromGameScripts(_object.GetType()) && !_isRegisteredForScriptsReload)
            {
                _isRegisteredForScriptsReload      = true;
                ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin;
            }

            base.OnAssetLoaded();
        }
Ejemplo n.º 11
0
        /// <inheritdoc />
        protected override void OnAssetLoaded()
        {
            _object = Asset.Instance;
            if (_object == null)
            {
                // Hint developer about cause of failure
                var dataTypeName = Asset.DataTypeName;
                var type         = Type.GetType(dataTypeName);
                if (type != null)
                {
                    try
                    {
                        var obj  = Activator.CreateInstance(type);
                        var data = Asset.Data;
                        FlaxEngine.Json.JsonSerializer.Deserialize(obj, data);
                    }
                    catch (Exception ex)
                    {
                        _presenter.NoSelectionText = "Failed to load asset. See log for more. " + ex.Message.Replace('\n', ' ');
                    }
                }
                else
                {
                    _presenter.NoSelectionText = string.Format("Missing type '{0}'.", dataTypeName);
                }
            }
            _presenter.Select(_object);
            _undo.Clear();
            ClearEditedFlag();

            // Auto-close on scripting reload if json asset is from game scripts (it might be reloaded)
            if ((_object == null || FlaxEngine.Scripting.IsTypeFromGameScripts(_object.GetType())) && !_isRegisteredForScriptsReload)
            {
                _isRegisteredForScriptsReload      = true;
                ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin;
            }

            base.OnAssetLoaded();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Clears references to the scene objects by the editor. Deselects objects. Clear undo history.
 /// </summary>
 public void ClearRefsToSceneObjects()
 {
     // Clear Editor's data
     Editor.SceneEditing.Deselect();
     Undo.Clear(); // note: undo actions serialize ids to the objects (not direct refs) but cache reflection meta so we need to clean it
 }