public override void OnInspectorGUI()
    {
        MegaWirePlantPoles mod = (MegaWirePlantPoles)target;

        undoManager.CheckUndo();
#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_2017
#else
        EditorGUIUtility.LookLikeControls();
#endif

        mod.path = (MegaShape)EditorGUILayout.ObjectField("Path", mod.path, typeof(MegaShape), true);

        if (mod.path != null && mod.path.splines.Count > 1)
        {
            mod.curve = EditorGUILayout.IntSlider("Curve", mod.curve, 0, mod.path.splines.Count - 1);
            if (mod.curve < 0)
            {
                mod.curve = 0;
            }

            if (mod.curve > mod.path.splines.Count - 1)
            {
                mod.curve = mod.path.splines.Count - 1;
            }
        }

        mod.start   = EditorGUILayout.Slider("Start", mod.start, 0.0f, 1.0f);
        mod.length  = EditorGUILayout.Slider("Length", mod.length, 0.0f, 1.0f);
        mod.spacing = EditorGUILayout.FloatField("Spacing", mod.spacing);

        mod.pole = (GameObject)EditorGUILayout.ObjectField("Pole Obj", mod.pole, typeof(GameObject), true);

        mod.offset = EditorGUILayout.FloatField("Offset", mod.offset);
        mod.rotate = EditorGUILayout.Vector3Field("Rotate", mod.rotate);

        mod.conform = EditorGUILayout.BeginToggleGroup("Conform", mod.conform);
        mod.upright = EditorGUILayout.Slider("Upright", mod.upright, 0.0f, 1.0f);
        EditorGUILayout.EndToggleGroup();

        mod.copyfrom     = (MegaWire)EditorGUILayout.ObjectField("Copy Wire", mod.copyfrom, typeof(MegaWire), true);
        mod.material     = (Material)EditorGUILayout.ObjectField("Wire Material", mod.material, typeof(Material), true);
        mod.addwires     = EditorGUILayout.BeginToggleGroup("Add Wires", mod.addwires);
        mod.reverseWire  = EditorGUILayout.Toggle("Reverse Wire", mod.reverseWire);
        mod.wireSizeMult = EditorGUILayout.FloatField("Wire Size Mult", mod.wireSizeMult);
        mod.stretch      = EditorGUILayout.FloatField("Stretch", mod.stretch);
        EditorGUILayout.EndToggleGroup();

        mod.seed = EditorGUILayout.IntField("Seed", mod.seed);
        mod.positionVariation = EditorGUILayout.Vector3Field("Position Variation", mod.positionVariation);
        mod.rotateVariation   = EditorGUILayout.Vector3Field("Rotate Variation", mod.rotateVariation);
        mod.spacingVariation  = EditorGUILayout.Slider("Spacing Variation", mod.spacingVariation, 0.0f, 1.0f);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            mod.Rebuild();
        }

        undoManager.CheckDirty();
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        MegaWireFlowWind mod = (MegaWireFlowWind)target;

        undoManager.CheckUndo();
#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_2017
#else
        EditorGUIUtility.LookLikeControls();
