예제 #1
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new GroupingByFolder();

            newNode.m_groupingKeyword = new SerializableMultiTargetString(m_groupingKeyword);
            newNode.m_patternType     = new SerializableMultiTargetInt(m_patternType);
            newNode.m_allowSlash      = m_allowSlash;
            newNode.m_groupNameFormat = new SerializableMultiTargetString(m_groupNameFormat);

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();
            return(newNode);
        }
예제 #2
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new MirrorDirectory();

            newNode.m_srcPath      = new SerializableMultiTargetString(m_srcPath);
            newNode.m_dstPath      = new SerializableMultiTargetString(m_dstPath);
            newNode.m_mirrorOption = new SerializableMultiTargetInt(m_mirrorOption);

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();

            return(newNode);
        }
예제 #3
0
        private void Init(AssetGraphController c, Model.NodeData data)
        {
            _assetGraphGuiConfig = AssetGraphGuiConfig.LoadGraphicsSettings();
            m_nodeWindowId       = 0;
            m_controller         = c;
            m_graph = m_controller.TargetGraph;
            m_data  = data;
            name    = m_data.Name;

            m_baseRect = new Rect(m_data.X, m_data.Y, _assetGraphGuiConfig.NODE_BASE_WIDTH, _assetGraphGuiConfig.NODE_BASE_HEIGHT);

            m_nodeSyle = data.Operation.Object.InactiveStyle;
        }
예제 #4
0
        private void Init(AssetGraphController c, Model.NodeData data)
        {
            hideFlags      = HideFlags.DontUnloadUnusedAsset | HideFlags.DontSave;
            m_nodeWindowId = 0;
            m_controller   = c;
            m_graph        = m_controller.TargetGraph;
            m_data         = data;
            name           = m_data.Name;

            m_baseRect = new Rect(m_data.X, m_data.Y, Model.Settings.GUI.NODE_BASE_WIDTH, Model.Settings.GUI.NODE_BASE_HEIGHT);

            m_nodeSyle = data.Operation.Object.InactiveStyle;
        }
예제 #5
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new PrefabBuilder();

            newNode.m_instance             = new SerializableMultiTargetInstance(m_instance);
            newNode.m_replacePrefabOptions = m_replacePrefabOptions;
            newNode.m_outputDir            = new SerializableMultiTargetString(m_outputDir);
            newNode.m_outputOption         = new SerializableMultiTargetInt(m_outputOption);

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();
            return(newNode);
        }
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new AddressableAssetAddress();

            newNode.m_isAddressable  = m_isAddressable;
            newNode.m_isAllLowerCase = m_isAllLowerCase;
            newNode.m_matchPattern   = m_matchPattern;
            newNode.m_addressPattern = m_addressPattern;

            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)
        {
            if (m_lastImportedAssets != null)
            {
                m_lastImportedAssets.RemoveAll(a => a == null);
            }

            Load(target, node, connectionsToOutput, Output);
        }
