Ejemplo n.º 1
0
 protected override IEnumerable <VFXBlockProvider.Descriptor> GetDescriptors()
 {
     return(VFXLibrary.GetBlocks()
            .Where(b => b.AcceptParent(m_ContextController.model))
            .Select(t => (Descriptor) new NewBlockDescriptor(t))
            .Concat(SubGraphCache.GetItems(typeof(VisualEffectSubgraphBlock))
                    .Where(t =>
                           (((SubGraphCache.AdditionalBlockInfo)t.additionalInfos).compatibleType &
                            m_ContextController.model.contextType) != 0 &&
                           (((SubGraphCache.AdditionalBlockInfo)t.additionalInfos).compatibleData &
                            m_ContextController.model.ownedType) != 0)
                    .Select(t => (Descriptor) new SubgraphBlockDescriptor(t)))
            .OrderBy(x => x.category)
            .ThenBy(x => x.name));
 }
Ejemplo n.º 2
0
        protected override IEnumerable <VFXBlockProvider.Descriptor> GetDescriptors()
        {
            var blocks         = new List <VFXModelDescriptor <VFXBlock> >(VFXLibrary.GetBlocks());
            var filteredBlocks = blocks.Where(b => b.AcceptParent(m_ContextController.model)).Select(t => (Descriptor) new NewBlockDescriptor(t));


            filteredBlocks = filteredBlocks.Concat(SubGraphCache.GetItems(typeof(VisualEffectSubgraphBlock)).Where(t =>
                                                                                                                   (((SubGraphCache.AdditionalBlockInfo)t.additionalInfos).compatibleType & m_ContextController.model.contextType) != 0 &&
                                                                                                                   (((SubGraphCache.AdditionalBlockInfo)t.additionalInfos).compatibleData & m_ContextController.model.ownedType) != 0
                                                                                                                   ).Select(t => (Descriptor) new SubgraphBlockDescriptor(t)));

            var blockList = filteredBlocks.ToList();

            blockList.Sort((blockA, blockB) =>
            {
                var infoA = blockA;
                var infoB = blockB;
                int res   = infoA.category.CompareTo(infoB.category);
                return(res != 0 ? res : blockA.name.CompareTo(blockB.name));
            });

            return(blockList);
        }
Ejemplo n.º 3
0
        protected override IEnumerable <Descriptor> GetDescriptors()
        {
            IEnumerable <Descriptor> descs = Enumerable.Empty <Descriptor>();

            if (m_AcceptedTypes == null || m_AcceptedTypes.Contains(typeof(VFXContext)))
            {
                var descriptorsContext = VFXLibrary.GetContexts().Select(o =>
                {
                    return(new Descriptor()
                    {
                        modelDescriptor = o,
                        category = ComputeCategory("Context", o),
                        name = o.name
                    });
                }).OrderBy(o => o.category + o.name);

                descs = descs.Concat(descriptorsContext);
            }
            if (m_AcceptedTypes == null || m_AcceptedTypes.Contains(typeof(VFXOperator)))
            {
                var descriptorsOperator = VFXLibrary.GetOperators().Select(o =>
                {
                    return(new Descriptor()
                    {
                        modelDescriptor = o,
                        category = ComputeCategory("Operator", o),
                        name = o.name
                    });
                });

                descriptorsOperator = descriptorsOperator.Concat(SubGraphCache.GetItems(typeof(VisualEffectSubgraphOperator)).Select(
                                                                     t => new Descriptor()
                {
                    modelDescriptor = t.path,
                    category        = "Operator/" + t.category,
                    name            = t.name
                }
                                                                     ));

                descs = descs.Concat(descriptorsOperator.OrderBy(o => o.category + o.name));
            }
            if (m_AcceptedTypes == null || m_AcceptedTypes.Contains(typeof(VFXParameter)))
            {
                var parameterDescriptors = m_Controller.parameterControllers.Select(t =>
                                                                                    new Descriptor
                {
                    modelDescriptor = t,
                    category        = string.IsNullOrEmpty(t.model.category) ? "Property" : string.Format("Property/{0}", t.model.category),
                    name            = t.exposedName
                }
                                                                                    ).OrderBy(t => t.category);
                descs = descs.Concat(parameterDescriptors);
            }
            if (m_AcceptedTypes == null)
            {
                var systemFiles = System.IO.Directory.GetFiles(VisualEffectAssetEditorUtility.templatePath).Where(t => Path.GetExtension(t) == VisualEffectResource.Extension).Select(t => t.Replace("\\", "/"));

                var systemDesc = systemFiles.Select(t => new Descriptor()
                {
                    modelDescriptor = t.Replace(VisualEffectGraphPackageInfo.fileSystemPackagePath, VisualEffectGraphPackageInfo.assetPackagePath), category = "System", name = System.IO.Path.GetFileNameWithoutExtension(t)
                });

                descs = descs.Concat(systemDesc);
            }
            var groupNodeDesc = new Descriptor()
            {
                modelDescriptor = new GroupNodeAdder(),
                category        = "Misc",
                name            = "Group Node"
            };

            descs = descs.Concat(Enumerable.Repeat(groupNodeDesc, 1));

            if (m_Filter == null)
            {
                return(descs);
            }
            else
            {
                return(descs.Where(t => m_Filter(t)));
            }
        }
