Ejemplo n.º 1
0
    public void DisplayGUI()
    {
        MegaLoftLayerSimple layer = (MegaLoftLayerSimple)target;

        SetLimits(layer.gameObject);

        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        EditorGUILayout.BeginVertical("TextArea");

        if (GUILayout.Button("Reset All Curves"))
        {
            layer.InitCurves();
            GUI.changed = true;
            EditorUtility.SetDirty(target);
        }

        layer.LayerName    = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle(MegaToolTip.Lock, layer.Lock);

            if (!layer.Lock)
            {
                layer.material  = (Material)EditorGUILayout.ObjectField(MegaToolTip.Material, layer.material, typeof(Material), true);
                layer.layerPath = (MegaShape)EditorGUILayout.ObjectField(MegaToolTip.Path, layer.layerPath, typeof(MegaShape), true);

                if (layer.layerPath && layer.layerPath.splines != null)
                {
                    if (layer.layerPath.splines.Count > 1)
                    {
                        layer.curve = EditorGUILayout.IntSlider(MegaToolTip.Curve, layer.curve, 0, layer.layerPath.splines.Count - 1);
                    }
                    if (layer.curve < 0)
                    {
                        layer.curve = 0;
                    }
                    if (layer.curve > layer.layerPath.splines.Count - 1)
                    {
                        layer.curve = layer.layerPath.splines.Count - 1;
                    }
                }

                layer.pathStart  = EditorGUILayout.Slider(MegaToolTip.Start, layer.pathStart, sl, sh);
                layer.pathLength = EditorGUILayout.Slider(MegaToolTip.Length, layer.pathLength, ll, lh);
                layer.pathDist   = EditorGUILayout.Slider(MegaToolTip.Dist, layer.pathDist, dl, dh);

                EditorGUILayout.BeginVertical("Box");
                layer.offset = EditorGUILayout.Vector3Field("Offset", layer.offset);

                layer.useOffsetX = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseOffsetX, layer.useOffsetX);
                layer.offsetCrvX = EditorGUILayout.CurveField(MegaToolTip.OffsetCrvX, layer.offsetCrvX);
                EditorGUILayout.EndToggleGroup();

                layer.useOffsetY = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseOffsetY, layer.useOffsetY);
                layer.offsetCrvY = EditorGUILayout.CurveField(MegaToolTip.OffsetCrvY, layer.offsetCrvY);
                EditorGUILayout.EndToggleGroup();

                layer.useOffsetZ = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseOffsetZ, layer.useOffsetZ);
                layer.offsetCrvZ = EditorGUILayout.CurveField(MegaToolTip.OffsetCrvZ, layer.offsetCrvZ);
                EditorGUILayout.EndToggleGroup();

                layer.frameMethod = (MegaFrameMethod)EditorGUILayout.EnumPopup("Frame Method", layer.frameMethod);
                layer.useTwistCrv = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseTwist, layer.useTwistCrv);
                layer.twistAmt    = EditorGUILayout.FloatField(MegaToolTip.Twist, layer.twistAmt);
                layer.twistCrv    = EditorGUILayout.CurveField(MegaToolTip.TwistCrv, layer.twistCrv);
                EditorGUILayout.EndToggleGroup();

                layer.color = EditorGUILayout.ColorField("Color", layer.color);
                layer.colR  = EditorGUILayout.CurveField("Red", layer.colR);
                layer.colG  = EditorGUILayout.CurveField("Green", layer.colG);
                layer.colB  = EditorGUILayout.CurveField("Blue", layer.colB);
                layer.colA  = EditorGUILayout.CurveField("Alpha", layer.colA);

                EditorGUILayout.EndVertical();

                //layer.showcrossparams = EditorGUILayout.Foldout(layer.showcrossparams, MegaToolTip.CrossParams);	//"Cross Params");
                layer.showcrossparams = MegaFoldOut.Start("Cross Params", layer.showcrossparams, new Color(0.5f, 1.0f, 0.5f));

                if (layer.showcrossparams)
                {
                    //EditorGUILayout.BeginVertical("Box");
                    layer.layerSection = (MegaShape)EditorGUILayout.ObjectField(MegaToolTip.Section, layer.layerSection, typeof(MegaShape), true);

                    if (layer.layerSection && layer.layerSection.splines != null)
                    {
                        if (layer.layerSection.splines.Count > 1)
                        {
                            layer.crosscurve = EditorGUILayout.IntSlider(MegaToolTip.Curve, layer.crosscurve, 0, layer.layerSection.splines.Count - 1);
                            layer.snap       = EditorGUILayout.Toggle(MegaToolTip.Snap, layer.snap);
                        }
                        if (layer.crosscurve < 0)
                        {
                            layer.crosscurve = 0;
                        }
                        if (layer.crosscurve > layer.layerSection.splines.Count - 1)
                        {
                            layer.crosscurve = layer.layerSection.splines.Count - 1;
                        }
                    }

                    //layer.alignCross = EditorGUILayout.Toggle("Align Cross", layer.alignCross);
                    layer.alignCross = EditorGUILayout.Slider("Align Cross", layer.alignCross, 0.0f, 1.0f);
                    layer.crossStart = EditorGUILayout.Slider(MegaToolTip.CrossStart, layer.crossStart, csl, csh);
                    layer.crossEnd   = EditorGUILayout.Slider(MegaToolTip.CrossLength, layer.crossEnd, cll, clh);
                    layer.crossDist  = EditorGUILayout.Slider(MegaToolTip.CrossDist, layer.crossDist, cdl, cdh);                        //0.025f, 1.0f);

                    layer.crossRot         = EditorGUILayout.Vector3Field("Cross Rotate", layer.crossRot);
                    layer.crossScale       = EditorGUILayout.Vector3Field("Cross Scale", layer.crossScale);
                    layer.pivot            = EditorGUILayout.Vector3Field("Pivot", layer.pivot);
                    layer.includeknots     = EditorGUILayout.Toggle(MegaToolTip.IncludeKnots, layer.includeknots);
                    layer.useCrossScaleCrv = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseCrossScale, layer.useCrossScaleCrv);
                    layer.crossScaleCrv    = EditorGUILayout.CurveField(MegaToolTip.CrossScaleCrv, layer.crossScaleCrv);
                    layer.scaleoff         = EditorGUILayout.Slider(MegaToolTip.CrossOff, layer.scaleoff, -1.0f, 1.0f);
                    layer.sepscale         = EditorGUILayout.Toggle(MegaToolTip.SeperateScale, layer.sepscale);
                    EditorGUILayout.EndToggleGroup();

                    if (layer.sepscale)
                    {
                        layer.useCrossScaleCrvY = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseCrossScaleY, layer.useCrossScaleCrvY);
                        layer.crossScaleCrvY    = EditorGUILayout.CurveField(MegaToolTip.CrossScaleCrvY, layer.crossScaleCrvY);
                        layer.scaleoffY         = EditorGUILayout.Slider(MegaToolTip.CrossOffY, layer.scaleoffY, -1.0f, 1.0f);
                        EditorGUILayout.EndToggleGroup();
                    }

                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showcrossparams);

                //layer.showadvancedparams = EditorGUILayout.Foldout(layer.showadvancedparams, MegaToolTip.AdvancedParams);
                layer.showadvancedparams = MegaFoldOut.Start("Advanced Params", layer.showadvancedparams, new Color(0.5f, 0.5f, 1.0f));

                if (layer.showadvancedparams)
                {
                    //layer.optimize = EditorGUILayout.Toggle("Optimize", layer.optimize);
                    //layer.maxdeviation = EditorGUILayout.Slider("Max Deviation", layer.maxdeviation, 0.0f, 90.0f);
                    layer.flip    = EditorGUILayout.Toggle(MegaToolTip.Flip, layer.flip);
                    layer.snapTop = EditorGUILayout.BeginToggleGroup(MegaToolTip.SnapTop, layer.snapTop);
                    layer.Top     = EditorGUILayout.FloatField(MegaToolTip.Top, layer.Top);
                    EditorGUILayout.EndToggleGroup();

                    layer.snapBottom = EditorGUILayout.BeginToggleGroup(MegaToolTip.SnapBottom, layer.snapBottom);
                    layer.Bottom     = EditorGUILayout.FloatField(MegaToolTip.Bottom, layer.Bottom);
                    EditorGUILayout.EndToggleGroup();


                    layer.clipTop    = EditorGUILayout.BeginToggleGroup(MegaToolTip.ClipTop, layer.clipTop);
                    layer.clipTopVal = EditorGUILayout.FloatField(MegaToolTip.ClipTopVal, layer.clipTopVal);
                    EditorGUILayout.EndToggleGroup();

                    layer.clipBottom    = EditorGUILayout.BeginToggleGroup(MegaToolTip.ClipBottom, layer.clipBottom);
                    layer.clipBottomVal = EditorGUILayout.FloatField(MegaToolTip.ClipBottomVal, layer.clipBottomVal);
                    EditorGUILayout.EndToggleGroup();
                }
                MegaFoldOut.End(layer.showadvancedparams);

                //layer.showuvparams = EditorGUILayout.Foldout(layer.showuvparams, MegaToolTip.UVParams);
                layer.showuvparams = MegaFoldOut.Start("UV Params", layer.showuvparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showuvparams)
                {
                    //EditorGUILayout.BeginVertical("Box");
                    MegaShapeLoftEditor.PushCols();
                    GUI.color = Color.white;

                    layer.UVOffset = EditorGUILayout.Vector2Field("UV Offset", layer.UVOffset);
                    layer.UVScale  = EditorGUILayout.Vector2Field("UV Scale", layer.UVScale);
                    layer.swapuv   = EditorGUILayout.Toggle(MegaToolTip.SwapUV, layer.swapuv);
                    layer.physuv   = EditorGUILayout.Toggle(MegaToolTip.PhysicalUV, layer.physuv);
                    layer.uvcalcy  = EditorGUILayout.Toggle("Calc Y", layer.uvcalcy);
                    layer.UVOrigin = (MegaLoftUVOrigin)EditorGUILayout.EnumPopup("UV origin", layer.UVOrigin);

                    //layer.pingpongx = EditorGUILayout.Toggle("PingPong uv X", layer.pingpongx);
                    //layer.pingpongy = EditorGUILayout.Toggle("PingPong uv Y", layer.pingpongy);

                    layer.planarMapping = EditorGUILayout.BeginToggleGroup("Planar", layer.planarMapping);
                    layer.planarAxis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.planarAxis);
                    //layer.planarWorld = EditorGUILayout.Toggle("World", layer.planarWorld);
                    layer.planarMode = (MegaPlanarMode)EditorGUILayout.EnumPopup("Mode", layer.planarMode);
                    bool lockWorld = EditorGUILayout.Toggle("Lock World", layer.lockWorld);
                    if (lockWorld != layer.lockWorld)
                    {
                        layer.lockWorld = lockWorld;
                        if (lockWorld)
                        {
                            layer.lockedTM = layer.transform.localToWorldMatrix;
                        }
                    }

                    EditorGUILayout.EndToggleGroup();

                    layer.sideViewUV   = EditorGUILayout.BeginToggleGroup("Side View", layer.sideViewUV);
                    layer.sideViewAxis = (MegaAxis)EditorGUILayout.EnumPopup("Side Axis", layer.sideViewAxis);
                    EditorGUILayout.EndToggleGroup();
                    MegaShapeLoftEditor.PopCols();
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showuvparams);

                //layer.showCapParams = EditorGUILayout.Foldout(layer.showCapParams, MegaToolTip.CapParams);
                layer.showCapParams = MegaFoldOut.Start("Cap Params", layer.showCapParams, new Color(1.0f, 1.0f, 0.5f));

                if (layer.showCapParams)
                {
                    layer.capflip          = EditorGUILayout.Toggle("Flip Caps", layer.capflip);
                    layer.capStart         = EditorGUILayout.BeginToggleGroup(MegaToolTip.CapStart, layer.capStart);
                    layer.capStartMat      = (Material)EditorGUILayout.ObjectField(MegaToolTip.CapStartMat, layer.capStartMat, typeof(Material), true);
                    layer.capStartUVOffset = EditorGUILayout.Vector2Field("UV Offset", layer.capStartUVOffset);
                    layer.capStartUVScale  = EditorGUILayout.Vector2Field("UV Scale", layer.capStartUVScale);
                    layer.capStartUVRot    = EditorGUILayout.FloatField(MegaToolTip.CapStartRot, layer.capStartUVRot);

                    EditorGUILayout.EndToggleGroup();

                    layer.capEnd         = EditorGUILayout.BeginToggleGroup(MegaToolTip.CapEnd, layer.capEnd);
                    layer.capEndMat      = (Material)EditorGUILayout.ObjectField(MegaToolTip.CapEndMat, layer.capEndMat, typeof(Material), true);
                    layer.capEndUVOffset = EditorGUILayout.Vector2Field("UV Offset", layer.capEndUVOffset);
                    layer.capEndUVScale  = EditorGUILayout.Vector2Field("UV Scale", layer.capEndUVScale);
                    layer.capEndUVRot    = EditorGUILayout.FloatField(MegaToolTip.CapEndRot, layer.capEndUVRot);
                    EditorGUILayout.EndToggleGroup();
                }
                MegaFoldOut.End(layer.showCapParams);

                layer.showConformParams = MegaFoldOut.Start("Conform Params", layer.showConformParams, new Color(1.0f, 1.0f, 0.5f));

                if (layer.showConformParams)
                {
                    layer.conform = EditorGUILayout.BeginToggleGroup("Conform", layer.conform);
                    GameObject contarget = (GameObject)EditorGUILayout.ObjectField("Target", layer.target, typeof(GameObject), true);

                    if (contarget != layer.target)
                    {
                        layer.SetTarget(contarget);
                    }
                    layer.conformAmount = EditorGUILayout.Slider("Amount", layer.conformAmount, 0.0f, 1.0f);
                    layer.raystartoff   = EditorGUILayout.FloatField("Ray Start Off", layer.raystartoff);
                    layer.conformOffset = EditorGUILayout.FloatField("Conform Offset", layer.conformOffset);
                    layer.raydist       = EditorGUILayout.FloatField("Ray Dist", layer.raydist);
                    EditorGUILayout.EndToggleGroup();
                }

                MegaFoldOut.End(layer.showConformParams);
            }
        }

        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();

        layer.customizeOffset = EditorGUILayout.BeginToggleGroup("Customize Offset", layer.customizeOffset);
        layer.param1          = EditorGUILayout.FloatField("Param 1", layer.param1);
        layer.param2          = EditorGUILayout.FloatField("Param 2", layer.param2);
        layer.param3          = EditorGUILayout.FloatField("Param 3", layer.param3);
        layer.param4          = EditorGUILayout.FloatField("Param 4", layer.param4);
        EditorGUILayout.EndToggleGroup();
    }
