Пример #1
0
        public void Draw(int yPos, int height)
        {
            rect.y      = yPos;
            rect.height = height;
            rect.width  = 7;

            GUI.Box(rect, "", EditorStyles.textField);
            Rect rHandle = new Rect(rect);

            rHandle.xMin += 0;
            rHandle.xMax -= 0;
            Rect uv = new Rect(rect);

            uv.x       = 0;
            uv.y       = 0;
            uv.width   = 1;
            uv.height /= SF_GUI.Handle_drag.height;
            GUI.DrawTextureWithTexCoords(rHandle, SF_GUI.Handle_drag, uv);

            if (rect.Contains(Event.current.mousePosition) || dragging)
            {
                SF_GUI.AssignCursor(rect, MouseCursor.ResizeHorizontal);
            }

            if (Event.current.isMouse)
            {
                if (SF_GUI.ReleasedRawLMB())
                {
                    StopDrag();
                }
                if (dragging)
                {
                    UpdateDrag();
                }
                if (SF_GUI.PressedLMB(rect))
                {
                    StartDrag();
                }
            }
        }
Пример #2
0
        public void OnLocalGUI(Rect r)
        {
            //r = r.PadTop(Mathf.CeilToInt(22*zoom));



            editor.mousePosition = Event.current.mousePosition;
            rect = r;



            // TOOLBAR
            //DrawToolbar( new Rect( rect.x, rect.y, rect.width, TOOLBAR_HEIGHT ) );



            Rect localRect = new Rect(r);

            localRect.x = 0;
            localRect.y = 0;

            //rect.y += TOOLBAR_HEIGHT;
            //rect.height -= TOOLBAR_HEIGHT;



            // VIEW
            Rect rectInner = new Rect(rect);

            rectInner.width  = float.MaxValue / 2f;
            rectInner.height = float.MaxValue / 2f;


            // TEMP:
            //			Rect btn = rectInner;
            //			btn.width = 64;
            //			btn.height = 24;
            //			if(SF_Debug.renderDataNodes){
            //				if(selection.Selection.Count > 0){
            //					if(GUI.Button(btn,"NSS")){
            //						editor.TakeNodePreviewScreenshot();
            //					}
            //				}
            //			}



            if (Event.current.type == EventType.Repaint)
            {
                nodeSpaceMousePos = ScreenSpaceToZoomSpace(Event.current.mousePosition);
            }



            bool mouseOverNode = false;



            SF_ZoomArea.Begin(zoom, rect, cameraPos);
            {
                selection.OnGUI(); // To detect if you press things
                if (editor.nodeView != null)
                {
                    editor.nodeView.selection.DrawBoxSelection();
                }

                if (Event.current.type == EventType.Repaint)
                {
                    viewSpaceMousePos = ZoomSpaceToScreenSpace(Event.current.mousePosition);
                }
                // NODES
                if (editor.nodes != null)
                {
                    // If we're repainting, draw in reverse to sort properly
                    //if(Event.current.rawType == EventType.repaint){
                    for (int i = editor.nodes.Count - 1; i >= 0; i--)
                    {
                        if (!editor.nodes[i].Draw())
                        {
                            break;
                        }
                    }

                    /*} else {
                     *                          for(int i=0;i<editor.nodes.Count;i++) {
                     *                                  if( !editor.nodes[i].Draw() )
                     *                                          break;
                     *                          }
                     *                  }*/

                    if (!mouseOverNode)
                    {
                        for (int i = 0; i < editor.nodes.Count; i++)
                        {
                            if (editor.nodes[i].MouseOverNode(world: true))
                            {
                                mouseOverNode = true;
                            }
                        }
                    }

                    if (Event.current.type == EventType.Repaint)
                    {
                        for (int i = 0; i < editor.nodes.Count; i++)
                        {
                            editor.nodes[i].DrawConnectors();
                        }
                    }
                }


                UpdateCutLine();

                UpdateCameraPanning();
            }
            SF_ZoomArea.End(zoom);


            if (!SF_Node.isEditingAnyNodeTextField)
            {
                SF_Editor.instance.UpdateKeyHoldEvents(mouseOverNode);
            }


            if (MouseInsideNodeView(false) && Event.current.type == EventType.ScrollWheel)
            {
                zoomTarget = ClampZoom(zoomTarget * (1f - Event.current.delta.y * 0.02f));
            }



            SetZoom(Mathf.Lerp(zoom, zoomTarget, 0.2f));



            if (Event.current.type == EventType.ContextClick && !SF_GUI.HoldingAlt())
            {
                Vector2 mousePos = Event.current.mousePosition;
                if (rect.Contains(mousePos))
                {
                    // Now create the menu, add items and show it
                    GenericMenu menu = new GenericMenu();

                    // First item is for creating a comment box
                    //menu.AddItem( new GUIContent("Create comment box"), false, ContextClick, mousePos );

                    //menu.AddSeparator("");

                    for (int i = 0; i < editor.nodeTemplates.Count; i++)
                    {
                        if (editor.ps.catLighting.renderPath == SFPSC_Lighting.RenderPath.Deferred && !editor.nodeTemplates[i].availableInDeferredPrePass)
                        {
                            continue; // Skip forward nodes when in deferred
                        }
                        menu.AddItem(new GUIContent(editor.nodeTemplates[i].fullPath), false, ContextClick, editor.nodeTemplates[i]);
                    }
                    editor.ResetRunningOutdatedTimer();
                    menu.ShowAsContext();
                    Event.current.Use();
                }
            }



            if (Event.current.type == EventType.DragPerform)
            {
                Object droppedObj = DragAndDrop.objectReferences[0];
                if (droppedObj is Texture2D || /*droppedObj is ProceduralTexture ||*/ droppedObj is RenderTexture)
                {
                    SFN_Tex2d texNode = editor.nodeBrowser.OnStopDrag() as SFN_Tex2d;
                    texNode.TextureAsset = droppedObj as Texture;
                    texNode.OnAssignedTexture();
                    Event.current.Use();
                }
                //if(droppedObj is ProceduralMaterial){
                //	OnDroppedSubstance(droppedObj as ProceduralMaterial);
                //}
            }

            if (Event.current.type == EventType.DragUpdated && Event.current.type != EventType.DragPerform)
            {
                if (DragAndDrop.objectReferences.Length > 0)
                {
                    Object dragObj = DragAndDrop.objectReferences[0];
                    if (dragObj is Texture2D || /*dragObj is ProceduralTexture || */ dragObj is RenderTexture)
                    {
                        DragAndDrop.visualMode = DragAndDropVisualMode.Link;
                        if (!editor.nodeBrowser.IsPlacing())
                        {
                            editor.nodeBrowser.OnStartDrag(editor.GetTemplate <SFN_Tex2d>());
                        }
                        else
                        {
                            editor.nodeBrowser.UpdateDrag();
                        }
                    }
                    //               else if(dragObj is ProceduralMaterial){
                    //	DragAndDrop.visualMode = DragAndDropVisualMode.Link;
                    //}
                    else
                    {
                        DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
                    }
                }
                else
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
                }
            }



            // If release
            if (MouseInsideNodeView(false) && Event.current.type == EventType.MouseUp)
            {
                bool ifCursorStayed = Vector2.SqrMagnitude(mousePosStart - Event.current.mousePosition) < SF_Tools.stationaryCursorRadius;

                if (ifCursorStayed && !SF_GUI.MultiSelectModifierHeld())
                {
                    selection.DeselectAll(registerUndo: true);
                }


                //editor.Defocus( deselectNodes: ifCursorStayed );
            }

            if (SF_GUI.ReleasedRawLMB())
            {
                SF_NodeConnector.pendingConnectionSource = null;
            }

            // If press
            if (Event.current.type == EventType.MouseDown && MouseInsideNodeView(false))
            {
                //bool ifNotHoldingModifier = !SF_GUI.MultiSelectModifierHeld();
                mousePosStart = Event.current.mousePosition;
                editor.Defocus();
            }


            if (!editor.screenshotInProgress)
            {
                Rect logoRect = rect;
                logoRect.y     -= 14;
                logoRect.x     += 1;
                logoRect.width  = SF_GUI.Logo.width;
                logoRect.height = SF_GUI.Logo.height;
                GUI.color       = new Color(1f, 1f, 1f, 0.5f);
                GUI.DrawTexture(logoRect, SF_GUI.Logo);

                logoRect.y     += logoRect.height;
                logoRect.height = 16;

                GUI.Label(logoRect, "v" + SF_Tools.version, EditorStyles.boldLabel);
                GUI.color = Color.white;
            }
        }
