Ejemplo n.º 1
0
        public static IEnumerable <Warning> Warnings(FlowGraph graph, IEnumerable <IUnitPortDefinition> definitions = null)
        {
            if (definitions == null)
            {
                definitions = LinqUtility.Concat <IUnitPortDefinition>(graph.controlInputDefinitions,
                                                                       graph.controlOutputDefinitions,
                                                                       graph.valueInputDefinitions,
                                                                       graph.valueOutputDefinitions);
            }

            var hasDuplicate = definitions.DistinctBy(d => d.key).Count() != definitions.Count();

            if (hasDuplicate)
            {
                yield return(Warning.Caution("Some port definitions with non-unique keys are currently ignored."));
            }

            foreach (var definition in definitions)
            {
                if (!definition.isValid)
                {
                    yield return(InvalidWarning(definition));
                }
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <IUnitOption> Subset(UnitOptionFilter filter, GraphReference reference)
        {
            lock (@lock)
            {
                if (options == null)
                {
                    Load();
                }

                var dynamicOptions    = UnityAPI.Await(() => GetDynamicOptions().ToHashSet());
                var contextualOptions = UnityAPI.Await(() => GetContextualOptions(reference).ToHashSet());

                return(LinqUtility.Concat <IUnitOption>(options, dynamicOptions, contextualOptions)
                       .Where((filter ?? UnitOptionFilter.Any).ValidateOption)
                       .ToArray());
            }
        }
 public static IEnumerable <string> GetVariableNameSuggestions(VariableKind kind, GraphReference reference)
 {
     return(LinqUtility.Concat <string>(GetPredefinedVariableNames(kind, reference), GetDynamicVariableNames(kind, reference)).Distinct().OrderBy(name => name));
 }
Ejemplo n.º 4
0
 public override IEnumerable <IFuzzyOption> SearchableRoot()
 {
     return(LinqUtility.Concat <IFuzzyOption>(primitiveOptions, assetOptions, primitiveFolderOptions, assetFolderOptions));
 }
Ejemplo n.º 5
0
        protected override IEnumerable <Warning> Warnings()
        {
            foreach (var baseWarning in base.Warnings())
            {
                yield return(baseWarning);
            }

            if (unit.graph != null)
            {
                foreach (var definitionWarning in UnitPortDefinitionUtility.Warnings(unit.graph, LinqUtility.Concat <IUnitPortDefinition>(unit.graph.controlOutputDefinitions, unit.graph.valueOutputDefinitions)))
                {
                    yield return(definitionWarning);
                }

                if (unit.graph.units.Count(unit => unit is GraphOutput) > 1)
                {
                    yield return(Warning.Caution("Multiple output units in the same graph. Only one of them will be used."));
                }
            }
        }
Ejemplo n.º 6
0
        protected override IEnumerable <Warning> Warnings()
        {
            foreach (var baseWarning in base.Warnings())
            {
                yield return(baseWarning);
            }

            if (unit.graph != null)
            {
                foreach (var definitionWarning in UnitPortDefinitionUtility.Warnings(unit.graph, LinqUtility.Concat <IUnitPortDefinition>(unit.graph.controlInputDefinitions, unit.graph.valueInputDefinitions)))
                {
                    yield return(definitionWarning);
                }
            }
        }