private void UpdateVariant(Model.NodeData n, Variant variant) { Model.ConnectionPointData p = n.InputPoints.Find(v => v.Id == variant.ConnectionPointId); UnityEngine.Assertions.Assert.IsNotNull(p); p.Label = variant.Name; }
public override void Prepare(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output) { // Label does not add, filter or change structure of group, so just pass given group of assets if (Output != null) { var dst = (connectionsToOutput == null || !connectionsToOutput.Any())? null : connectionsToOutput.First(); if (incoming != null) { foreach (var ag in incoming) { Output(dst, ag.assetGroups); } } else { Output(dst, new Dictionary <string, List <AssetReference> >()); } } }
public void Import(V1.NodeData v1, Model.NodeData v2) { foreach (var f in v1.FilterConditions) { m_filter.Add(new FilterEntry(new FilterByNameAndType(f.FilterKeyword, f.FilterKeytype), v2.FindOutputPoint(f.ConnectionPointId))); } }
public override Node Clone(Model.NodeData newData) { var newNode = new Imported(); newData.AddDefaultOutputPoint(); return(newNode); }
public ExportReport(Model.NodeData node) { m_nodeData = node; m_exportedItems = new List <Entry>(); m_failedItems = new List <ErrorEntry> (); }
static public bool DoesPrefabNeedRebuilding(PrefabBuilder builder, Model.NodeData node, BuildTarget target, string groupKey, List <AssetReference> assets) { var buildInfo = GetPrefabBuildInfo(builder, node, target, groupKey); // need rebuilding if no buildInfo found if (buildInfo == null) { return(true); } // need rebuilding if given builder is changed if (buildInfo.m_builderClass != builder.Builder.ClassName) { return(true); } // need rebuilding if given builder is changed if (buildInfo.m_instanceData != builder.Builder[target]) { return(true); } // need rebuilding if replace prefab option is changed if (buildInfo.m_replacePrefabOptions != (int)builder.Options) { return(true); } var builderVersion = PrefabBuilderUtility.GetPrefabBuilderVersion(builder.Builder.ClassName); // need rebuilding if given builder version is changed if (buildInfo.m_prefabBuilderVersion != builderVersion) { return(true); } // need rebuilding if given groupKey changed if (buildInfo.m_groupKey != groupKey) { return(true); } if (!Enumerable.SequenceEqual( buildInfo.m_usedAssets.Select(v => v.importFrom).OrderBy(s => s), assets.Select(v => v.importFrom).OrderBy(s => s))) { return(true); } // If any asset is modified from last time, then need rebuilding foreach (var usedAsset in buildInfo.m_usedAssets) { if (usedAsset.IsAssetModifiedFromLastTime) { return(true); } } return(false); }
private AssetImporter GetReferenceAssetImporter(Model.NodeData node, bool allowCustom) { if (allowCustom) { if (m_useCustomSettingAsset) { if (CustomSettingAsset != null) { var path = AssetDatabase.GUIDToAssetPath(CustomSettingAssetGuid); return(AssetImporter.GetAtPath(path)); } return(null); } } var sampleFileDir = FileUtility.PathCombine(Model.Settings.Path.ImporterSettingsPath, node.Id); UnityEngine.Assertions.Assert.IsTrue(Directory.Exists(sampleFileDir)); var sampleFiles = FileUtility.GetFilePathsInFolder(sampleFileDir) .Where(path => !path.EndsWith(Model.Settings.UNITY_METAFILE_EXTENSION)) .ToList(); UnityEngine.Assertions.Assert.IsTrue(sampleFiles.Count == 1); return(AssetImporter.GetAtPath(sampleFiles[0])); }
static private PrefabBuildInfo GetPrefabBuildInfo(PrefabBuilder builder, Model.NodeData node, BuildTarget target, string groupKey) { var prefabCacheDir = FileUtility.EnsurePrefabBuilderCacheDirExists(target, node); var buildInfoPath = FileUtility.PathCombine(prefabCacheDir, groupKey + ".asset"); return(AssetDatabase.LoadAssetAtPath <PrefabBuildInfo>(buildInfoPath)); }
private void MarkAndTraverseParent(Model.ConfigGraph saveData, Model.NodeData current, List <Model.ConnectionData> visitedConnections, List <Model.NodeData> visitedNode) { // Assert.IsNotNull(current); if (current == null) { return; } // if node is visited from other route, just quit if (visitedNode.Contains(current)) { return; } var connectionsToParents = saveData.Connections.FindAll(con => con.ToNodeId == current.Id); foreach (var c in connectionsToParents) { if (visitedConnections.Contains(c)) { throw new NodeException("Looped connection detected. Please fix connections to avoid loop.", current.Id); } visitedConnections.Add(c); var parentNode = saveData.Nodes.Find(node => node.Id == c.FromNodeId); if (parentNode != null) { // parentNode may be null while deleting node MarkAndTraverseParent(saveData, parentNode, visitedConnections, visitedNode); } } visitedNode.Add(current); }
public override void Initialize(Model.NodeData data) { m_instance = new SerializableMultiTargetInstance(); data.AddDefaultInputPoint(); data.AddDefaultOutputPoint(); }
public void UpdateFilterEntry(Model.NodeData n, FilterEntry f) { Model.ConnectionPointData p = n.OutputPoints.Find(v => v.Id == f.ConnectionPointId); UnityEngine.Assertions.Assert.IsNotNull(p); p.Label = f.Instance.Object.Label; }
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 Initialize(Model.NodeData data) { m_path = new SerializableMultiTargetString(); m_style = AssertionStyle.AllowOnlyAssetsUnderAssertionPath; data.AddDefaultInputPoint(); data.AddDefaultOutputPoint(); }
public void UpdateGeneratorEntry(Model.NodeData n, GeneratorEntry e) { Model.ConnectionPointData p = n.OutputPoints.Find(v => v.Id == e.m_id); UnityEngine.Assertions.Assert.IsNotNull(p); p.Label = e.m_name; }
private void Mirror(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, Action <Model.NodeData, string, float> progressFunc) { try { var srcDir = GetNormalizedPath(m_srcPath[target]); var dstDir = GetNormalizedPath(m_dstPath[target]); if (Directory.Exists(dstDir)) { if (m_mirrorOption[target] == (int)MirrorOption.AlwaysRecreateDestination) { FileUtility.DeleteDirectory(dstDir, true); } else if (m_mirrorOption[target] == (int)MirrorOption.KeepAlreadyCopiedFiles) { var dstFilePaths = FileUtility.GetAllFilePathsInFolder(dstDir); // checking destination files - remove files if not exist in source foreach (var dstPath in dstFilePaths) { var srcPath = dstPath.Replace(dstDir, srcDir); if (!File.Exists(srcPath)) { File.Delete(dstPath); } } } } var targetFilePaths = FileUtility.GetAllFilePathsInFolder(srcDir); int i = 0; foreach (var srcPath in targetFilePaths) { var dstPath = srcPath.Replace(srcDir, dstDir); var dstParentDir = Directory.GetParent(dstPath); if (!dstParentDir.Exists) { var dirPath = dstParentDir.ToString(); Directory.CreateDirectory(dirPath); } var srcInfo = new FileInfo(srcPath); var dstInfo = new FileInfo(dstPath); if (!dstInfo.Exists || srcInfo.LastWriteTimeUtc > dstInfo.LastWriteTimeUtc) { File.Copy(srcPath, dstPath, true); progressFunc(node, string.Format("Copying {0}", Path.GetFileName(srcPath)), (float)(i++) / (float)targetFilePaths.Count); } } } catch (Exception e) { throw new NodeException(node.Name + ":" + e.Message, node.Id); } }
private void AddVariant(Model.NodeData n, string name) { var p = n.AddInputPoint(name); var newEntry = new Variant(name, p); m_variants.Add(newEntry); UpdateVariant(n, newEntry); }
public void AddFilterCondition(Model.NodeData n, IFilter filter) { var point = n.AddOutputPoint(filter.Label); var newEntry = new FilterEntry(filter, point); m_filter.Add(newEntry); UpdateFilterEntry(n, newEntry); }
public void AddEntry(Model.NodeData n, GeneratorEntry src) { var point = n.AddOutputPoint(src.m_name); var newEntry = new GeneratorEntry(src.m_name, src.m_instance, point); m_entries.Add(newEntry); UpdateGeneratorEntry(n, newEntry); }
public void AddEntry(Model.NodeData n) { var point = n.AddOutputPoint(""); var newEntry = new GeneratorEntry("", point); m_entries.Add(newEntry); UpdateGeneratorEntry(n, newEntry); }
/// <summary> /// Prepare is the method which validates and perform necessary setups in order to build. /// </summary> /// <param name="target">Target platform.</param> /// <param name="nodeData">NodeData instance for this node.</param> /// <param name="incoming">Incoming group of assets for this node on executing graph.</param> /// <param name="connectionsToOutput">Outgoing connections from this node.</param> /// <param name="outputFunc">An interface to set outgoing group of assets.</param> public virtual void Prepare(BuildTarget target, Model.NodeData nodeData, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output outputFunc) { // Do nothing }
public override void Initialize(Model.NodeData data) { m_groupSizeByte = new SerializableMultiTargetInt(); m_groupingType = new SerializableMultiTargetInt(); data.AddDefaultInputPoint(); data.AddDefaultOutputPoint(); }
public override Node Clone(Model.NodeData newData) { var newNode = new GroupingByFile(); newData.AddDefaultInputPoint(); newData.AddDefaultOutputPoint(); return(newNode); }
public override void Prepare(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output) { GroupingOutput(target, node, incoming, connectionsToOutput, Output); }
public override void Initialize(Model.NodeData data) { m_bundleNameTemplate = "shared_*"; m_groupExtractedAssets = new SerializableMultiTargetInt(); m_groupSizeByte = new SerializableMultiTargetInt(); m_groupingType = new SerializableMultiTargetInt(); data.AddDefaultInputPoint(); data.AddDefaultOutputPoint(); }
private void GroupingOutput(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output) { ValidateGroupingKeyword( m_groupSizeByte[target], () => { throw new NodeException("Invalid size.", node.Id); } ); if (connectionsToOutput == null || Output == null) { return; } var outputDict = new Dictionary <string, List <AssetReference> >(); long szGroup = m_groupSizeByte[target] * 1000; int groupCount = 0; long szGroupCount = 0; var groupName = groupCount.ToString(); if (incoming != null) { foreach (var ag in incoming) { foreach (var assets in ag.assetGroups.Values) { foreach (var a in assets) { szGroupCount += GetSizeOfAsset(a, (GroupingType)m_groupingType[target]); if (!outputDict.ContainsKey(groupName)) { outputDict[groupName] = new List <AssetReference>(); } outputDict[groupName].Add(a); if (szGroupCount >= szGroup) { szGroupCount = 0; ++groupCount; groupName = groupCount.ToString(); } } } } } var dst = (connectionsToOutput == null || !connectionsToOutput.Any())? null : connectionsToOutput.First(); Output(dst, outputDict); }
public override Node Clone(Model.NodeData newData) { var newNode = new LoaderBySearch(); newNode.m_searchFilter = new SerializableMultiTargetString(m_searchFilter); newData.AddDefaultOutputPoint(); return(newNode); }
public override void Initialize(Model.NodeData data) { m_buildOptions = new SerializableMultiTargetInt(); m_buildLocations = new SerializableMultiTargetString(); m_playerName = new SerializableMultiTargetString(); m_scenes = new SerializableMultiTargetString(); data.AddDefaultInputPoint(); m_scroll = Vector2.zero; }
public override void Initialize(Model.NodeData data) { m_groupingKeyword = new SerializableMultiTargetString(Model.Settings.GROUPING_KEYWORD_DEFAULT); m_patternType = new SerializableMultiTargetInt((int)GroupingPatternType.WildCard); m_allowSlash = false; data.AddDefaultInputPoint(); data.AddDefaultOutputPoint(); }
public override void Initialize(Model.NodeData data) { m_enabledBundleOptions = new SerializableMultiTargetInt(); m_outputDir = new SerializableMultiTargetString(); m_outputOption = new SerializableMultiTargetInt((int)OutputOption.BuildInCacheDirectory); data.AddDefaultInputPoint(); data.AddDefaultOutputPoint(); }
/// <summary> /// Build is the method which actualy performs the build. It is always called after Setup() is performed. /// </summary> /// <param name="target">Target platform.</param> /// <param name="nodeData">NodeData instance for this node.</param> /// <param name="incoming">Incoming group of assets for this node on executing graph.</param> /// <param name="connectionsToOutput">Outgoing connections from this node.</param> /// <param name="outputFunc">An interface to set outgoing group of assets.</param> /// <param name="progressFunc">An interface to display progress.</param> public virtual void Build(BuildTarget target, Model.NodeData nodeData, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output outputFunc, Action <Model.NodeData, string, float> progressFunc) { // Do nothing }