public void DisplayRuleGUI(MegaLoftRule rule)
    {
        EditorGUILayout.BeginVertical("Box");

        rule.rulename = EditorGUILayout.TextField("Name", rule.rulename);
        rule.obj      = (GameObject)EditorGUILayout.ObjectField("Obj", rule.obj, typeof(GameObject), true);
        rule.obj      = MegaMeshCheck.ValidateObj(rule.obj);
        rule.enabled  = EditorGUILayout.Toggle("Enabled", rule.enabled);

        rule.offset = EditorGUILayout.Vector3Field("Offset", rule.offset);
        rule.scale  = EditorGUILayout.Vector3Field("Scale", rule.scale);
        rule.gapin  = EditorGUILayout.FloatField("Gap In", rule.gapin);
        rule.gapout = EditorGUILayout.FloatField("Gap Out", rule.gapout);

        rule.type   = (MegaLoftRuleType)EditorGUILayout.EnumPopup("Type", rule.type);
        rule.weight = EditorGUILayout.FloatField("Weight", rule.weight);

        if (rule.type == MegaLoftRuleType.Regular)
        {
            rule.count = EditorGUILayout.IntField("Count", rule.count);
        }

        if (rule.type == MegaLoftRuleType.Placed)
        {
            rule.alpha = EditorGUILayout.FloatField("Alpha", rule.alpha);
        }

        EditorGUILayout.EndVertical();
    }
    public void DisplayGUI()
    {
        MegaLoftLayerCloneSpline layer = (MegaLoftLayerCloneSpline)target;

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

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

        EditorGUILayout.BeginVertical("TextArea");

        layer.LayerName    = EditorGUILayout.TextField("Name", layer.LayerName);
        layer.LayerEnabled = EditorGUILayout.Toggle("Enabled", layer.LayerEnabled);
        layer.paramcol     = EditorGUILayout.ColorField("Col", 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.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.Offset   = EditorGUILayout.Vector3Field("Offset", layer.Offset);
                layer.rot      = EditorGUILayout.Vector3Field("Rotate", layer.rot);
                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);

                // 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.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     = (GameObject)EditorGUILayout.ObjectField("Mesh", layer.mainObj, typeof(GameObject), true);
                    layer.mainObj     = MegaMeshCheck.ValidateObj(layer.mainObj);
                    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     = (GameObject)EditorGUILayout.ObjectField("Mesh", layer.endObj, typeof(GameObject), true);
                    layer.endObj     = MegaMeshCheck.ValidateObj(layer.endObj);
                    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();
    }
