Exemplo n.º 1
0
        // public float barX;
        static public void Draw(TC_Layer layer, ref Vector2 startOffset, float activeMulti, bool drawMethod, bool isFirst, bool isLast)
        {
            TC_GlobalSettings g = TC_Settings.instance.global;

            bool isCulled = false;

            TC_LayerGroupGUI.DrawLayerOrLayerGroup(layer, ref startOffset, g.colLayer, ref isCulled, activeMulti, drawMethod, isFirst, isLast);
            if (!layer.active)
            {
                activeMulti *= 0.75f;
            }

            // DropDownMenu(rect, layer);

            bool hideSelectNodes = false;

            if (layer.outputId != TC.heightOutput)
            {
                if (layer.selectItemGroup.totalActive <= 1)
                {
                    hideSelectNodes = true;
                }
            }

            TC_NodeGroupGUI.Draw(layer.maskNodeGroup, ref startOffset, g.colMaskNodeGroup, g.colMaskNode, g.colLayer, activeMulti, layer.nodeFoldout, false, false, false);
            if (!hideSelectNodes)
            {
                TC_NodeGroupGUI.Draw(layer.selectNodeGroup, ref startOffset, g.colSelectNodeGroup, g.colSelectNode, g.colLayer, activeMulti, layer.nodeFoldout, false, layer.outputId != TC.heightOutput, hideSelectNodes);
            }
            if (layer.selectItemGroup != null && layer.outputId != TC.heightOutput)
            {
                TC_SelectItemGroupGUI.Draw(layer.selectItemGroup, ref startOffset, TC_Settings.instance.global.colSelectItemGroup, TC_Settings.instance.global.colSelectItem, g.colLayer, activeMulti);
            }
        }
Exemplo n.º 2
0
        public void SetPreviewColor()
        {
            TC_GlobalSettings globalSettings = TC_Settings.instance.global;

            if (selectIndex == -1)
            {
                selectIndex = 0;
            }

            if (outputId == TC.splatOutput)
            {
                if (splatCustom)
                {
                    color = Color.black;
                    for (int i = 0; i < splatCustomValues.Length; i++)
                    {
                        color += splatCustomValues[i] * globalSettings.GetVisualizeColor(i);
                    }
                    color /= splatCustomTotal;
                }
                else
                {
                    color = globalSettings.GetVisualizeColor(selectIndex);
                }
            }
            else if (outputId == TC.treeOutput || outputId == TC.objectOutput)
            {
                color = globalSettings.GetVisualizeColor(listIndex);
            }
            else
            {
                color = globalSettings.GetVisualizeColor(selectIndex);
            }
        }
Exemplo n.º 3
0
        static void DrawConnectionIndicator(TC_ItemBehaviour item, Vector2 pos, bool addBefore, bool nodeFoldout)
        {
            if (!nodeFoldout)
            {
                pos.y -= 351;
            }

            //if (TD.startDrag)
            //{
            //    Rect dropRect = TD.GetRectScaled(new Rect(pos.x, pos.y, TD.texConnectionIndicator.width, TD.texConnectionIndicator.height));
            //    // TD.DragDropNode(item, dropRect);
            //    DrawTextureCommand.Add(pos, TD.texConnectionIndicator, Color.white);
            //}
            //else
            //{
            TC_GlobalSettings g = TC_Settings.instance.global;

            pos -= new Vector2(2.5f, 2.5f);
            Rect rect = new Rect(pos.x + g.rect4.x, pos.y + g.rect4.y, g.rect4.width, g.rect4.width);
            // DrawTextureCommand.Add(rect, TD.texCardCounter, TD.g.colLayer * 0.25f);
            int clickedButton = TD.Button(rect, TD.texAddFirstCard, true, new Color(1, 1, 1, 0.25f), Color.white, Color.white, true, true);

            // tooltip
            //Vector2 mousePosition = Event.current.mousePosition;

            //if (rectScaled.Contains(mousePosition))
            //{
            //    DrawCommand.Add(mousePosition + new Vector2(9, 19), 65, "Left Click", "-> Add a new Layer", Color.white);
            //    DrawCommand.Add(mousePosition + new Vector2(9, 19 + TD.labelHeight), 65, "Right Click","-> Add a new Layer Group", Color.white);
            //    TD.repaintNodeWindow = true;
            //}

            if (clickedButton == 0)
            {
                Undo.RegisterCreatedObjectUndo(item.Add <TC_Layer>("", true, addBefore, true).gameObject, "Created Layer");
            }
            else if (clickedButton == 1)
            {
                Undo.RegisterCreatedObjectUndo(item.Add <TC_LayerGroup>("", true, addBefore, true).gameObject, "Created GameObject");
            }
            //}
        }