예제 #8
0
        private void FilterAssets(Model.NodeData node,
                                  IEnumerable <PerformGraph.AssetGroups> incoming,
                                  IEnumerable <Model.ConnectionData> connectionsToOutput,
                                  PerformGraph.Output Output)
        {
            if (connectionsToOutput == null || Output == null)
            {
                return;
            }

            var allOutput = new Dictionary <string, Dictionary <string, List <AssetReference> > >();

            foreach (var outPoints in node.OutputPoints)
            {
                allOutput[outPoints.Id] = new Dictionary <string, List <AssetReference> >();
            }
            if (incoming != null)
            {
                foreach (var ag in incoming)
                {
                    foreach (var groupKey in ag.assetGroups.Keys)
                    {
                        foreach (var a in ag.assetGroups[groupKey])
                        {
                            foreach (var filter in m_filter)
                            {
                                if (filter.Instance.Object.FilterAsset(a))
                                {
                                    var output = allOutput[filter.ConnectionPointId];
                                    if (!output.ContainsKey(groupKey))
                                    {
                                        output[groupKey] = new List <AssetReference>();
                                    }
                                    output[groupKey].Add(a);
                                    // consume this asset with this output
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            foreach (var dst in connectionsToOutput)
            {
                if (allOutput.ContainsKey(dst.FromNodeConnectionPointId))
                {
                    Output(dst, allOutput[dst.FromNodeConnectionPointId]);
                }
            }
        }
예제 #9
0
        public NodeException(string reason, string howToFix, AssetReference a)
        {
            AssetGraphController gc = AssetGraphPostprocessor.Postprocessor.GetCurrentGraphController();

            if (gc == null || gc.CurrentNode == null)
            {
                throw new AssetGraphException("Attempted to create NodeException outside node execution.");
            }

            this.Reason   = reason;
            this.HowToFix = howToFix;
            this.Node     = gc.CurrentNode;
            this.Asset    = a;
        }
예제 #10
0
        public override void Initialize(Model.NodeData data)
        {
            m_spritePackingTagNameTemplate = new SerializableMultiTargetString("*");
            m_overwritePackingTag          = false;
            m_useCustomSettingAsset        = false;
            m_customSettingAssetGuid       = string.Empty;
            m_overwriteSpriteSheet         = false;
            m_referenceAssetGuid           = string.Empty;

            m_configuratorInstance = new SerializableMultiTargetInstance();

            data.AddDefaultInputPoint();
            data.AddDefaultOutputPoint();
        }
예제 #11
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new BundleBuilder();

            newNode.m_enabledBundleOptions = new SerializableMultiTargetInt(m_enabledBundleOptions);
            newNode.m_outputDir            = new SerializableMultiTargetString(m_outputDir);
            newNode.m_outputOption         = new SerializableMultiTargetInt(m_outputOption);
            newNode.m_manifestName         = new SerializableMultiTargetString(m_manifestName);

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();

            return(newNode);
        }
예제 #12
0
    /**
     * Build is called when Unity builds assets with AssetBundle Graph.
     */
    public override void Build(BuildTarget target,
                               Model.NodeData node,
                               IEnumerable <PerformGraph.AssetGroups> incoming,
                               IEnumerable <Model.ConnectionData> connectionsToOutput,
                               PerformGraph.Output outputFunc,
                               Action <Model.NodeData, string, float> progressFunc)
    {
        var directoryPath = PrepareOutputDirectory(target, node);

        if (Directory.Exists(directoryPath))
        {
            Directory.Delete(directoryPath, true);
        }
    }
예제 #13
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new FileOperation
            {
                m_destinationPath        = new SerializableMultiTargetString(m_destinationPath),
                m_destinationOption      = new SerializableMultiTargetInt(m_destinationOption),
                m_operationType          = m_operationType,
                m_removingDirectoryDepth = m_removingDirectoryDepth
            };

            newData.AddDefaultInputPoint();

            return(newNode);
        }
예제 #14
0
        private string PrepareOutputDirectory(BuildTarget target, Model.NodeData node, bool autoCreate, bool throwException)
        {
            var outputOption = (OutputOption)m_outputOption [target];

            if (outputOption == OutputOption.BuildInCacheDirectory)
            {
                return(FileUtility.EnsureAssetBundleCacheDirExists(target, node));
            }

            var outputDir = m_outputDir [target];

            outputDir = outputDir.Replace("{Platform}", BuildTargetUtility.TargetToAssetBundlePlatformName(target));

            if (throwException)
            {
                if (string.IsNullOrEmpty(outputDir))
                {
                    throw new NodeException("Output directory is empty.",
                                            "Select valid output directory from inspector.", node);
                }

                if (target != BuildTargetUtility.GroupToTarget(BuildTargetGroup.Unknown) &&
                    outputOption == OutputOption.ErrorIfNoOutputDirectoryFound)
                {
                    if (!Directory.Exists(outputDir))
                    {
                        throw new NodeException("Output directory not found. \n" + outputDir,
                                                "Create output directory or select other valid directory from inspector.", node);
                    }
                }
            }

            if (autoCreate)
            {
                if (outputOption == OutputOption.DeleteAndRecreateOutputDirectory)
                {
                    if (Directory.Exists(outputDir))
                    {
                        FileUtility.DeleteDirectory(outputDir, true);
                    }
                }

                if (!Directory.Exists(outputDir))
                {
                    Directory.CreateDirectory(outputDir);
                }
            }

            return(outputDir);
        }
예제 #15
0
        public override void Prepare(BuildTarget target,
                                     Model.NodeData node,
                                     IEnumerable <PerformGraph.AssetGroups> incoming,
                                     IEnumerable <Model.ConnectionData> connectionsToOutput,
                                     PerformGraph.Output Output)
        {
            var importPath = GetImportDirectoryPath(m_importDirectoryPath[target]);

            if (!Directory.Exists(importPath))
            {
                throw new NodeException("Import Path directory does not exist. Path:" + m_importDirectoryPath[target],
                                        "Create directory or set valid import path from inspector.", node);
            }
        }
예제 #16
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new GroupingBySize();

            newNode.m_groupSizeByte    = new SerializableMultiTargetInt(m_groupSizeByte);
            newNode.m_groupingType     = new SerializableMultiTargetInt(m_groupingType);
            newNode.m_groupViewContext = new GroupViewContext();
            newNode.m_freezeGroups     = m_freezeGroups;
            newNode.m_groupNameFormat  = new SerializableMultiTargetString(m_groupNameFormat);

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();
            return(newNode);
        }
예제 #17
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new PlayerBuilder();

            newNode.m_buildOptions   = new SerializableMultiTargetInt(m_buildOptions);
            newNode.m_buildLocations = new SerializableMultiTargetString(m_buildLocations);
            newNode.m_playerName     = new SerializableMultiTargetString(m_playerName);
            newNode.m_scenes         = new SerializableMultiTargetString(m_scenes);
            newNode.m_scroll         = m_scroll;

            newData.AddDefaultInputPoint();

            return(newNode);
        }
예제 #18
0
        public static string EnsureCacheDirExists(BuildTarget t, Model.NodeData node, string name)
        {
            var cacheDir = FileUtility.PathCombine(Model.Settings.Path.CachePath, name, node.Id, SystemDataUtility.GetPathSafeTargetName(t));

            if (!Directory.Exists(cacheDir))
            {
                Directory.CreateDirectory(cacheDir);
            }
            if (!cacheDir.EndsWith(Model.Settings.UNITY_FOLDER_SEPARATOR.ToString()))
            {
                cacheDir = cacheDir + Model.Settings.UNITY_FOLDER_SEPARATOR.ToString();
            }
            return(cacheDir);
        }
예제 #19
0
파일: Loader.cs 프로젝트: kookllcat3/MyKit
        public override bool OnAssetsReimported(
            Model.NodeData nodeData,
            AssetReferenceStreamManager streamManager,
            BuildTarget target,
            AssetPostprocessorContext ctx,
            bool isBuilding)
        {
            if (isBuilding && !m_respondToAssetChange)
            {
                return(false);
            }

            CheckAndCorrectPath(target);
            var loadPath = GetLoadPath(target);

            foreach (var asset in ctx.ImportedAssets)
            {
                if (asset.importFrom.StartsWith(loadPath))
                {
                    return(true);
                }
            }

            foreach (var asset in ctx.MovedAssets)
            {
                if (asset.importFrom.StartsWith(loadPath))
                {
                    return(true);
                }
            }

            foreach (var path in ctx.MovedFromAssetPaths)
            {
                if (path.StartsWith(loadPath))
                {
                    return(true);
                }
            }

            foreach (var path in ctx.DeletedAssetPaths)
            {
                if (path.StartsWith(loadPath))
                {
                    return(true);
                }
            }

            return(false);
        }
    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!!!");
        }
    }
