FindIncomingAssetType() public static method

public static FindIncomingAssetType ( List assets ) : Type
assets List
return System.Type
        private Type FindIncomingAssetType(ConnectionPointData inputPoint)
        {
            var assetGroups = AssetBundleGraphEditorWindow.GetIncomingAssetGroups(inputPoint);

            if (assetGroups == null)
            {
                return(null);
            }
            return(TypeUtility.FindIncomingAssetType(assetGroups.SelectMany(v => v.Value).ToList()));
        }
Exemplo n.º 2
0
        public static void ValidateModifier(
            NodeData node,
            BuildTarget target,
            List <Asset> incomingAssets,
            Action <Type, Type, Asset> multipleAssetTypeFound,
            Action noModiferData,
            Action failedToCreateModifier,
            Action <Type, Type> incomingTypeMismatch
            )
        {
            Type expectedType = TypeUtility.FindIncomingAssetType(incomingAssets);

            if (expectedType != null)
            {
                foreach (var a  in incomingAssets)
                {
                    Type assetType = TypeUtility.FindTypeOfAsset(a.importFrom);
                    if (assetType != expectedType)
                    {
                        multipleAssetTypeFound(expectedType, assetType, a);
                    }
                }
            }

            if (string.IsNullOrEmpty(node.InstanceData[target]))
            {
                noModiferData();
            }

            var modifier = ModifierUtility.CreateModifier(node, target);

            if (null == modifier)
            {
                failedToCreateModifier();
            }

            // if there is no incoming assets, there is no way to check if
            // right type of asset is coming in - so we'll just skip the test
            if (incomingAssets.Any())
            {
                var targetType = ModifierUtility.GetModifierTargetType(modifier);
                if (targetType != expectedType)
                {
                    incomingTypeMismatch(targetType, expectedType);
                }
            }
        }
Exemplo n.º 3
0
        public static void ValidateInputSetting(
            NodeData node,
            BuildTarget target,
            List <Asset> incomingAssets,
            Action <Type, Type, Asset> multipleAssetTypeFound,
            Action <Type> unsupportedType,
            Action <Type, Type> incomingTypeMismatch,
            Action <ConfigStatus> errorInConfig
            )
        {
            Type expectedType = TypeUtility.FindIncomingAssetType(incomingAssets);

            if (multipleAssetTypeFound != null)
            {
                if (expectedType != null)
                {
                    foreach (var a  in incomingAssets)
                    {
                        Type assetType = TypeUtility.FindTypeOfAsset(a.importFrom);
                        if (assetType != expectedType)
                        {
                            multipleAssetTypeFound(expectedType, assetType, a);
                        }
                    }
                }
            }

            if (unsupportedType != null)
            {
                if (expectedType != null)
                {
                    if (expectedType == typeof(UnityEditor.TextureImporter) ||
                        expectedType == typeof(UnityEditor.ModelImporter) ||
                        expectedType == typeof(UnityEditor.AudioImporter)
                        )
                    {
                        // good. do nothing
                    }
                    else
                    {
                        unsupportedType(expectedType);
                    }
                }
            }

            var status = GetConfigStatus(node);

            if (errorInConfig != null)
            {
                if (status != ConfigStatus.GoodSampleFound)
                {
                    errorInConfig(status);
                }
            }

            if (incomingTypeMismatch != null)
            {
                // if there is no incoming assets, there is no way to check if
                // right type of asset is coming in - so we'll just skip the test
                if (incomingAssets.Any() && status == ConfigStatus.GoodSampleFound)
                {
                    Type targetType = GetReferenceAssetImporter(node).GetType();
                    if (targetType != expectedType)
                    {
                        incomingTypeMismatch(targetType, expectedType);
                    }
                }
            }
        }