Пример #3
0
        public override void NeatWindow( )
        {
            GUI.BeginGroup(rect);
            GUI.color             = Color.white;
            GUI.skin.box.clipping = TextClipping.Overflow;



            // Resize handle
            int size = 10;



            Rect topLeft = LocalRect().GetBorder(RectBorder.TopLeft, size);
            //Rect lowerRight = LocalRect().GetBorder(RectBorder.BottomRight,size);
            Rect topRight = LocalRect().GetBorder(RectBorder.TopRight, size);

            Rect left = LocalRect().GetBorder(RectBorder.Left, size);
            //Rect lowerRight = LocalRect().GetBorder(RectBorder.Center,size);
            Rect right = LocalRect().GetBorder(RectBorder.Right, size);


            Rect lowerLeft  = LocalRect().GetBorder(RectBorder.BottomLeft, size);           //new Rect(rect.width - size, rect.height-size,size,size);
            Rect lower      = LocalRect().GetBorder(RectBorder.Bottom, size);
            Rect lowerRight = LocalRect().GetBorder(RectBorder.BottomRight, size);


            /*
             * if(!resizing)
             *      SF_GUI.AssignCursor(lowerRight,MouseCursor.ResizeUpLeft);
             * else
             *      SF_GUI.AssignCursor(new Rect(0,0,Screen.width,Screen.height),MouseCursor.ResizeUpLeft);*/



            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.TopLeft, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);
            //SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.Top			,size,  showResizeCursor:true), SF_GUI.Handle_drag, local:true );
            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.TopRight, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);
            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.Left, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);
            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.Right, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);
            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.BottomLeft, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);
            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.Bottom, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);
            SF_GUI.DrawTextureTiled(LocalRect().GetBorder(RectBorder.BottomRight, size, showResizeCursor: true), SF_GUI.Handle_drag, local: true);


            // -1 = left / top
            //  0 = static
            //  1 = right / bottom