Ejemplo n.º 4
0
        protected override IEnumerable <Descriptor> GetDescriptors()
        {
            IEnumerable <Descriptor> descs = Enumerable.Empty <Descriptor>();

            if (m_AcceptedTypes == null || m_AcceptedTypes.Contains(typeof(VFXContext)))
            {
                var descriptorsContext = VFXLibrary.GetContexts().Select(o =>
                {
                    return(new Descriptor()
                    {
                        modelDescriptor = o,
                        category = ComputeCategory("Context", o),
                        name = o.name
                    });
                }).OrderBy(o => o.category + o.name);

                descs = descs.Concat(descriptorsContext);
            }
            if (m_AcceptedTypes == null || m_AcceptedTypes.Contains(typeof(VFXOperator)))
            {
                var descriptorsOperator = VFXLibrary.GetOperators().Select(o =>
                {
                    return(new Descriptor()
                    {
                        modelDescriptor = o,
                        category = ComputeCategory("Operator", o),
                        name = o.name
                    });
                });

                descriptorsOperator = descriptorsOperator.Concat(SubGraphCache.GetItems(typeof(VisualEffectSubgraphOperator)).Select(
                                                                     t => new Descriptor()
                {
                    modelDescriptor = t.path,
                    category        = "Operator/" + t.category,
                    name            = t.name
                }
                                                                     ));

                descs = descs.Concat(descriptorsOperator.OrderBy(o => o.category + o.name));
            }
            if (m_AcceptedTypes == null || m_AcceptedTypes.Contains(typeof(VFXParameter)))
            {
                var parameterDescriptors = m_Controller.parameterControllers.Select(t =>
                                                                                    new Descriptor
                {
                    modelDescriptor = t,
                    category        = string.IsNullOrEmpty(t.model.category) ? "Property" : string.Format("Property/{0}", t.model.category),
                    name            = t.exposedName
                }
                                                                                    ).OrderBy(t => t.category);
                descs = descs.Concat(parameterDescriptors);
            }
            if (m_AcceptedTypes == null)
            {
                AddTemplatesFromDirectory(VisualEffectAssetEditorUtility.templatePath, "System", ref descs);

                if ((VFXResources.defaultResources.userTemplateDirectory.Length > 0) && System.IO.Directory.Exists(VFXResources.defaultResources.userTemplateDirectory))
                {
                    AddTemplatesFromDirectory(VFXResources.defaultResources.userTemplateDirectory, "User Systems", ref descs);
                }
            }
            var groupNodeDesc = new Descriptor()
            {
                modelDescriptor = new GroupNodeAdder(),
                category        = "Misc",
                name            = "Group Node"
            };

            descs = descs.Concat(Enumerable.Repeat(groupNodeDesc, 1));

            if (m_Filter == null)
            {
                return(descs);
            }
            else
            {
                return(descs.Where(t => m_Filter(t)));
            }
        }