Ejemplo n.º 2
0
    public void DisplayGUI()
    {
        MegaLoftLayerScatterSpline layer = (MegaLoftLayerScatterSpline)target;

        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        SetLimits(layer.gameObject);
        EditorGUILayout.BeginVertical("TextArea");

        layer.LayerName    = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle(MegaToolTip.Lock, layer.Lock);

            if (!layer.Lock)
            {
                layer.scatterMesh = (Mesh)EditorGUILayout.ObjectField("Scatter Mesh", layer.scatterMesh, typeof(Mesh), true);
                layer.material    = (Material)EditorGUILayout.ObjectField("Material", layer.material, typeof(Material), true);
                layer.layerPath   = (MegaShape)EditorGUILayout.ObjectField("Path", layer.layerPath, typeof(MegaShape), true);

                if (layer.layerPath && layer.layerPath.splines.Count > 1)
                {
                    layer.curve = EditorGUILayout.IntSlider(MegaToolTip.Curve, layer.curve, 0, layer.layerPath.splines.Count - 1);
                    layer.snap  = EditorGUILayout.Toggle(MegaToolTip.Snap, layer.snap);
                }

                layer.start  = EditorGUILayout.Slider(MegaToolTip.Start, layer.start, sl, sh);
                layer.length = EditorGUILayout.Slider(MegaToolTip.Length, layer.length, ll, lh);

                layer.offPath = EditorGUILayout.Vector3Field("Path Move", layer.offPath);
                layer.rotPath = EditorGUILayout.Vector3Field("Path Rotate", layer.rotPath);
                layer.sclPath = EditorGUILayout.Vector3Field("Path Scale", layer.sclPath);

                layer.Count  = EditorGUILayout.IntField("Count", layer.Count);
                layer.Seed   = EditorGUILayout.IntField("Seed", layer.Seed);
                layer.Offset = EditorGUILayout.Vector3Field("Offset", layer.Offset);
                layer.rot    = EditorGUILayout.Vector3Field("Rotate", layer.rot);
                layer.scale  = EditorGUILayout.Vector3Field("Scale", layer.scale);

                layer.rotRange      = EditorGUILayout.Vector3Field("Rand Rotate", layer.rotRange);
                layer.scaleRangeMin = EditorGUILayout.Vector3Field("Rnd Scale Min", layer.scaleRangeMin);
                layer.scaleRangeMax = EditorGUILayout.Vector3Field("Rnd Scale Max", layer.scaleRangeMax);

                layer.tangent = EditorGUILayout.FloatField("Tangent", layer.tangent);
                layer.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.axis);

                layer.useTwist = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseTwist, layer.useTwist);
                layer.twist    = EditorGUILayout.FloatField(MegaToolTip.Twist, layer.twist);
                layer.twistCrv = EditorGUILayout.CurveField(MegaToolTip.TwistCrv, layer.twistCrv);
                EditorGUILayout.EndToggleGroup();

                // Advanced
                layer.RemoveDof   = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                layer.GlobalScale = EditorGUILayout.FloatField("Scale", layer.GlobalScale);

                EditorGUILayout.BeginVertical("TextArea");
                layer.Alpha      = EditorGUILayout.Slider("Alpha", layer.Alpha, 0.0f, 1.0f);
                layer.Speed      = EditorGUILayout.FloatField("Speed", layer.Speed);
                layer.useDensity = EditorGUILayout.BeginToggleGroup("Use Density", layer.useDensity);
                layer.density    = EditorGUILayout.CurveField("Density", layer.density, Color.green, new Rect(0.0f, 0.0f, 1.0f, 1.0f));
                EditorGUILayout.EndToggleGroup();
                EditorGUILayout.EndVertical();
            }

            layer.showConformParams = MegaFoldOut.Start("Conform Params", layer.showConformParams, new Color(1.0f, 1.0f, 0.5f));

            if (layer.showConformParams)
            {
                layer.conform = EditorGUILayout.BeginToggleGroup("Conform", layer.conform);
                GameObject contarget = (GameObject)EditorGUILayout.ObjectField("Target", layer.target, typeof(GameObject), true);

                if (contarget != layer.target)
                {
                    layer.SetTarget(contarget);
                }
                layer.conformAmount = EditorGUILayout.Slider("Amount", layer.conformAmount, 0.0f, 1.0f);
                layer.raystartoff   = EditorGUILayout.FloatField("Ray Start Off", layer.raystartoff);
                layer.conformOffset = EditorGUILayout.FloatField("Conform Offset", layer.conformOffset);
                layer.raydist       = EditorGUILayout.FloatField("Ray Dist", layer.raydist);
                EditorGUILayout.EndToggleGroup();
            }

            MegaFoldOut.End(layer.showConformParams);

            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();
        }
        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }
    public void DisplayGUI()
    {
        MegaLoftLayerCloneRules layer = (MegaLoftLayerCloneRules)target;

        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        EditorGUILayout.BeginVertical("TextArea");

        //MegaShapeLoft loft = layer.GetComponent<MegaShapeLoft>();

        SetLimits(layer.gameObject);

        layer.LayerName    = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle("Lock", layer.Lock);
            if (!layer.Lock)
            {
                layer.surfaceLoft = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", layer.surfaceLoft, typeof(MegaShapeLoft), true);
                //layer.surfaceLayer = EditorGUILayout.Popup("Layer", layer.surfaceLayer + 1, MegaShapeUtils.GetLayers(layer.surfaceLoft)) - 1;
                int surfaceLayer = MegaShapeUtils.FindLayer(layer.surfaceLoft, layer.surfaceLayer);
                surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(layer.surfaceLoft)) - 1;
                if (layer.surfaceLoft)
                {
                    for (int i = 0; i < layer.surfaceLoft.Layers.Length; i++)
                    {
                        //if ( layer.surfaceLoft.Layers[i].GetType() == typeof(MegaLoftLayerSimple) )
                        if (layer.surfaceLoft.Layers[i] is MegaLoftLayerSimple)
                        {
                            if (surfaceLayer == 0)
                            {
                                layer.surfaceLayer = i;
                                break;
                            }

                            surfaceLayer--;
                        }
                    }
                }
                else
                {
                    layer.surfaceLayer = surfaceLayer;
                }

                layer.start      = EditorGUILayout.Slider(MegaToolTip.Start, layer.start, sl, sh);
                layer.Length     = EditorGUILayout.Slider(MegaToolTip.Length, layer.Length, ll, lh);
                layer.CrossAlpha = EditorGUILayout.Slider("Cross Alpha", layer.CrossAlpha, csl, csh);
                layer.CalcUp     = EditorGUILayout.Toggle("Calc Up", layer.CalcUp);

                if (layer.CalcUp)
                {
                    layer.calcUpAmount = EditorGUILayout.Slider("Up Amount", layer.calcUpAmount, 0.0f, 1.0f);
                }

                layer.Seed = EditorGUILayout.IntField("Seed", layer.Seed);

                layer.tmrot   = EditorGUILayout.Vector3Field("TMRotate", layer.tmrot);
                layer.scale   = EditorGUILayout.Vector3Field("Scale", layer.scale);
                layer.tangent = EditorGUILayout.FloatField("Tangent", layer.tangent);
                layer.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.axis);

                layer.useTwistCrv = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseTwist, layer.useTwistCrv);
                layer.twist       = EditorGUILayout.FloatField("Twist", layer.twist);
                layer.twistCrv    = EditorGUILayout.CurveField("Twist Crv", layer.twistCrv);
                EditorGUILayout.EndToggleGroup();

                // Advanced
                layer.RemoveDof   = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                layer.GlobalScale = EditorGUILayout.FloatField("Global Scale", layer.GlobalScale);

                layer.useCrossCrv = EditorGUILayout.BeginToggleGroup("Use Cross Crv", layer.useCrossCrv);
                layer.CrossCrv    = EditorGUILayout.CurveField("Cross Crv", layer.CrossCrv);
                EditorGUILayout.EndToggleGroup();

                if (GUILayout.Button("Add Rule"))
                {
                    MegaLoftRule newrule = new MegaLoftRule();
                    layer.rules.Add(newrule);
                    GUI.changed = true;
                }

                //layer.showmainparams = EditorGUILayout.Foldout(layer.showmainparams, "Rules");
                layer.showmainparams = MegaFoldOut.Start("Rules", layer.showmainparams, new Color(0.5f, 0.5f, 1.0f));

                if (layer.showmainparams)
                {
                    for (int i = 0; i < layer.rules.Count; i++)
                    {
                        DisplayRuleGUI(layer.rules[i]);
                        if (GUILayout.Button("Delete Rule"))
                        {
                            layer.rules.RemoveAt(i);
                            i--;
                            GUI.changed = true;
                        }
                    }
                }
                MegaFoldOut.End(layer.showmainparams);
            }

            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();
        }

        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }
    public void DisplayGUI()
    {
        MegaLoftLayerComplex layer = (MegaLoftLayerComplex)target;

        //MegaShapeLoft loft = layer.GetComponent<MegaShapeLoft>();

        SetLimits(layer.gameObject);
        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        EditorGUILayout.BeginVertical("TextArea");

        layer.LayerName = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);

        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle(MegaToolTip.Lock, layer.Lock);

            if (!layer.Lock)
            {
                layer.material  = (Material)EditorGUILayout.ObjectField(MegaToolTip.Material, layer.material, typeof(Material), true);
                layer.layerPath = (MegaShape)EditorGUILayout.ObjectField(MegaToolTip.Path, layer.layerPath, typeof(MegaShape), true);

                if (layer.layerPath && layer.layerPath.splines != null)
                {
                    if (layer.layerPath.splines.Count > 1)
                    {
                        layer.curve = EditorGUILayout.IntSlider(MegaToolTip.Curve, layer.curve, 0, layer.layerPath.splines.Count - 1);
                    }
                    if (layer.curve < 0)
                    {
                        layer.curve = 0;
                    }
                    if (layer.curve > layer.layerPath.splines.Count - 1)
                    {
                        layer.curve = layer.layerPath.splines.Count - 1;
                    }
                }

                layer.SnapToPath = EditorGUILayout.Toggle("Snap To Path", layer.SnapToPath);
                layer.pathStart  = EditorGUILayout.Slider(MegaToolTip.Start, layer.pathStart, sl, sh);
                layer.pathLength = EditorGUILayout.Slider(MegaToolTip.Length, layer.pathLength, ll, lh);
                layer.pathDist   = EditorGUILayout.FloatField(MegaToolTip.Dist, layer.pathDist);
                layer.pathDist   = Mathf.Clamp(layer.pathDist, dl, dh);                 //0.05f, 1.0f);

                EditorGUILayout.BeginVertical("Box");
                layer.offset = EditorGUILayout.Vector3Field("Offset", layer.offset);

                layer.useOffsetX = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseOffsetX, layer.useOffsetX);
                layer.offsetCrvX = EditorGUILayout.CurveField(MegaToolTip.OffsetCrvX, layer.offsetCrvX);
                EditorGUILayout.EndToggleGroup();

                layer.useOffsetY = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseOffsetY, layer.useOffsetY);
                layer.offsetCrvY = EditorGUILayout.CurveField(MegaToolTip.OffsetCrvY, layer.offsetCrvY);
                EditorGUILayout.EndToggleGroup();

                layer.useOffsetZ = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseOffsetZ, layer.useOffsetZ);
                layer.offsetCrvZ = EditorGUILayout.CurveField(MegaToolTip.OffsetCrvZ, layer.offsetCrvZ);
                EditorGUILayout.EndToggleGroup();
                EditorGUILayout.EndVertical();

                layer.frameMethod = (MegaFrameMethod)EditorGUILayout.EnumPopup("Frame Method", layer.frameMethod);
                layer.flip        = EditorGUILayout.Toggle(MegaToolTip.Flip, layer.flip);

                layer.PathSteps = EditorGUILayout.IntField("Path Steps", layer.PathSteps);
                if (layer.PathSteps < 1)
                {
                    layer.PathSteps = 1;
                }

                layer.PathTeeter = EditorGUILayout.Slider("Path Teeter", layer.PathTeeter, 0.0f, 1.0f);

                layer.advancedParams = MegaFoldOut.Start("Advanced Params", layer.advancedParams, new Color(0.5f, 0.5f, 1.0f));
                //layer.advancedParams = MegaFoldOut.Foldout("Advanced Params", layer.advancedParams, new Color(0.5f, 0.5f, 1.0f));
                //layer.advancedParams = EditorGUILayout.Foldout(layer.advancedParams, MegaToolTip.AdvancedParams);

                if (layer.advancedParams)
                {
                    layer.easeType = (MegaLoftEaseType)EditorGUILayout.EnumPopup("Ease Type", layer.easeType);

                    layer.useTwistCrv = EditorGUILayout.BeginToggleGroup("Use Twist", layer.useTwistCrv);
                    layer.twistCrv    = EditorGUILayout.CurveField("Twist Curve", layer.twistCrv);
                    EditorGUILayout.EndToggleGroup();

                    layer.useScaleXCrv = EditorGUILayout.BeginToggleGroup("Use ScaleX", layer.useScaleXCrv);
                    layer.scaleCrvX    = EditorGUILayout.CurveField("Scale X Curve", layer.scaleCrvX);
                    EditorGUILayout.EndToggleGroup();
                    layer.useScaleYCrv = EditorGUILayout.BeginToggleGroup("Use ScaleY", layer.useScaleYCrv);
                    layer.scaleCrvY    = EditorGUILayout.CurveField("Scale Y Curve", layer.scaleCrvY);
                    EditorGUILayout.EndToggleGroup();
                }
                MegaFoldOut.End(layer.advancedParams);

                //layer.showcrossparams = EditorGUILayout.Foldout(layer.showcrossparams, "Cross Params");
                layer.showcrossparams = MegaFoldOut.Start("Cross Params", layer.showcrossparams, new Color(0.5f, 1.0f, 0.5f));

                if (layer.showcrossparams)
                {
                    //EditorGUILayout.BeginVertical("Box");
                    layer.crossStart = EditorGUILayout.Slider(MegaToolTip.CrossStart, layer.crossStart, csl, csh);
                    layer.crossEnd   = EditorGUILayout.Slider(MegaToolTip.CrossLength, layer.crossEnd, cll, clh);
                    layer.CrossSteps = EditorGUILayout.IntField("Cross Steps", layer.CrossSteps);
                    if (layer.CrossSteps < 1)
                    {
                        layer.CrossSteps = 1;
                    }
                    layer.crossRot         = EditorGUILayout.Vector3Field("Cross Rotate", layer.crossRot);
                    layer.crossScale       = EditorGUILayout.Vector3Field("Cross Scale", layer.crossScale);
                    layer.pivot            = EditorGUILayout.Vector3Field("Pivot", layer.pivot);
                    layer.useCrossScaleCrv = EditorGUILayout.BeginToggleGroup("Use Scale Curve", layer.useCrossScaleCrv);
                    layer.crossScaleCrv    = EditorGUILayout.CurveField("Scale", layer.crossScaleCrv);
                    EditorGUILayout.EndToggleGroup();

                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showcrossparams);

                //layer.showuvparams = EditorGUILayout.Foldout(layer.showuvparams, MegaToolTip.UVParams);
                layer.showuvparams = MegaFoldOut.Start("UV Params", layer.showuvparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showuvparams)
                {
                    //EditorGUILayout.BeginVertical("Box");
                    MegaShapeLoftEditor.PushCols();
                    GUI.color = Color.white;

                    layer.UVOffset = EditorGUILayout.Vector2Field("UV Offset", layer.UVOffset);
                    layer.UVRotate = EditorGUILayout.Vector2Field("UV Rotate", layer.UVRotate);
                    layer.UVScale  = EditorGUILayout.Vector2Field("UV Scale", layer.UVScale);

                    layer.swapuv   = EditorGUILayout.Toggle(MegaToolTip.SwapUV, layer.swapuv);
                    layer.physuv   = EditorGUILayout.Toggle(MegaToolTip.PhysicalUV, layer.physuv);
                    layer.planaruv = EditorGUILayout.Toggle("Planar UV", layer.planaruv);
                    layer.UVOrigin = (MegaLoftUVOrigin)EditorGUILayout.EnumPopup("UV Origin", layer.UVOrigin);
                    MegaShapeLoftEditor.PopCols();
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showuvparams);

                //layer.showCapParams = EditorGUILayout.Foldout(layer.showCapParams, MegaToolTip.CapParams);
                layer.showCapParams = MegaFoldOut.Start("Cap Params", layer.showCapParams, new Color(1.0f, 1.0f, 0.5f));

                if (layer.showCapParams)
                {
                    layer.capflip = EditorGUILayout.Toggle("Flip Caps", layer.capflip);

                    layer.capStart         = EditorGUILayout.BeginToggleGroup(MegaToolTip.CapStart, layer.capStart);
                    layer.capStartMat      = (Material)EditorGUILayout.ObjectField(MegaToolTip.CapStartMat, layer.capStartMat, typeof(Material), true);
                    layer.capStartUVOffset = EditorGUILayout.Vector2Field("UV Offset", layer.capStartUVOffset);
                    layer.capStartUVScale  = EditorGUILayout.Vector2Field("UV Scale", layer.capStartUVScale);
                    layer.capStartUVRot    = EditorGUILayout.FloatField(MegaToolTip.CapStartRot, layer.capStartUVRot);
                    EditorGUILayout.EndToggleGroup();

                    layer.capEnd         = EditorGUILayout.BeginToggleGroup(MegaToolTip.CapEnd, layer.capEnd);
                    layer.capEndMat      = (Material)EditorGUILayout.ObjectField(MegaToolTip.CapEndMat, layer.capEndMat, typeof(Material), true);
                    layer.capEndUVOffset = EditorGUILayout.Vector2Field("UV Offset", layer.capEndUVOffset);
                    layer.capEndUVScale  = EditorGUILayout.Vector2Field("UV Scale", layer.capEndUVScale);
                    layer.capEndUVRot    = EditorGUILayout.FloatField(MegaToolTip.CapEndRot, layer.capEndUVRot);
                    EditorGUILayout.EndToggleGroup();
                }
                MegaFoldOut.End(layer.showCapParams);

                //layer.showsections = EditorGUILayout.Foldout(layer.showsections, "Cross Sections");
                layer.showsections = MegaFoldOut.Start("Cross Sections", layer.showsections, new Color(0.5f, 1.0f, 1.0f));

                if (layer.showsections)
                {
                    if (layer.sections == null || layer.sections.Count < 2)
                    {
                        EditorGUILayout.LabelField("At least 2 cross sections are required to build the loft");
                    }

                    seccol           = EditorGUILayout.ColorField("Sections", seccol);
                    layer.handlesize = EditorGUILayout.FloatField("Handle Size", layer.handlesize);

                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Reset Sections"))
                    {
                        for (int i = 0; i < layer.sections.Count; i++)
                        {
                            layer.sections[i].alpha = (float)i / (float)(layer.sections.Count - 1);
                        }

                        GUI.changed = true;
                    }

                    if (layer.sections.Count == 0)
                    {
                        if (GUILayout.Button("Add Section"))
                        {
                            MegaLoftSection lsect = new MegaLoftSection();
                            layer.sections.Add(lsect);
                            GUI.changed = true;
                        }
                    }

                    EditorGUILayout.EndHorizontal();

                    for (int i = 0; i < layer.sections.Count; i++)
                    {
                        EditorGUILayout.BeginVertical("Box");
                        EditorGUILayout.LabelField("Cross " + i, "");

                        float min = 0.0f;
                        float max = 1.0f;
                        if (i > 0)
                        {
                            min = layer.sections[i - 1].alpha;
                        }

                        if (i < layer.sections.Count - 1)
                        {
                            max = layer.sections[i + 1].alpha;
                        }

                        float alpha = 0.0f;
                        if (i == 0)
                        {
                            alpha = 0.0f;
                        }
                        else
                        {
                            if (i == layer.sections.Count - 1)
                            {
                                alpha = 1.0f;
                            }
                            else
                            {
                                alpha = EditorGUILayout.Slider("Alpha", layer.sections[i].alpha, min, max);
                            }
                        }
                        if (alpha != layer.sections[i].alpha)
                        {
                            if (i > 0)
                            {
                                if (alpha < layer.sections[i - 1].alpha)
                                {
                                    alpha = layer.sections[i - 1].alpha;
                                }
                            }

                            if (i < layer.sections.Count - 1)
                            {
                                if (alpha > layer.sections[i + 1].alpha)
                                {
                                    alpha = layer.sections[i + 1].alpha;
                                }
                            }

                            layer.sections[i].alpha = alpha;
                        }

                        layer.sections[i].shape = (MegaShape)EditorGUILayout.ObjectField("Section", layer.sections[i].shape, typeof(MegaShape), true);

                        if (layer.sections[i].shape != null)
                        {
                            if (layer.sections[i].shape.splines.Count > 1)
                            {
                                layer.sections[i].curve = EditorGUILayout.IntSlider("Curve", layer.sections[i].curve, 0, layer.sections[i].shape.splines.Count - 1);
                            }

                            layer.sections[i].snap = EditorGUILayout.Toggle("Snap", layer.sections[i].snap);

                            if (layer.sections[i].curve < 0)
                            {
                                layer.sections[i].curve = 0;
                            }

                            if (layer.sections[i].curve > layer.sections[i].shape.splines.Count - 1)
                            {
                                layer.sections[i].curve = layer.sections[i].shape.splines.Count - 1;
                            }
                        }

                        layer.sections[i].offset = EditorGUILayout.Vector3Field("Offset", layer.sections[i].offset);
                        layer.sections[i].rot    = EditorGUILayout.Vector3Field("Rotate", layer.sections[i].rot);
                        layer.sections[i].scale  = EditorGUILayout.Vector3Field("Scale", layer.sections[i].scale);

                        layer.sections[i].uselen = EditorGUILayout.Toggle("Use Section Len", layer.sections[i].uselen);

                        if (layer.sections[i].uselen)
                        {
                            layer.sections[i].start  = EditorGUILayout.Slider("Start", layer.sections[i].start, csl, csh);
                            layer.sections[i].length = EditorGUILayout.Slider("Length", layer.sections[i].length, cll, clh);
                        }

                        EditorGUILayout.BeginHorizontal();
                        if (GUILayout.Button("Add Section"))
                        {
                            MegaLoftSection lsect = new MegaLoftSection();

                            lsect.shape = layer.sections[i].shape;
                            lsect.curve = layer.sections[i].curve;
                            lsect.scale = layer.sections[i].scale;

                            if (i == layer.sections.Count - 1)
                            {
                                int pi = i - 1;
                                if (pi >= 0)
                                {
                                    lsect.alpha = (layer.sections[pi].alpha + layer.sections[i].alpha) * 0.5f;
                                }
                                else
                                {
                                    lsect.alpha = 1.0f;
                                }

                                layer.sections.Add(lsect);
                            }
                            else
                            {
                                int pi = i + 1;

                                if (pi < layer.sections.Count - 1)
                                {
                                    lsect.alpha = (layer.sections[pi].alpha + layer.sections[i].alpha) * 0.5f;
                                }
                                else
                                {
                                    lsect.alpha = 1.0f;
                                }
                                layer.sections.Insert(i + 1, lsect);
                            }
                            GUI.changed = true;
                        }

                        if (GUILayout.Button("Delete Section"))
                        {
                            layer.sections.RemoveAt(i);
                            i--;
                            GUI.changed = true;
                        }

                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.EndVertical();
                    }
                    MegaFoldOut.End(layer.showsections);

                    if (layer.sections.Count > 0)
                    {
                        if (layer.sections[0].alpha != 0.0f)
                        {
                            layer.sections[0].alpha = 0.0f;
                        }

                        for (int i = 1; i < layer.sections.Count - 1; i++)
                        {
                            if (layer.sections[i].alpha <= layer.sections[i - 1].alpha)
                            {
                                layer.sections[i - 1].alpha = layer.sections[i].alpha;
                            }

                            if (layer.sections[i].alpha >= layer.sections[i + 1].alpha)
                            {
                                layer.sections[i].alpha = layer.sections[i + 1].alpha;
                            }
                        }

                        if (layer.sections[layer.sections.Count - 1].alpha != 1.0f)
                        {
                            layer.sections[layer.sections.Count - 1].alpha = 1.0f;
                        }
                    }
                }
            }

            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();
        }
        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }
    public void DisplayGUI()
    {
        MegaLoftLayerCloneSplineSimple layer = (MegaLoftLayerCloneSplineSimple)target;

        //MegaShapeLoft loft = layer.GetComponent<MegaShapeLoft>();

        SetLimits(layer.gameObject);
        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        EditorGUILayout.BeginVertical("TextArea");

        layer.LayerName    = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle(MegaToolTip.Lock, layer.Lock);

            if (!layer.Lock)
            {
                layer.layerPath = (MegaShape)EditorGUILayout.ObjectField(MegaToolTip.Path, layer.layerPath, typeof(MegaShape), true);

                if (layer.layerPath && layer.layerPath.splines.Count > 1)
                {
                    layer.curve = EditorGUILayout.IntSlider(MegaToolTip.Curve, layer.curve, 0, layer.layerPath.splines.Count - 1);
                    layer.snap  = EditorGUILayout.Toggle(MegaToolTip.Snap, layer.snap);
                }

                layer.material = (Material)EditorGUILayout.ObjectField(MegaToolTip.Material, layer.material, typeof(Material), true);
                layer.Start    = EditorGUILayout.Slider(MegaToolTip.Start, layer.Start, sl, sh);
                layer.Length   = EditorGUILayout.Slider(MegaToolTip.Length, layer.Length, ll, lh);

                layer.offPath = EditorGUILayout.Vector3Field("Path Move", layer.offPath);
                layer.rotPath = EditorGUILayout.Vector3Field("Path Rotate", layer.rotPath);
                layer.sclPath = EditorGUILayout.Vector3Field("Path Scale", layer.sclPath);

                layer.rot     = EditorGUILayout.Vector3Field("Rotate", layer.rot);
                layer.tangent = EditorGUILayout.FloatField("Tangent", layer.tangent);
                layer.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.axis);
                //layer.meshAxis = (MegaAxis)EditorGUILayout.EnumPopup("Mesh Axis", layer.meshAxis);

                layer.useTwist = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseTwist, layer.useTwist);
                layer.twist    = EditorGUILayout.FloatField(MegaToolTip.Twist, layer.twist);
                layer.twistCrv = EditorGUILayout.CurveField(MegaToolTip.TwistCrv, layer.twistCrv);
                EditorGUILayout.EndToggleGroup();

                // Advanced
                layer.RemoveDof   = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                layer.GlobalScale = EditorGUILayout.FloatField("Scale", layer.GlobalScale);

                // Start Info
                //layer.showstartparams = EditorGUILayout.Foldout(layer.showstartparams, "Start Params");
                layer.showstartparams = MegaFoldOut.Start("Start Params", layer.showstartparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showstartparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.StartEnabled = EditorGUILayout.Toggle("Enabled", layer.StartEnabled);
                    layer.startObj     = (Mesh)EditorGUILayout.ObjectField("Mesh", layer.startObj, typeof(Mesh), true);
                    layer.StartOff     = EditorGUILayout.Vector3Field("Offset", layer.StartOff);
                    layer.StartScale   = EditorGUILayout.Vector3Field("Scale", layer.StartScale);
                    layer.StartGap     = EditorGUILayout.FloatField("Gap", layer.StartGap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showstartparams);

                // Main Info
                //layer.showmainparams = EditorGUILayout.Foldout(layer.showmainparams, "Main Params");
                layer.showmainparams = MegaFoldOut.Start("Main Params", layer.showmainparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showmainparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.MainEnabled = EditorGUILayout.Toggle("Enabled", layer.MainEnabled);
                    layer.mainObj     = (Mesh)EditorGUILayout.ObjectField("Mesh", layer.mainObj, typeof(Mesh), true);
                    layer.MainOff     = EditorGUILayout.Vector3Field("Offset", layer.MainOff);
                    layer.MainScale   = EditorGUILayout.Vector3Field("Scale", layer.MainScale);
                    layer.Gap         = EditorGUILayout.FloatField("Gap", layer.Gap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showmainparams);

                // End Info
                //layer.showendparams = EditorGUILayout.Foldout(layer.showendparams, "End Params");
                layer.showendparams = MegaFoldOut.Start("End Params", layer.showendparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showendparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.EndEnabled = EditorGUILayout.Toggle("Enabled", layer.EndEnabled);
                    layer.endObj     = (Mesh)EditorGUILayout.ObjectField("Mesh", layer.endObj, typeof(Mesh), true);
                    layer.EndOff     = EditorGUILayout.Vector3Field("Offset", layer.EndOff);
                    layer.EndScale   = EditorGUILayout.Vector3Field("Scale", layer.EndScale);
                    layer.EndGap     = EditorGUILayout.FloatField("Gap", layer.EndGap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showendparams);

                layer.showConformParams = MegaFoldOut.Start("Conform Params", layer.showConformParams, new Color(1.0f, 1.0f, 0.5f));

                if (layer.showConformParams)
                {
                    layer.conform = EditorGUILayout.BeginToggleGroup("Conform", layer.conform);
                    GameObject contarget = (GameObject)EditorGUILayout.ObjectField("Target", layer.target, typeof(GameObject), true);

                    if (contarget != layer.target)
                    {
                        layer.SetTarget(contarget);
                    }
                    layer.conformAmount = EditorGUILayout.Slider("Amount", layer.conformAmount, 0.0f, 1.0f);
                    layer.raystartoff   = EditorGUILayout.FloatField("Ray Start Off", layer.raystartoff);
                    layer.conformOffset = EditorGUILayout.FloatField("Conform Offset", layer.conformOffset);
                    layer.raydist       = EditorGUILayout.FloatField("Ray Dist", layer.raydist);
                    EditorGUILayout.EndToggleGroup();
                }

                MegaFoldOut.End(layer.showConformParams);
            }
            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();
        }
        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }
    public void DisplayGUI()
    {
        MegaLoftLayerCloneSplineRules layer = (MegaLoftLayerCloneSplineRules)target;

        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;
        EditorGUILayout.BeginVertical("TextArea");

        SetLimits(layer.gameObject);

        layer.LayerName    = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle("Lock", layer.Lock);

            if (!layer.Lock)
            {
                layer.layerPath = (MegaShape)EditorGUILayout.ObjectField(MegaToolTip.Path, layer.layerPath, typeof(MegaShape), true);

                if (layer.layerPath && layer.layerPath.splines.Count > 1)
                {
                    layer.curve = EditorGUILayout.IntSlider(MegaToolTip.Curve, layer.curve, 0, layer.layerPath.splines.Count - 1);
                    layer.snap  = EditorGUILayout.Toggle(MegaToolTip.Snap, layer.snap);
                }

                layer.start    = EditorGUILayout.Slider(MegaToolTip.Start, layer.start, sl, sh);
                layer.Length   = EditorGUILayout.Slider(MegaToolTip.Length, layer.Length, ll, lh);
                layer.offset   = EditorGUILayout.Vector3Field("Offset", layer.offset);
                layer.Seed     = EditorGUILayout.IntField("Seed", layer.Seed);
                layer.tmrot    = EditorGUILayout.Vector3Field("TMRotate", layer.tmrot);
                layer.scale    = EditorGUILayout.Vector3Field("Scale", layer.scale);
                layer.tangent  = EditorGUILayout.FloatField("Tangent", layer.tangent);
                layer.axis     = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.axis);
                layer.twist    = EditorGUILayout.FloatField("Twist", layer.twist);
                layer.twistCrv = EditorGUILayout.CurveField("Twist Crv", layer.twistCrv);

                // Advanced
                layer.RemoveDof   = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                layer.GlobalScale = EditorGUILayout.FloatField("Global Scale", layer.GlobalScale);

                if (GUILayout.Button("Add Rule"))
                {
                    MegaLoftRule newrule = new MegaLoftRule();
                    layer.rules.Add(newrule);
                    GUI.changed = true;
                }

                //layer.showmainparams = EditorGUILayout.Foldout(layer.showmainparams, "Rules");
                layer.showmainparams = MegaFoldOut.Start("Rules", layer.showmainparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showmainparams)
                {
                    for (int i = 0; i < layer.rules.Count; i++)
                    {
                        DisplayRuleGUI(layer.rules[i]);
                        if (GUILayout.Button("Delete Rule"))
                        {
                            layer.rules.RemoveAt(i);
                            i--;
                            GUI.changed = true;
                        }
                    }
                }

                MegaFoldOut.End(layer.showmainparams);
            }
            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();

            layer.showConformParams = MegaFoldOut.Start("Conform Params", layer.showConformParams, new Color(1.0f, 1.0f, 0.5f));

            if (layer.showConformParams)
            {
                layer.conform = EditorGUILayout.BeginToggleGroup("Conform", layer.conform);
                GameObject contarget = (GameObject)EditorGUILayout.ObjectField("Target", layer.target, typeof(GameObject), true);

                if (contarget != layer.target)
                {
                    layer.SetTarget(contarget);
                }
                layer.conformAmount = EditorGUILayout.Slider("Amount", layer.conformAmount, 0.0f, 1.0f);
                layer.raystartoff   = EditorGUILayout.FloatField("Ray Start Off", layer.raystartoff);
                layer.conformOffset = EditorGUILayout.FloatField("Conform Offset", layer.conformOffset);
                layer.raydist       = EditorGUILayout.FloatField("Ray Dist", layer.raydist);
                EditorGUILayout.EndToggleGroup();
            }

            MegaFoldOut.End(layer.showConformParams);
        }
        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }
Ejemplo n.º 7
0
    public void DisplayGUI()
    {
        MegaLoftLayerClone layer = (MegaLoftLayerClone)target;

        MegaShapeLoftEditor.PushCols();

        MegaShapeLoft loft = layer.GetComponent <MegaShapeLoft>();

        float sl = -1.0f;
        float sh = 1.0f;
        float ll = 0.001f;
        float lh = 2.0f;

        float csl = -1.0f;
        float csh = 1.0f;

        if (loft)
        {
            sl  = loft.startLow;
            sh  = loft.startHigh;
            ll  = loft.lenLow;
            lh  = loft.lenHigh;
            csl = loft.crossLow;
            csh = loft.crossHigh;
        }

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        EditorGUILayout.BeginVertical("TextArea");

        layer.LayerName    = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle("Lock", layer.Lock);

            if (!layer.Lock)
            {
                //layer.material = (Material)EditorGUILayout.ObjectField(MegaToolTip.Material, layer.material, typeof(Material), true);
                layer.surfaceLoft = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", layer.surfaceLoft, typeof(MegaShapeLoft), true);
                //layer.surfaceLayer = EditorGUILayout.Popup("Layer", layer.surfaceLayer + 1, MegaShapeUtils.GetLayers(layer.surfaceLoft)) - 1;

                int surfaceLayer = MegaShapeUtils.FindLayer(layer.surfaceLoft, layer.surfaceLayer);
                surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(layer.surfaceLoft)) - 1;

                if (layer.surfaceLoft)
                {
                    for (int i = 0; i < layer.surfaceLoft.Layers.Length; i++)
                    {
                        //if ( layer.surfaceLoft.Layers[i].GetType() == typeof(MegaLoftLayerSimple) )
                        if (layer.surfaceLoft.Layers[i] is MegaLoftLayerSimple)
                        {
                            if (surfaceLayer == 0)
                            {
                                layer.surfaceLayer = i;
                                break;
                            }

                            surfaceLayer--;
                        }
                    }
                }
                else
                {
                    layer.surfaceLayer = surfaceLayer;
                }

                layer.start  = EditorGUILayout.Slider(MegaToolTip.Start, layer.start, sl, sh);
                layer.Length = EditorGUILayout.Slider(MegaToolTip.Length, layer.Length, ll, lh);
                //layer.CrossAlpha = EditorGUILayout.Slider("Cross Alpha", layer.CrossAlpha, csl, csh);	//-1.0f, 2.0f);
                layer.CrossAlpha = Slider("Cross Alpha", layer.CrossAlpha, csl, csh);                   //-1.0f, 2.0f);
                layer.CalcUp     = EditorGUILayout.Toggle("Calc Up", layer.CalcUp);
                if (!layer.CalcUp)
                {
                    layer.RemoveDof = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                }

                //Vector3	off = EditorGUILayout.Vector3Field("Offset", layer.Offset);
                //layer.Offset += (layer.Offset - off) * 0.1f;
                layer.Offset = Vector3Field("Offset", layer.Offset);
                //layer.Offset = EditorGUILayout.Vector3Field("Offset", layer.Offset);
                layer.rot     = EditorGUILayout.Vector3Field("Rotate", layer.rot);
                layer.tmrot   = EditorGUILayout.Vector3Field("TMRotate", layer.tmrot);
                layer.tangent = EditorGUILayout.FloatField("Tangent", layer.tangent);
                layer.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.axis);

                layer.useTwist = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseTwist, layer.useTwist);
                layer.twist    = EditorGUILayout.FloatField(MegaToolTip.Twist, layer.twist);
                layer.twistCrv = EditorGUILayout.CurveField(MegaToolTip.TwistCrv, layer.twistCrv);
                EditorGUILayout.EndToggleGroup();

                // Advanced
                layer.RemoveDof   = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                layer.GlobalScale = EditorGUILayout.FloatField("Scale", layer.GlobalScale);

                layer.useCrossCrv = EditorGUILayout.BeginToggleGroup("Use Cross Crv", layer.useCrossCrv);
                layer.CrossCrv    = EditorGUILayout.CurveField("Cross Crv", layer.CrossCrv);
                EditorGUILayout.EndToggleGroup();

                // Start Info
                //layer.showstartparams = EditorGUILayout.Foldout(layer.showstartparams, "Start Params");
                layer.showstartparams = MegaFoldOut.Start("Start Params", layer.showstartparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showstartparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.StartEnabled = EditorGUILayout.Toggle("Enabled", layer.StartEnabled);
                    layer.startObj     = (GameObject)EditorGUILayout.ObjectField("Mesh", layer.startObj, typeof(GameObject), true);
                    layer.startObj     = MegaMeshCheck.ValidateObj(layer.startObj);
                    //layer.StartOff = EditorGUILayout.Vector3Field("Offset", layer.StartOff);
                    layer.StartOff   = Vector3Field("Offset", layer.StartOff);
                    layer.StartScale = EditorGUILayout.Vector3Field("Scale", layer.StartScale);
                    layer.StartGap   = FloatField("Gap", layer.StartGap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showstartparams);

                // Main Info
                //layer.showmainparams = EditorGUILayout.Foldout(layer.showmainparams, "Main Params");
                layer.showmainparams = MegaFoldOut.Start("Main Params", layer.showmainparams, new Color(0.5f, 1.0f, 0.5f));

                if (layer.showmainparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.MainEnabled = EditorGUILayout.Toggle("Enabled", layer.MainEnabled);
                    layer.mainObj     = (GameObject)EditorGUILayout.ObjectField("Mesh", layer.mainObj, typeof(GameObject), true);
                    layer.mainObj     = MegaMeshCheck.ValidateObj(layer.mainObj);
                    //layer.MainOff = EditorGUILayout.Vector3Field("Offset", layer.MainOff);
                    layer.MainOff   = Vector3Field("Offset", layer.MainOff);
                    layer.MainScale = EditorGUILayout.Vector3Field("Scale", layer.MainScale);

                    if (layer.MainScale.x < 0.01f)
                    {
                        layer.MainScale.x = 0.01f;
                    }

                    if (layer.MainScale.y < 0.01f)
                    {
                        layer.MainScale.y = 0.01f;
                    }
                    if (layer.MainScale.z < 0.1f)
                    {
                        layer.MainScale.z = 0.1f;
                    }

                    layer.Gap = FloatField("Gap", layer.Gap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showmainparams);

                // End Info
                //layer.showendparams = EditorGUILayout.Foldout(layer.showendparams, "End Params");
                layer.showendparams = MegaFoldOut.Start("End Params", layer.showendparams, new Color(0.5f, 0.5f, 1.0f));

                if (layer.showendparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.EndEnabled = EditorGUILayout.Toggle("Enabled", layer.EndEnabled);
                    layer.endObj     = (GameObject)EditorGUILayout.ObjectField("Mesh", layer.endObj, typeof(GameObject), true);
                    layer.endObj     = MegaMeshCheck.ValidateObj(layer.endObj);
                    //layer.EndOff = EditorGUILayout.Vector3Field("Offset", layer.EndOff);
                    layer.EndOff   = Vector3Field("Offset", layer.EndOff);
                    layer.EndScale = EditorGUILayout.Vector3Field("Scale", layer.EndScale);
                    layer.EndGap   = FloatField("Gap", layer.EndGap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showendparams);
            }

            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();
        }

        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }
