예제 #1
0
 StatusFlags OpenNodeViewScriptStatus(DropdownMenu.MenuAction action)
 {
     if (NodeProvider.GetNodeViewScript(GetType()) != null)
     {
         return(StatusFlags.Normal);
     }
     return(StatusFlags.Disabled);
 }
예제 #2
0
 Status OpenNodeScriptStatus(DropdownMenuAction action)
 {
     if (NodeProvider.GetNodeScript(nodeTarget.GetType()) != null)
     {
         return(Status.Normal);
     }
     return(Status.Disabled);
 }
예제 #3
0
        public void OpenNodeScript()
        {
            var scriptPath = NodeProvider.GetNodeScript(nodeTarget.GetType());

            if (scriptPath != null)
            {
                InternalEditorUtility.OpenFileAtLineExternal(scriptPath, 0);
            }
        }
예제 #4
0
        public void OpenNodeScript()
        {
            var script = NodeProvider.GetNodeScript(nodeTarget.GetType());

            if (script != null)
            {
                AssetDatabase.OpenAsset(script.GetInstanceID(), 0, 0);
            }
        }
예제 #5
0
        public virtual IEnumerable <KeyValuePair <string, Type> > FilterCreateNodeMenuEntries()
        {
            // By default we don't filter anything
            foreach (var nodeMenuItem in NodeProvider.GetNodeMenuEntries())
            {
                yield return(nodeMenuItem);
            }

            // TODO: add exposed properties to this list
        }
예제 #6
0
        public void OpenNodeScript()
        {
            var scriptPath = NodeProvider.GetNodeScript(nodeTarget.GetType());

#pragma warning disable CS0618 // Deprecated function but no alternative :(
            if (scriptPath != null)
            {
                InternalEditorUtility.OpenFileAtLineExternal(scriptPath, 0);
            }
#pragma warning restore CS0618
        }
예제 #7
0
        protected virtual IEnumerable <Type> GetExposedParameterTypes()
        {
            // filter the slot types because we don't want generic types (i.e lists)
            foreach (var type in NodeProvider.GetSlotTypes())
            {
                if (type.IsGenericType)
                {
                    continue;
                }

                yield return(type);
            }
        }
예제 #8
0
        protected virtual IEnumerable <Type> GetExposedParameterTypes()
        {
            // filter the slot types because we don't want generic types (i.e lists)
            foreach (var type in NodeProvider.GetSlotTypes())
            {
                if (type.IsGenericType || type.FullName == "ConditionalLink" || type.FullName == "RelayNode+PackedRelayData" || type.FullName == "GraphProcessor.BaseGraph")
                {
                    continue;
                }

                yield return(type);
            }
        }
예제 #9
0
        protected BaseNodeView AddNodeView(BaseNode node)
        {
            var viewType = NodeProvider.GetNodeViewTypeFromType(node.GetType());

            if (viewType == null)
            {
                viewType = typeof(BaseNodeView);
            }

            var baseNodeView = Activator.CreateInstance(viewType) as BaseNodeView;

            baseNodeView.Initialize(this, node);
            AddElement(baseNodeView);

            nodeViews.Add(baseNodeView);
            nodeViewsPerNode[node] = baseNodeView;

            return(baseNodeView);
        }
예제 #10
0
        void CreateEdgeNodeMenu(List <SearchTreeEntry> tree)
        {
            var entries = NodeProvider.GetEdgeCreationNodeMenuEntry((edgeFilter.input ?? edgeFilter.output) as PortView);

            var titlePaths = new HashSet <string>();

            var nodePaths = NodeProvider.GetNodeMenuEntries();

            tree.Add(new SearchTreeEntry(new GUIContent($"Relay", icon))
            {
                level    = 1,
                userData = new NodeProvider.PortDescription {
                    nodeType        = typeof(RelayNode),
                    portType        = typeof(System.Object),
                    isInput         = inputPortView != null,
                    portFieldName   = inputPortView != null ? nameof(RelayNode.output) : nameof(RelayNode.input),
                    portIdentifier  = "0",
                    portDisplayName = inputPortView != null ? "Out" : "In",
                }
            });

            foreach (var nodeMenuItem in entries.OrderBy(n => n.nodeType.ToString()))
            {
                var nodePath = nodePaths.FirstOrDefault(kp => kp.Value.nodeType == nodeMenuItem.nodeType).Key;

                // Ignore the node if it's not in the create menu
                if (String.IsNullOrEmpty(nodePath))
                {
                    continue;
                }

                var nodeName = nodePath;
                var level    = 0;
                var parts    = nodePath.Split('/');

                if (parts.Length > 1)
                {
                    level++;
                    nodeName = parts[parts.Length - 1];
                    var fullTitleAsPath = "";

                    for (var i = 0; i < parts.Length - 1; i++)
                    {
                        var title = parts[i];
                        fullTitleAsPath += title;
                        level            = i + 1;

                        // Add section title if the node is in subcategory
                        if (!titlePaths.Contains(fullTitleAsPath))
                        {
                            tree.Add(new SearchTreeGroupEntry(new GUIContent(title))
                            {
                                level = level
                            });
                            titlePaths.Add(fullTitleAsPath);
                        }
                    }
                }

                tree.Add(new SearchTreeEntry(new GUIContent($"{nodeName}:  {nodeMenuItem.portDisplayName}", icon))
                {
                    level    = level + 1,
                    userData = nodeMenuItem
                });
            }
        }