コード例 #1
0
    public static int OnGUI_Spline(Rect pRect, AXNodeGraphEditorWindow editor, AXParameter p)
    {
        float cur_x = ArchimatixUtils.cur_x;

        //float box_w = ArchimatixUtils.paletteRect.width - cur_x - 3*ArchimatixUtils.indent;
        float box_w = pRect.width - cur_x - 1 * ArchimatixUtils.indent;

        int cur_y   = (int)pRect.y;
        int lineHgt = (int)pRect.height;
        int gap     = 5;

        int margin = 24;

        float wid = pRect.width - margin;



        Color shapeColor = editor.getDataColor(AXParameter.DataType.Spline);

        Color oldBackgroundColor = GUI.backgroundColor;
        Color dataColor          = editor.getDataColor(p.Type);

        GUI.backgroundColor = dataColor;


        // INPUT
        if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != AXParameter.DataType.Spline)
        {
            GUI.enabled = false;
        }
        if (p.PType != AXParameter.ParameterType.Output)
        {
            if (GUI.Button(new Rect(-3, cur_y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize), ""))
            {
                if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != p.Type)
                {
                    editor.OutputParameterBeingDragged = null;
                }
                else
                {
                    editor.inputSocketClicked(p);
                }
            }
        }

        GUI.enabled = true;

        // OUTPUT
        if (editor.InputParameterBeingDragged == null || editor.InputParameterBeingDragged.Type == AXParameter.DataType.Spline)
        {
            if (GUI.Button(new Rect(pRect.width + 6, cur_y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize), ""))
            {
                if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != p.Type)
                {
                    editor.OutputParameterBeingDragged = null;
                }
                else
                {
                    editor.outputSocketClicked(p);
                }
            }
        }



        // LABEL
        Rect boxRect = new Rect(cur_x + ArchimatixUtils.indent + 3, cur_y, box_w, pRect.height);
        Rect lRect   = boxRect;

        lRect.x     += 3;
        lRect.width -= 10;

        GUIStyle labelstyle = GUI.skin.GetStyle("Label");

        labelstyle.alignment = TextAnchor.MiddleLeft;

        if (p.PType == AXParameter.ParameterType.Output)
        {
            labelstyle.alignment  = TextAnchor.MiddleRight;
            labelstyle.fixedWidth = lRect.width - 13;
        }

        GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " ");


        //Debug.Log(p.Name + " - " + p.ParentNode+ " - " + p.ParentNode.Name);

        string label = p.Name;

        if (p.ParentNode != null && p.ParentNode is AXShape)
        {
            if (p.DependsOn != null)
            {
                if (p.DependsOn.Parent != null)
                {
                    label = p.DependsOn.Parent.Name;
                }
            }
        }


        GUI.Label(lRect, label);



        // SOLID/VOID TOGGLE


        if (p.PType == AXParameter.ParameterType.Input && p.ParentNode != null && (p.ParentNode is AXShape))
        {
            // Texture2D solidVoidIconTexture = (Texture2D) AssetDatabase.LoadAssetAtPath(ArchimatixEngine.ArchimatixAssetPath+"/ui/GeneralIcons/"+iconname, typeof(Texture2D));

            Texture2D solidVoidIconTexture = (p.polyType == PolyType.ptSubject) ? editor.solidIconTexture : editor.voidIconTexture;

            Rect svRect = new Rect(boxRect.x + boxRect.width - lineHgt, cur_y, lineHgt, lineHgt);

            if (GUI.Button(svRect, new GUIContent(solidVoidIconTexture, "Solid/Void"), GUIStyle.none))
            //if(GUI.Button ( bRect, solidVoidIconTexture, GUIStyle.none))
            {
                p.polyType = (p.polyType == PolyType.ptSubject) ? PolyType.ptClip : PolyType.ptSubject;
                p.parametricObject.model.autobuild();
            }

            GUI.Label(new Rect(10, 40, 100, 40), GUI.tooltip);
        }



        // OPEN/CLOSED TOGGLE
        else
        {
            Texture2D solidOpenClosedTexture = (p.shapeState == ShapeState.Open) ? editor.shapeOpenIconTexture : editor.shapeClosedIconTexture;
            Rect      svRect = new Rect(boxRect.x + boxRect.width - lineHgt - 2, cur_y, lineHgt + 2, lineHgt + 2);

            if (GUI.Button(svRect, new GUIContent(solidOpenClosedTexture, "Open/Closed"), GUIStyle.none))
            //if(GUI.Button ( bRect, solidVoidIconTexture, GUIStyle.none))
            {
                p.shapeState = (p.shapeState == ShapeState.Open) ? ShapeState.Closed : ShapeState.Open;
                p.parametricObject.model.autobuild();
            }

            GUI.Label(new Rect(10, 40, 100, 40), GUI.tooltip);
        }



        // FOLDOUT (isOpen)
        GUI.backgroundColor = new Color(1, 1, 1, 1f);
        p.isOpen            = EditorGUI.Foldout(new Rect(cur_x, cur_y, 15, lineHgt), p.isOpen, "");
        GUI.backgroundColor = shapeColor;
        cur_y += lineHgt + gap;


        Rect tRect = pRect;

        tRect.x     = 30;
        tRect.width = pRect.width - 20;



        if (p.isOpen)
        {
            ArchimatixUtils.cur_x += ArchimatixUtils.indent;

            lineHgt = ArchimatixUtils.lineHgtSmall;

            p.drawClosed = false;


            string[] options;

            tRect.x     += 2;
            tRect.y      = cur_y;
            tRect.width -= 11;
            tRect.height = 16;

            Rect cntlRect = tRect;             // new Rect(x0, cur_y, wid, 16);

            cntlRect.height = 16;



            //  EXPOSE AS RUNTIME Interface ------------
            //EditorGUIUtility.labelWidth = wid-36;
            cntlRect = new Rect(tRect.x, cur_y, wid, 16);
            EditorGUI.BeginChangeCheck();
            p.exposeAsInterface = EditorGUI.Toggle(cntlRect, "Runtime", p.exposeAsInterface);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Expose Parameter");

                if (p.exposeAsInterface)
                {
                    p.parametricObject.model.addExposedParameter(p);
                }
                else
                {
                    p.parametricObject.model.removeExposedParameter(p);
                }
            }

            cur_y += lineHgt + gap;



            // BREAK MINMAXSLIDER
            tRect.y = cur_y;
            GUI.Label(tRect, "Break Geom|Norms");
            cur_y += lineHgt;
            GUI.backgroundColor = Color.white;
            tRect.y             = cur_y;
            EditorGUI.BeginChangeCheck();

                        #if UNITY_5_5_OR_NEWER
            EditorGUI.MinMaxSlider(
                tRect,
                GUIContent.none,
                ref p.breakGeom, ref p.breakNorm,
                0, 100);
                        #else
            EditorGUI.MinMaxSlider(
                GUIContent.none,
                tRect,
                ref p.breakGeom, ref p.breakNorm,
                0, 100);
                        #endif
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Max Min Slider");

                p.parametricObject.model.isAltered(1);
            }

            cur_y += lineHgt + gap;

            cntlRect.y = cur_y;


            // REVERSE
            EditorGUI.BeginChangeCheck();
            p.reverse = GUI.Toggle(cntlRect, p.reverse, "Reverse");
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Reverse");

                p.parametricObject.model.autobuild();
            }

            cur_y += lineHgt + gap;

            cntlRect.y = cur_y;


            // SYMMETRY
            EditorGUI.BeginChangeCheck();
            p.symmetry = GUI.Toggle(cntlRect, p.symmetry, "Symetry");
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Symetry");

                p.parametricObject.model.autobuild();
            }

            cur_y += lineHgt + gap;

            cntlRect.y = cur_y;



            // SYMMETRY SEPERATION
            if (p.symmetry)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUIUtility.labelWidth = .5f * wid;
                GUI.SetNextControlName("FloatField_SymSeperation_Text_" + p.Guid + "_");
                p.symSeperation = EditorGUI.FloatField(cntlRect, "Seperation", p.symSeperation);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "SymetrySeperation");

                    p.parametricObject.model.autobuild();
                }

                cur_y += lineHgt + gap;

                cntlRect.y = cur_y;
            }



            // FLIP_X

            EditorGUI.BeginChangeCheck();
            p.flipX = GUI.Toggle(cntlRect, p.flipX, "FlipX");
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Flip X");

                p.parametricObject.model.autobuild();

                p.parametricObject.generator.adjustWorldMatrices();
            }

            cur_y += lineHgt + gap;



            tRect.y = cur_y;

            tRect.height = 16;



            // SHAPE_STATE

            options = ArchimatixUtils.getMenuOptions("ShapeState");
            EditorGUIUtility.labelWidth = .5f * wid;          //-50;
            EditorGUI.BeginChangeCheck();
            p.shapeState = (ShapeState)EditorGUI.Popup(
                tRect,
                "ShapeState",
                (int)p.shapeState,
                options);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Shape State");

                p.parametricObject.model.autobuild();
            }
            cur_y += lineHgt + gap;



            cntlRect.y      = cur_y;
            cntlRect.height = ArchimatixUtils.lineHgtSmall;



            // THICKNESS

            AXEditorUtilities.assertFloatFieldKeyCodeValidity("FloatField_Thickness");

            EditorGUI.BeginChangeCheck();
            GUI.SetNextControlName("FloatField_Thickness_Text_" + p.Guid + "_");
            p.thickness = EditorGUI.FloatField(cntlRect, "Thickness", p.thickness);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for Thickness");
                p.thickness = Mathf.Max(p.thickness, 0);
                p.parametricObject.model.isAltered(2);
            }
            cur_y += ArchimatixUtils.lineHgtSmall + gap;



            if (p.shapeState == ShapeState.Closed)
            {
                cntlRect.y      = cur_y;
                cntlRect.height = ArchimatixUtils.lineHgtSmall;


                // ROUNDNESS

                AXEditorUtilities.assertFloatFieldKeyCodeValidity("FloatField_Roundness");

                EditorGUI.BeginChangeCheck();
                GUI.SetNextControlName("FloatField_Roundness_Text_" + p.Guid + "_");
                p.roundness = EditorGUI.FloatField(cntlRect, "Roundness", p.roundness);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for Roundness");
                    p.parametricObject.model.isAltered(3);
                }
                cur_y += ArchimatixUtils.lineHgtSmall + gap;

                cntlRect.y      = cur_y;
                cntlRect.height = ArchimatixUtils.lineHgtSmall;



                // OFFSET

                AXEditorUtilities.assertFloatFieldKeyCodeValidity("FloatField_Offset");

                EditorGUI.BeginChangeCheck();
                GUI.SetNextControlName("FloatField_Offset_Text_" + p.Guid + "_");
                p.offset = EditorGUI.FloatField(cntlRect, "Offset", p.offset);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for Offset");
                    p.parametricObject.model.isAltered(3);
                }
                cur_y += ArchimatixUtils.lineHgtSmall + gap;
            }


            if (p.thickness > 0)
            {
                if (p.shapeState == ShapeState.Closed)
                {                       // CLOSED
                    if (p.thickness > 0)
                    {
                        p.endType = AXClipperLib.EndType.etClosedLine;
                    }
                    else
                    {
                        p.endType = AXClipperLib.EndType.etClosedPolygon;
                    }
                }
                else
                {                       // OPEN
                    switch (p.openEndType)
                    {
                    case AXParameter.OpenEndType.Butt:
                        p.endType = AXClipperLib.EndType.etOpenButt;
                        break;

                    case AXParameter.OpenEndType.Square:
                        p.endType = AXClipperLib.EndType.etOpenSquare;
                        break;

                    case AXParameter.OpenEndType.Round:
                        p.endType = AXClipperLib.EndType.etOpenRound;
                        break;

                    default:
                        p.endType = AXClipperLib.EndType.etOpenSquare;
                        break;
                    }
                }
            }



            if (p.shapeState == ShapeState.Closed)
            {
                p.drawClosed = true;
            }


            if ((p.thickness > 0) || (p.roundness != 0) || (p.offset != 0))
            {
                p.drawClosed = true;

                tRect.y = cur_y;

                options = ArchimatixUtils.getMenuOptions("JoinType");
                EditorGUIUtility.labelWidth = .5f * wid;              //-50;
                EditorGUI.BeginChangeCheck();

                p.joinType = (AXClipperLib.JoinType)EditorGUI.Popup(
                    tRect,
                    "JoinType",
                    (int)p.joinType,
                    options);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for JoinType");
                    p.parametricObject.model.autobuild();
                }

                cur_y += lineHgt + gap;

                if (p.joinType == AXClipperLib.JoinType.jtRound || p.endType == AXClipperLib.EndType.etOpenRound)
                {
                    tRect.y = cur_y;

                    AXEditorUtilities.assertFloatFieldKeyCodeValidity("FloatField_smoothness");


                    if (float.IsNaN(p.arcTolerance))
                    {
                        p.arcTolerance = 50;
                    }
                    if (p.arcTolerance < .25f)
                    {
                        p.arcTolerance = .25f;
                    }
                    float tmp_arcTol = p.arcTolerance;

                    float smoothness = (float)(120 / (p.arcTolerance * p.arcTolerance));
                    EditorGUI.BeginChangeCheck();
                    GUI.SetNextControlName("FloatField_smoothness_Text_" + p.Guid + "_");
                    smoothness = EditorGUI.FloatField(tRect, "smoothness", smoothness);

                    if (EditorGUI.EndChangeCheck())
                    {
                        smoothness = Mathf.Clamp(smoothness, .048f, 2.0f);


                        float smoothLOD = ((smoothness - .048f) * p.parametricObject.model.segmentReductionFactor) + .048f;

                        p.arcTolerance = (float)(Math.Sqrt(120 / smoothLOD));
                        if (p.arcTolerance != tmp_arcTol && p.Parent.model.readyToRegisterUndo)
                        {
                            //Debug.Log ("REGISTER UNDO");
                            float newval = p.arcTolerance;
                            p.arcTolerance = tmp_arcTol;
                            Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for " + p.Name);
                            p.arcTolerance = newval;



                            p.Parent.model.readyToRegisterUndo = false;
                        }
                        if (p.arcTolerance < .25f)
                        {
                            p.arcTolerance = .25f;
                        }
                        if (p.arcTolerance > 50)
                        {
                            p.arcTolerance = 50;
                        }
                        if (float.IsNaN(p.arcTolerance))
                        {
                            p.arcTolerance = 50;
                        }

                        p.parametricObject.model.isAltered(4);
                    }
                    cur_y += lineHgt + gap;
                }
            }
            if (p.shapeState == ShapeState.Open && p.thickness > 0)
            {
                // OPEN_END_TYPE
                options = ArchimatixUtils.getMenuOptions("OpenEndType");
                EditorGUIUtility.labelWidth = .5f * wid;              //-50;
                tRect.y = cur_y;
                EditorGUI.BeginChangeCheck();
                p.openEndType = (AXParameter.OpenEndType)EditorGUI.Popup(
                    tRect,
                    "EndType",
                    (int)p.openEndType,
                    options);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for EndType");
                }
                cur_y += lineHgt + gap;
            }



            cur_y += lineHgt / 2;


            // SUBDIVISION
            cntlRect.y = cur_y;

            EditorGUI.BeginChangeCheck();
            GUI.SetNextControlName("FloatField_Subdivision_Text_" + p.Guid + "_");
            p.subdivision = (float)EditorGUI.IntField(cntlRect, "Subdivision", (int)p.subdivision);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for Subdivision");
                if (p.subdivision < 0)
                {
                    p.subdivision = 0;
                }
                p.parametricObject.model.isAltered(3);
            }

            ArchimatixUtils.cur_x -= ArchimatixUtils.indent;
            cur_y += 2 * lineHgt;
        }


        GUI.backgroundColor = oldBackgroundColor;

        return(cur_y);
    }