Ejemplo n.º 3
0
    void OnGUI()
    {
        if (Selection.activeGameObject == null)
        {
            return;
        }

        MegaShapeLoft loft = Selection.activeGameObject.GetComponent <MegaShapeLoft>();

        if (loft == null)
        {
            return;
        }

        lofttype  = (MegaLoftType)EditorGUILayout.EnumPopup("Type", lofttype);
        LayerName = EditorGUILayout.TextField("Name", LayerName);
        start     = EditorGUILayout.FloatField("Start", start);
        length    = EditorGUILayout.FloatField("Length", length);
        paramCol  = EditorGUILayout.ColorField("Param Col", paramCol);

        EditorStyles.textField.wordWrap = true;

        switch (lofttype)
        {
        case MegaLoftType.Simple:
            EditorGUILayout.TextArea("Basic Loft layer that uses a single spline for the path and another spline for the cross section", GUILayout.Height(50.0f));
            path     = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            section  = (MegaShape)EditorGUILayout.ObjectField("Section", section, typeof(MegaShape), true);
            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        //case MegaLoftType.Collider:
        //	colliderwidth = EditorGUILayout.FloatField("Collider Width", colliderwidth);
        //	break;

        case MegaLoftType.CloneSimple:
            EditorGUILayout.TextArea("Clone a mesh onto a surface with options for start, end and main meshes", GUILayout.Height(50.0f));
            startObjMesh = (Mesh)EditorGUILayout.ObjectField("Start Obj", startObjMesh, typeof(Mesh), true);
            mainObjMesh  = (Mesh)EditorGUILayout.ObjectField("Main Obj", mainObjMesh, typeof(Mesh), true);
            endObjMesh   = (Mesh)EditorGUILayout.ObjectField("End Obj", endObjMesh, typeof(Mesh), true);
            surfaceLoft  = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", surfaceLoft, typeof(MegaShapeLoft), true);
            surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(surfaceLoft)) - 1;
            material     = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        case MegaLoftType.ScatterSimple:
            EditorGUILayout.TextArea("Scatters a choosen mesh and material over a surface", GUILayout.Height(50.0f));
            mainObjMesh  = (Mesh)EditorGUILayout.ObjectField("Obj", mainObjMesh, typeof(Mesh), true);
            surfaceLoft  = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", surfaceLoft, typeof(MegaShapeLoft), true);
            surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(surfaceLoft)) - 1;
            material     = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        case MegaLoftType.Scatter:
            EditorGUILayout.TextArea("Builds a mesh layer by scattering a choosen object over a surface", GUILayout.Height(50.0f));
            mainObj      = (GameObject)EditorGUILayout.ObjectField("Obj", mainObj, typeof(Mesh), true);
            mainObj      = MegaMeshCheck.ValidateObj(mainObj);
            surfaceLoft  = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", surfaceLoft, typeof(MegaShapeLoft), true);
            surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(surfaceLoft)) - 1;
            break;

        case MegaLoftType.ScatterSpline:
            EditorGUILayout.TextArea("Build a mesh by scattering a choosen mesh and material along a spline", GUILayout.Height(50.0f));
            path        = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            mainObjMesh = (Mesh)EditorGUILayout.ObjectField("Obj", mainObjMesh, typeof(Mesh), true);
            material    = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        case MegaLoftType.Complex:
            EditorGUILayout.TextArea("Advanced lofter that uses a spline for the path and any number of cross section splines to define the loft", GUILayout.Height(50.0f));
            path     = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            section  = (MegaShape)EditorGUILayout.ObjectField("Section", section, typeof(MegaShape), true);
            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        case MegaLoftType.CloneSplineSimple:
            EditorGUILayout.TextArea("Clone a mesh along a spline with options for start, end and main meshes", GUILayout.Height(50.0f));
            path         = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            startObjMesh = (Mesh)EditorGUILayout.ObjectField("Start Obj", startObjMesh, typeof(Mesh), true);
            //startObj = MegaMeshCheck.ValidateObj(startObj);
            mainObjMesh = (Mesh)EditorGUILayout.ObjectField("Main Obj", mainObjMesh, typeof(Mesh), true);
            //mainObj = MegaMeshCheck.ValidateObj(mainObj);
            endObjMesh = (Mesh)EditorGUILayout.ObjectField("End Obj", endObjMesh, typeof(Mesh), true);
            //endObj = MegaMeshCheck.ValidateObj(endObj);
            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        case MegaLoftType.Clone:
            EditorGUILayout.TextArea("Clone a mesh onto a surface with options for start, end and main meshes", GUILayout.Height(50.0f));
            startObj     = (GameObject)EditorGUILayout.ObjectField("Start Obj", startObj, typeof(GameObject), true);
            startObj     = MegaMeshCheck.ValidateObj(startObj);
            mainObj      = (GameObject)EditorGUILayout.ObjectField("Main Obj", mainObj, typeof(GameObject), true);
            mainObj      = MegaMeshCheck.ValidateObj(mainObj);
            endObj       = (GameObject)EditorGUILayout.ObjectField("End Obj", endObj, typeof(GameObject), true);
            endObj       = MegaMeshCheck.ValidateObj(endObj);
            surfaceLoft  = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", surfaceLoft, typeof(MegaShapeLoft), true);
            surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(surfaceLoft)) - 1;
            material     = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);

            break;

        case MegaLoftType.CloneSpline:
            EditorGUILayout.TextArea("Build a mesh layer by cloning objects along a spline with options for start, end and main objects", GUILayout.Height(50.0f));
            path     = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            startObj = (GameObject)EditorGUILayout.ObjectField("Start Obj", startObj, typeof(GameObject), true);
            startObj = MegaMeshCheck.ValidateObj(startObj);
            mainObj  = (GameObject)EditorGUILayout.ObjectField("Main Obj", mainObj, typeof(GameObject), true);
            mainObj  = MegaMeshCheck.ValidateObj(mainObj);
            endObj   = (GameObject)EditorGUILayout.ObjectField("End Obj", endObj, typeof(GameObject), true);
            endObj   = MegaMeshCheck.ValidateObj(endObj);
            break;

        case MegaLoftType.CloneRules:
            EditorGUILayout.TextArea("Rule based clone onto a surface", GUILayout.Height(50.0f));
            //path = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            surfaceLoft  = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", surfaceLoft, typeof(MegaShapeLoft), true);
            surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(surfaceLoft)) - 1;
            break;

        case MegaLoftType.CloneSplineRules:
            EditorGUILayout.TextArea("Rule based clone along a spline", GUILayout.Height(50.0f));
            path         = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            surfaceLoft  = (MegaShapeLoft)EditorGUILayout.ObjectField("Surface", surfaceLoft, typeof(MegaShapeLoft), true);
            surfaceLayer = EditorGUILayout.Popup("Layer", surfaceLayer + 1, MegaShapeUtils.GetLayers(surfaceLoft)) - 1;
            break;

