Esempio 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);
            }
        }
Esempio n. 2
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;
        }