コード例 #2
0
    // return the height of this gui area
    public static int OnGUI(Rect pRect, AXNodeGraphEditorWindow editor, AXParameter p)
    {
        Event e = Event.current;


        if (Event.current.type == EventType.KeyUp)
        {
            if (p != null && !GUI.GetNameOfFocusedControl().Contains("logicTextArea_"))
            {
                p.parametricObject.model.autobuildDelayed(1000);
            }
        }
        int hgt = (int)pRect.height;

        float foldoutWidth = 20;
        float boxWidth     = pRect.width - foldoutWidth - ArchimatixUtils.indent;

        float cur_x = ArchimatixUtils.cur_x;
        float box_w = ArchimatixUtils.paletteRect.width - cur_x - 3 * ArchimatixUtils.indent;


        int cur_y = (int)pRect.y;



        Color inactiveColor = new Color(.7f, .7f, .7f);

        Color oldBackgroundColor = GUI.backgroundColor;
        Color dataColor          = editor.getDataColor(p.Type);


        if (!EditorGUIUtility.isProSkin)
        {
            dataColor = new Color(dataColor.r, dataColor.b, dataColor.g, .3f);
        }

        GUI.color = dataColor;
        Rect boxRect = new Rect(cur_x + ArchimatixUtils.indent, cur_y, box_w, ArchimatixUtils.lineHgt);

        GUI.Box(boxRect, " ");
        GUI.Box(boxRect, " ");
        GUI.color = Color.white;

        int   margin = 24;
        float x0     = pRect.x + 14;
        float xTF    = pRect.x + 12;
        float wid    = pRect.width - margin;


        int indent  = (int)x0 + 2;
        int lineHgt = 16;
        int gap     = 2;

        if (p.isEditing)
        {
            hgt *= 5;
            hgt += 8;
            GUI.Box(new Rect(pRect.x - 6, pRect.y - 3, boxWidth, lineHgt * (8 + p.expressions.Count)), GUIContent.none);
        }


        if (p.Parent == null)
        {
            return(0);
        }

        if (p.Parent != null && p.to_delete == true)
        {
            p.Parent.removeParameter(p);
            return(0);
        }

        Color defcolor = GUI.color;



        // input/ouput sockets

        GUI.backgroundColor = dataColor;



        // INPUT SOCKET

        string buttonLabel = null;
        Rect   buttonRect;

        if (p.isEditing || p.hasInputSocket)
        {
            if (p.isEditing && !p.hasInputSocket)
            {
                GUI.color = new Color(defcolor.r, defcolor.g, defcolor.b, .3f);
            }


            buttonLabel = (editor.InputParameterBeingDragged == p) ? "-" : "";
            buttonRect  = new Rect(-3, pRect.y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize);

            // button color
            if (editor.OutputParameterBeingDragged != null)
            {
                if (editor.OutputParameterBeingDragged.Type != p.Type)
                {
                    GUI.backgroundColor = inactiveColor;
                }
                else if (buttonRect.Contains(Event.current.mousePosition))
                {
                    GUI.backgroundColor = Color.white;
                }
            }
            else if (editor.InputParameterBeingDragged != null)
            {
                if (editor.InputParameterBeingDragged == p)
                {
                    GUI.backgroundColor = Color.white;
                }
                else
                {
                    GUI.backgroundColor = inactiveColor;
                }
            }

            // Input Button

            if (editor.OutputParameterBeingDragged != null && (editor.OutputParameterBeingDragged.parametricObject == p.parametricObject || editor.OutputParameterBeingDragged.Type != p.Type))
            {
                GUI.enabled = false;
            }

            if (GUI.Button(buttonRect, buttonLabel))
            {
                if (p.isEditing)
                {
                    p.hasOutputSocket = (!p.hasOutputSocket);
                }
                else
                {
                    if (Event.current.command)
                    {
                        Debug.Log("CONTEXT");
                    }
                    else if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != p.Type)
                    {
                        editor.OutputParameterBeingDragged = null;
                    }
                    else
                    {
                        editor.inputSocketClicked(p);
                    }
                }
            }
            GUI.enabled = true;
        }
        GUI.backgroundColor = editor.getDataColor(p.Type);
        GUI.color           = defcolor;

        // INPUT SOCKET



        // OUTPUT SOCKET

        if (p.isEditing || p.hasOutputSocket)
        {
            if (p.isEditing && !p.hasOutputSocket)
            {
                GUI.color = new Color(defcolor.r, defcolor.g, defcolor.b, .3f);
            }

            buttonLabel = (editor.OutputParameterBeingDragged == p) ? "-" : "";
            buttonRect  = new Rect(p.Parent.rect.width - pRect.height + 3, pRect.y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize);

            // button color
            if (editor.InputParameterBeingDragged != null)
            {
                if (editor.InputParameterBeingDragged.Type != p.Type)
                {
                    GUI.backgroundColor = inactiveColor;
                }
                else if (buttonRect.Contains(Event.current.mousePosition))
                {
                    GUI.backgroundColor = Color.white;
                }
            }
            else if (editor.OutputParameterBeingDragged != null)
            {
                if (editor.OutputParameterBeingDragged == p)
                {
                    GUI.backgroundColor = Color.white;
                }
                else
                {
                    GUI.backgroundColor = inactiveColor;
                }
            }

            // Output Button
            if (editor.InputParameterBeingDragged != null && (editor.InputParameterBeingDragged.parametricObject == p.parametricObject || editor.InputParameterBeingDragged.Type != p.Type))
            {
                GUI.enabled = false;
            }

            if (GUI.Button(buttonRect, buttonLabel))
            {
                if (p.isEditing)
                {
                    p.hasOutputSocket = (!p.hasOutputSocket);
                }
                else
                {
                    if (Event.current.control)
                    {
                        // DISPLAY CONTEXT MENU FOR THINGS YOU CAN USE THIS OUTPUT FOR
                        Debug.Log("context");
                        //model.selectPO(parametricObject);

                        MeshOuputMenu.contextMenu(p, e.mousePosition);


                        e.Use();
                    }
                    else if (editor.InputParameterBeingDragged != null && editor.InputParameterBeingDragged.Type != p.Type)
                    {
                        editor.InputParameterBeingDragged = null;
                    }
                    else
                    {
                        editor.outputSocketClicked(p);
                    }
                }
            }
            GUI.enabled = true;
        }

        GUI.color = defcolor;

        // OUTPUT SOCKET



        // SLIDER AND NUMBER FIELD


        Rect nameLabelRect = new Rect(x0, pRect.y, wid - 30, 16);
        Rect cntlRect      = new Rect(x0, pRect.y, wid, 16);

        //Rect boxRect = new Rect(xb, pRect.y+vMargin, boxWidth, pRect.height-vMargin*2);


        /*
         * if (hasInputSocket && ! hasOutputSocket)
         *      boxRect = new Rect(xb, pRect.y+vMargin, inputwid, pRect.height-vMargin*2);
         * else if(! hasInputSocket && hasOutputSocket)
         *      boxRect = new Rect(xb+x_output, pRect.y+vMargin, inputwid+4, pRect.height-vMargin*2);
         */

        Rect textFieldRect = new Rect(xTF + 3, pRect.y, wid - 60, pRect.height + 2);



        // -- DON'T USE PROPERTY DRAWER TO HANDLE UNDO WITH SLIDER
        // we need o get the updated value atomically, which the propertydrawer does not seem to do (slower update)



        // BINDING HIGHLIGHT BACKGROUND BOX
        //Handles.yAxisColor;


        //GUI.color = Handles.yAxisColor;

        /*
         * if (p.sizeBindingAxis > 0)
         * {
         *      switch(p.sizeBindingAxis)
         *      {
         *      case Axis.X:
         *              GUI.color = Handles.xAxisColor; break;
         *      case Axis.Y:
         *              GUI.color = Handles.yAxisColor; break;
         *      case Axis.Z:
         *              GUI.color = Handles.zAxisColor; break;
         *
         *      }
         *
         *      GUI.Box (new Rect(boxRect.x-m, boxRect.y-m, boxRect.width+4*m, boxRect.height+2*m), GUIContent.none);
         *      GUI.Box (new Rect(boxRect.x-m, boxRect.y-m, boxRect.width+4*m, boxRect.height+2*m), GUIContent.none);
         *      GUI.Box (new Rect(boxRect.x-m, boxRect.y-m, boxRect.width+4*m, boxRect.height+2*m), GUIContent.none);
         *      GUI.Box (new Rect(boxRect.x-m, boxRect.y-m, boxRect.width+4*m, boxRect.height+2*m), GUIContent.none);
         *      GUI.Box (new Rect(boxRect.x-m, boxRect.y-m, boxRect.width+4*m, boxRect.height+2*m), GUIContent.none);
         *      GUI.Box (new Rect(boxRect.x-m, boxRect.y-m, boxRect.width+4*m, boxRect.height+2*m), GUIContent.none);
         * }
         */
        /*
         * if (EditorGUIUtility.isProSkin)
         *      GUI.color = new Color(defcolor.r, defcolor.b, defcolor.g, 1f);
         * else
         *      GUI.color = new Color(defcolor.r, defcolor.b, defcolor.g, .4f);
         *
         * GUI.Box (boxRect, GUIContent.none);
         * GUI.color = defcolor;
         *
         * if (EditorGUIUtility.isProSkin)
         * {
         *      GUI.Box (boxRect, GUIContent.none);
         *      GUI.Box (boxRect, GUIContent.none);
         *      if (p.Parent.model.isSelected(p.Parent))
         *              GUI.Box (boxRect, GUIContent.none);
         * }
         */
        // BINDING HIGHLIGHT BACKGROUND BOX



        // PROPERTYDRAWER
        //EditorGUI.PropertyField(pRect, pProperty);

        //OR...
        GUIStyle labelstyle = GUI.skin.GetStyle("Label");

        labelstyle.alignment = TextAnchor.MiddleLeft;

        GUIStyle buttonstyle = GUI.skin.GetStyle("Button");

        buttonstyle.alignment = TextAnchor.MiddleLeft;

        // NAME

        string nameString = p.Name;        // + "_" + Guid;

        if (p.PType == AXParameter.ParameterType.Input)
        {
            labelstyle.alignment  = TextAnchor.MiddleLeft;
            labelstyle.fixedWidth = boxRect.width - 10;
            GUI.Label(nameLabelRect, nameString);
        }

        else if (p.PType == AXParameter.ParameterType.Output)
        {
            labelstyle.alignment  = TextAnchor.MiddleRight;
            labelstyle.fixedWidth = boxRect.width - 10;
            GUI.Label(nameLabelRect, nameString);
        }

        else if ((p.hasInputSocket && !p.hasOutputSocket))
        {
            labelstyle.alignment = TextAnchor.MiddleLeft;
            if (p.Parent.isEditing)
            {
                GUI.Label(nameLabelRect, nameString);
            }
            else
            {
                GUI.Label(nameLabelRect, nameString);
            }
        }
        else if (p.PType == AXParameter.ParameterType.Output)        //(!hasInputSocket && hasOutputSocket)
        {
            labelstyle.alignment = TextAnchor.MiddleRight;
            if (p.Parent.isEditing)
            {
                GUI.Label(nameLabelRect, nameString + " .... ");
            }
            else
            {
                GUI.Label(cntlRect, nameString);
            }
        }
        else if (p.Type == AXParameter.DataType.Plane)
        {
            labelstyle.alignment = TextAnchor.MiddleRight;
            if (p.Parent.isEditing)
            {
                GUI.Label(nameLabelRect, nameString);
            }
            else
            {
                GUI.Label(cntlRect, nameString);
            }
        }
        else if (p.Type == AXParameter.DataType.MaterialTool)
        {
            labelstyle.alignment = TextAnchor.MiddleLeft;
            if (p.Parent.isEditing)
            {
                GUI.Label(nameLabelRect, nameString);
            }
            else
            {
                GUI.Label(cntlRect, nameString);
            }
        }


        else if ((p.hasInputSocket && p.hasOutputSocket))
        {
            EditorGUIUtility.fieldWidth = wid / 3.2f;          //36;
            EditorGUIUtility.labelWidth = wid - EditorGUIUtility.fieldWidth;

            GUI.backgroundColor = Color.white;

            EditorGUI.BeginChangeCheck();
            p.isOpen = EditorGUI.Foldout(new Rect(pRect.x, cur_y, 20, lineHgt), p.isOpen, "");
            if (EditorGUI.EndChangeCheck())
            {
                if (p.isOpen)
                {
                    foreach (AXParameter pop in p.parametricObject.parameters)
                    {
                        if (pop != p)
                        {
                            pop.isOpen = false;
                        }
                    }
                }
            }



            if (p.isOpen)
            {
                // NAME

                GUI.SetNextControlName("ParameterName_Text_NameField" + p.Guid + "_" + p.Name);

                p.Name = EditorGUI.TextField(textFieldRect, p.Name);

                if (p.shouldFocus)
                {
                    GUI.FocusControl("ParameterName_Text_NameField" + p.Guid + "_" + p.Name);
                    p.shouldFocus = false;
                }


                // DELETE PARAMETER
                if (GUI.Button(new Rect(pRect.width - 2 * lineHgt * 1.5f, cur_y - 1, lineHgt * 1.25f, lineHgt), "-"))
                {
                    //Debug.Log("remove...");
                    p.parametricObject.removeParameter(p);
                    //p.expressions.RemoveAt(i);
                }

                // MOVE PARAMETER UP
                if (GUI.Button(new Rect(pRect.width - lineHgt * 1.5f, cur_y - 1, lineHgt * 1.25f, lineHgt), "^"))
                {
                    //Debug.Log("remove...");
                    p.parametricObject.moveParameterUp(p);
                    //p.expressions.RemoveAt(i);
                }



                cur_y += lineHgt + gap * 3;

                GUI.Box(new Rect((x0 - 4), cur_y - 4, (pRect.width - 20), ((6 + p.expressions.Count) * lineHgt)), " ");


                // DATA_TYPE
                //EditorGUI.PropertyField( new Rect((textFieldRect.x+textFieldRect.width)+6, textFieldRect.y, 60, 22), pProperty.FindPropertyRelative("m_type"), GUIContent.none);


                //EditorGUI.PropertyField( new Rect((textFieldRect.x+textFieldRect.width)+6, textFieldRect.y, 60, 22), m_type, GUIContent.none);
                //Rect rec = new Rect((textFieldRect.x+textFieldRect.width)+6, textFieldRect.y, 60, 22);
                Rect rec = new Rect(x0, cur_y, 60, 22);
                //m_type = (DataType) EditorGUI.EnumPopup(rec, m_type, "YUP");
                string   dataType_menu    = "Float|Int|Bool|String";
                string[] dataType_options = dataType_menu.Split('|');
                EditorGUI.BeginChangeCheck();
                int typeOption = (int)p.Type;
                if (typeOption == (int)AXParameter.DataType.String)
                {
                    typeOption = 3;
                }

                typeOption = (int)EditorGUI.Popup(
                    rec,
                    "",
                    typeOption,
                    dataType_options);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Parameter Type");
                    p.Type = (AXParameter.DataType)typeOption;
                    if (p.Type == AXParameter.DataType.Spline)
                    {
                        p.Type = AXParameter.DataType.String;
                    }
                }


                cur_y += lineHgt + gap * 3;


                //  EXPOSE AS RUNTIME Interface ------------
                //EditorGUIUtility.labelWidth = wid-36;
                cntlRect = new Rect(x0, cur_y, wid, 16);
                EditorGUI.BeginChangeCheck();
                p.exposeAsInterface = EditorGUI.Toggle(cntlRect, "Expose", p.exposeAsInterface);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "Expose Parameter");

                    if (p.exposeAsInterface)
                    {
                        p.parametricObject.model.addExposedParameter(p);
                    }
                    else
                    {
                        p.parametricObject.model.removeExposedParameter(p);
                    }
                }

                cur_y += lineHgt + gap;



                /*
                 * if (p.Type == AXParameter.DataType.Float)
                 * {
                 *      EditorGUI.BeginChangeCheck ();
                 *
                 *      //EditorGUIUtility.labelWidth = 20;
                 *      GUI.backgroundColor = Color.white;
                 *      GUI.Label(new Rect(indent, cur_y, 200,16), "Bind externally in: ");
                 *      p.sizeBindingAxis = EditorGUI.Popup(
                 *              new Rect((textFieldRect.x+textFieldRect.width)+6, cur_y, 60,16),
                 *              "",
                 *              p.sizeBindingAxis,
                 *              new string[] {
                 *              "None",
                 *              "X",
                 *              "Y",
                 *              "Z"
                 *      });
                 *      if (EditorGUI.EndChangeCheck ()) {
                 *              Undo.RegisterCompleteObjectUndo (p.parametricObject.model, "Size bind Axis");
                 *              Debug.Log ("sizeBindingAxis changed to "+p.sizeBindingAxis );
                 *
                 *      }
                 *      cur_y += lineHgt;
                 * }
                 */

                // STRING
                if (p.Type == AXParameter.DataType.String)
                {
                    p.StringVal = EditorGUI.TextField(new Rect(indent, cur_y, wid - 10, lineHgt), p.StringVal);
                    cur_y      += lineHgt;
                }

                // NUMBER
                else if (p.Type == AXParameter.DataType.Float || (p.Type == AXParameter.DataType.Int))
                {
                    GUI.Label(new Rect(indent, cur_y, 200, 16), new GUIContent("Expressions", "When the value of this parameter changes, define its effect on other paramters with mathematical descriptions using this parameter."));
                    cur_y += lineHgt;



                    // expressions
                    if (p.expressions == null)
                    {
                        p.expressions = new List <string>();
                    }
                    if (p.expressions.Count == 0)
                    {
                        p.expressions.Add("");
                    }

                    for (int i = 0; i < p.expressions.Count; i++)
                    {
                        GUI.SetNextControlName("ParameterExpression_" + i + "_Text_" + p.Guid + "_" + p.Name);
                        p.expressions[i] = EditorGUI.TextField(new Rect(indent, cur_y, wid - 30, lineHgt), p.expressions[i]);


                        if (GUI.Button(new Rect(pRect.width - lineHgt * 1.5f, cur_y - 1, lineHgt * 1.25f, lineHgt), "-"))
                        {
                            p.expressions.RemoveAt(i);
                        }

                        cur_y += lineHgt + gap * 2;
                    }

                    if (GUI.Button(new Rect(pRect.width - lineHgt * 1.5f, cur_y, lineHgt * 1.25f, lineHgt), new GUIContent("+", "Add an expression to this Parameter")))
                    {
                        p.expressions.Add("");
                    }
                    cur_y += lineHgt;
                }
                cur_y += lineHgt;



                // DONE
                if (GUI.Button(new Rect((wid - 30 - lineHgt * 1.5f), cur_y - 1, 50, pRect.height), "Done"))
                {
                    p.isOpen      = false;
                    p.shouldFocus = false;
                    AXEditorUtilities.clearFocus();
                }

                // MOVE PARAMETER UP
                if (GUI.Button(new Rect(pRect.width - lineHgt * 1.5f, cur_y - 1, lineHgt * 1.25f, lineHgt), "v"))
                {
                    //Debug.Log("remove...");
                    p.parametricObject.moveParameterDown(p);
                    //p.expressions.RemoveAt(i);
                }



                cur_y += lineHgt;
            }
            else             // (not open)
            {
                // NOT EDITING, RATHER USING
                string bindingLabel = "";
                switch (p.sizeBindingAxis)
                {
                case Axis.X:
                    bindingLabel = " [X]"; break;

                case Axis.Y:
                    bindingLabel = " [Y]"; break;

                case Axis.Z:
                    bindingLabel = " [Z]"; break;
                }


                switch (p.Type)
                {
                case AXParameter.DataType.AnimationCurve:
                    GUILayout.BeginArea(new Rect(indent, cur_y, wid - 10, 2 * lineHgt));

                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.CurveField(p.animationCurve);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterCompleteObjectUndo(p.parametricObject.model, "ModifierCurve");
                        p.parametricObject.model.isAltered(28);
                    }

                    GUILayout.EndArea();

                    break;

                case AXParameter.DataType.Float:

                    // FLOAT SLIDER
                    if (p.PType != AXParameter.ParameterType.DerivedValue)
                    {
                        // VALIDATE INPUT - IF INVALID >> LOSE FOCUS
                        AXEditorUtilities.assertFloatFieldKeyCodeValidity("FloatField_Text_FloatField_" + p.Name);

                        EditorGUI.BeginChangeCheck();
                        GUI.SetNextControlName("FloatField_Text_" + p.Guid + "_" + p.Name);
                        p.val = EditorGUI.FloatField(cntlRect, nameString + bindingLabel, p.val);
                        if (EditorGUI.EndChangeCheck())
                        {
                            //Debug.Log(val);

                            Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for " + p.Name);
                            p.Parent.initiateRipple_setFloatValueFromGUIChange(p.Name, p.val);
                            p.parametricObject.model.isAltered(27);
                            p.parametricObject.generator.adjustWorldMatrices();
                        }
                    }
                    else
                    {
                        Rect labelRect = cntlRect;
                        labelRect.width = cntlRect.width - 25;
                        GUI.Label(labelRect, p.Name);
                        GUI.Label(new Rect(cntlRect.width - 10, cntlRect.y, 18, cntlRect.height), "" + p.val);
                    }

                    if (p.shouldFocus)
                    {
                        GUI.FocusControl("FloatField_Text_" + p.Guid + "_" + p.Name);
                        p.shouldFocus = false;
                    }
                    break;

                case AXParameter.DataType.Int:
                {
                    // INT SLIDER
                    // VALIDATE INPUT - IF INVALID >> LOSE FOCUS

                    /*
                     * if (Event.current.type == EventType.KeyDown)
                     * {
                     *              if(Event.current.keyCode != KeyCode.None && !AXEditorUtilities.isValidIntFieldKeyCode(Event.current.keyCode) && GUI.GetNameOfFocusedControl() == ("IntField_" + p.Name))
                     *      {
                     *              Event.current.Use();
                     *              GUI.FocusControl("dummy_label");
                     *      }
                     * }
                     */

                    AXEditorUtilities.assertIntFieldKeyCodeValidity("IntField_" + p.Name);

                    EditorGUI.BeginChangeCheck();
                    GUI.SetNextControlName("IntField_" + p.Guid + "_" + p.Name);
                    p.intval = EditorGUI.IntField(cntlRect, nameString, p.intval);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for " + p.Name);
                        p.initiateRipple_setIntValueFromGUIChange(p.intval);
                        p.parametricObject.model.isAltered(28);
                        p.parametricObject.generator.adjustWorldMatrices();
                    }

                    break;
                }

                case AXParameter.DataType.Bool:
                {
                    EditorGUIUtility.labelWidth = wid - 16;
                    EditorGUI.BeginChangeCheck();

                    GUI.SetNextControlName("BoolToggle_" + p.Guid + "_" + p.Name);
                    p.boolval = EditorGUI.Toggle(cntlRect, nameString, p.boolval);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for " + p.Name);

                        p.parametricObject.initiateRipple_setBoolParameterValueByName(p.Name, p.boolval);
                        p.parametricObject.model.autobuild();
                        p.parametricObject.generator.adjustWorldMatrices();
                    }

                    break;
                }

                case AXParameter.DataType.String:
                    labelstyle.alignment = TextAnchor.MiddleLeft;
                    if (p.Parent.isEditing)
                    {
                        GUI.Label(nameLabelRect, nameString);
                    }
                    else
                    {
                        GUI.Label(nameLabelRect, nameString);
                    }

                    break;

                case AXParameter.DataType.Option:
                {
                    // OPTION POPUP

                    string[] options = ArchimatixUtils.getMenuOptions(p.Name);
                    EditorGUIUtility.labelWidth = wid - 50;


                    EditorGUI.BeginChangeCheck();
                    GUI.SetNextControlName("OptionPopup_" + p.Guid + "_" + p.Name);
                    p.intval = EditorGUI.Popup(
                        cntlRect,
                        p.Name,
                        p.intval,
                        options);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for " + p.Name);
                        p.parametricObject.model.autobuild();

                        if (p.PType == AXParameter.ParameterType.PositionControl)
                        {
                            p.parametricObject.generator.adjustWorldMatrices();
                        }
                    }

                    break;
                }

                case AXParameter.DataType.CustomOption:
                {
                    // OPTION POPUP

                    string[] options = p.optionLabels.ToArray();

                    EditorGUIUtility.labelWidth = wid * .5f;


                    EditorGUI.BeginChangeCheck();
                    GUI.SetNextControlName("CustomOptionPopup_" + p.Guid + "_" + p.Name);
                    p.intval = EditorGUI.Popup(
                        cntlRect,
                        p.Name,
                        p.intval,
                        options);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterCompleteObjectUndo(p.Parent.model, "value change for " + p.Name);
                        p.parametricObject.model.autobuild();

                        if (p.PType == AXParameter.ParameterType.PositionControl)
                        {
                            p.parametricObject.generator.adjustWorldMatrices();
                        }
                    }

                    break;
                }
                }                // END switch (Type)
            }
        }

        cur_y += lineHgt;


        GUI.backgroundColor = oldBackgroundColor;



        /*
         * if(GUI.changed && ! editor.codeChanged)
         * {
         *      Debug.Log ("generate " + Parent.Name + " :: " + Name);
         *      //Parent.generateOutput("guid01");
         *
         *
         * }
         */
        GUI.color = defcolor;


        return(cur_y - (int)pRect.y);
    }