#if true
        case MegaLoftType.MultiMaterial:
            EditorGUILayout.TextArea("Will create a loft using multiple materials based on material ids in the spline knots. It uses a single spline for the path and another spline for the cross section", GUILayout.Height(50.0f));
            path     = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            section  = (MegaShape)EditorGUILayout.ObjectField("Section", section, typeof(MegaShape), true);
            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;

        case MegaLoftType.MultiMaterialComplex:
            EditorGUILayout.TextArea("Will create a complex loft using multiple materials based on material ids in the spline knots. It uses a single spline for the path and another spline for the cross section", GUILayout.Height(50.0f));
            path     = (MegaShape)EditorGUILayout.ObjectField("Path", path, typeof(MegaShape), true);
            section  = (MegaShape)EditorGUILayout.ObjectField("Section", section, typeof(MegaShape), true);
            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);
            break;
#endif
        }

        EditorStyles.textField.wordWrap = false;

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Create"))
        {
            MegaLoftLayerBase laybase = null;

            switch (lofttype)
            {
            case MegaLoftType.Simple:
            {
                MegaLoftLayerSimple layer = Selection.activeGameObject.AddComponent <MegaLoftLayerSimple>();
                layer.pathStart    = start;
                layer.pathLength   = length;
                layer.layerPath    = path;
                layer.layerSection = section;
                laybase            = layer;
            }
            break;

            case MegaLoftType.CloneSimple:
            {
                MegaLoftLayerCloneSimple layer = Selection.activeGameObject.AddComponent <MegaLoftLayerCloneSimple>();
                layer.startObj     = startObjMesh;
                layer.mainObj      = mainObjMesh;
                layer.endObj       = endObjMesh;
                layer.surfaceLoft  = surfaceLoft;
                layer.surfaceLayer = surfaceLayer;
                laybase            = layer;
            }
            break;

            case MegaLoftType.ScatterSimple:
            {
                MegaLoftLayerScatterSimple layer = Selection.activeGameObject.AddComponent <MegaLoftLayerScatterSimple>();
                layer.scatterMesh  = mainObjMesh;
                layer.surfaceLoft  = surfaceLoft;
                layer.surfaceLayer = surfaceLayer;
                laybase            = layer;
            }
            break;

            case MegaLoftType.Scatter:
            {
                MegaLoftLayerScatter layer = Selection.activeGameObject.AddComponent <MegaLoftLayerScatter>();
                layer.mainObj      = mainObj;
                layer.surfaceLoft  = surfaceLoft;
                layer.surfaceLayer = surfaceLayer;
                laybase            = layer;
            }
            break;

            case MegaLoftType.ScatterSpline:
            {
                MegaLoftLayerScatterSpline layer = Selection.activeGameObject.AddComponent <MegaLoftLayerScatterSpline>();
                layer.scatterMesh = mainObjMesh;
                layer.layerPath   = path;
                laybase           = layer;
            }
            break;

            case MegaLoftType.Complex:
            {
                MegaLoftLayerComplex layer = Selection.activeGameObject.AddComponent <MegaLoftLayerComplex>();
                layer.layerPath    = path;
                layer.layerSection = section;
                laybase            = layer;
            }
            break;

            case MegaLoftType.CloneSplineSimple:
            {
                MegaLoftLayerCloneSplineSimple layer = Selection.activeGameObject.AddComponent <MegaLoftLayerCloneSplineSimple>();
                layer.layerPath = path;
                layer.startObj  = startObjMesh;
                layer.mainObj   = mainObjMesh;
                layer.endObj    = endObjMesh;
                laybase         = layer;
            }
            break;

            case MegaLoftType.CloneSpline:
            {
                MegaLoftLayerCloneSpline layer = Selection.activeGameObject.AddComponent <MegaLoftLayerCloneSpline>();
                layer.layerPath = path;
                layer.startObj  = startObj;
                layer.mainObj   = mainObj;
                layer.endObj    = endObj;
                laybase         = layer;
            }
            break;

            case MegaLoftType.Clone:
            {
                MegaLoftLayerClone layer = Selection.activeGameObject.AddComponent <MegaLoftLayerClone>();
                layer.surfaceLoft  = surfaceLoft;
                layer.surfaceLayer = surfaceLayer;
                layer.startObj     = startObj;
                layer.mainObj      = mainObj;
                layer.endObj       = endObj;
                laybase            = layer;
            }
            break;

            case MegaLoftType.CloneRules:
            {
                MegaLoftLayerCloneRules layer = Selection.activeGameObject.AddComponent <MegaLoftLayerCloneRules>();
                layer.surfaceLoft  = surfaceLoft;
                layer.surfaceLayer = surfaceLayer;
                //layer.layerPath = path;
                //layer.layerSection = section;
                laybase = layer;
            }
            break;

            case MegaLoftType.CloneSplineRules:
            {
                MegaLoftLayerCloneSplineRules layer = Selection.activeGameObject.AddComponent <MegaLoftLayerCloneSplineRules>();
                layer.layerPath = path;
                laybase         = layer;
            }
            break;

#if true
            case MegaLoftType.MultiMaterial:
            {
                MegaLoftLayerMultiMat layer = Selection.activeGameObject.AddComponent <MegaLoftLayerMultiMat>();
                layer.pathStart    = start;
                layer.pathLength   = length;
                layer.layerPath    = path;
                layer.layerSection = section;
                MegaMaterialSection ms = new MegaMaterialSection();
                ms.mat = material;
                layer.sections.Add(ms);
                laybase = layer;
            }
            break;

            // We should add two loft sections
            // if cross has multiple splines add them all equally spaced?
            case MegaLoftType.MultiMaterialComplex:
            {
                MegaLoftLayerMultiMatComplex layer = Selection.activeGameObject.AddComponent <MegaLoftLayerMultiMatComplex>();
                layer.pathStart    = start;
                layer.pathLength   = length;
                layer.layerPath    = path;
                layer.layerSection = section;
                MegaMaterialSection ms = new MegaMaterialSection();
                ms.mat = material;
                layer.sections.Add(ms);
                laybase = layer;
            }
            break;
#endif
            default:
                EditorUtility.DisplayDialog("Layer Not Supported", "Currently this layer type is not not supported", "OK");
                break;
            }

            // Common params
            if (laybase)
            {
                laybase.paramcol  = paramCol;
                laybase.LayerName = LayerName;
                laybase.LayerName = LayerName;
                laybase.material  = material;
            }
            this.Close();
        }

        if (GUILayout.Button("Cancel"))
        {
            this.Close();
        }
        EditorGUILayout.EndHorizontal();
    }
Ejemplo n.º 4
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();
    }