Example #1
0
    void acceptDraggedNorm(Type type, MNorm norm)
    {
        if (dragAcceptPending)
        {
            if (Event.current.type == EventType.Repaint)
            {
                //var act = act;
                Convert.ChangeType(norm, type);

                Vector2 pos = NodeEditorWindow.current.WindowToGridPosition(Event.current.mousePosition);
                //  NewNodeGraph graph = target as NewNodeGraph;

                NormNode nn = CreateNode(typeof(NormNode), pos) as NormNode;

                nn.sourceNorm = norm;
                nn.normtype   = norm.GetType();

                nn.action  = norm.targetAction;
                nn.context = nn.populateFilter(nn.context, norm.context, PortOrientation.In);

                Debug.Log("Dragged norm");

                dragAcceptPending = false;
                n           = null;
                draggedType = null;
            }
        }
    }
Example #2
0
    public override void OnHeaderGUI()
    {
        if (node == null)
        {
            node = target as NormNode;
        }

        if (node.sourceNorm != null)
        {
            GUILayout.Label(node.sourceNorm.GetType().ToString(), NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
        }
        else
        {
            inspectStuff.Show();
            OdinEditorWindow.InspectObject(inspectStuff, node);
            //window.Repaint();
        }

        if (node == null)
        {
            node = target as NormNode;
        }

        if (node.context == null)
        {
            node.initNode();
            window.Repaint();
        }
    }