コード例 #1
0
        private static AssetImportOutput[] ReImportAssets(IEnumerable <string> localInputFiles, bool simulate)
        {
            // Early-out, if no input files are specified
            if (!localInputFiles.Any())
            {
                return(new AssetImportOutput[0]);
            }

            // Set up an import operation and process it
            AssetReImportOperation reimportOperation = new AssetReImportOperation(localInputFiles);

            reimportOperation.ImporterConflictHandler = ResolveImporterConflict;
            bool success = simulate ?
                           reimportOperation.SimulatePerform() :
                           reimportOperation.Perform();

            // Did we actually do something?
            if (!simulate)
            {
                // Notify the editor that we have modified some Resources
                if (reimportOperation.Output.Any())
                {
                    IEnumerable <Resource> touchedResources = reimportOperation.Output.Select(item => item.Resource).Res();
                    DualityEditorApp.NotifyObjPropChanged(null, new ObjectSelection(touchedResources));
                }

                // Global event handling
                OnImportFinished(reimportOperation, success);
            }

            return(reimportOperation.Output.ToArray());
        }
コード例 #2
0
ファイル: AssetManager.cs プロジェクト: Scottyaim/duality
		private static AssetImportOutput[] ReImportAssets(IEnumerable<string> localInputFiles, bool simulate)
		{
			// Early-out, if no input files are specified
			if (!localInputFiles.Any()) return new AssetImportOutput[0];
			
			// Set up an import operation and process it
			AssetReImportOperation reimportOperation = new AssetReImportOperation(localInputFiles);
			reimportOperation.ImporterConflictHandler = ResolveImporterConflict;
			bool success = simulate ? 
				reimportOperation.SimulatePerform() : 
				reimportOperation.Perform();
			
			// Notify the editor that we have modified some Resources
			if (!simulate && reimportOperation.Output.Any())
			{
				IEnumerable<Resource> touchedResources = reimportOperation.Output.Select(item => item.Resource).Res();
				DualityEditorApp.NotifyObjPropChanged(null, new ObjectSelection(touchedResources));
			}

			return reimportOperation.Output.ToArray();
		}