Exemplo n.º 4
0
        static public void Draw(TC_LayerGroup layerGroup, ref Vector2 pos, float posOldX, float activeMulti, bool nodeFoldout)
        {
            TC_GlobalSettings g = TC_Settings.instance.global;

            TC_LayerGroupResult groupResult = layerGroup.groupResult;

            float x1 = pos.x - 78;

            if (groupResult.foldout < 2)
            {
                x1 += nodeFoldout ? 126 : 135;
            }
            x1 -= TD.texCardBody.width / 2;
            float y1 = pos.y + (layerGroup.nodeFoldout ? TD.cardHeight : 32);

            TD.DrawTextureScaled(x1 - (TD.texShelfLinesConnectUp.width / 2), y1 - 16, TD.texShelfLinesConnectUp, Color.white);
            TD.DrawTextureScaled(x1 - (TD.texShelfLinesConnectUp.width / 2), y1 - 16, TD.texLineConnectUp, g.colLayer * activeMulti);
            x1 += 30;

            if (layerGroup.foldout == 2 && groupResult.itemList.Count > 0)
            {
                TD.DrawTextureScaled(x1, y1 + 16, posOldX - x1 - g.layerHSpace, TD.texShelfLinesHorizontal, Color.white);
                TD.DrawTextureScaled(x1, y1 + 16, posOldX - x1 - g.layerHSpace, TD.texLineHorizontal, g.colLayer * activeMulti);
            }
            else
            {
                Vector2 posOld = pos;
                pos.x  = x1 + 52;
                pos.y += layerGroup.nodeFoldout ? 258 : -94;
                int mouseClick = TD.DrawNodeCount(groupResult, ref pos, groupResult.itemList.Count, true, ref layerGroup.foldout, g.colLayer * activeMulti, g.rect.width);
                if (groupResult.itemList.Count == 0)
                {
                    if (mouseClick == 0)
                    {
                        groupResult.Add <TC_Layer>("", false);
                    }
                    else if (mouseClick == 1)
                    {
                        groupResult.Add <TC_LayerGroup>("", false);
                    }
                }
                else
                {
                    if (mouseClick == 0)
                    {
                        layerGroup.nodeFoldout = true;
                    }
                }

                pos = posOld;
            }

            TD.DrawBracket(ref pos, nodeFoldout, true, g.colLayerGroup * activeMulti, ref groupResult.foldout, true, true);
            if (groupResult.foldout == 2)
            {
                bool isCulled = false;
                pos.x -= TD.texCardBody.width;
                TD.DrawNode(groupResult, pos, g.colLayer, Color.white, ref isCulled, activeMulti, nodeFoldout, false, true);

                int mouseButton = TD.Button(new Rect(pos.x + 245.1f, pos.y + 6.5f, 20, 20), TD.texFoldout, true, new Color(1, 1, 1, 0.25f), Color.white, Color.white, true);
                if (mouseButton == 0)
                {
                    if (layerGroup.foldout == 0)
                    {
                        layerGroup.foldout = 2;
                    }
                    else
                    {
                        layerGroup.foldout = 0;
                    }
                }
            }
            else
            {
                if (nodeFoldout)
                {
                    TD.DrawNodeCount(groupResult, ref pos, 1, true, ref groupResult.foldout, g.colLayerGroup * activeMulti, 1);
                }
            }
            TD.DrawBracket(ref pos, nodeFoldout, false, g.colLayerGroup * activeMulti, ref groupResult.foldout, true, true);
        }
