Exemplo n.º 1
0
        public void GenerateBody()
        {
            GenerateContent();
            if (slim)
            {
                head_height = 0.0f;
                body_height = 32.0f;
                size        = new Vector2(GetWidth(), head_height + body_height);
            }
            else
            {
                head_height = ICON_SIZE_OFFSET;

                body_height = GetHeight();

                // Calculate Size...
                size = new Vector2(GetWidth(), head_height + body_height);
                // Recalculate Size...
                size = Vector2.Max(size, new Vector2(MIN_SIZE_X, MIN_SIZE_Y));
                // Create nodeRect...
            }
            if (GraphEditor.snapToGrid)
            {
                rects[this.id] = new Rect(FPMath.SnapVector2(this.position) + GraphEditor.scroll, this.size);
            }
            else
            {
                rects[this.id] = new Rect(this.position + GraphEditor.scroll, this.size);
            }
            // Recalculate Size...
            CreatePortPoints();
            GenerateRects();
        }
Exemplo n.º 2
0
        public void EDITOR_Update()
        {
            if (!is_ready)
            {
                EDITOR_Prepare();
                return;
            }
            if (this is IVariable && (this as IVariable).GetVariableName() != title)
            {
                EDITOR_Prepare();
                return;
            }
            if (GraphEditor.snapToGrid)
            {
                if (!GraphEditor.is_drag)
                {
                    position = FPMath.SnapVector2(position);
                }
                rects[this.id] = new Rect(FPMath.SnapVector2(this.position) + GraphEditor.scroll, this.size);
            }
            else
            {
                rects[this.id] = new Rect(this.position + GraphEditor.scroll, this.size);
            }
            Vector2 pos = rects[this.id].position;

            head_rect.position = pos;
            body_rect.position = new Vector2(pos.x, pos.y + head_height);
            icon_rect.position = new Vector2(pos.x + 5.0f, pos.y + 5.0f);
            if (has_subtitle)
            {
                if (invert_title)
                {
                    title_rect.position    = new Vector2(pos.x + ICON_SIZE_OFFSET, pos.y + 23.0f);
                    subtitle_rect.position = new Vector2(pos.x + ICON_SIZE_OFFSET, pos.y + 6.0f);
                }
                else
                {
                    title_rect.position    = new Vector2(pos.x + ICON_SIZE_OFFSET, pos.y + 6.0f);
                    subtitle_rect.position = new Vector2(pos.x + ICON_SIZE_OFFSET, pos.y + 23.0f);
                }
            }
            else
            {
                title_rect.position = new Vector2(pos.x + ICON_SIZE_OFFSET, pos.y + 15.0f);
            }
        }