//public override void Prepare (BuildTarget target, // Model.NodeData node, // IEnumerable<PerformGraph.AssetGroups> incoming, // IEnumerable<Model.ConnectionData> connectionsToOutput, // PerformGraph.Output Output) //{ // ValidateLoadPath( // m_loadPath[target], // GetLoaderFullLoadPath(target), // () => { // //can be empty // //throw new NodeException(node.Name + ": Load Path is empty.", node.Id); // }, // () => { // throw new NodeException(node.Name + ": Directory not found: " + GetLoaderFullLoadPath(target), node.Id); // } // ); // Load(target, node, connectionsToOutput, Output); //} void Load(BuildTarget target, Model.NodeData node, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output) { if (connectionsToOutput == null || Output == null) { return; } // SOMEWHERE_FULLPATH/PROJECT_FOLDER/Assets/ var assetsFolderPath = Application.dataPath + Model.Settings.UNITY_FOLDER_SEPARATOR; var outputSource = new List <AssetReference>(); var targetFilePaths = FileUtility.GetAllFilePathsInFolder(GetLoaderFullLoadPath(target)); foreach (var targetFilePath in targetFilePaths) { // already contained into Assets/ folder. // imported path is Assets/SOMEWHERE_FILE_EXISTS. if (targetFilePath.StartsWith(assetsFolderPath)) { var relativePath = targetFilePath.Replace(assetsFolderPath, Model.Settings.Path.ASSETS_PATH); if (TypeUtility.IsGraphToolSystemAsset(relativePath)) { continue; } var r = AssetReferenceDatabase.GetReference(relativePath); if (r == null) { continue; } if (!TypeUtility.IsLoadingAsset(r)) { continue; } if (r != null) { outputSource.Add(r); } continue; } throw new NodeException(node.Name + ": Invalid Load Path. Path must start with Assets/", node.Name); } var output = new Dictionary <string, List <AssetReference> > { { "0", outputSource } }; var dst = (connectionsToOutput == null || !connectionsToOutput.Any())? null : connectionsToOutput.First(); Output(dst, output); }
public override void Prepare(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output) { if (Output != null) { var destination = connectionsToOutput == null || !connectionsToOutput.Any() ? null : connectionsToOutput.First(); if (incoming != null) { var key = "0"; var outputDict = new Dictionary <string, List <AssetReference> >(); outputDict[key] = new List <AssetReference>(); var internalPath = string.Empty; foreach (var ag in incoming) { foreach (var agAssetGroup in ag.assetGroups) { foreach (var assetReference in agAssetGroup.Value) { internalPath = assetReference.path; break; } break; } break; } _manifestDirectoryInternalRelative = Path.GetDirectoryName(internalPath); Debug.Log("Custom manifest folder choose: " + _manifestDirectoryInternalRelative); var customManifest = AssetReferenceDatabase.GetAssetBundleReference(GetCustomManifestPath(_manifestDirectoryInternalRelative)); outputDict[key].Add(customManifest); Output(destination, outputDict); } else { Output(destination, new Dictionary <string, List <AssetReference> >()); } } else { Debug.LogError("Output node not set!!! You need attach some node to NodeBundlesManifestCreator!!!"); } }
public override void Prepare(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output) { if (Output != null) { var destination = connectionsToOutput == null || !connectionsToOutput.Any() ? null : connectionsToOutput.First(); if (incoming != null) { var key = "0"; var outputDict = new Dictionary <string, List <AssetReference> >(); outputDict[key] = new List <AssetReference>(); foreach (var ag in incoming) { foreach (var agAssetGroup in ag.assetGroups) { foreach (var assetReference in agAssetGroup.Value) { if (assetReference.extension != ".manifest" && !_ignoreList.Contains(assetReference.fileNameAndExtension)) { var bundle = AssetReferenceDatabase.GetAssetBundleReference(assetReference.path); Debug.Log(bundle.fileName); outputDict[key].Add(bundle); } } } } var customPath = GetCustomManifestPath(target, node); var customManifest = AssetReferenceDatabase.GetAssetBundleManifestReference(customPath); outputDict[key].Add(customManifest); Output(destination, outputDict); } else { Output(destination, new Dictionary <string, List <AssetReference> >()); } } else { Debug.LogError("Output node not set!!! You need attach some node to NodeBundlesManifestCreator!!!"); } }
public override void Prepare(BuildTarget target, NodeData nodeData, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <ConnectionData> connectionsToOutput, PerformGraph.Output outputFunc) { if (outputFunc != null) { ConnectionData destinationResult = null; ConnectionData destinationPass = null; if (connectionsToOutput != null && connectionsToOutput.Count() == 2) { destinationResult = connectionsToOutput.First(data => data.FromNodeConnectionPointId == _outputPointResult.Id); destinationPass = connectionsToOutput.First(data => data.FromNodeConnectionPointId == _outputPointPass.Id); } if (incoming != null) { if (destinationPass != null) { if (incoming.First() != null) { outputFunc(destinationPass, incoming.First().assetGroups); } else { outputFunc(destinationPass, new Dictionary <string, List <AssetReference> >()); } } if (destinationResult != null) { if (incoming.First() != null) { var key = "0"; var outputDict = new Dictionary <string, List <AssetReference> >(); outputDict[key] = new List <AssetReference>(); foreach (var agAssetGroup in incoming.First().assetGroups) { foreach (var assetReference in agAssetGroup.Value) { if (assetReference.extension != ".manifest" && !_ignoreList.Contains(assetReference.fileNameAndExtension)) { var bundle = AssetReferenceDatabase.GetAssetBundleReference(assetReference.path); outputDict[key].Add(bundle); } } } if (outputDict[key].Count > 0) { var customManifestPath = Path.Combine(Path.GetDirectoryName(outputDict[key][0].path), _manifestFileName + ".json"); _manifestCachePath = AssetReferenceDatabase.GetAssetBundleReference(customManifestPath); outputDict[key].Add(_manifestCachePath); } outputFunc(destinationResult, outputDict); } else { outputFunc(destinationResult, new Dictionary <string, List <AssetReference> >()); } } } } }