ForceRepaint() public static method

public static ForceRepaint ( ) : void
return void
コード例 #1
0
    private void SelectNodesInRect(Rect rect)
    {
        rect.x      *= 1f / NodifyEditorUtilities.currentSelectedGroup.editorZoomAmount;
        rect.y      *= 1f / NodifyEditorUtilities.currentSelectedGroup.editorZoomAmount;
        rect.width  *= 1f / NodifyEditorUtilities.currentSelectedGroup.editorZoomAmount;
        rect.height *= 1f / NodifyEditorUtilities.currentSelectedGroup.editorZoomAmount;

        if (!Event.current.shift && EditorPrefs.GetInt("nodify.hotkeys.multi_select_nodes", 303) == 0)
        {
            Selection.activeGameObject = null;
        }

        foreach (Node childNodes in NodifyEditorUtilities.currentSelectedGroup.childNodes)
        {
            object renderer      = Nodify.Editor.NodifyEditorUtilities.FindNodeRenderer(childNodes.GetType());
            Rect   NodesPosition = (Rect)renderer.GetType().GetMethod("GetContentRect").Invoke(renderer, new object[] { childNodes });

            Rect position = NodesPosition;
            if (position.xMax >= rect.x && position.x <= rect.xMax && position.yMax >= rect.y && position.y <= rect.yMax)
            {
                NodifyEditorWindow.AddToSelectedObjects(childNodes.gameObject);
            }
        }
        NodifyEditorWindow.ForceRepaint();
    }
コード例 #2
0
        public virtual void OnRenderAnchorConnectionMinusButton(Anchor anchor, AnchorConnection connection, GUIStyle minusStyle, GUIStyle arrowStyle, Vector2 centerPoint, Vector2 start, Vector2 end)
        {
            Rect minusRect = new Rect(centerPoint.x - 8, centerPoint.y - 8, 16, 16);

            GUI.Box(minusRect, string.Empty, minusStyle);

            EditorGUIUtility.AddCursorRect(minusRect, MouseCursor.Link);

            if (minusRect.Contains(Event.current.mousePosition))
            {
                if (Event.current.type == EventType.MouseDown && Event.current.button != 2)
                {
                    anchor.RemoveConnection(connection);
                    NodifyEditorUtilities.SafeDestroy(connection.gameObject);
                    NodifyEditorWindow.ForceRepaint();
                }
            }
        }
コード例 #3
0
ファイル: NodeRenderer.cs プロジェクト: cxsquared/LetsMake
        /// <summary>
        /// Handles all mouse & keyboard events for the node.
        /// </summary>
        /// <param name="node"></param>
        public virtual void OnHandleEvents(T node)
        {
            node.editorPosition.x = Mathf.Max(node.editorPosition.x, 0f);
            node.editorPosition.y = Mathf.Max(node.editorPosition.y, 0f);
            Rect contentRect = GetContentRect(node);

            EditorGUIUtility.AddCursorRect(contentRect, MouseCursor.MoveArrow);

            if (contentRect.Contains(Event.current.mousePosition))
            {
                if (Event.current.type == EventType.ContextClick)
                {
                    // Begin Expose default method
                    if (NodifyPreferencesGUI.GetAdditionalButtons(EditorPrefs.GetInt("nodify.hotkeys.auto_create_default_method_anchor_dor_node", 303)))
                    {
                        Expose defaultExposed = null;

                        foreach (Expose exposedElement in node.GetExposed())
                        {
                            if (exposedElement.isDefault)
                            {
                                defaultExposed = exposedElement;
                            }
                        }

                        if (defaultExposed == null)
                        {
                            defaultExposed = node.GetExposedByName("OnComplete");
                        }

                        if (defaultExposed != null)
                        {
                            GameObject exposed = new GameObject(defaultExposed.exposedName);
                            exposed.hideFlags = HideFlags.HideInHierarchy;

                            Anchor anchor = exposed.AddComponent <Anchor>();
                            anchor.displayName = defaultExposed.exposedName;

                            if (defaultExposed.exposedType == ExposedType.FIELD || defaultExposed.exposedType == ExposedType.PROPERTY)
                            {
                                anchor.type = AnchorType.VARIABLE;
                            }
                            else
                            {
                                anchor.type = AnchorType.METHOD;
                            }

                            anchor.editorPosition.y = -25;

                            exposed.transform.parent = node.transform;
                        }
                    }
                    else
                    {
                        if (NodifyEditorUtilities.currentConnectingAnchor == null)
                        {
                            GenericMenu menu = new GenericMenu();
                            this.OnDrawTopContextMenu(node, menu);
                            this.OnDrawBottomContextMenu(node, menu);
                            menu.ShowAsContext();
                        }
                        else
                        {
                            if (NodifyEditorUtilities.currentConnectingAnchor.type == AnchorType.METHOD)
                            {
                                NodifyEditorUtilities.currentConnectingAnchor.ConnectToNode(node);
                                NodifyEditorUtilities.currentConnectingAnchor = null;
                            }
                        }
                    }

                    Event.current.Use();
                }

                if (Event.current.type == EventType.MouseDrag && NodifyEditorUtilities.currentDraggingAnchor == null)
                {
                    Event.current.Use();
                }

                if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
                {
                    // Handle Hot Control for input manipulation
                    if (IsSelected(node))
                    {
                        if (NodifyPreferencesGUI.GetAdditionalButtons(EditorPrefs.GetInt("nodify.hotkeys.multiple_select_and_deselect", 303)))
                        {
                            NodifyEditorWindow.RemoveFromSelectedObjects(node.gameObject);
                            NodifyEditorWindow.ForceRepaint();
                        }
                        else
                        {
                            NodifyEditorUtilities.currentManipulatingNode       = node;
                            NodifyEditorUtilities.currentManipulatingNodeOffset = node.editorPosition - Event.current.mousePosition;
                        }
                    }
                    else
                    {
                        NodifyEditorUtilities.currentManipulatingNode       = node;
                        NodifyEditorUtilities.currentManipulatingNodeOffset = node.editorPosition - Event.current.mousePosition;

                        if (NodifyPreferencesGUI.GetAdditionalButtons(EditorPrefs.GetInt("nodify.hotkeys.multiple_select_and_deselect", 303)))
                        {
                            NodifyEditorWindow.AddToSelectedObjects(node.gameObject);
                            NodifyEditorWindow.ForceRepaint();
                        }
                        else
                        {
                            Selection.activeGameObject = node.gameObject;
                        }
                    }

                    Event.current.Use();
                }
            }

            if (NodifyEditorUtilities.currentManipulatingNode == node)
            {
                Vector2 lastPosition = node.editorPosition;

                node.editorPosition = Event.current.mousePosition + NodifyEditorUtilities.currentManipulatingNodeOffset;

                Vector2 moveDelta = node.editorPosition - lastPosition;

                NodifyEditorWindow.MovedNodeSelectionDelta(node, moveDelta);
            }

            if (Event.current.type == EventType.MouseUp)
            {
                if (NodifyEditorUtilities.currentManipulatingNode == node)
                {
                    NodifyEditorUtilities.currentManipulatingNode = null;
                }
            }
        }