예제 #21
0
파일: Loader.cs 프로젝트: kookllcat3/MyKit
        public override void Initialize(Model.NodeData data)
        {
            if (m_loadPath == null)
            {
                m_loadPath = new SerializableMultiTargetString();
            }
            if (m_loadPathGuid == null)
            {
                m_loadPathGuid = new SerializableMultiTargetString();
            }

            m_respondToAssetChange = false;

            data.AddDefaultOutputPoint();
        }
예제 #22
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new Filter();

            newNode.m_filter = new List <FilterEntry>(m_filter.Count);

            newData.AddDefaultInputPoint();

            foreach (var f in m_filter)
            {
                newNode.AddFilterCondition(newData, f.Instance.Object);
            }

            return(newNode);
        }
예제 #23
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new AddressableBuilder
            {
                m_contentStateFilePath = m_contentStateFilePath,
                m_builderGuid          = m_builderGuid,
                m_preferUpdate         = m_preferUpdate,
                m_profileName          = m_profileName,
            };

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();

            return(newNode);
        }
예제 #24
0
        public override void Prepare(BuildTarget target,
                                     Model.NodeData node,
                                     IEnumerable <PerformGraph.AssetGroups> incoming,
                                     IEnumerable <Model.ConnectionData> connectionsToOutput,
                                     PerformGraph.Output Output)
        {
            ValidateSearchCondition(
                m_searchFilter[target],
                () => {
                throw new NodeException(node.Name + ": Serach filter is empty", node);
            }
                );

            Load(target, node, connectionsToOutput, Output);
        }
예제 #25
0
        public override void Prepare(BuildTarget target,
                                     Model.NodeData node,
                                     IEnumerable <PerformGraph.AssetGroups> incoming,
                                     IEnumerable <Model.ConnectionData> connectionsToOutput,
                                     PerformGraph.Output Output)
        {
            if (!AddressableAssetSettingsDefaultObject.SettingsExists)
            {
                throw new NodeException("Addressable Asset Settings not found.",
                                        "Create Addressable Asset Settings object from Addressables window.");
            }

            if (string.IsNullOrEmpty(m_builderGuid))
            {
                throw new NodeException("Builder Script not selected.",
                                        "Please select Builder Script from Inspector.");
            }

            m_currentDataBuilder = Settings.DataBuilders.FirstOrDefault(obj =>
                                                                        AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(obj)) == m_builderGuid);

            if (m_currentDataBuilder == null)
            {
                throw new NodeException("Selected Builder Script is missing.",
                                        "Please select a valid Builder Script from Inspector.");
            }


            // AddressableBuilder 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> >());
                }
            }
        }