コード例 #3
0
    public static int OnGUI_Mesh(Rect pRect, AXNodeGraphEditorWindow editor, AXParameter p)
    {
        float cur_x = ArchimatixUtils.cur_x;

        //float box_w = ArchimatixUtils.paletteRect.width - cur_x - 3*ArchimatixUtils.indent;
        float box_w = pRect.width - cur_x - 1 * ArchimatixUtils.indent;

        int cur_y   = (int)pRect.y;
        int lineHgt = (int)pRect.height;
        int gap     = 5;



        Color oldBackgroundColor = GUI.backgroundColor;
        Color dataColor          = editor.getDataColor(p.Type);

        GUI.backgroundColor = dataColor;


        // INPUT
        if (!p.parametricObject.isCurrentGrouper())
        {
            if (editor.OutputParameterBeingDragged == null || editor.OutputParameterBeingDragged.Type == AXParameter.DataType.Mesh)
            {
                if (p.PType != AXParameter.ParameterType.Output)
                {
                    if (GUI.Button(new Rect(-3, cur_y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize), ""))
                    {
                        if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != p.Type)
                        {
                            editor.OutputParameterBeingDragged = null;
                        }
                        else
                        {
                            editor.inputSocketClicked(p);
                        }
                    }
                }
            }
        }


        // OUTPUT
        if (editor.InputParameterBeingDragged == null || editor.InputParameterBeingDragged.Type == AXParameter.DataType.Mesh)
        {
            if (GUI.Button(new Rect(pRect.width + 6, cur_y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize), ""))
            {
                if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != p.Type)
                {
                    editor.OutputParameterBeingDragged = null;
                }
                else
                {
                    editor.outputSocketClicked(p);
                }
            }
        }

        /*
         * // IF EDITABLE
         * EditorGUI.BeginChangeCheck ();
         * p.isOpen = EditorGUI.Foldout (new Rect (pRect.x , cur_y, 20, lineHgt), p.isOpen, "");
         * if(EditorGUI.EndChangeCheck())
         * {
         *      if (p.isOpen )
         *      {
         *              foreach(AXParameter pop in p.parametricObject.parameters)
         *                      if (pop != p)
         *                              pop.isOpen = false;
         *      }
         * }
         */

        // LABEL
        Rect boxRect = new Rect(cur_x + ArchimatixUtils.indent, cur_y, box_w, pRect.height);
        Rect lRect   = boxRect;

        lRect.x     += 3;
        lRect.width -= 10;

        GUIStyle labelstyle = GUI.skin.GetStyle("Label");

        labelstyle.alignment = TextAnchor.MiddleLeft;

        if (p.PType == AXParameter.ParameterType.Output)
        {
            labelstyle.alignment  = TextAnchor.MiddleRight;
            labelstyle.fixedWidth = lRect.width - 13;
        }

        GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " ");


        //Debug.Log(p.Name + " - " + p.ParentNode+ " - " + p.ParentNode.Name);

        string label = p.Name;


        GUI.Label(lRect, label);



        GUI.Label(new Rect(10, 40, 100, 40), GUI.tooltip);

        cur_y += lineHgt + gap;



        GUI.backgroundColor = oldBackgroundColor;

        return(cur_y);
    }