#endif

        mod.source = (MegaFlow)EditorGUILayout.ObjectField("Source", mod.source, typeof(MegaFlow), true);

        if (mod.source && mod.source.frames.Count > 1)
        {
            mod.frame = EditorGUILayout.IntSlider("Frame", mod.frame, 0, mod.source.frames.Count - 1);
        }

        mod.flowscale = EditorGUILayout.FloatField("Flow Frc", mod.flowscale);

        mod.dir = EditorGUILayout.Vector3Field("Direction", mod.dir);

        mod.decay    = EditorGUILayout.FloatField("Decay", mod.decay);
        mod.strength = EditorGUILayout.FloatField("Strength", mod.strength);
        mod.type     = (MegaWindType)EditorGUILayout.EnumPopup("Type", mod.type);
        mod.turb     = EditorGUILayout.FloatField("Turbelance", mod.turb);
        mod.freq     = EditorGUILayout.FloatField("Frequency", mod.freq);
        mod.scale    = EditorGUILayout.FloatField("Scale", mod.scale);

        mod.strengthnoise = EditorGUILayout.BeginToggleGroup("Strength Noise", mod.strengthnoise);
        mod.strengthscale = EditorGUILayout.FloatField("Strength Scale", mod.strengthscale);
        mod.strengthfreq  = EditorGUILayout.FloatField("Strength Freq", mod.strengthfreq);
        EditorGUILayout.EndToggleGroup();

        mod.dirnoise = EditorGUILayout.BeginToggleGroup("Dir Noise", mod.dirnoise);
        mod.dirscale = EditorGUILayout.Vector3Field("Dir Scale", mod.dirscale);
        mod.dirfreq  = EditorGUILayout.FloatField("Dir Freq", mod.dirfreq);
        EditorGUILayout.EndToggleGroup();

        mod.displayGizmo = EditorGUILayout.BeginToggleGroup("Display Gizmo", mod.displayGizmo);

        mod.gizmoSize = EditorGUILayout.Vector2Field("Gizmo Size", mod.gizmoSize);
        mod.divs      = EditorGUILayout.IntField("Divs", mod.divs);
        mod.gizscale  = EditorGUILayout.Slider("Giz Scale", mod.gizscale, 0.0f, 1.0f);
        mod.gizmocol  = EditorGUILayout.ColorField("Gizmo Col", mod.gizmocol);

        EditorGUILayout.EndToggleGroup();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }
Exemple #3
0
    public override void OnInspectorGUI()
    {
        MegaWireConnectionHelper mod = (MegaWireConnectionHelper)target;

        undoManager.CheckUndo();

#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_2017
#else
        EditorGUIUtility.LookLikeControls();
#endif

        mod.showgizmo = EditorGUILayout.Toggle("Show Connections", mod.showgizmo);
        if (GUILayout.Button("Add Wire"))
        {
            MegaWireConnectionDef cdef = new MegaWireConnectionDef();

            if (mod.connections.Count > 0)
            {
                MegaWireConnectionDef last = mod.connections[mod.connections.Count - 1];
                cdef.inOffset  = last.inOffset;
                cdef.outOffset = last.outOffset;
                cdef.radius    = last.radius;
            }
            mod.connections.Add(cdef);
        }

        for (int i = 0; i < mod.connections.Count; i++)
        {
            MegaWireConnectionDef con = mod.connections[i];
            EditorGUILayout.BeginVertical("box");

            con.radius    = EditorGUILayout.FloatField("Radius", con.radius);
            con.outOffset = EditorGUILayout.Vector3Field("Out Offset", con.outOffset);
            con.inOffset  = EditorGUILayout.Vector3Field("In Offset", con.inOffset);

            if (GUILayout.Button("Delete"))
            {
                if (mod.connections.Count > 1)
                {
                    mod.connections.RemoveAt(i);
                }
            }
            EditorGUILayout.EndVertical();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }
Exemple #4
0
    public override void OnInspectorGUI()
    {
        MegaWireHanger mod = (MegaWireHanger)target;

        undoManager.CheckUndo();

#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_2017
#else
        EditorGUIUtility.LookLikeControls();
#endif

        MegaWire wire = (MegaWire)EditorGUILayout.ObjectField("Wire", mod.wire, typeof(MegaWire), true);
        if (wire != mod.wire)
        {
            mod.wire   = wire;
            mod.parent = null;
            if (wire)
            {
                mod.parent = wire.transform.parent;
            }
        }

        mod.alpha = EditorGUILayout.Slider("Alpha", mod.alpha, 0.0f, 1.0f);

        int cons = 0;
        if (mod.wire)
        {
            cons = mod.wire.spans[0].connections.Count - 1;
        }

        mod.strand = EditorGUILayout.IntSlider("Strand", mod.strand, 0, cons);
        mod.offset = EditorGUILayout.FloatField("Offset", mod.offset);

        mod.align  = EditorGUILayout.BeginToggleGroup("Align", mod.align);
        mod.rotate = EditorGUILayout.Vector3Field("Rotate", mod.rotate);
        EditorGUILayout.EndToggleGroup();
        mod.weight = EditorGUILayout.FloatField("Weight", mod.weight);
        //mod.snaptomass = EditorGUILayout.Toggle("Snap To Mass", mod.snaptomass);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }
    public override void OnInspectorGUI()
    {
        MegaWireAttach mod = (MegaWireAttach)target;

        undoManager.CheckUndo();

        EditorGUIUtility.LookLikeControls();

        MegaWire wire = (MegaWire)EditorGUILayout.ObjectField("Wire", mod.wire, typeof(MegaWire), true);

        if (wire != mod.wire)
        {
            mod.wire   = wire;
            mod.parent = null;
            if (wire)
            {
                mod.parent = wire.transform.parent;
            }
        }

        mod.alpha = EditorGUILayout.Slider("Alpha", mod.alpha, 0.0f, 1.0f);

        int cons = 0;

        if (mod.wire)
        {
            cons = mod.wire.spans[0].connections.Count - 1;
        }

        mod.connection = EditorGUILayout.IntSlider("Strand", mod.connection, 0, cons);
        mod.offset     = EditorGUILayout.Vector3Field("Offset", mod.offset);

        mod.align  = EditorGUILayout.BeginToggleGroup("Align", mod.align);
        mod.rotate = EditorGUILayout.Vector3Field("Rotate", mod.rotate);
        EditorGUILayout.EndToggleGroup();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }
Exemple #6
0
    public override void OnInspectorGUI()
    {
        MegaWireWind mod = (MegaWireWind)target;

        undoManager.CheckUndo();
        EditorGUIUtility.LookLikeControls();

        mod.dir = EditorGUILayout.Vector3Field("Direction", mod.dir);

        mod.decay    = EditorGUILayout.FloatField("Decay", mod.decay);
        mod.strength = EditorGUILayout.FloatField("Strength", mod.strength);
        mod.type     = (MegaWindType)EditorGUILayout.EnumPopup("Type", mod.type);
        mod.turb     = EditorGUILayout.FloatField("Turbelance", mod.turb);
        mod.freq     = EditorGUILayout.FloatField("Frequency", mod.freq);
        mod.scale    = EditorGUILayout.FloatField("Scale", mod.scale);

        mod.strengthnoise = EditorGUILayout.BeginToggleGroup("Strength Noise", mod.strengthnoise);
        mod.strengthscale = EditorGUILayout.FloatField("Strength Scale", mod.strengthscale);
        mod.strengthfreq  = EditorGUILayout.FloatField("Strength Freq", mod.strengthfreq);
        EditorGUILayout.EndToggleGroup();

        mod.dirnoise = EditorGUILayout.BeginToggleGroup("Dir Noise", mod.dirnoise);
        mod.dirscale = EditorGUILayout.Vector3Field("Dir Scale", mod.dirscale);
        mod.dirfreq  = EditorGUILayout.FloatField("Dir Freq", mod.dirfreq);
        EditorGUILayout.EndToggleGroup();

        mod.displayGizmo = EditorGUILayout.BeginToggleGroup("Display Gizmo", mod.displayGizmo);

        mod.gizmoSize = EditorGUILayout.Vector2Field("Gizmo Size", mod.gizmoSize);
        mod.divs      = EditorGUILayout.IntField("Divs", mod.divs);
        mod.gizscale  = EditorGUILayout.Slider("Giz Scale", mod.gizscale, 0.0f, 1.0f);
        mod.gizmocol  = EditorGUILayout.ColorField("Gizmo Col", mod.gizmocol);

        EditorGUILayout.EndToggleGroup();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }
    public override void OnInspectorGUI()
    {
        MegaWire mod = (MegaWire)target;

        undoManager.CheckUndo();

#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_2017
#else
        EditorGUIUtility.LookLikeControls();
#endif

        MegaWire.DisableAll = EditorGUILayout.Toggle("Disable All", MegaWire.DisableAll);

        if (GUILayout.Button("Rebuild"))
        {
            mod.Rebuild = true;
            mod.RebuildWire();
        }

        mod.warmPhysicsTime = EditorGUILayout.FloatField("Warm Physics Time", mod.warmPhysicsTime);
        if (GUILayout.Button("Run Physics"))
        {
            mod.RunPhysics(mod.warmPhysicsTime);
        }

        if (GUILayout.Button("Open Select Window"))
        {
        }

        if (GUILayout.Button("Add Wire"))
        {
            MegaWireConnectionDef last = mod.connections[mod.connections.Count - 1];
            MegaWireConnectionDef cdef = new MegaWireConnectionDef();
            cdef.inOffset  = last.inOffset;
            cdef.outOffset = last.outOffset;
            cdef.radius    = last.radius;
            mod.connections.Add(cdef);
            mod.RebuildWire();
            mod.Rebuild = true;
        }

        mod.Enabled = EditorGUILayout.Toggle("Enabled", mod.Enabled);

        bool ShowWire = EditorGUILayout.Toggle("Show Wire", mod.ShowWire);
        if (ShowWire != mod.ShowWire)
        {
            mod.ShowWire = ShowWire;
            mod.SetWireVisible(ShowWire);
        }
        // Lod params
        mod.disableOnDistance = EditorGUILayout.BeginToggleGroup("Disable On Dist", mod.disableOnDistance);
        mod.disableDist       = EditorGUILayout.FloatField("Disable Dist", mod.disableDist);
        EditorGUILayout.EndToggleGroup();

        mod.disableOnNotVisible = EditorGUILayout.Toggle("Disable On InVisible", mod.disableOnNotVisible);

        // Physics data
        mod.showphysics = EditorGUILayout.Foldout(mod.showphysics, "Physics Params");

        if (mod.showphysics)
        {
            EditorGUILayout.BeginVertical("box");

            int points = EditorGUILayout.IntSlider("Masses", mod.points, 2, 20);
            if (points != mod.points)
            {
                mod.points = points;
                mod.RebuildWire();
            }

            float Mass = EditorGUILayout.FloatField("Mass", mod.Mass);
            if (Mass != mod.Mass)
            {
                mod.Mass = Mass;
                mod.RebuildWire();
            }

            float massrnd = EditorGUILayout.FloatField("Mass Random", mod.massRand);
            if (massrnd != mod.massRand)
            {
                mod.massRand = massrnd;
                mod.RebuildWire();
            }

            float spring = EditorGUILayout.FloatField("Spring", mod.spring);
            if (spring != mod.spring)
            {
                mod.spring = spring;
                mod.RebuildWire();
            }

            float damp = EditorGUILayout.FloatField("Damp", mod.damp);
            if (damp != mod.damp)
            {
                mod.damp = damp;
                mod.RebuildWire();
            }

            float stretch = EditorGUILayout.FloatField("Stretch", mod.stretch);
            if (stretch != mod.stretch)
            {
                mod.stretch = stretch;
                mod.ChangeStretch(stretch);
            }

            mod.gravity = EditorGUILayout.Vector3Field("Gravity", mod.gravity);
            mod.airdrag = EditorGUILayout.Slider("Aero Drag", mod.airdrag, 0.0f, 1.0f);

            // These require a rebuild
            bool lencon = EditorGUILayout.Toggle("Length Constraints", mod.lengthConstraints);
            if (lencon != mod.lengthConstraints)
            {
                mod.lengthConstraints = lencon;
                mod.RebuildWire();
            }

            bool stiff = EditorGUILayout.BeginToggleGroup("Stiff Springs", mod.stiffnessSprings);
            if (stiff != mod.stiffnessSprings)
            {
                mod.stiffnessSprings = stiff;
                mod.RebuildWire();
            }

            float stiffrate = EditorGUILayout.FloatField("Stiff Rate", mod.stiffrate);
            if (stiffrate != mod.stiffrate)
            {
                mod.stiffrate = stiffrate;
                mod.RebuildWire();
            }

            float stiffdamp = EditorGUILayout.FloatField("Stiff Damp", mod.stiffdamp);
            if (stiffdamp != mod.stiffdamp)
            {
                mod.stiffdamp = stiffdamp;
                mod.RebuildWire();
            }
            EditorGUILayout.EndToggleGroup();

            mod.doCollisions = EditorGUILayout.BeginToggleGroup("Do Collisions", mod.doCollisions);
            mod.useraycast   = EditorGUILayout.Toggle("Use RayCast", mod.useraycast);

            if (mod.useraycast)
            {
                mod.collisionoff  = EditorGUILayout.FloatField("Collision Offset", mod.collisionoff);
                mod.collisiondist = EditorGUILayout.FloatField("Collision Dist", mod.collisiondist);
                mod.collisionmask = LayerMaskField("Mask", mod.collisionmask);
            }
            else
            {
                mod.floor = EditorGUILayout.FloatField("Floor", mod.floor);
            }

            EditorGUILayout.EndToggleGroup();

            mod.showWindParams = EditorGUILayout.Foldout(mod.showWindParams, "Wind Params");
            if (mod.showWindParams)
            {
                mod.wind         = (MegaWireWind)EditorGUILayout.ObjectField("Wind Src", mod.wind, typeof(MegaWireWind), true);
                MegaWire.windDir = EditorGUILayout.Vector3Field("Wind Dir", MegaWire.windDir);
                MegaWire.windFrc = EditorGUILayout.FloatField("Wind Frc", MegaWire.windFrc);
                mod.windEffect   = EditorGUILayout.FloatField("Wind Effect", mod.windEffect);
            }

            mod.showPhysicsAdv = EditorGUILayout.Foldout(mod.showPhysicsAdv, "Advanced Params");
            if (mod.showPhysicsAdv)
            {
                mod.timeStep  = EditorGUILayout.FloatField("Time Step", mod.timeStep);
                mod.fudge     = EditorGUILayout.FloatField("Time Mult", mod.fudge);
                mod.startTime = EditorGUILayout.FloatField("Start Time", mod.startTime);
                mod.awakeTime = EditorGUILayout.FloatField("Awake Time", mod.awakeTime);
                mod.frameWait = EditorGUILayout.IntField("Frame Wait", mod.frameWait);
                mod.frameNum  = EditorGUILayout.IntField("Frame Num", mod.frameNum);

                mod.iters = EditorGUILayout.IntSlider("Constraint Iters", mod.iters, 1, 8);
            }

            EditorGUILayout.EndVertical();
        }

        // Meshing options
        mod.showmeshparams = EditorGUILayout.Foldout(mod.showmeshparams, "Mesh Params");
        if (mod.showmeshparams)
        {
            EditorGUILayout.BeginVertical("box");

            Material mat = (Material)EditorGUILayout.ObjectField("Material", mod.material, typeof(Material), true);
            if (mat != mod.material)
            {
                mod.material = mat;
                for (int i = 0; i < mod.spans.Count; i++)
                {
                    Renderer rend = mod.spans[i].GetComponent <Renderer>();
                    if (rend)
                    {
                        rend.sharedMaterial = mat;
                    }
                }
            }
            mod.strandedMesher.sides        = EditorGUILayout.IntSlider("Sides", mod.strandedMesher.sides, 2, 32);
            mod.strandedMesher.segments     = EditorGUILayout.IntSlider("Segments", mod.strandedMesher.segments, 1, 64);
            mod.strandedMesher.SegsPerUnit  = EditorGUILayout.FloatField("Segs Per Unit", mod.strandedMesher.SegsPerUnit);
            mod.strandedMesher.strands      = EditorGUILayout.IntSlider("Strands", mod.strandedMesher.strands, 1, 8);
            mod.strandedMesher.offset       = EditorGUILayout.FloatField("Offset", mod.strandedMesher.offset);
            mod.strandedMesher.strandRadius = EditorGUILayout.FloatField("Strand Radius", mod.strandedMesher.strandRadius);

            mod.strandedMesher.Twist        = EditorGUILayout.FloatField("Twist", mod.strandedMesher.Twist);
            mod.strandedMesher.TwistPerUnit = EditorGUILayout.FloatField("Twist Per Unit", mod.strandedMesher.TwistPerUnit);

            bool genuv = EditorGUILayout.BeginToggleGroup("Gen UV", mod.strandedMesher.genuv);
            if (genuv != mod.strandedMesher.genuv)
            {
                mod.strandedMesher.genuv = genuv;
                mod.builduvs             = true;
            }

            float uvtwist = EditorGUILayout.FloatField("UV Twist", mod.strandedMesher.uvtwist);
            if (uvtwist != mod.strandedMesher.uvtwist)
            {
                mod.strandedMesher.uvtwist = uvtwist;
                mod.builduvs = true;
            }

            float uvtilex = EditorGUILayout.FloatField("UV Tile X", mod.strandedMesher.uvtilex);
            if (uvtilex != mod.strandedMesher.uvtilex)
            {
                mod.strandedMesher.uvtilex = uvtilex;
                mod.builduvs = true;
            }

            float uvtiley = EditorGUILayout.FloatField("UV Tile Y", mod.strandedMesher.uvtiley);
            if (uvtiley != mod.strandedMesher.uvtiley)
            {
                mod.strandedMesher.uvtiley = uvtiley;
                mod.builduvs = true;
            }
            EditorGUILayout.EndToggleGroup();

            mod.strandedMesher.linInterp    = EditorGUILayout.Toggle("Linear Interp", mod.strandedMesher.linInterp);
            mod.strandedMesher.calcBounds   = EditorGUILayout.Toggle("Calc Bounds", mod.strandedMesher.calcBounds);
            mod.strandedMesher.calcTangents = EditorGUILayout.Toggle("Calc Tangents", mod.strandedMesher.calcTangents);

            int vcount = mod.GetVertexCount();
            EditorGUILayout.LabelField("Vertex Count: " + vcount);
            EditorGUILayout.EndVertical();
        }

        mod.showconnections = EditorGUILayout.Foldout(mod.showconnections, "Connections");

        if (mod.showconnections)
        {
            for (int i = 0; i < mod.connections.Count; i++)
            {
                MegaWireConnectionDef con = mod.connections[i];
                EditorGUILayout.BeginVertical("box");

                float radius = EditorGUILayout.FloatField("Radius", con.radius);
                if (radius != con.radius)
                {
                    con.radius = radius;
                }

                Vector3 outOffset = EditorGUILayout.Vector3Field("Out Offset", con.outOffset);
                if (outOffset != con.outOffset)
                {
                    con.outOffset = outOffset;

                    mod.Rebuild = true;
                }

                Vector3 inOffset = EditorGUILayout.Vector3Field("In Offset", con.inOffset);
                if (inOffset != con.inOffset)
                {
                    con.inOffset = inOffset;
                    mod.Rebuild  = true;
                }

                if (GUILayout.Button("Delete"))
                {
                    if (mod.connections.Count > 1)
                    {
                        mod.connections.RemoveAt(i);
                        mod.RebuildWire();
                        mod.Rebuild = true;
                    }
                }

                EditorGUILayout.EndVertical();
            }
        }

        bool hidespans = EditorGUILayout.Toggle("Hide Spans", mod.hidespans);
        if (hidespans != mod.hidespans)
        {
            mod.hidespans = hidespans;
            mod.SetHidden(mod.hidespans);
            EditorApplication.RepaintHierarchyWindow();
        }

        mod.displayGizmo = EditorGUILayout.BeginToggleGroup("Show Gizmos", mod.displayGizmo);
        mod.gizmoColor   = EditorGUILayout.ColorField("Gizmo Color", mod.gizmoColor);
        EditorGUILayout.EndToggleGroup();

        mod.showAttach = EditorGUILayout.Foldout(mod.showAttach, "Span Connections");

        if (mod.showAttach)
        {
            EditorGUILayout.BeginVertical("Box");
            for (int i = 0; i < mod.spans.Count; i++)
            {
                if (i > 0)
                {
                    EditorGUILayout.Separator();
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Start", GUILayout.MaxWidth(40.0f));
                for (int c = 0; c < mod.spans[i].connections.Count; c++)
                {
                    bool active = EditorGUILayout.Toggle(mod.spans[i].connections[c].constraints[0].active, GUILayout.MaxWidth(10.0f));
                    if (active != mod.spans[i].connections[c].constraints[0].active)
                    {
                        mod.spans[i].connections[c].SetEndConstraintActive(0, active, 2.0f);
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("End", GUILayout.MaxWidth(40.0f));
                for (int c = 0; c < mod.spans[i].connections.Count; c++)
                {
                    bool active = EditorGUILayout.Toggle(mod.spans[i].connections[c].constraints[1].active, GUILayout.MaxWidth(10.0f));
                    if (active != mod.spans[i].connections[c].constraints[1].active)
                    {
                        mod.spans[i].connections[c].SetEndConstraintActive(1, active, 2.0f);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }
    public override void OnInspectorGUI()
    {
        bool rebuild = false;
        MegaWirePlantPolesList mod = (MegaWirePlantPolesList)target;

        undoManager.CheckUndo();
        EditorGUIUtility.LookLikeControls();

        if (GUILayout.Button("Add Waypoint"))
        {
            Vector3 p = Vector3.zero;

            if (mod.waypoints.Count > 0)
            {
                if (mod.waypoints.Count > 1)
                {
                    p = mod.waypoints[mod.waypoints.Count - 1];
                    Vector3 p1 = mod.waypoints[mod.waypoints.Count - 2];
                    p += p - p1;
                }
                else
                {
                    p    = mod.waypoints[mod.waypoints.Count - 1];
                    p.x += 4.0f;
                }
            }

            mod.waypoints.Add(p);
            rebuild = true;
        }

        for (int i = 0; i < mod.waypoints.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("-", GUILayout.MaxWidth(20.0f)))
            {
                mod.waypoints.RemoveAt(i);
                rebuild = true;
            }
            else
            {
                mod.waypoints[i] = EditorGUILayout.Vector3Field("Waypoint " + i, mod.waypoints[i]);
            }
            EditorGUILayout.EndHorizontal();
        }

        if (mod.waypoints.Count > 0)
        {
            if (GUILayout.Button("Delete"))
            {
                mod.waypoints.RemoveAt(mod.waypoints.Count - 1);
                rebuild = true;
            }
        }

        mod.start   = EditorGUILayout.Slider("Start", mod.start, 0.0f, 1.0f);
        mod.length  = EditorGUILayout.Slider("Length", mod.length, 0.0f, 1.0f);
        mod.spacing = EditorGUILayout.FloatField("Spacing", mod.spacing);
        if (mod.spacing < 1.0f)
        {
            mod.spacing = 1.0f;
        }
        mod.closed = EditorGUILayout.Toggle("Closed", mod.closed);

        mod.pole = (GameObject)EditorGUILayout.ObjectField("Pole Obj", mod.pole, typeof(GameObject), true);

        mod.offset = EditorGUILayout.FloatField("Offset", mod.offset);
        mod.rotate = EditorGUILayout.Vector3Field("Rotate", mod.rotate);

        mod.conform = EditorGUILayout.BeginToggleGroup("Conform", mod.conform);
        mod.upright = EditorGUILayout.Slider("Upright", mod.upright, 0.0f, 1.0f);
        EditorGUILayout.EndToggleGroup();

        mod.material     = (Material)EditorGUILayout.ObjectField("Wire Material", mod.material, typeof(Material), true);
        mod.copyfrom     = (MegaWire)EditorGUILayout.ObjectField("Copy Wire", mod.copyfrom, typeof(MegaWire), true);
        mod.addwires     = EditorGUILayout.BeginToggleGroup("Add Wires", mod.addwires);
        mod.reverseWire  = EditorGUILayout.Toggle("Reverse Wire", mod.reverseWire);
        mod.wireSizeMult = EditorGUILayout.FloatField("Wire Size Mult", mod.wireSizeMult);
        mod.stretch      = EditorGUILayout.Slider("Stretch", mod.stretch, 0.0f, 1.5f);
        EditorGUILayout.EndToggleGroup();

        mod.seed = EditorGUILayout.IntField("Seed", mod.seed);
        mod.positionVariation = EditorGUILayout.Vector3Field("Position Variation", mod.positionVariation);
        mod.rotateVariation   = EditorGUILayout.Vector3Field("Rotate Variation", mod.rotateVariation);
        mod.spacingVariation  = EditorGUILayout.Slider("Spacing Variation", mod.spacingVariation, 0.0f, 1.0f);

        //mod.realtime = EditorGUILayout.Toggle("Realtime", mod.realtime);
        //mod.watch = (GameObject)EditorGUILayout.ObjectField("Watch", mod.watch, typeof(GameObject), true);

        if (GUI.changed || rebuild)
        {
            EditorUtility.SetDirty(target);
            mod.Rebuild();
        }

        GUI.changed         = false;
        mod.showgizmoparams = EditorGUILayout.Foldout(mod.showgizmoparams, "Gizmo Params");

        if (mod.showgizmoparams)
        {
            mod.showgizmo = EditorGUILayout.BeginToggleGroup("Show Gizmo", mod.showgizmo);
            mod.gizmoType = (MegaWireGizmoType)EditorGUILayout.EnumPopup("Show Type", mod.gizmoType);

            mod.units      = (MegaWireUnits)EditorGUILayout.EnumPopup("Units", mod.units);
            mod.unitsScale = EditorGUILayout.FloatField("Units Scale", mod.unitsScale);

            mod.arrowwidth  = EditorGUILayout.FloatField("Arrow Width", mod.arrowwidth);
            mod.arrowlength = EditorGUILayout.FloatField("Arrow Length", mod.arrowlength);
            mod.arrowoff    = EditorGUILayout.Slider("Arrow Offset", mod.arrowoff, 0.0f, 1.0f);
            mod.vertStart   = EditorGUILayout.FloatField("Vert Start", mod.vertStart);
            mod.vertLength  = EditorGUILayout.FloatField("Vert Length", mod.vertLength);

            mod.dashdist = EditorGUILayout.FloatField("Dash Dist", mod.dashdist);
            mod.lineCol  = EditorGUILayout.ColorField("Line Color", mod.lineCol);
            mod.arrowCol = EditorGUILayout.ColorField("Arrow Color", mod.arrowCol);
            mod.otherCol = EditorGUILayout.ColorField("Other Color", mod.otherCol);
            mod.dashCol  = EditorGUILayout.ColorField("Dash Color", mod.dashCol);
            EditorGUILayout.EndToggleGroup();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        undoManager.CheckDirty();
    }