#if UNITY_2018
            bool clicked = Event.current.type == EventType.MouseDown && Event.current.button == 0;
#else
            bool clicked = Event.current.type == EventType.mouseDown && Event.current.button == 0;
#endif



            if (clicked)
            {
                xDrag = 0;
                yDrag = 0;
                Vector3 mPos = Event.current.mousePosition;

                /*
                 * bool[,] dragGrid = new bool[3,3]{
                 *      {topLeft.Contains(mPos),		false,				topRight.Contains(mPos)},
                 *      {left.Contains(mPos),		false,					right.Contains(mPos)},
                 *      {lowerLeft.Contains(mPos),	lower.Contains(mPos),	lowerRight.Contains(mPos)}
                 * };*/

                bool[,] dragGrid = new bool[3, 3] {
                    { topLeft.Contains(mPos), left.Contains(mPos), lowerLeft.Contains(mPos) },
                    { false, false, lower.Contains(mPos) },
                    { topRight.Contains(mPos), right.Contains(mPos), lowerRight.Contains(mPos) }
                };



                bool leftSide   = dragGrid[0, 0] || dragGrid[0, 1] || dragGrid[0, 2];
                bool rightSide  = dragGrid[2, 0] || dragGrid[2, 1] || dragGrid[2, 2];
                bool topSide    = dragGrid[0, 0] || dragGrid[1, 0] || dragGrid[2, 0];
                bool bottomSide = dragGrid[0, 2] || dragGrid[1, 2] || dragGrid[2, 2];


                if (leftSide)
                {
                    xDrag = -1;
                }
                else if (rightSide)
                {
                    xDrag = 1;
                }

                if (topSide)
                {
                    yDrag = -1;
                }
                else if (bottomSide)
                {
                    yDrag = 1;
                }


                bool contained = xDrag != 0 || yDrag != 0;


                if (contained)
                {
                    resizing = true;
                    Event.current.Use();
                }
            }