コード例 #4
0
    public static int display(Rect pRect, AXNodeGraphEditorWindow editor, AXParameter p)
    {
        //Debug.Log("ParameterTextureGUI.DISPLAY "+p.Name);
        float cur_x = ArchimatixUtils.cur_x;
        //float box_w = ArchimatixUtils.paletteRect.width - cur_x - 3*ArchimatixUtils.indent;
        float box_w = pRect.width - cur_x - 1 * ArchimatixUtils.indent;

        int cur_y   = (int)pRect.y;
        int lineHgt = (int)pRect.height;
        int gap     = 5;



        //Color shapeColor = editor.getDataColor (AXParameter.DataType.Spline);

        Color dataColor = editor.getDataColor(p.Type);

        Color oldBackgroundColor = GUI.backgroundColor;

        GUI.backgroundColor = dataColor;


        // INPUT
        if (editor.OutputParameterBeingDragged == null || editor.OutputParameterBeingDragged.Type == p.Type)
        {
            if (p.PType != AXParameter.ParameterType.Output)
            {
                if (GUI.Button(new Rect(-3, cur_y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize), ""))
                {
                    if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != p.Type)
                    {
                        editor.OutputParameterBeingDragged = null;
                    }
                    else
                    {
                        editor.inputSocketClicked(p);
                    }
                }
            }
        }


        // OUTPUT

        if (editor.InputParameterBeingDragged == null || editor.InputParameterBeingDragged.Type == AXParameter.DataType.MaterialTool)
        {
            if (GUI.Button(new Rect(pRect.width + 6, cur_y, ArchimatixEngine.buttonSize, ArchimatixEngine.buttonSize), ""))
            {
                if (editor.InputParameterBeingDragged != null && editor.InputParameterBeingDragged.Type != p.Type)
                {
                    editor.InputParameterBeingDragged = null;
                }
                else
                {
                    editor.outputSocketClicked(p);
                }
            }
        }



        // LABEL BOX
        Rect boxRect = new Rect(cur_x + ArchimatixUtils.indent, cur_y, box_w, pRect.height);

        GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " ");


        // LABEL
        Rect lRect = boxRect;

        lRect.x     += 3;
        lRect.width -= 10;
        GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " "); GUI.Box(boxRect, " ");

        GUIStyle labelstyle = GUI.skin.GetStyle("Label");

        labelstyle.alignment = TextAnchor.MiddleLeft;
        if (p.PType == AXParameter.ParameterType.Output)
        {
            labelstyle.alignment  = TextAnchor.MiddleRight;
            labelstyle.fixedWidth = lRect.width + 5;
        }

        string label = p.Name;

        if (p.ParentNode != null && p.ParentNode is AXShape)
        {
            if (p.DependsOn != null)
            {
                if (p.DependsOn.Parent != null)
                {
                    label = p.DependsOn.Parent.Name;
                }
            }
        }

        GUI.Label(lRect, label);



        // Texture Thumbnail
        AXParameter        src_p  = p.DependsOn;
        AXParametricObject src_po = null;

        if (src_p != null)
        {
            src_po = src_p.parametricObject;
        }

        Rect texThumbRect;

        if (src_po != null)
        {
            if (src_po.generator is MaterialTool && src_po.axMat.mat != null && src_po.axMat.mat.mainTexture != null)
            {
                texThumbRect = new Rect((boxRect.x + boxRect.width - lineHgt + 1), cur_y + 1, lineHgt - 2, lineHgt - 2);
                EditorGUI.DrawTextureTransparent(texThumbRect, src_po.axMat.mat.mainTexture, ScaleMode.ScaleToFit, 1.0F);
            }
            else
            {
                texThumbRect = new Rect((boxRect.x + boxRect.width - lineHgt + 1), cur_y + 1, lineHgt - 2, lineHgt - 2);
                EditorGUI.DrawTextureTransparent(texThumbRect, ArchimatixEngine.nodeIcons[p.Type.ToString()], ScaleMode.ScaleToFit, 1.0F);
            }
        }
        else if (src_po == null)
        {
            if (src_p != null)
            {
                texThumbRect = new Rect((boxRect.x + boxRect.width - lineHgt + 1), cur_y + 1, lineHgt - 2, lineHgt - 2);
                EditorGUI.DrawTextureTransparent(texThumbRect, ArchimatixEngine.nodeIcons[p.Type.ToString()], ScaleMode.ScaleToFit, 1.0F);
            }
            else
            {
                // NEW TOOL

                texThumbRect = new Rect((boxRect.x + boxRect.width - lineHgt), cur_y - 1, lineHgt, lineHgt);

                if (GUI.Button(texThumbRect, ArchimatixEngine.nodeIcons[p.Type.ToString()]))                   //"+"))
                {
                    src_po             = AXEditorUtilities.addNodeToCurrentModel(p.Type.ToString());
                    src_po.Name        = Regex.Replace(p.Name, @"\s+", "");                     // remove spaces
                    src_po.rect.x      = p.parametricObject.rect.x - 220;
                    src_po.rect.y      = p.parametricObject.rect.y + 50;
                    src_po.rect.height = 500;


                    if (p.parametricObject.model.currentWorkingGroupPO != null)
                    {
                        p.parametricObject.model.currentWorkingGroupPO.addGroupee(src_po);
                    }
                    else
                    {
                        src_po.grouper    = null;
                        src_po.grouperKey = null;
                    }



                    //AXNodeGraphEditorWindow.zoomToRectIfOpen(src_po.rect);
                    //src_po.inputControls.isOpen = true;

                    src_po.geometryControls.isOpen = true;

                    src_po.generator.pollInputParmetersAndSetUpLocalReferences();

                    //Debug.Log("here " + src_po.getParameter("Output"));

                    p.makeDependentOn(src_po.getParameter("Output"));

                    p.parametricObject.model.remapMaterialTools();

                    p.parametricObject.isAltered = true;
                    p.parametricObject.model.autobuild();
                }
            }
        }



        /*
         * // FOLDOUT (isOpen)
         * GUI.backgroundColor = new Color(1,1,1,1f);
         *
         * EditorGUI.BeginChangeCheck ();
         * p.isOpen = EditorGUI.Foldout (new Rect (cur_x, cur_y, 55, lineHgt), p.isOpen, "");
         * if (EditorGUI.EndChangeCheck ())
         * {
         *      if (src_p == null)
         *      {
         *              src_po = AXEditorUtilities.addNodeToCurrentModel(p.Type.ToString(), false);
         *              src_po.Name = Regex.Replace(p.Name, @"\s+", "");	// remove spaces
         *              src_po.rect.x = p.parametricObject.rect.x - 200;
         *              src_po.rect.y = p.parametricObject.rect.y + 50;
         *              src_po.isOpen = false;
         *              p.makeDependentOn(src_po.generator.P_Output);
         *              p.parametricObject.model.autobuild();
         *      }
         * }
         * GUI.backgroundColor = shapeColor;
         *
         * if (p.DependsOn == null)
         *      p.isOpen = false;
         *
         * cur_y += lineHgt+gap;
         *
         * if (p.isOpen)
         * {
         *
         *
         *
         *      //Archimatix.cur_x += Archimatix.indent;
         *      p.drawClosed = false;
         *
         *      Rect tRect = pRect;
         *      tRect.x = 20;//30;
         *      tRect.width = pRect.width;
         *      tRect.x += 2;
         *      tRect.width -= 11;
         *
         *      if (! src_po.isOpen)
         *      {
         *      foreach (AXParameter sp in src_po.getAllParametersOfPType(AXParameter.ParameterType.GeometryControl))
         *      {
         *
         *
         *
         *
         *
         *              tRect.y = cur_y;
         *              Rect cntlRect = tRect; // new Rect(x0, cur_y, wid, 16);
         *
         *
         *              int hgt = ParameterGUI.OnGUI(cntlRect, editor, sp);
         *
         *              cur_y += hgt + gap;
         *      }
         *      }
         *
         *
         *
         *
         *
         *
         *
         *
         *
         *      //Archimatix.cur_x -= Archimatix.indent;
         *
         *
         *
         * }
         */
        cur_y += lineHgt + gap;

        GUI.backgroundColor = oldBackgroundColor;

        return(cur_y);
    }
