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 Init() { matcount = 0; mats.Clear(); for (int r = 0; r < rules.Count; r++) { MegaLoftRule rule = rules[r]; rule.lofttris.Clear(); if (rule.obj) { MeshFilter mf = rule.obj.GetComponent <MeshFilter>(); if (mf) { Mesh ms = mf.sharedMesh; rule.bounds = ms.bounds; rule.verts = ms.vertices; rule.uvs = ms.uv; rule.tris = ms.triangles; MeshRenderer mr = rule.obj.GetComponent <MeshRenderer>(); rule.mats = mr.sharedMaterials; matcount += rule.mats.Length; mats.AddRange(rule.mats); rule.numtris = 0; for (int i = 0; i < ms.subMeshCount; i++) { MegaLoftTris lt = new MegaLoftTris(); lt.sourcetris = ms.GetTriangles(i); rule.numtris += lt.sourcetris.Length; rule.lofttris.Add(lt); } } } } //transform.position = Vector3.zero; }
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(); }
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 override int BuildMesh(MegaShapeLoft loft, int triindex) { MegaLoftLayerSimple layer = (MegaLoftLayerSimple)surfaceLoft.Layers[surfaceLayer]; LayerLength = 1.0f / layer.GetLength(surfaceLoft); if (tangent < 0.1f) { tangent = 0.1f; } //mat = surfaceLoft.transform.localToWorldMatrix; mat = surfaceLoft.transform.localToWorldMatrix * transform.worldToLocalMatrix; //mat = transform.localToWorldMatrix * surfaceLoft.transform.worldToLocalMatrix; // * transform.worldToLocalMatrix; //mat = surfaceLoft.transform.localToWorldMatrix; //mat = surfaceLoft.transform.worldToLocalMatrix * transform.localToWorldMatrix; // * transform.worldToLocalMatrix; //mat = surfaceLoft.transform.localToWorldMatrix; tm = Matrix4x4.identity; tw = Quaternion.identity; //surfacetolofttm = mat * transform.worldToLocalMatrix; //surfacetolofttm = surfaceLoft.transform.localToWorldMatrix * transform.worldToLocalMatrix; MegaMatrix.Rotate(ref tm, Mathf.Deg2Rad * tmrot); float off = 0.0f; int trioff = 0; int vi = 0; float ca = CrossAlpha; if (ca > 0.99999f) { ca = 0.99999f; } // This is also done in prepareloft for (int r = 0; r < rules.Count; r++) { for (int i = 0; i < rules[r].lofttris.Count; i++) { rules[r].lofttris[i].offset = 0; } } for (int r = 0; r < loftobjs.Count; r++) { MegaLoftRule obj = loftobjs[r]; Vector3 sscl = (scale + obj.scale) * GlobalScale; Vector3 soff = Vector3.Scale(offset + obj.offset, sscl); off -= obj.bounds.min[(int)axis]; off += (obj.gapin * obj.bounds.size[(int)axis]); for (int i = 0; i < obj.verts.Length; i++) { Vector3 p = obj.verts[i]; p = Deform(p, surfaceLoft, layer, start, ca, off, sscl, RemoveDof, soff); loftverts[vi] = p; loftuvs[vi++] = obj.uvs[i]; } for (int i = 0; i < obj.lofttris.Count; i++) { int toff = obj.lofttris[i].offset; for (int t = 0; t < obj.lofttris[i].sourcetris.Length; t++) { obj.lofttris[i].tris[toff++] = obj.lofttris[i].sourcetris[t] + trioff + triindex; } obj.lofttris[i].offset = toff; } off += obj.bounds.max[(int)axis]; off += (obj.gapout * obj.bounds.size[(int)axis]); trioff = vi; } return(triindex); }
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 override int BuildMesh(MegaShapeLoft loft, int triindex) { if (tangent < 0.1f) { tangent = 0.1f; } //mat = layerPath.transform.localToWorldMatrix; //mat = transform.localToWorldMatrix * layerPath.transform.worldToLocalMatrix; // * transform.worldToLocalMatrix; //mat = surfaceLoft.transform.localToWorldMatrix; mat = Matrix4x4.identity; tm = Matrix4x4.identity; MegaMatrix.Rotate(ref tm, Mathf.Deg2Rad * tmrot); float off = 0.0f; int trioff = 0; int vi = 0; Vector3 sploff = Vector3.zero; if (snap) { sploff = layerPath.splines[0].knots[0].p - layerPath.splines[curve].knots[0].p; } for (int r = 0; r < rules.Count; r++) { for (int i = 0; i < rules[r].lofttris.Count; i++) { rules[r].lofttris[i].offset = 0; } } for (int r = 0; r < loftobjs.Count; r++) { MegaLoftRule obj = loftobjs[r]; Vector3 sscl = (scale + obj.scale) * GlobalScale; Vector3 soff = Vector3.Scale(offset + obj.offset, sscl); off -= obj.bounds.min[(int)axis]; off += (obj.gapin * obj.bounds.size[(int)axis]); for (int i = 0; i < obj.verts.Length; i++) { Vector3 p = obj.verts[i]; p = Deform(p, layerPath, start, off, sscl, RemoveDof, soff, sploff); loftverts[vi] = p; loftuvs[vi++] = obj.uvs[i]; } for (int i = 0; i < obj.lofttris.Count; i++) { int toff = obj.lofttris[i].offset; for (int t = 0; t < obj.lofttris[i].sourcetris.Length; t++) { obj.lofttris[i].tris[toff++] = obj.lofttris[i].sourcetris[t] + trioff + triindex; } obj.lofttris[i].offset = toff; } off += obj.bounds.max[(int)axis]; off += (obj.gapout * obj.bounds.size[(int)axis]); trioff = vi; } if (conform) { CalcBounds(loftverts); DoConform(loft, loftverts); } return(triindex); }
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(); }
// Could add pre and post objects to each rule if needed public void BuildLoftObjects(float length) { loftobjs.Clear(); // Reset usage count on all rules for (int i = 0; i < rules.Count; i++) { rules[i].usage = 0; } // Need length MegaLoftRule rule = GetStart(); if (rule != null) { loftobjs.Add(rule); rule.usage++; } float tlen = length; int count = 0; int bug = 20; float len = 0.0f; while (len < tlen) { rule = GetPlaced(len); if (rule == null) { rule = GetRegular(count); } if (rule == null) { rule = GetFiller(); } // If we have no rule then exit if (rule == null) { break; } loftobjs.Add(rule); rule.usage++; float gsize = (rule.gapin + rule.gapout) * rule.bounds.size[(int)axis]; float rlen = (rule.bounds.size[(int)axis] + gsize) * (scale[(int)axis] + rule.scale[(int)axis]) * GlobalScale; rlen = Mathf.Abs(rlen); if (rlen == 0.0f) { bug--; if (bug < 0) { Debug.Log("Found too many 0 width rules, Exiting Loft early."); break; } } len += rlen; count++; } // End rule = GetEnd(); if (rule != null) { loftobjs.Add(rule); rule.usage++; } // Now tot up the verts and tri counts, we do this in prepare int verts = 0; int tris = 0; for (int i = 0; i < loftobjs.Count; i++) { verts += loftobjs[i].verts.Length; tris += loftobjs[i].tris.Length; } }
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(); }