#if UNITY_2018
            if (resizing && Event.current.type == EventType.MouseDrag)
            {
#else
            if (resizing && Event.current.type == EventType.mouseDrag)
            {
#endif

                if (Event.current.delta.sqrMagnitude > 0)
                {
                    UndoRecord("resize node");
                }

                if (xDrag == 1)
                {
                    rect.width += Event.current.delta.x;
                }
                else if (xDrag == -1)
                {
                    rect.xMin += Event.current.delta.x;
                }

                if (yDrag == 1)
                {
                    rect.height += Event.current.delta.y;
                }
                if (yDrag == -1)
                {
                    rect.yMin += Event.current.delta.y;
                }

                //Debug.Log("RESIZING X " + xDrag + " Y " + yDrag);

                ClampSize();

                Event.current.Use();
            }

            if (resizing && SF_GUI.ReleasedRawLMB())
            {
                resizing = false;
                xDrag    = 0;
                yDrag    = 0;
                if (base.isDragging)
                {
                    base.OnRelease();
                }
                Event.current.Use();
            }

            Rect insideHandleRect = LocalRect().PadLeft(size).PadRight(size).PadBottom(size).PadTop(Mathf.Max(15, size));
            DrawInner(insideHandleRect);

            /*
             * if( showColor ) {
             *
             *      texture.Draw( rectInner );
             *
             *      if( SF_Debug.nodes ) {
             *              Rect r = new Rect( 0, 16, 96, 20 );
             *              GUI.color = Color.white;
             *              GUI.skin.box.normal.textColor = Color.white;
             *              GUI.Box( r, "ID: " + id );
             *              r.y += r.height;
             *              //GUI.Box( r, "Cmps: " + texture.CompCount );
             *              //r.y += r.height;
             *              //GUI.Box( r, "Unif: " + texture.dataUniform );
             *
             *      }
             *
             *
             * }*/

            if (showLowerPropertyBox)
            {
                GUI.color = Color.white;
                DrawLowerPropertyBox();
            }

            //GUI.DragWindow();


            GUI.EndGroup( );


            //if(rect.center.x)
        }
        public void OnGUI()
        {
            /*
             * selectionBox.x = Event.current.mousePosition.x;
             * selectionBox.y = Event.current.mousePosition.y;
             * selectionBox.width = 128;
             * selectionBox.height = 128;
             */


            if (SF_GUI.ReleasedRawLMB() && boxSelecting)
            {
                ExecuteBoxSelect();
            }


            if (SF_GUI.PressedLMB() && SF_GUI.HoldingBoxSelect())
            {
                boxSelecting = true;

                if (!SF_GUI.MultiSelectModifierHeld())
                {
                    DeselectAll(registerUndo: true);
                }

                selectionBox.x = Event.current.mousePosition.x;
                selectionBox.y = Event.current.mousePosition.y;
                Event.current.Use();
            }


            // Duplicate, copy, cut, paste
            EventType et = Application.platform == RuntimePlatform.OSXEditor ? EventType.KeyDown : EventType.KeyUp;             // TODO: Use KeyDown for Windows too



            if (SF_GUI.HoldingControl() && Event.current.type == et && !SF_Node.isEditingAnyNodeTextField)
            {
                switch (Event.current.keyCode)
                {
                case (KeyCode.D):
                    DuplicateSelection();
                    break;

                case (KeyCode.C):
                    CopySelection();
                    break;

                case (KeyCode.X):
                    CutSelection();
                    break;

                case (KeyCode.V):
                    PasteFromClipboard();
                    break;
                }
            }

            // Selection box
            if (boxSelecting)
            {
                selectionBox.width  = Event.current.mousePosition.x - selectionBox.x;
                selectionBox.height = Event.current.mousePosition.y - selectionBox.y;

                if (Event.current.isMouse)
                {
                    Event.current.Use();
                }
            }

            if (SF_GUI.PressedDelete() && !SF_Node.isEditingAnyNodeTextField)
            {
                DeleteSelected();
                Event.current.Use();
            }
        }