コード例 #5
0
        // return the height of this gui area
        public static void OnGUI(int win_id, AXNodeGraphEditorWindow editor, AXParametricObject po)
        {
            Event e = Event.current;

            AXModel model = editor.model;


            AXParameter p;

            string buttonLabel;
            Rect   buttonRect;

            Color inactiveColor = new Color(.7f, .7f, .7f);


            Color oldBackgroundColor = GUI.backgroundColor;



            // START LAYOUT OF INNER PALETTE


            // Horizontal layput
            float winMargin  = ArchimatixUtils.indent;
            float innerWidth = po.rect.width - 2 * winMargin;



            int x1 = 10;
            int x2 = 20;

            // vertical layut
            int cur_y   = 25;
            int gap     = ArchimatixUtils.gap;
            int lineHgt = ArchimatixUtils.lineHgt;


//		if (EditorGUIUtility.isProSkin)
//		{
//			GUI.color = po.generator.GUIColorPro;
//			GUI.backgroundColor = Color.Lerp(po.generator.GUIColorPro, Color.white, .5f) ;
//		}
//		else
//		{
//			GUI.color = po.generator.GUIColor;
//			GUI.backgroundColor = Color.Lerp(po.generator.GUIColor, Color.white, .5f) ;
//
//		}



            // DRAW HIGHLIGHT AROUND SELECTED NODE PALETTE
            if (model.isSelected(po))
            {
                float pad     = (EditorGUIUtility.isProSkin) ? 1 : 1;
                Rect  outline = new Rect(0, 0, po.rect.width - pad, po.rect.height - pad);
                Handles.color = Color.white;

                Handles.DrawSolidRectangleWithOutline(outline, new Color(1, 1, 1, 0f), ArchimatixEngine.AXGUIColors ["NodePaletteHighlightRect"]);
                //Handles.DrawSolidRectangleWithOutline(outline, new Color(.1f, .1f, .3f, .05f), new Color(.1f, .1f, .8f, 1f));
            }


            // TITLE

            if (GUI.Button(new Rect(x1, cur_y, innerWidth - lineHgt * 2 - 6, lineHgt * 2), po.Name))
            {
//				po.isEditing = true;
//				for (int i = 0; i < po.parameters.Count; i++) {
//					p = po.parameters [i];
//					p.isEditing = false;
//				}
                po.isMini = false;
            }


            if (ArchimatixEngine.nodeIcons.ContainsKey(po.Type))
            {
                EditorGUI.DrawTextureTransparent(new Rect(x1 + innerWidth - lineHgt * 2 - 4, cur_y, lineHgt * 2, lineHgt * 2), ArchimatixEngine.nodeIcons [po.Type], ScaleMode.ScaleToFit, 1.0F);
            }


            cur_y += lineHgt + 2 * gap;



            // DO THUMBNAIL / DROP_ZONE



            int bottomPadding    = 55;
            int splineCanvasSize = (int)(po.rect.width - 60);

            editor.mostRecentThumbnailRect = new Rect(x1, cur_y + lineHgt, innerWidth, innerWidth);

            Rect lowerRect = new Rect(0, cur_y - 50, po.rect.width, po.rect.width);


            if (po.thumbnailState == ThumbnailState.Open)
            {
                //if (po.Output != null && po.Output.Type == AXParameter.DataType.Spline)
                if (po.is2D())
                {
                    AXParameter output_p = po.generator.getPreferredOutputParameter();
                    if (po.generator.hasOutputsReady())
                    {
                        if (ArchimatixEngine.nodeIcons.ContainsKey("Blank"))
                        {
                            EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, ArchimatixEngine.nodeIcons ["Blank"], ScaleMode.ScaleToFit, 1.0F);
                        }

                        Color color = po.thumbnailLineColor;

                        if (color.Equals(Color.clear))
                        {
                            color = Color.magenta;
                        }

                        GUIDrawing.DrawPathsFit(output_p, new Vector2(po.rect.width / 2, cur_y + po.rect.width / 2), po.rect.width - 60, ArchimatixEngine.AXGUIColors ["ShapeColor"]);
                    }
                    else if (ArchimatixEngine.nodeIcons.ContainsKey(po.Type.ToString()))
                    {
                        EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, ArchimatixEngine.nodeIcons [po.Type], ScaleMode.ScaleToFit, 1.0F);
                    }
                }
                else
                {
                    //Debug.Log ("po.renTex.IsCreated()="+po.renTex.IsCreated());

                    //Debug.Log (po.renTex + " :::::::::::::::::::::::--::



                    if (po.generator is PrefabInstancer && po.prefab != null)
                    {
                        Texture2D thumber = AssetPreview.GetAssetPreview(po.prefab);
                        if (e.type == EventType.Repaint)
                        {
                            if (thumber != null)
                            {
                                EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, thumber, ScaleMode.ScaleToFit, 1.0F);
                            }
                            else
                            {
                                EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, ArchimatixEngine.nodeIcons [po.Type], ScaleMode.ScaleToFit, 1.0F);
                            }
                        }
                    }
                    else if (((po.Output != null && po.Output.meshes != null && po.Output.meshes.Count > 0) || po.generator is MaterialTool) && (po.renTex != null || po.thumbnail != null))
                    {                   //if ( po.thumbnail != null )
                        //Debug.Log("thumb " + po.renTex);
                        if (e.type == EventType.Repaint)
                        {
                            EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, po.renTex, ScaleMode.ScaleToFit, 1.0F);


                            // DROP ZONE

                            if (po.generator is Grouper && editor.editorState == AXNodeGraphEditorWindow.EditorState.DraggingNodePalette && editor.mouseIsDownOnPO != po && po != model.currentWorkingGroupPO)
                            {
                                if (editor.mostRecentThumbnailRect.Contains(e.mousePosition))
                                {
                                    EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, editor.dropZoneOverTex, ScaleMode.ScaleToFit, 1.0F);
                                    editor.OverDropZoneOfPO = po;
                                }
                                else
                                {
                                    EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, editor.dropZoneTex, ScaleMode.ScaleToFit, 1.0F);
                                }
                            }
                        }
                        //else
                        //	GUI.DrawTexture(editor.mostRecentThumbnailRect, po.thumbnail, ScaleMode.ScaleToFit, false, 1.0F);



                        if (editor.mostRecentThumbnailRect.Contains(e.mousePosition) || editor.draggingThumbnailOfPO == po)
                        {
                            Rect orbitButtonRect = new Rect(x1 + innerWidth - 16 - 3, cur_y + lineHgt + 3, 16, 16);

                            if (e.command || e.control)
                            {
                                EditorGUI.DrawTextureTransparent(orbitButtonRect, editor.dollyIconTex);
                            }
                            else
                            {
                                EditorGUI.DrawTextureTransparent(orbitButtonRect, editor.orbitIconTex);
                            }


                            if (e.type == EventType.MouseDown && orbitButtonRect.Contains(e.mousePosition))
                            {
                                model.selectOnlyPO(po);
                                editor.draggingThumbnailOfPO = po;
                                e.Use();
                            }
                        }
                    }
                    else if (ArchimatixEngine.nodeIcons.ContainsKey(po.Type.ToString()))
                    {
                        EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, ArchimatixEngine.nodeIcons [po.Type], ScaleMode.ScaleToFit, 1.0F);

                        // DROP ZONE

                        if (po.generator is Grouper && editor.editorState == AXNodeGraphEditorWindow.EditorState.DraggingNodePalette && editor.mouseIsDownOnPO != po && po != model.currentWorkingGroupPO)
                        {
                            if (editor.mostRecentThumbnailRect.Contains(e.mousePosition))
                            {
                                EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, editor.dropZoneOverTex, ScaleMode.ScaleToFit, 1.0F);
                                editor.OverDropZoneOfPO = po;
                            }
                            else
                            {
                                EditorGUI.DrawTextureTransparent(editor.mostRecentThumbnailRect, editor.dropZoneTex, ScaleMode.ScaleToFit, 1.0F);
                            }
                        }
                    }
                }

                cur_y += lineHgt + bottomPadding + splineCanvasSize + gap;

                po.rect.height = cur_y;
                cur_y         += 4 * gap;
            }
            else
            {
                // no thumbnail
                cur_y         += 2 * lineHgt;
                po.rect.height = cur_y;
            }



            // INLETS
            // INPUT ITEMS
            // Parameter Lines

            //for (int i=0; i<po.parameters.Count; i++) {
            if ((po.inputControls != null && po.inputControls.children != null))
            {
                for (int i = 0; i < po.inputControls.children.Count; i++)
                {
                    p = (AXParameter)po.inputControls.children [i];


                    if (p.PType != AXParameter.ParameterType.Input)
                    {
                        continue;
                    }


                    //if ( p.DependsOn != null && !p.DependsOn.Parent.isOpen && ! p.Name.Contains ("External"))
                    //	continue;


                    //if (parametricObjects_Property != null)
                    if (model.parametricObjects != null)
                    {
                        // these points are world, not rlative to the this GUIWindow
                        p.inputPoint  = new Vector2(po.rect.x, po.rect.y + 100);
                        p.outputPoint = new Vector2(po.rect.x + po.rect.width, po.rect.y + cur_y + lineHgt / 2);
                    }
                }
            }



            // OUTLETS

            if (po.outputsNode != null)
            {
                for (int i = 0; i < po.outputsNode.children.Count; i++)
                {
                    p = (AXParameter)po.outputsNode.children [i];

                    if (p == null)
                    {
                        continue;
                    }

                    //if (p.hasInputSocket || ! p.hasOutputSocket)
                    if (p.PType != AXParameter.ParameterType.Output)
                    {
                        continue;
                    }


                    //if (parametricObjects_Property != null)
                    if (model.parametricObjects != null)
                    {
                        // these points are world, not relative to the this GUIWindow
                        p.inputPoint  = new Vector2(po.rect.x, po.rect.y + cur_y + lineHgt / 2);
                        p.outputPoint = new Vector2(po.rect.x + po.rect.width, po.rect.y + po.rect.width);


                        Rect pRect = new Rect(x1, cur_y, innerWidth, lineHgt);


                        //if (parameters_Property.arraySize > i)
                        if (po.parameters != null && po.parameters.Count > i)
                        {
                            int hgt = 0;

                            if (po.is2D())
                            {
                                hgt   = ParameterSplineGUI.OnGUI_Spline(pRect, editor, p);
                                cur_y = hgt + gap;
                            }
                            else
                            {
                                //hgt = ParameterGUI.OnGUI (pRect, editor, p);
                                //cur_y += hgt + gap;

                                Color dataColor = editor.getDataColor(p.Type);

                                // PERSONAL
                                if (!EditorGUIUtility.isProSkin)
                                {
                                    dataColor = new Color(dataColor.r, dataColor.b, dataColor.g, .3f);
                                }

                                GUI.color = dataColor;

                                buttonLabel = (editor.OutputParameterBeingDragged == p) ? "-" : "";
                                buttonRect  = new Rect(p.Parent.rect.width - pRect.height - 10, p.Parent.rect.width - 10, 2 * ArchimatixEngine.buttonSize, 2 * ArchimatixEngine.buttonSize);

                                // button color
                                if (editor.InputParameterBeingDragged != null)
                                {
                                    if (editor.InputParameterBeingDragged.Type != p.Type)
                                    {
                                        GUI.backgroundColor = inactiveColor;
                                    }
                                    else if (buttonRect.Contains(Event.current.mousePosition))
                                    {
                                        GUI.backgroundColor = Color.white;
                                    }
                                }
                                else if (editor.OutputParameterBeingDragged != null)
                                {
                                    if (editor.OutputParameterBeingDragged == p)
                                    {
                                        GUI.backgroundColor = Color.white;
                                    }
                                    else
                                    {
                                        GUI.backgroundColor = inactiveColor;
                                    }
                                }


                                if (GUI.Button(buttonRect, buttonLabel))
                                {
                                    if (editor.InputParameterBeingDragged != null && editor.InputParameterBeingDragged.Type != p.Type)
                                    {
                                        editor.InputParameterBeingDragged = null;
                                    }
                                    else
                                    {
                                        editor.outputSocketClicked(p);
                                    }
                                }
                            }
                        }
                    }
                }
            }



            // FOOTER //



            // STATS
            if (po.stats_VertCount > 0 || po.generator is MaterialTool)
            {
                string statsText;

                if (po.generator is MaterialTool)
                {
                    statsText = (po.generator as MaterialTool).texelsPerUnit.ToString("F0") + " Texels/Unit";
                }
                else
                {
                    statsText = po.stats_VertCount + " verts";

                    if (po.stats_TriangleCount > 0)
                    {
                        statsText += ", " + po.stats_TriangleCount + " tris";
                    }
                }

                GUIStyle   statlabelStyle        = GUI.skin.GetStyle("Label");
                TextAnchor prevStatTextAlignment = statlabelStyle.alignment;
                statlabelStyle.alignment    = TextAnchor.MiddleLeft;
                EditorGUIUtility.labelWidth = 500;
                GUI.Label(new Rect(10, po.rect.height - x2 + 2, 500, lineHgt), statsText);
                statlabelStyle.alignment = prevStatTextAlignment;
            }



            if (e.type == EventType.MouseDown && lowerRect.Contains(e.mousePosition))
            {
                editor.clearFocus();
                GUI.FocusWindow(po.guiWindowId);
            }

            // WINDOW RESIZE
            buttonRect = new Rect(po.rect.width - 16, po.rect.height - 17, 14, 14);
            if (e.type == EventType.MouseDown && buttonRect.Contains(e.mousePosition))
            {
                Undo.RegisterCompleteObjectUndo(model, "GUI Window Resize");

                editor.editorState             = AXNodeGraphEditorWindow.EditorState.DragResizingNodePalleteWindow;
                editor.DraggingParameticObject = po;
            }
            //GUI.Button ( buttonRect, "∆", GUIStyle.none);
            GUI.Button(buttonRect, editor.resizeCornerTexture, GUIStyle.none);


            if (e.type == EventType.MouseDown && buttonRect.Contains(e.mousePosition))
            {
            }

            //cur_y += lineHgt + gap;

            // Window title bar is the dragable area
            //GUI.DragWindow(headerRect);

            if (editor.draggingThumbnailOfPO == null || editor.draggingThumbnailOfPO != po)
            {
                GUI.DragWindow();
            }
        }