Exemplo n.º 5
0
        static public void Draw(TC_LayerGroup layerGroup, bool drawMethod, ref Vector2 pos, float activeMulti, bool isFirst, bool isLast, ref float shelfLineVerticalStartY)
        {
            TC_GlobalSettings g = TC_Settings.instance.global;

            if (layerGroup.level == 0)
            {
                pos.x -= TD.texShelfStartOutput.width;
            }

            float posOldX = pos.x;

            bool isCulled = false;

            layerGroup.nodePos = pos - new Vector2(0, TD.cardHeight);
            Rect rect = DrawLayerOrLayerGroup(layerGroup, ref pos, g.colLayerGroup, ref isCulled, activeMulti, drawMethod, isFirst, isLast);

            activeMulti = layerGroup.active ? activeMulti : activeMulti * 0.75f;

            // Rect rectFoldout = TD.GetRectScaled(pos.x + 240, pos.y + 43 + (layerGroup.nodeFoldout ? TD.cardHeight : 32), 20, 20);
            // if (GUI.Button(rectFoldout, "")) layerGroup.foldout = !layerGroup.foldout;

            shelfLineVerticalStartY = pos.y + (layerGroup.nodeFoldout ? TD.texShelfLayerStart1.height : TD.texShelfLayerCollapsed.height) - TD.shelfOffsetY;

            DropDownMenu(rect, layerGroup);

            Vector2 bar2 = pos;

            bar2.x -= TD.texCardBody.width * 1.5f;
            bar2.y += TD.cardHeight;

            TC_NodeGroupGUI.Draw(layerGroup.maskNodeGroup, ref pos, g.colMaskNodeGroup, g.colMaskNode, g.colLayerGroup, activeMulti, layerGroup.nodeFoldout, false, false, false);
            // if (startOffsetXMax > startOffset.x) startOffsetXMax = startOffset.x;

            // Draw Result Node
            TC_LayerGroupResultGUI.Draw(layerGroup, ref pos, posOldX, activeMulti, layerGroup.nodeFoldout);

            int layerGroupCount = 0;
            int layerCount      = 0;

            float lineOffsetX;

            if (layerGroup.maskNodeGroup.itemList.Count > 0)
            {
                lineOffsetX = 2.5f;
            }
            else
            {
                lineOffsetX = 0;
            }

            bool  m_isFirst, m_isLast;
            float m_shelfLineVerticalStartY = 0;

            pos.y += layerGroup.nodeFoldout ? (TD.cardHeight) : 32;

            if (layerGroup.foldout == 2)
            {
                for (int i = layerGroup.groupResult.itemList.Count - 1; i >= 0; --i)
                {
                    pos.x  = posOldX;// - lineOffsetX ;
                    pos.x -= g.layerHSpace;

                    TC_LayerGroup layerGroupChild = layerGroup.groupResult.itemList[i] as TC_LayerGroup;

                    m_isLast  = (i == 0);
                    m_isFirst = (i == layerGroup.groupResult.itemList.Count - 1);

                    if (layerGroupChild != null)
                    {
                        Draw(layerGroupChild, i != 0, ref pos, activeMulti, m_isFirst, m_isLast, ref m_shelfLineVerticalStartY);
                        if (!m_isLast)
                        {
                            pos.y += layerGroupChild.nodeFoldout ? 0 : 32;

                            TD.DrawTextureScaledV(pos.x + 64, m_shelfLineVerticalStartY, (pos.y - m_shelfLineVerticalStartY) + 16, TD.texShelfLinesVertical, Color.white);
                            TD.DrawTextureScaledV(pos.x + 64, m_shelfLineVerticalStartY, (pos.y - m_shelfLineVerticalStartY) + 16, TD.texLineVertical, g.colLayer * activeMulti);
                        }

                        ++layerGroupCount;
                    }
                    else
                    {
                        TC_Layer layer = layerGroup.groupResult.itemList[i] as TC_Layer;
                        if (layer == null)
                        {
                            continue;
                        }

                        TC_LayerGUI.Draw(layer, ref pos, activeMulti, i != 0, m_isFirst, m_isLast);
                        pos.y += layer.nodeFoldout ? TD.cardHeight : 32;
                        ++layerCount;
                    }
                }
            }

            pos.y += 64;

            Rect clickRect = TD.GetRectScaled(new Rect(bar2.x + (TD.texCardBody.width * 1.5f) - (2.5f + lineOffsetX), bar2.y - 5f, 10, 10));

            if (TD.ClickRect(clickRect, 0))
            {
                if (layerGroup.foldout == 0)
                {
                    layerGroup.foldout = 2;
                }
                else
                {
                    layerGroup.foldout = 0;
                }
            }

            pos.x = posOldX;
        }