Ejemplo n.º 8
0
    public void DisplayGUI()
    {
        MegaLoftLayerCloneSimple layer = (MegaLoftLayerCloneSimple)target;

        MegaShapeLoftEditor.PushCols();

        GUI.color           = Color.white;
        GUI.backgroundColor = layer.paramcol;
        GUI.contentColor    = Color.white;

        //MegaShapeLoft loft = layer.GetComponent<MegaShapeLoft>();

        SetLimits(layer.gameObject);
        EditorGUILayout.BeginVertical("TextArea");

        layer.LayerName = EditorGUILayout.TextField(MegaToolTip.LayerName, layer.LayerName);

        layer.LayerEnabled = EditorGUILayout.Toggle(MegaToolTip.Enabled, layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField(MegaToolTip.ParamCol, layer.paramcol);

        if (layer.LayerEnabled)
        {
            layer.Lock = EditorGUILayout.Toggle(MegaToolTip.Lock, layer.Lock);

            if (!layer.Lock)
            {
                // TODO: If null use material from main
                layer.material    = (Material)EditorGUILayout.ObjectField(MegaToolTip.Material, layer.material, typeof(Material), true);
                layer.surfaceLoft = (MegaShapeLoft)EditorGUILayout.ObjectField(MegaToolTip.Surface, layer.surfaceLoft, typeof(MegaShapeLoft), true);
                //layer.surfaceLayer = EditorGUILayout.Popup(MegaToolTip.Layer, layer.surfaceLayer + 1, MegaShapeUtils.GetLayersAsContent(layer.surfaceLoft)) - 1;
                int surfaceLayer = MegaShapeUtils.FindLayer(layer.surfaceLoft, layer.surfaceLayer);
                surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(layer.surfaceLoft)) - 1;
                if (layer.surfaceLoft)
                {
                    for (int i = 0; i < layer.surfaceLoft.Layers.Length; i++)
                    {
                        //if ( layer.surfaceLoft.Layers[i].GetType() == typeof(MegaLoftLayerSimple) )
                        if (layer.surfaceLoft.Layers[i] is MegaLoftLayerSimple)
                        {
                            if (surfaceLayer == 0)
                            {
                                layer.surfaceLayer = i;
                                break;
                            }

                            surfaceLayer--;
                        }
                    }
                }
                else
                {
                    layer.surfaceLayer = surfaceLayer;
                }

                layer.start  = EditorGUILayout.Slider(MegaToolTip.Start, layer.start, sl, sh);
                layer.Length = EditorGUILayout.Slider(MegaToolTip.Length, layer.Length, ll, lh);

                layer.CrossAlpha = EditorGUILayout.Slider("Cross Alpha", layer.CrossAlpha, csl, csh);                   //-1.0f, 2.0f);
                layer.CalcUp     = EditorGUILayout.Toggle("Calc Up", layer.CalcUp);
                if (!layer.CalcUp)
                {
                    layer.RemoveDof = EditorGUILayout.FloatField("UpRight", layer.RemoveDof);
                }

                layer.Offset  = EditorGUILayout.Vector3Field("Offset", layer.Offset);
                layer.rot     = EditorGUILayout.Vector3Field("Rotate", layer.rot);
                layer.tmrot   = EditorGUILayout.Vector3Field("TMRotate", layer.tmrot);
                layer.tangent = EditorGUILayout.FloatField("Tangent", layer.tangent);
                layer.axis    = (MegaAxis)EditorGUILayout.EnumPopup("Axis", layer.axis);

                layer.useTwist = EditorGUILayout.BeginToggleGroup(MegaToolTip.UseTwist, layer.useTwist);
                layer.twist    = EditorGUILayout.FloatField(MegaToolTip.Twist, layer.twist);
                layer.twistCrv = EditorGUILayout.CurveField(MegaToolTip.TwistCrv, layer.twistCrv);
                EditorGUILayout.EndToggleGroup();

                // Advanced
                layer.GlobalScale = EditorGUILayout.FloatField("Scale", layer.GlobalScale);
                layer.useCrossCrv = EditorGUILayout.BeginToggleGroup("Use Cross Crv", layer.useCrossCrv);
                layer.CrossCrv    = EditorGUILayout.CurveField("Cross Crv", layer.CrossCrv);
                EditorGUILayout.EndToggleGroup();

                // Start Info
                //layer.showstartparams = EditorGUILayout.Foldout(layer.showstartparams, "Start Params");
                layer.showstartparams = MegaFoldOut.Start("Start Params", layer.showstartparams, new Color(1.0f, 0.5f, 0.5f));

                if (layer.showstartparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.StartEnabled = EditorGUILayout.Toggle("Enabled", layer.StartEnabled);
                    Mesh startObj = (Mesh)EditorGUILayout.ObjectField("Mesh", layer.startObj, typeof(Mesh), true);
                    if (startObj != layer.startObj)
                    {
                        layer.SetMesh(startObj, 0);
                    }

                    layer.StartOff   = EditorGUILayout.Vector3Field("Offset", layer.StartOff);
                    layer.StartScale = EditorGUILayout.Vector3Field("Scale", layer.StartScale);
                    layer.StartGap   = EditorGUILayout.FloatField("Gap", layer.StartGap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showstartparams);

                // Main Info
                //layer.showmainparams = EditorGUILayout.Foldout(layer.showmainparams, "Main Params");
                layer.showmainparams = MegaFoldOut.Start("Main Params", layer.showmainparams, new Color(0.5f, 1.0f, 0.5f));

                if (layer.showmainparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.MainEnabled = EditorGUILayout.Toggle("Enabled", layer.MainEnabled);
                    Mesh mainObj = (Mesh)EditorGUILayout.ObjectField("Mesh", layer.mainObj, typeof(Mesh), true);

                    if (mainObj != layer.mainObj)
                    {
                        layer.SetMesh(mainObj, 1);
                    }

                    layer.MainOff   = EditorGUILayout.Vector3Field("Offset", layer.MainOff);
                    layer.MainScale = EditorGUILayout.Vector3Field("Scale", layer.MainScale);
                    layer.Gap       = EditorGUILayout.FloatField("Gap", layer.Gap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showmainparams);

                // End Info
                //layer.showendparams = EditorGUILayout.Foldout(layer.showendparams, "End Params");
                layer.showendparams = MegaFoldOut.Start("End Params", layer.showendparams, new Color(0.5f, 0.5f, 1.0f));

                if (layer.showendparams)
                {
                    //EditorGUILayout.BeginVertical("TextArea");
                    layer.EndEnabled = EditorGUILayout.Toggle("Enabled", layer.EndEnabled);
                    Mesh endObj = (Mesh)EditorGUILayout.ObjectField("Mesh", layer.endObj, typeof(Mesh), true);
                    if (endObj != layer.endObj)
                    {
                        layer.SetMesh(endObj, 2);
                    }

                    layer.EndOff   = EditorGUILayout.Vector3Field("Offset", layer.EndOff);
                    layer.EndScale = EditorGUILayout.Vector3Field("Scale", layer.EndScale);
                    layer.EndGap   = EditorGUILayout.FloatField("Gap", layer.EndGap);
                    //EditorGUILayout.EndVertical();
                }
                MegaFoldOut.End(layer.showendparams);
            }

            //EditorGUILayout.EndVertical();
            //MegaShapeLoftEditor.PopCols();
        }
        EditorGUILayout.EndVertical();
        MegaShapeLoftEditor.PopCols();
    }