コード例 #6
0
    public static int OnGUI(Rect pRect, AXNodeGraphEditorWindow editor, AXShape shp)
    {
        Color shapeColor = editor.getDataColor(AXParameter.DataType.Spline);

        Color origBG = GUI.backgroundColor;


        //Rect pRect = new Rect(x1+12, cur_y, width-20,lineHgt);
        float cur_x = ArchimatixUtils.cur_x;
        //float box_x = cur_x + ArchimatixUtils.indent;
        float box_w = ArchimatixUtils.paletteRect.width - cur_x - 3 * ArchimatixUtils.indent;



        int x1      = (int)pRect.x - ArchimatixUtils.indent;
        int cur_y   = (int)pRect.y;
        int width   = (int)pRect.width;
        int lineHgt = ArchimatixUtils.lineHgt;
        int gap     = 5;

        Rect boxRect = pRect;

        boxRect = new Rect(cur_x + ArchimatixUtils.indent, cur_y, box_w, ArchimatixUtils.lineHgt);

        Rect lRect = new Rect(x1 + 11, cur_y, 50, lineHgt);

        if (!shp.isOpen && shp.inputs != null)
        {
            foreach (AXParameter sp in  shp.inputs)
            {
                sp.inputPoint  = new Vector2(ArchimatixUtils.paletteRect.x, ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
                sp.outputPoint = new Vector2(ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width, ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
            }
        }



        // Header
        //EditorGUI.BeginChangeCheck();

        //GUI.Button(pRect, Name);
        GUI.color = Color.white;

        GUI.backgroundColor = shapeColor;



        //
        shp.isOpen = true;

        if (shp.isOpen)
        {
            /*  INPUTS
             */


            GUIStyle labelstyle = GUI.skin.GetStyle("Label");
            labelstyle.alignment  = TextAnchor.MiddleLeft;
            labelstyle.fixedWidth = 100;
            labelstyle.fontSize   = 12;

            //Rect boxRect = new Rect (x1 + 22, cur_y, width - 38, lineHgt);
            //Rect editRect = new Rect (x1 + 22, cur_y, width - 38, lineHgt);


            //Archimatix.cur_x += Archimatix.indent;
            // INPUT SHAPE PARAMETERS
            for (int i = 0; i < shp.inputs.Count; i++)
            {
                AXParameter sp = shp.inputs [i];

                sp.inputPoint  = new Vector2(ArchimatixUtils.paletteRect.x, ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
                sp.outputPoint = new Vector2(ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width, ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);

                cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width, lineHgt), editor, sp);
            }
            //Archimatix.cur_x -= Archimatix.indent;

            // Empty / New SHAPE PARAMETER

            if (editor.OutputParameterBeingDragged != null && editor.OutputParameterBeingDragged.Type != AXParameter.DataType.Spline)
            {
                GUI.enabled = false;
            }

            if (GUI.Button(new Rect(-3, cur_y, lineHgt, lineHgt), ""))
            {
                //Debug.Log ("make shape 2");
                AXParameter new_p = shp.addInput();
                editor.inputSocketClicked(new_p);
                editor.OutputParameterBeingDragged = null;
            }

            GUI.enabled = true;

            boxRect = new Rect(x1 + 11, cur_y, width - 38, lineHgt);
            GUI.Box(boxRect, " ");
            GUI.Box(boxRect, " ");
            //boxRect.x += 10;
            GUI.Label(boxRect, "Empty Shape");


            cur_y += lineHgt + gap;


            //cur_y += 2*gap;



            //Rect bRect = boxRect;

            lRect.y = cur_y;


            /*  SPECIFIC OUTPUT  PARAMETERS
             */
            //lRect.y = cur_y;
            //GUI.Label(lRect, "Output Combinations");
            cur_y += gap;

            //Archimatix.cur_x += Archimatix.indent;

            GUI.color           = Color.white;
            GUI.backgroundColor = Color.white;

            //Rect foldRect = new Rect(ArchimatixUtils.indent*2, cur_y, 30,lineHgt);


            //outputParametersOpen = EditorGUI.Foldout(foldRect, outputParametersOpen, "Merge Results");



            /*
             * if (false && shp.outputParametersOpen)
             * {
             *      cur_y += lineHgt;
             *      ArchimatixUtils.cur_x += ArchimatixUtils.indent;
             *
             *      bool tmp_boolval;
             *      bRect.x = ArchimatixUtils.indent*3+4;//width-lineHgt;
             *
             *
             *      // difference
             *      shp.difference.inputPoint   = new Vector2 (ArchimatixUtils.paletteRect.x,                                   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      shp.difference.outputPoint  = new Vector2 (ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width,   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      bRect.y = cur_y-2;
             *      lRect.y = cur_y;
             *
             *      cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width,lineHgt), editor, shp.difference);
             *
             *      tmp_boolval = (shp.combineType == AXShape.CombineType.Difference);
             *      EditorGUI.BeginChangeCheck ();
             *      tmp_boolval = EditorGUI.Toggle (bRect, "",  tmp_boolval);
             *      if (EditorGUI.EndChangeCheck ()) {
             *              Undo.RegisterCompleteObjectUndo (shp.Parent.model, "value change for combineType" );
             *              shp.combineType = AXShape.CombineType.Difference;
             *              shp.parametricObject.model.autobuild();
             *      }
             *
             *      // difference
             *      shp.differenceRail.inputPoint   = new Vector2 (ArchimatixUtils.paletteRect.x,                                   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      shp.differenceRail.outputPoint  = new Vector2 (ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width,   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *
             *      bRect.y = cur_y-2;
             *
             *      cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width, lineHgt), editor, shp.differenceRail);
             *
             *      tmp_boolval = (shp.combineType == AXShape.CombineType.DifferenceRail);
             *      EditorGUI.BeginChangeCheck ();
             *      tmp_boolval = EditorGUI.Toggle (bRect, "",  tmp_boolval);
             *      if (EditorGUI.EndChangeCheck ()) {
             *              Undo.RegisterCompleteObjectUndo (shp.Parent.model, "value change for combineType" );
             *              shp.combineType = AXShape.CombineType.DifferenceRail;
             *              shp.parametricObject.model.autobuild();
             *      }
             *
             *      cur_y += gap;
             *
             *
             *
             *      // INTERSECTION
             *      shp.intersection.inputPoint     = new Vector2 (ArchimatixUtils.paletteRect.x,                                   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      shp.intersection.outputPoint    = new Vector2 (ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width,   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      bRect.y = cur_y-2;
             *
             *      cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width, lineHgt), editor, shp.intersection);
             *
             *      tmp_boolval = (shp.combineType == AXShape.CombineType.Intersection);
             *      EditorGUI.BeginChangeCheck ();
             *      tmp_boolval = EditorGUI.Toggle (bRect, "",  tmp_boolval);
             *      if (EditorGUI.EndChangeCheck ()) {
             *              Undo.RegisterCompleteObjectUndo (shp.Parent.model, "value change for combineType" );
             *              Debug.Log("YA");
             *              shp.combineType = AXShape.CombineType.Intersection;
             *              shp.parametricObject.model.autobuild();
             *      }
             *
             *
             *      // INTERSECTION_RAIL
             *      shp.intersectionRail.inputPoint     = new Vector2 (ArchimatixUtils.paletteRect.x,                                   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      shp.intersectionRail.outputPoint    = new Vector2 (ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width,   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      bRect.y = cur_y-2;
             *
             *      cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width, lineHgt), editor, shp.intersectionRail);
             *
             *      tmp_boolval = (shp.combineType == AXShape.CombineType.IntersectionRail);
             *      EditorGUI.BeginChangeCheck ();
             *      tmp_boolval = EditorGUI.Toggle (bRect, "",  tmp_boolval);
             *      if (EditorGUI.EndChangeCheck ()) {
             *              Undo.RegisterCompleteObjectUndo (shp.Parent.model, "value change for combineType" );
             *              shp.combineType = AXShape.CombineType.IntersectionRail;
             *              shp.parametricObject.model.autobuild();
             *      }
             *
             *      cur_y += gap;
             *
             *
             *
             *      // union
             *      shp.union.inputPoint    = new Vector2 (ArchimatixUtils.paletteRect.x,                                   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      shp.union.outputPoint   = new Vector2 (ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width,   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      bRect.y = cur_y-2;
             *
             *      cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width, lineHgt), editor, shp.union);
             *
             *      tmp_boolval = (shp.combineType == AXShape.CombineType.Union);
             *      EditorGUI.BeginChangeCheck ();
             *      tmp_boolval = EditorGUI.Toggle (bRect, "",  tmp_boolval);
             *      if (EditorGUI.EndChangeCheck ()) {
             *              Undo.RegisterCompleteObjectUndo (shp.Parent.model, "value change for combineType" );
             *              shp.combineType = AXShape.CombineType.Union;
             *              shp.parametricObject.model.autobuild();
             *      }
             *
             *      cur_y += gap;
             *
             *
             *
             *      // grouped
             *      if (shp.grouped == null || shp.grouped.Type == AXParameter.DataType.Float)
             *              shp.grouped             = shp.createSplineParameter(AXParameter.ParameterType.Output, "Grouped");
             *
             *      shp.grouped.inputPoint  = new Vector2 (ArchimatixUtils.paletteRect.x,                                   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      shp.grouped.outputPoint     = new Vector2 (ArchimatixUtils.paletteRect.x + ArchimatixUtils.paletteRect.width,   ArchimatixUtils.paletteRect.y + cur_y + lineHgt / 2);
             *      bRect.y = cur_y-2;
             *
             *      cur_y = ParameterSplineGUI.OnGUI_Spline(new Rect(x1, cur_y, width, lineHgt), editor, shp.grouped);
             *
             *      tmp_boolval = (shp.combineType == AXShape.CombineType.Grouped);
             *      EditorGUI.BeginChangeCheck ();
             *      tmp_boolval = EditorGUI.Toggle (bRect, "",  tmp_boolval);
             *      if (EditorGUI.EndChangeCheck ()) {
             *              Undo.RegisterCompleteObjectUndo (shp.Parent.model, "value change for combineType" );
             *              shp.combineType = AXShape.CombineType.Grouped;
             *              shp.parametricObject.model.autobuild();
             *      }
             *
             *
             *
             *
             *      ArchimatixUtils.cur_x -= ArchimatixUtils.indent;
             *
             *
             * }
             */
            //Archimatix.cur_x -= Archimatix.indent;
            //cur_y += lineHgt;
        }


        GUI.backgroundColor = origBG;

        return(cur_y);
    }     // OnGUI