Exemplo n.º 6
0
        static public Rect DrawLayerOrLayerGroup(TC_ItemBehaviour item, ref Vector2 pos, Color color, ref bool isCulled, float activeMulti, bool drawMethod, bool isFirst, bool isLast)
        {
            TC_GlobalSettings g          = TC_Settings.instance.global; // TODO: Make global static and init
            TC_LayerGroup     layerGroup = item as TC_LayerGroup;
            TC_Layer          layer      = item as TC_Layer;
            bool nodeFoldout             = (layerGroup != null) ? layerGroup.nodeFoldout : layer.nodeFoldout;

            if (isFirst)
            {
                pos.y += TD.shelfOffsetY;
                TD.DrawTextureScaled(pos.x, pos.y, TD.texShelfLinesConnectDown, Color.white);
                TD.DrawTextureScaled(pos.x, pos.y, TD.texLineConnectDown, g.colLayer * activeMulti);
                pos.y += TD.texShelfLinesConnectDown.height;
            }
            else if (item.level == 0)
            {
                TD.DrawTextureScaled(pos.x + 64, pos.y, TD.texShelfStartConnect, Color.white);
            }
            else
            {
                pos.y += 15;
            }

            Texture texShelf;
            Texture texLine = null;

            if (item.level == 0)
            {
                if (nodeFoldout)
                {
                    texShelf = TD.texShelfStartOutput;
                }
                else
                {
                    texShelf = TD.texShelfStartOutputCollapsed;
                }
            }
            else if (isLast)
            {
                if (nodeFoldout)
                {
                    texShelf = TD.texShelfLayerStart2; texLine = TD.texLineLayerStart2;
                }
                else
                {
                    texShelf = TD.texShelfLayerCollapsedStart2; texLine = TD.texLineLayerStart2;
                }
            }
            else
            {
                if (nodeFoldout)
                {
                    texShelf = TD.texShelfLayerStart1; texLine = TD.texLineLayerStart1;
                }
                else
                {
                    texShelf = TD.texShelfLayerCollapsedStart1; texLine = TD.texLineLayerCollapsedStart1;
                }
            }

            TD.DrawTextureScaled(pos.x, pos.y, texShelf, Color.white);
            if (item.level > 0)
            {
                TD.DrawTextureScaled(pos.x, pos.y, texLine, g.colLayer * activeMulti);
            }

            TD.DrawTextureScaled(pos.x - TD.texShelfStartOutput.width, pos.y, nodeFoldout ? TD.texShelfLayer : TD.texShelfLayerCollapsed, Color.white, false, StretchMode.Left);

            pos.y += TD.shelfOffsetY;
            pos.x -= TD.texCardBody.width - (item.level == 0 ? 20 : 34);

            isCulled = false;

            Rect nodeRect = TD.DrawNode(item, pos, color, Color.white, ref isCulled, activeMulti, nodeFoldout, drawMethod);

            if (isCulled)
            {
                return(nodeRect);
            }

            int mouseButton = TD.Button(new Rect(pos.x + 245.1f, pos.y + 6.5f, 20, 20), TD.texFoldout, true, new Color(1, 1, 1, 0.25f), Color.white, Color.white, true);

            if (mouseButton >= 0)
            {
                if (layerGroup != null)
                {
                    layerGroup.nodeFoldout = !layerGroup.nodeFoldout;
                    if (mouseButton == 0)
                    {
                        layerGroup.foldout = layerGroup.nodeFoldout ? 2 : 0;
                    }
                }
                else
                {
                    layer.nodeFoldout = !layer.nodeFoldout;
                }

                Event.current.Use();
            }

            //if (GUI.Button(TD.GetRectScaled(pos.x + 225, pos.y + 2, 40, 25), ""))
            //{
            //    if (layerGroup != null) layerGroup.nodeFoldout = !layerGroup.nodeFoldout;
            //    else layer.nodeFoldout = !layer.nodeFoldout;
            //}

            if (item.method == Method.Lerp && drawMethod)
            {
                // TD.DrawSlider(startOffset, ref item.overlay, 0, 1);
                // if (GUI.changed) TC_Generate.singleton.AutoGenerate();
            }

            if (item.level > 0)
            {
                DrawConnectionIndicator(item, new Vector2(pos.x + 289, pos.y - 27), false, true);
                if (isLast)
                {
                    DrawConnectionIndicator(item, new Vector2(pos.x + 289, pos.y + TD.cardHeight + 4), true, nodeFoldout);
                }
            }

            return(nodeRect);
        }
        static public void DrawLayerGroup(TC_TerrainLayer terrainLayer, int index, ref Vector2 pos, ref float scrollY)
        {
            TC_GlobalSettings g            = TC_Settings.instance.global;
            Event             eventCurrent = Event.current;

            TC_LayerGroup layerGroup = terrainLayer.layerGroups[index];

            if (layerGroup == null)
            {
                return;
            }

            Vector2 posOld = pos;

            float t = 0;

            TC_LayerGroupGUI.Draw(layerGroup, false, ref pos, 1, false, false, ref t);

            Rect rect;

            rect = new Rect(posOld.x + 50, posOld.y - 18, 400, 100);
            TD.DrawTextureScaled(posOld.x - 44, posOld.y, 100, TD.texLineHorizontal, g.colLayerGroup);

            Color buttonColor;

            if (layerGroup.visible)
            {
                if (layerGroup.active)
                {
                    buttonColor = Color.green;
                }
                else
                {
                    buttonColor = Color.red;
                }
            }
            else
            {
                buttonColor = Color.white;
            }

            if (TD.DrawButton(rect, TC.outputNames[layerGroup.outputId], 64, true, Color.white, TD.editorSkinMulti == 1 ? buttonColor : new Color(buttonColor.r * 0.4f, buttonColor.g * 0.4f, buttonColor.b * 0.4f, 1)))
            {
                // Debug.Log("Clicked Button");
                TD.ClickOutputButton(layerGroup);
                eventCurrent.Use();
            }

            for (int i = 0; i < 3; i++)
            {
                rect = TD.GetRectScaled(pos.x - 32 + 25, pos.y + 33 + (i * 32), 32, 32); rect.xMin = 0;
                TD.DrawTexture(rect, TD.texSeparatorCenter, new Color(1, 1, 1, 0.5f));
                rect = TD.GetRectScaled(pos.x + 25, pos.y + 33 + (i * 32), 32, 32);
                TD.DrawTexture(rect, TD.texSeparatorRight, new Color(1, 1, 1, 0.5f));
            }

            pos.y += TD.cardHeight;
            pos.y += g.outputVSpace;

            // scrollY += startY - startOffset.y;
            // else GlobalManager.singleton.scrollAdd.y = 0;
            pos.x = posOld.x;
        }
