示例#1
0
        /// <inheritdoc />
        public override void OnExit()
        {
            FlaxEngine.Content.AssetDisposing -= Content_OnAssetDisposing;

            // Disable events
            _enableEvents = false;

            // Cleanup
            Proxy.ForEach(x => x.Dispose());
            if (ProjectContent != null)
            {
                ProjectContent.Dispose();
                ProjectContent = null;
            }
            if (ProjectSource != null)
            {
                ProjectSource.Dispose();
                ProjectSource = null;
            }
            if (EnginePrivate != null)
            {
                EnginePrivate.Dispose();
                EnginePrivate = null;
            }
            if (EditorPrivate != null)
            {
                EditorPrivate.Dispose();
                EditorPrivate = null;
            }
            Proxy.Clear();
        }
示例#2
0
        internal void OnDirectoryEvent(MainContentTreeNode node, FileSystemEventArgs e)
        {
            // Ensure to be ready for external events
            if (_isDuringFastSetup)
            {
                return;
            }

            // TODO: maybe we could make it faster! since we have a path so it would be easy to just create or delete given file
            // TODO: but remember about subdirectories!

            // Switch type
            switch (e.ChangeType)
            {
            case WatcherChangeTypes.Created:
            case WatcherChangeTypes.Deleted:
            {
                // We want to enqueue dir modification events for better stability
                if (!_dirtyNodes.Contains(node))
                {
                    _dirtyNodes.Enqueue(node);
                }

                break;
            }

            default: break;
            }
        }
示例#3
0
        /// <inheritdoc />
        public override void OnInit()
        {
            FlaxEngine.Content.AssetDisposing += Content_OnAssetDisposing;

            // Setup content proxies
            Proxy.Add(new TextureProxy());
            Proxy.Add(new ModelProxy());
            Proxy.Add(new MaterialProxy());
            Proxy.Add(new MaterialInstanceProxy());
            Proxy.Add(new SpriteAtlasProxy());
            Proxy.Add(new CubeTextureProxy());
            Proxy.Add(new PreviewsCacheProxy());
            Proxy.Add(new FontProxy());
            Proxy.Add(new ScriptProxy());
            Proxy.Add(new SceneProxy());
            Proxy.Add(new IESProfileProxy());
            Proxy.Add(new CollisionDataProxy());
            Proxy.Add(new AudioClipProxy());
            Proxy.Add(new SpawnableJsonAssetProxy <PhysicalMaterial>());

            // Settings
            Proxy.Add(new SettingsProxy <GameSettings>());
            Proxy.Add(new SettingsProxy <TimeSettings>());
            Proxy.Add(new SettingsProxy <LayersAndTagsSettings>());
            Proxy.Add(new SettingsProxy <PhysicsSettings>());
            Proxy.Add(new SettingsProxy <GraphicsSettings>());
            Proxy.Add(new SettingsProxy <BuildSettings>());
            Proxy.Add(new SettingsProxy <InputSettings>());
            Proxy.Add(new SettingsProxy <WindowsPlatformSettings>());
            Proxy.Add(new SettingsProxy <UWPPlatformSettings>());
            Proxy.Add(new SettingsProxy <AudioSettings>());

            // Last add generic json (won't override other json proxies)
            Proxy.Add(new GenericJsonAssetProxy());

            // Create content folders nodes
            ProjectContent = new MainContentTreeNode(ContentFolderType.Content, Globals.ContentFolder);
            ProjectSource  = new MainContentTreeNode(ContentFolderType.Source, Globals.SourceFolder);
            EnginePrivate  = new MainContentTreeNode(ContentFolderType.Editor, Globals.EngineFolder);
            EditorPrivate  = new MainContentTreeNode(ContentFolderType.Engine, Globals.EditorFolder);

            // Load all folders
            // TODO: we should create async task for gathering content and whole workspace contents if it takes too long
            // TODO: create progress bar in content window and after end we should enable events and update it
            _isDuringFastSetup = true;
            loadFolder(ProjectContent, true);
            loadFolder(ProjectSource, true);
            loadFolder(EnginePrivate, true);
            loadFolder(EditorPrivate, true);
            _isDuringFastSetup = false;

            // Enable events
            _enableEvents = true;
            Editor.ContentImporting.ImportFileEnd += ContentImporting_ImportFileDone;

            Editor.Log("Project database created. Items count: " + _itemsCreated);
        }
        internal void OnDirectoryEvent(MainContentTreeNode node, FileSystemEventArgs e)
        {
            // Ensure to be ready for external events
            if (_isDuringFastSetup)
            {
                return;
            }

            // TODO: maybe we could make it faster! since we have a path so it would be easy to just create or delete given file. but remember about subdirectories

            // Switch type
            switch (e.ChangeType)
            {
            case WatcherChangeTypes.Created:
            case WatcherChangeTypes.Deleted:
            {
                lock (_dirtyNodes)
                {
                    _dirtyNodes.Add(node);
                }
                break;
            }
            }
        }
示例#5
0
 private void RemoveFolder2Root(MainContentTreeNode node)
 {
     // Remove from the root
     _root.RemoveChild(node);
 }
示例#6
0
 private void AddFolder2Root(MainContentTreeNode node)
 {
     // Add to the root
     _root.AddChild(node);
 }