예제 #26
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new ImportSetting();

            newNode.m_overwritePackingTag          = m_overwritePackingTag;
            newNode.m_spritePackingTagNameTemplate = new SerializableMultiTargetString(m_spritePackingTagNameTemplate);
            newNode.m_useCustomSettingAsset        = m_useCustomSettingAsset;
            newNode.m_customSettingAssetGuid       = m_customSettingAssetGuid;
            newNode.m_overwriteSpriteSheet         = m_overwriteSpriteSheet;
            newNode.m_configuratorInstance         = new SerializableMultiTargetInstance(m_configuratorInstance);
            newNode.m_referenceAssetGuid           = string.Empty;

            newData.AddDefaultInputPoint();
            newData.AddDefaultOutputPoint();
            return(newNode);
        }
예제 #27
0
        public override void Prepare(BuildTarget target,
                                     Model.NodeData node,
                                     IEnumerable <PerformGraph.AssetGroups> incoming,
                                     IEnumerable <Model.ConnectionData> connectionsToOutput,
                                     PerformGraph.Output Output)
        {
            if (connectionsToOutput == null || Output == null)
            {
                return;
            }

            var outputDict = new Dictionary <string, List <AssetReference> >();

            if (incoming != null)
            {
                int i = 0;
                foreach (var ag in incoming)
                {
                    foreach (var g in ag.assetGroups.Keys)
                    {
                        var assets = ag.assetGroups [g];
                        foreach (var a in assets)
                        {
                            var key = i.ToString();

                            if (!string.IsNullOrEmpty(m_groupNameFormat [target]))
                            {
                                key = m_groupNameFormat [target]
                                      .Replace("{FileName}", a.fileName)
                                      .Replace("{FileExtension}", a.extension)
                                      .Replace("{NewGroup}", key)
                                      .Replace("{OldGroup}", g);
                            }

                            outputDict[key] = new List <AssetReference>();
                            outputDict [key].Add(a);
                            ++i;
                        }
                    }
                }
            }

            var dst = (connectionsToOutput == null || !connectionsToOutput.Any())?
                      null : connectionsToOutput.First();

            Output(dst, outputDict);
        }
예제 #28
0
        public static string EnsureAssetBundleCacheDirExists(BuildTarget t, Model.NodeData node, bool remake = false)
        {
            var cacheDir = FileUtility.PathCombine(Model.Settings.Path.BundleBuilderCachePath, node.Id, BuildTargetUtility.TargetToAssetBundlePlatformName(t));

            if (!Directory.Exists(cacheDir))
            {
                Directory.CreateDirectory(cacheDir);
            }
            else
            {
                if (remake)
                {
                    RemakeDirectory(cacheDir);
                }
            }
            return(cacheDir);
        }
예제 #29
0
        public override bool OnAssetsReimported(
            Model.NodeData nodeData,
            AssetReferenceStreamManager streamManager,
            BuildTarget target,
            AssetPostprocessorContext ctx,
            bool isBuilding)
        {
            if (isBuilding && !m_respondToAssetChange)
            {
                return(false);
            }

            if (m_searchFilter == null)
            {
                return(false);
            }

            var cond  = m_searchFilter[target];
            var guids = AssetDatabase.FindAssets(cond);

            if (guids.Length == 0)
            {
                return(false);
            }

            List <string> reimportedAssetGuids = new List <string> ();

            foreach (var a in ctx.ImportedAssets)
            {
                reimportedAssetGuids.Add(a.assetDatabaseId);
            }
            foreach (var a in ctx.MovedAssets)
            {
                reimportedAssetGuids.Add(a.assetDatabaseId);
            }

            foreach (var guid in guids)
            {
                if (reimportedAssetGuids.Contains(guid))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #30
0
        public override Node Clone(Model.NodeData newData)
        {
            var newNode = new Loader();

            newNode.m_loadPath             = new SerializableMultiTargetString(m_loadPath);
            newNode.m_loadPathGuid         = new SerializableMultiTargetString(m_loadPathGuid);
            newNode.m_respondToAssetChange = m_respondToAssetChange;

            newNode.m_ignorePatterns = new List <IgnorePattern> ();
            foreach (var p in m_ignorePatterns)
            {
                newNode.m_ignorePatterns.Add(new IgnorePattern(p));
            }

            newData.AddDefaultOutputPoint();
            return(newNode);
        }