Exemplo n.º 8
0
        void ScrollInterface()
        {
            TC_GlobalSettings g = TC_Settings.instance.global;

            TD.scrollOffset = settings.scrollOffset;
            TD.scale        = settings.scale;

            if (TD.scrollOffset.x < 0)
            {
                TD.scrollOffset.x = 0;
            }
            else if (TD.scrollOffset.x > TD.scrollMax.x + 1000 && TD.scrollMax.x != 0)
            {
                TD.scrollOffset.x = TD.scrollMax.x + 1000;
            }

            if (TD.scrollOffset.y > 0)
            {
                TD.scrollOffset.y = 0;
            }
            else if (TD.scrollOffset.y < TD.scrollMax.y && TD.scrollMax.y != 0)
            {
                TD.scrollOffset.y = TD.scrollMax.y;
            }
            // Vector2 deltaMouse = key.mousePosition-mousePositionOld;

            TD.scrollOffset += settings.scrollAdd;

            bool doScroll = false;

            if (eventCurrent.alt && eventCurrent.control && eventCurrent.type == EventType.MouseDrag && eventCurrent.button == 0)
            {
                doScroll = true;
            }
            else if (eventCurrent.type == EventType.MouseDrag && eventCurrent.button == 2)
            {
                doScroll = true;
            }

            if (doScroll)
            {
                TD.scrollOffset     += (eventCurrent.delta / TD.scale) / TD.mouseSensivity;
                TC.repaintNodeWindow = true;
                eventCurrent.Use();
            }

            if (eventCurrent.alt && eventCurrent.control && eventCurrent.type == EventType.mouseDown)
            {
                eventCurrent.Use();
            }

            // Debug.Log(TD.scrollOffset.y + " " + TD.scrollMax.y);

            Vector2 deltaMouse = eventCurrent.mousePosition - new Vector2(TC_NodeWindow.window.position.width / 2, TC_NodeWindow.window.position.height / 2);

            if (eventCurrent.type == EventType.ScrollWheel)
            {
                if (eventCurrent.delta.y > 0)
                {
                    // TD.scrollOffset -= deltaMouse / (TD.scale);
                    TD.scale /= 1 + (eventCurrent.delta.y / (20f * TD.mouseScrollWheelSensivity));
                    // TD.scrollOffset += deltaMouse / (TD.scale);
                }
                else
                {
                    TD.scrollOffset -= deltaMouse / (TD.scale);
                    TD.scale        *= 1 + (-eventCurrent.delta.y / (20f * TD.mouseScrollWheelSensivity));
                    TD.scrollOffset += deltaMouse / (TD.scale);
                }

                if (TD.scale > 2.4f)
                {
                    TD.scale = 2.4f;
                }
                else if (TD.scale < 0.05f)
                {
                    TD.scale = 0.05f;
                }

                TC.repaintNodeWindow = true;
            }

            //if (TD.setNewScrollOffset)
            //{
            //    TD.setNewScrollOffset = false;
            //    TD.scrollOffset = (new Vector2(-TD.newScrollOffset.x + TC_NodeWindow.window.position.width, -TD.newScrollOffset.y + TC_NodeWindow.window.position.height));
            //}

            if (eventCurrent.type == EventType.keyDown)
            {
                if (eventCurrent.keyCode == g.keyZoomIn)
                {
                    TD.scale *= 1.5f;
                }
                else if (eventCurrent.keyCode == g.keyZoomOut)
                {
                    TD.scale /= 1.5f;
                }
            }

            if (eventCurrent.button == 2 && eventCurrent.clickCount == 2)
            {
                TD.scale = 1;
            }

            settings.scrollOffset = TD.scrollOffset - settings.scrollAdd;
            settings.scale        = TD.scale;
            // mousePositionOld = key.mousePosition;
            // if (TC_Settings.instance.global.scrollOffset.x * (TD.scale * 1.5f) < 680) TC_Settings.instance.global.scrollOffset.x = 680 / (TD.scale * 1.5f);
            // Debug.Log(GlobalManager.singleton.scrollOffset.x * (TD.scale * 1));
        }
        static public int Draw(TC_NodeGroup nodeGroup, ref Vector2 pos, Color colGroupNode, Color colNode, Color colBracket, float activeMulti, bool nodeFoldout, bool drawMethod, bool colorPreviewTex, bool hideSelectNodes)
        {
            if (nodeGroup == null)
            {
                return(0);
            }
            // bool select = false;
            // Draw total node

            Rect  dropDownRect;
            float activeMultiOld = activeMulti;

            activeMulti *= nodeGroup.active ? 1 : 0.75f;

            bool isCulled       = false;
            TC_GlobalSettings g = TC_Settings.instance.global;

            // if ((nodeGroup.foldout == 1 && nodeGroup.itemList.Count == 1) || nodeGroup.itemList.Count == 0) nodeGroup.foldout = 0;

            // Closing Bracket
            TD.DrawBracket(ref pos, nodeFoldout, true, colBracket * activeMultiOld, ref nodeGroup.foldout, true, nodeGroup.itemList.Count > 0);

            if (nodeGroup.foldout > 0)
            {
                if ((nodeGroup.itemList.Count != 1 || nodeGroup.foldout != 1) && nodeGroup.itemList.Count != 0 && !hideSelectNodes)
                {
                    pos.x -= TD.texCardBody.width;
                }

                if (nodeGroup.itemList.Count > 1 && !hideSelectNodes)
                {
                    dropDownRect = TD.DrawNode(nodeGroup, pos, colGroupNode, Color.white, ref isCulled, activeMulti, nodeFoldout, drawMethod, false);
                    if (nodeGroup.foldout == 2)
                    {
                        pos.x -= TD.texCardBody.width + g.nodeHSpace;
                    }
                    DropDownMenu(dropDownRect, nodeGroup);
                }

                //if (colorPreviewTex)
                //{
                //    startOffset.x -= TD.nodeWidth;
                //    TD.DrawNode(nodeGroup, drawMethod, ref startOffset, true, color, click, Color.white, ref isCulled);
                //    startOffset.x -= TD.nodeWidth;
                //}

                // Draw ()
                //if (nodeGroup.itemList.Count > 1)
                //{
                //    startOffset.x += 10;

                //    Draw ItemList Count
                //    if (!nodeGroup.foldout)
                //    {
                //        TD.DrawRect(new Rect(startOffset.x - 9, (startOffset.y + TD.nodeHeight / 2) - 5, 18, 10), TC_Settings.instance.global.colTextBackGround);
                //        TD.DrawText(new Vector2(startOffset.x + 2, startOffset.y + TD.nodeHeight / 2), nodeGroup.itemList.Count.ToString(), 8, FontStyle.Bold, Color.white, HorTextAlign.Center, VerTextAlign.Center);
                //    }
                //    startOffset.x -= TD.nodeWidthSpace;
                //}

                if (nodeGroup.foldout == 2 && !hideSelectNodes)
                {
                    if (nodeGroup.itemList.Count > 1 && nodeFoldout)
                    {
                        TD.DrawMethod(nodeGroup, pos + new Vector2(TD.texCardBody.width - 18, 172), true, colNode, activeMulti);
                    }

                    for (int i = nodeGroup.itemList.Count - 1; i >= 0; --i)
                    {
                        TC_Node node = nodeGroup.itemList[i] as TC_Node;

                        if (node != null)
                        {
                            TC_NodeGUI.Draw(node, nodeFoldout, i == 0 ? false : true, pos, colNode, activeMulti);
                            if (i != 0)
                            {
                                pos.x -= TD.nodeWidthHSpace;
                            }
                            if (node.inputKind != InputKind.Current && node.inputKind != InputKind.Portal && i != 0 && nodeFoldout)
                            {
                                TD.DrawMethod(node, pos + new Vector2(TD.texCardBody.width - 18, 172), false, colNode, (node.active ? 1 : 0.5f) * activeMulti);
                            }
                        }
                        else
                        {
                            TC_NodeGroup nodeGroupChild = nodeGroup.itemList[i] as TC_NodeGroup;

                            if (nodeGroupChild != null)
                            {
                                pos.x += TD.nodeWidthHSpace;
                                Draw(nodeGroupChild, ref pos, colGroupNode, colNode, colBracket, activeMulti, nodeFoldout, drawMethod, false, false);
                                if (i != 0)
                                {
                                    pos.x -= TD.nodeWidthHSpace;
                                    TD.DrawMethod(nodeGroupChild, pos + new Vector2(TD.texCardBody.width - 18, 172), false, colNode, (nodeGroupChild.active ? 1 : 0.5f) * activeMulti);
                                }
                            }
                        }
                    }
                }
            }

            if (nodeFoldout)
            {
                int mouseClick = TD.DrawNodeCount(nodeGroup, ref pos, nodeGroup.itemList.Count, nodeFoldout, ref nodeGroup.foldout, (nodeGroup.foldout == 1 && nodeGroup.itemList.Count != 1 ? colGroupNode * 0.75f : colBracket) * activeMulti);
                if (mouseClick == 0 && nodeGroup.itemList.Count == 0)
                {
                    nodeGroup.Add <TC_Node>("", false, false, true);
                }
            }

            // Opening Bracket
            TD.DrawBracket(ref pos, nodeFoldout, false, colBracket * activeMultiOld, ref nodeGroup.foldout, true, nodeGroup.itemList.Count > 0);

            return(0);
        }
        public void DrawCustomInspector()
        {
            TC_GlobalSettings globalSettings = TC_Settings.instance.global;

            serializedObject.Update();
            global.Update();

            TD.DrawSpacer();
            TD.DrawLabelWidthUnderline("Local Settings", 14);

            EditorGUILayout.BeginVertical("Box");

            GUILayout.Space(5);

            TD.DrawProperty(masterTerrain, new GUIContent("Master Terrain", globalSettings.tooltip ? "This terrain is used for selecting the splat textures, grass textures and trees in the nodes." : ""));

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(new GUIContent("Node Preview Image Resolution", globalSettings.tooltip ? "The resolution of the node preview images." : ""));
            previewResolution.intValue = EditorGUILayout.IntPopup(previewResolution.intValue, previewResolutionsDisplay, previewResolutions);
            EditorGUILayout.EndHorizontal();

            TD.DrawProperty(hideTerrainGroup, new GUIContent("Hide TerrainLayer GameObject"));
            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
                TC_NodeWindow.DebugMode();
            }

            TD.DrawProperty(useTCRuntime);
            if (GUI.changed)
            {
                if (!useTCRuntime.boolValue)
                {
                    TC_Settings.instance.transform.parent.tag = "EditorOnly";
                }
                else
                {
                    TC_Settings.instance.transform.parent.tag = "Untagged";
                }
            }
            TD.DrawProperty(defaultTerrainHeight);
            TD.DrawProperty(generateOffset);
            // TD.DrawProperty(scrollAdd);
            EditorGUILayout.EndVertical();

            GUILayout.Space(10);
            TD.DrawSpacer();
            GUILayout.Space(10);

            TD.DrawLabelWidthUnderline("Global Settings", 14);
            GUILayout.Space(5);

            EditorGUILayout.BeginVertical("Box");
            TD.DrawProperty(tooltip);
            TD.DrawProperty(showResolutionWarnings);

            GUI.changed = false;
            Vector3 defaultTerrainSize = globalSettings.defaultTerrainSize;

            defaultTerrainSize = EditorGUILayout.Vector3Field("Default Node Size", defaultTerrainSize);
            if (GUI.changed)
            {
                Undo.RecordObject(globalSettings, "Default Terrain Size");
                globalSettings.defaultTerrainSize = defaultTerrainSize;
                EditorUtility.SetDirty(globalSettings);
            }
            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            TD.DrawLabelWidthUnderline("Trees and Objects", 12);
            EditorGUILayout.BeginVertical("Box");
            TD.DrawProperty(linkScaleToMaskDefault, new GUIContent("Link Scale To Mask Default"));
            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            TD.DrawLabelWidthUnderline("Keys", 12);

            EditorGUILayout.BeginVertical("Box");
            TD.DrawProperty(keyZoomIn);
            TD.DrawProperty(keyZoomOut);
            EditorGUILayout.EndVertical();

            TD.DrawLabelWidthUnderline("Node Colors", 12);

            EditorGUILayout.BeginVertical("Box");

            TD.DrawProperty(colLayerGroup, new GUIContent("Color Layer Group"));
            TD.DrawProperty(colLayer, new GUIContent("Color Layer"));
            TD.DrawProperty(colMaskNodeGroup, new GUIContent("Color Mask Node Group"));
            TD.DrawProperty(colMaskNode, new GUIContent("Color Mask Node"));
            TD.DrawProperty(colSelectNodeGroup, new GUIContent("Color Select Node Group"));
            TD.DrawProperty(colSelectNode, new GUIContent("Color Select Node"));
            TD.DrawProperty(colSelectItemGroup, new GUIContent("Color Select Item Group"));
            TD.DrawProperty(colSelectItem, new GUIContent("Color Select Item"));

            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            TD.DrawPropertyArray(previewColors);

            TD.DrawSpacer();

            serializedObject.ApplyModifiedProperties();
            global.ApplyModifiedProperties();
        }