Пример #5
0
        public override float DrawInner(ref Rect r)
        {
Restart:
            //int propCount = editor.nodeView.treeStatus.propertyList.Count;

            List <SF_Node> propertyList = editor.nodeView.treeStatus.propertyList;

            //GUI.Label( r.MovedUp(), "propertyList.Count = " + propertyList.Count );

            int propCount = propertyList.Count;

            bool multiple = propCount > 1;


            float prevYpos = r.y;

            r.y = 0;


            if (propCount == 0)
            {
                r.y        += 16;
                GUI.enabled = false;
                GUI.Label(r, "No properties in this shader yet");
                GUI.enabled = true;
                r.y        -= 16;
            }


            r.y    += 23;
            r.xMin += 20;             // Indent
            r.xMax -= 3;



            r.height = propertyHeight;



            // On drop...
            if (draggingProperty != null && SF_GUI.ReleasedRawLMB())
            {
                int moveDist = Mathf.RoundToInt((Event.current.mousePosition.y - startMouseY) / propertyHeight);

                // Execute reordering!
                if (moveDist != 0)                    // See if it actually moved to another slot
                {
                    int newIndex = Mathf.Clamp(dragStartIndex + moveDist, 0, propCount - 1);
                    Undo.RecordObject(editor.nodeView.treeStatus, "property reorder");
                    editor.nodeView.treeStatus.propertyList.RemoveAt(dragStartIndex);
                    //if( newIndex > dragStartIndex )
                    //	newIndex--;
                    editor.nodeView.treeStatus.propertyList.Insert(newIndex, draggingProperty);
                }

                draggingProperty = null;
            }

            float yStart = r.y;


            int i = 0;


            for (int j = 0; j < propertyList.Count; j++)
            {
                SF_Node prop = propertyList[j];


                if (prop.property == null)                    // Due to a weird bug - remove these nodes

                // Disconnect
                {
                    foreach (SF_NodeConnector con in prop.connectors)
                    {
                        if (con.conType == ConType.cOutput)
                        {
                            con.Disconnect();
                        }
                    }
                    prop.Deselect(registerUndo: false);
                    propertyList.Remove(prop);
                    editor.nodeView.treeStatus.propertyList.Remove(prop);
                    editor.nodes.Remove(prop);
                    //Debug.Log("Removing broken property...");
                    DestroyImmediate(prop);
                    goto Restart;
                }


                bool draggingThis = (draggingProperty == prop);
                bool dragging     = (draggingProperty != null);

                r.y = yStart + propertyHeight * i;

                if (draggingThis)
                {
                    r.x -= 5;
                    r.y  = Mathf.Clamp(Event.current.mousePosition.y + dragStartOffsetY, yStart, yStart + propertyHeight * (propCount - 1));
                }
                else if (dragging)
                {
                    if (i < dragStartIndex)
                    {
                        float offset = propertyHeight + SF_Tools.Smoother(Mathf.Clamp(r.y - DragRectPosY, -propertyHeight, 0) / -propertyHeight) * -propertyHeight;
                        r.y += offset;
                    }
                    else if (i > dragStartIndex)
                    {
                        r.y -= propertyHeight - SF_Tools.Smoother(Mathf.Clamp(r.y - DragRectPosY, 0, propertyHeight) / propertyHeight) * propertyHeight;
                    }
                }



                GUI.Box(r, string.Empty, draggingThis ? SF_Styles.HighlightStyle : SF_Styles.NodeStyle);
                bool mouseOver = r.Contains(Event.current.mousePosition);



                // We're now in the property box
                // We need: Grabber, Text field, Internal label



                bool imagePreview  = (prop.property is SFP_Tex2d || prop.property is SFP_Cubemap);
                bool colorInput    = (prop.property is SFP_Color);
                bool checkboxInput = (prop.property is SFP_ToggleProperty || prop.property is SFP_SwitchProperty);


                // GRABBER
                Rect gRect = SF_Tools.GetExpanded(r, -6);
                gRect.width = gRect.height / 2f;

                gRect.yMin += 8;

                Rect gRectCoords = new Rect(gRect);

                gRectCoords.x       = 0;
                gRectCoords.y       = 0;
                gRectCoords.width  /= SF_GUI.Handle_drag.width;
                gRectCoords.height /= SF_GUI.Handle_drag.height;
                if (multiple)
                {
                    GUI.DrawTextureWithTexCoords(gRect, SF_GUI.Handle_drag, gRectCoords);
                }
                gRect.yMin -= 8;

                /*
                 * if( propCount > 1 ) {
                 *      if( gRect.Contains( Event.current.mousePosition ) && SF_GUI.PressedLMB() && !dragging ) {
                 *              dragStartOffsetY = r.y - Event.current.mousePosition.y;
                 *              draggingProperty = prop;
                 *              dragStartIndex = i;
                 *              startMouseY = Event.current.mousePosition.y;
                 *      }
                 *      SF_GUI.AssignCursor( gRect,MouseCursor.Pan);
                 *      GUI.DrawTextureWithTexCoords(gRect, SF_GUI.Handle_drag, gRectCoords );
                 * }
                 */



                // Property type name
                Color c = GUI.color;
                c.a       = 0.5f;
                GUI.color = c;
                Rect propTypeNameRect = new Rect(gRect);
                //propTypeNameRect.x += propTypeNameRect.width + 8;
                propTypeNameRect.y -= 5;
                if (imagePreview || colorInput || checkboxInput)
                {
                    propTypeNameRect.width = r.width - r.height - 38;
                }
                else
                {
                    propTypeNameRect.width = r.width - 48;
                }
                propTypeNameRect.height = 16;
                //if( prop.property != null )
                GUI.Label(propTypeNameRect, prop.property.nameType, EditorStyles.miniLabel);
                propTypeNameRect.x += gRect.width + 8;
                c.a       = 1f;
                GUI.color = c;
                //else
                //return (int)r.yMax;


                // INTERNAL NAME

                if (mouseOver)
                {
                    c.a       = 0.5f;
                    GUI.color = c;
                    Rect intRect = new Rect(propTypeNameRect);
                    intRect.xMin += intRect.width - SF_GUI.WidthOf(prop.property.nameInternal, EditorStyles.label);
                    //SF_GUI.AssignCursor( intRect, MouseCursor.Text );
                    GUI.Label(intRect, prop.property.nameInternal, EditorStyles.label);
                    c.a       = 1f;
                    GUI.color = c;
                }



                // DISPLAY NAME
                Rect dispNameRect = new Rect(propTypeNameRect);
                dispNameRect.y += 18;
                //dispNameRect.x += dispNameRect.width + 4;
                //dispNameRect.height = 16;
                //dispNameRect.y += 10;
                //dispNameRect.width = ( r.width - dispNameRect.width - texRect.width - 20 ) * 0.5f;

                ps.StartIgnoreChangeCheck();
                string bef = prop.property.nameDisplay;
                SF_GUI.AssignCursor(dispNameRect, MouseCursor.Text);
                //if( mouseOver )
                UndoableEnterableNodeTextField(prop.property.node, dispNameRect, ref prop.property.nameDisplay, "change property name", update: false, extra: prop.property);
                //else
                //GUI.Label( dispNameRect, prop.property.nameDisplay, EditorStyles.boldLabel );
                if (prop.property.nameDisplay != bef)                    // Changed
                {
                    prop.property.UpdateInternalName();
                }
                ps.EndIgnoreChangeCheck();



                // Texture preview
                Rect texRect = new Rect(0, 0, 0, 0);
                c = GUI.color;
                if (imagePreview)
                {
                    texRect       = SF_Tools.GetExpanded(new Rect(r), -4);
                    texRect.xMin += texRect.width - texRect.height;
                    //texRect.x += gRect.width + 4;
                    //texRect.width = texRect.height;
                    GUI.Box(SF_Tools.GetExpanded(texRect, 1f), string.Empty, SF_Styles.NodeStyle);
                    GUI.color = Color.white;
                    GUI.DrawTexture(texRect, prop.texture.texture);
                    GUI.color = c;
                }


                if (prop.property is SFP_Slider)
                {
                    SFN_Slider slider = (prop as SFN_Slider);

                    ps.StartIgnoreChangeCheck();
                    Rect sR = new Rect(dispNameRect);
                    sR.y    += sR.height + 5;
                    sR.width = 28;
                    GUI.Label(sR, "Min");
                    //sR.x += sR.width;
                    sR = sR.MovedRight();
                    prop.UndoableEnterableFloatField(sR, ref slider.min, "min value", null);


                    sR = sR.MovedRight();

                    sR.width = r.width - 164;

                    float beforeSlider = slider.current;

                    string sliderName = "slider" + slider.id;
                    GUI.SetNextControlName(sliderName);

                    sR.xMin += 4;
                    sR.xMax -= 4;

                    slider.current = prop.UndoableHorizontalSlider(sR, slider.current, slider.min, slider.max, "value");
                    if (beforeSlider != slider.current)
                    {
                        GUI.FocusControl(sliderName);
                        slider.OnValueChanged();
                    }
                    //SF_GUI.AssignCursor( sR, MouseCursor.Arrow );

                    sR.x    += sR.width + 4;
                    sR.width = 32;
                    prop.UndoableEnterableFloatField(sR, ref slider.max, "max value", null);
                    sR.x += sR.width;
                    GUI.Label(sR, "Max");

                    ps.EndIgnoreChangeCheck();
                }
                else if (colorInput)
                {
                    SFN_Color colNode = (prop as SFN_Color);

                    texRect       = SF_Tools.GetExpanded(new Rect(r), -4);
                    texRect.xMin += texRect.width - texRect.height;
                    //GUI.Box( SF_Tools.GetExpanded( texRect, 1f ), string.Empty, SF_Styles.NodeStyle );
                    GUI.color     = Color.white;
                    texRect.yMax -= 21;
                    texRect.yMin += 15;
                    texRect.xMin += 2;
                    //texRect.xMax -= 2;

                    SF_GUI.AssignCursor(texRect, MouseCursor.Arrow);

                    ps.StartIgnoreChangeCheck();
                    //Color col = EditorGUI.ColorField( texRect, colNode.texture.dataUniform );
                    Color col = colNode.UndoableColorField(texRect, colNode.texture.dataUniform, "set color of " + colNode.property.nameDisplay);
                    ps.EndIgnoreChangeCheck();
                    colNode.SetColor(col);
                    GUI.color = c;
                }
                else if (prop.property is SFP_Vector4Property)
                {
                    SFN_Vector4Property vec4 = (prop as SFN_Vector4Property);

                    ps.StartIgnoreChangeCheck();
                    Rect sR = new Rect(dispNameRect);
                    sR.y    += sR.height + 5;
                    sR.width = 20;

                    int lbWidth = 12;


                    //string channelStr = "XYZW";



                    sR.width = lbWidth;
                    GUI.Label(sR, "X", EditorStyles.miniLabel);
                    sR.x    += sR.width;
                    sR.width = 32;
                    prop.UndoableEnterableFloatField(sR, ref vec4.texture.dataUniform.x, "X channel", EditorStyles.textField);
                    SF_GUI.AssignCursor(sR, MouseCursor.Text);
                    sR.x += sR.width + 3;


                    sR.width = lbWidth;
                    GUI.Label(sR, "Y", EditorStyles.miniLabel);
                    sR.x    += sR.width;
                    sR.width = 32;
                    prop.UndoableEnterableFloatField(sR, ref vec4.texture.dataUniform.y, "Y channel", EditorStyles.textField);
                    SF_GUI.AssignCursor(sR, MouseCursor.Text);
                    sR.x += sR.width + 3;


                    sR.width = lbWidth;
                    GUI.Label(sR, "Z", EditorStyles.miniLabel);
                    sR.x    += sR.width;
                    sR.width = 32;
                    prop.UndoableEnterableFloatField(sR, ref vec4.texture.dataUniform.z, "Z channel", EditorStyles.textField);
                    SF_GUI.AssignCursor(sR, MouseCursor.Text);
                    sR.x += sR.width + 3;


                    sR.width = lbWidth;
                    GUI.Label(sR, "W", EditorStyles.miniLabel);
                    sR.x    += sR.width;
                    sR.width = 32;
                    prop.UndoableEnterableFloatField(sR, ref vec4.texture.dataUniform.w, "W channel", EditorStyles.textField);
                    SF_GUI.AssignCursor(sR, MouseCursor.Text);



                    ps.EndIgnoreChangeCheck();
                }
                else if (prop.property is SFP_ValueProperty)
                {
                    SFN_ValueProperty val = (prop as SFN_ValueProperty);

                    ps.StartIgnoreChangeCheck();
                    Rect sR = new Rect(dispNameRect);
                    sR.y    += sR.height + 5;
                    sR.width = 20;

                    sR.width = 35;
                    GUI.Label(sR, "Value", EditorStyles.miniLabel);
                    sR.x    += sR.width;
                    sR.width = 55;
                    //SF_GUI.EnterableFloatField( prop, sR, ref val.texture.dataUniform.r, EditorStyles.textField );
                    prop.UndoableEnterableFloatField(sR, ref val.texture.dataUniform.x, "value", EditorStyles.textField);
                    SF_GUI.AssignCursor(sR, MouseCursor.Text);
                    ps.EndIgnoreChangeCheck();
                }
                else if (checkboxInput)
                {
                    bool isToggle = (prop.property is SFP_ToggleProperty);

                    bool prevValue = isToggle ? (prop.property.node as SFN_ToggleProperty).on : (prop.property.node as SFN_SwitchProperty).on;



                    ps.StartIgnoreChangeCheck();

                    texRect       = SF_Tools.GetExpanded(new Rect(r), -4);
                    texRect.xMin += texRect.width - texRect.height;
                    //GUI.Box( SF_Tools.GetExpanded( texRect, 1f ), string.Empty, SF_Styles.NodeStyle );

                    texRect.yMax -= 21;
                    texRect.yMin += 15;
                    texRect.xMin += 2;
                    //texRect.xMax -= 2;

                    SF_GUI.AssignCursor(texRect, MouseCursor.Arrow);

                    bool newValue = prevValue;

                    if (isToggle)
                    {
                        prop.property.node.UndoableToggle(texRect, ref (prop.property.node as SFN_ToggleProperty).on, "", "property checkbox", EditorStyles.toggle);
                        newValue = (prop.property.node as SFN_ToggleProperty).on;
                    }
                    else
                    {
                        prop.property.node.UndoableToggle(texRect, ref (prop.property.node as SFN_SwitchProperty).on, "", "property checkbox", EditorStyles.toggle);
                        newValue = (prop.property.node as SFN_SwitchProperty).on;
                    }

                    if (newValue != prevValue)
                    {
                        //if(isToggle){
                        //	(prop.property.node as SFN_ToggleProperty).on = newValue;
                        //} else {
                        //	(prop.property.node as SFN_SwitchProperty).on = newValue;
                        ////}
                        if (isToggle)
                        {
                            prop.property.node.texture.dataUniform = Color.white * (newValue ? 1f : 0f);
                        }
                        else
                        {
                            //prop.property.node.texture.UpdateColorPreview("",true);
                        }
                        prop.property.node.OnUpdateNode(NodeUpdateType.Soft);
                    }
                    ps.EndIgnoreChangeCheck();
                }



                if (r.Contains(Event.current.mousePosition) && SF_GUI.PressedLMB() && !dragging && multiple)
                {
                    dragStartOffsetY = r.y - Event.current.mousePosition.y;
                    draggingProperty = prop;
                    dragStartIndex   = i;
                    startMouseY      = Event.current.mousePosition.y;
                    editor.Defocus();
                }
                if (multiple)
                {
                    SF_GUI.AssignCursor(r, MouseCursor.Pan);
                }



                if (draggingThis)
                {
                    r.x += 5;
                }

                //GUI.Label( r, "prop.property.nameType = " + prop.property.nameType );

                r.y += propertyHeight;
                i++;
            }



            r.y      = yStart + propCount * propertyHeight;
            r.height = 20;

            r.y += prevYpos;

            return(r.yMax);
        }