Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        MegaLoftLayerSimple layer = (MegaLoftLayerSimple)target;
        MegaShapeLoft       loft  = layer.GetComponent <MegaShapeLoft>();

        if (loft && loft.undo)
        {
            undoManager.CheckUndo();
        }

        DisplayGUI();
        CommonGUI();

        if (GUI.changed)
        {
            if (loft)
            {
                loft.rebuild = true;
                EditorUtility.SetDirty(loft);
            }

            if (layer)
            {
                EditorUtility.SetDirty(layer);
            }
        }
        if (loft && loft.undo)
        {
            undoManager.CheckDirty();
        }
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        MegaModifier mod = (MegaModifier)target;

        serializedObject.Update();

        if (mod.useUndo)
        {
            undoManager.CheckUndo();
        }

        DrawGUI();

        serializedObject.ApplyModifiedProperties();

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

        if (mod.useUndo)
        {
            undoManager.CheckDirty();
        }
    }
    public override void OnInspectorGUI()
    {
        undoManager.CheckUndo();
        DrawGUI();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
        undoManager.CheckDirty();
    }
Esempio n. 4
0
    public override void OnInspectorGUI()
    {
        undoManager.CheckUndo();

#if !UNITY_5
        EditorGUIUtility.LookLikeControls();
#endif

        DisplayGUI();

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

        undoManager.CheckDirty();
    }
Esempio n. 5
0
    public override void OnInspectorGUI()
    {
        MegaModifier mod = (MegaModifier)target;

        if (mod.useUndo)
        {
            undoManager.CheckUndo();
        }

        DrawGUI();

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

        if (mod.useUndo)
        {
            undoManager.CheckDirty();
        }
    }
    public override void OnInspectorGUI()
    {
        undoManager.CheckUndo();
        MegaMorphRef morph = (MegaMorphRef)target;

        PushCols();

        MegaMorph src = (MegaMorph)EditorGUILayout.ObjectField("Source", morph.source, typeof(MegaMorph), true);

        if (src != morph.source)
        {
            morph.SetSource(src);
        }

        // Basic mod stuff
        showmodparams = EditorGUILayout.Foldout(showmodparams, "Modifier Common Params");

        if (showmodparams)
        {
            morph.Label        = EditorGUILayout.TextField("Label", morph.Label);
            morph.MaxLOD       = EditorGUILayout.IntField("MaxLOD", morph.MaxLOD);
            morph.ModEnabled   = EditorGUILayout.Toggle("Mod Enabled", morph.ModEnabled);
            morph.useUndo      = EditorGUILayout.Toggle("Use Undo", morph.useUndo);
            morph.DisplayGizmo = EditorGUILayout.Toggle("Display Gizmo", morph.DisplayGizmo);
            morph.Order        = EditorGUILayout.IntField("Order", morph.Order);
            morph.gizCol1      = EditorGUILayout.ColorField("Giz Col 1", morph.gizCol1);
            morph.gizCol2      = EditorGUILayout.ColorField("Giz Col 2", morph.gizCol2);
        }

        morph.animate = EditorGUILayout.Toggle("Animate", morph.animate);

        if (morph.animate)
        {
            morph.animtime   = EditorGUILayout.FloatField("AnimTime", morph.animtime);
            morph.looptime   = EditorGUILayout.FloatField("LoopTime", morph.looptime);
            morph.speed      = EditorGUILayout.FloatField("Speed", morph.speed);
            morph.repeatMode = (MegaRepeatMode)EditorGUILayout.EnumPopup("RepeatMode", morph.repeatMode);
        }

        string bname = "Hide Channels";

        if (!showchannels)
        {
            bname = "Show Channels";
        }

        if (GUILayout.Button(bname))
        {
            showchannels = !showchannels;
        }

        morph.limitchandisplay = EditorGUILayout.Toggle("Compact Display", morph.limitchandisplay);

        if (showchannels && morph.chanBank != null)
        {
            if (morph.limitchandisplay)
            {
                morph.startchannel = EditorGUILayout.IntField("Start", morph.startchannel);
                morph.displaychans = EditorGUILayout.IntField("Display", morph.displaychans);
                if (morph.displaychans < 0)
                {
                    morph.displaychans = 0;
                }

                if (morph.startchannel < 0)
                {
                    morph.startchannel = 0;
                }

                if (morph.startchannel >= morph.chanBank.Count - 1)
                {
                    morph.startchannel = morph.chanBank.Count - 1;
                }

                int end = morph.startchannel + morph.displaychans;
                if (end >= morph.chanBank.Count)
                {
                    end = morph.chanBank.Count;
                }

                for (int i = morph.startchannel; i < end; i++)
                {
                    PushCols();

                    if ((i & 1) == 0)
                    {
                        GUI.backgroundColor = ChanCol1;
                    }
                    else
                    {
                        GUI.backgroundColor = ChanCol2;
                    }

                    DisplayChannelLim(morph, morph.chanBank[i], i);
                    PopCols();
                }
            }
            else
            {
                for (int i = 0; i < morph.chanBank.Count; i++)
                {
                    PushCols();

                    if ((i & 1) == 0)
                    {
                        GUI.backgroundColor = ChanCol1;
                    }
                    else
                    {
                        GUI.backgroundColor = ChanCol2;
                    }

                    DisplayChannel(morph, morph.chanBank[i], i);
                    PopCols();
                }
            }
        }

        extraparams = EditorGUILayout.Foldout(extraparams, "Extra Params");

        if (extraparams)
        {
            ChanCol1 = EditorGUILayout.ColorField("Channel Col 1", ChanCol1);
            ChanCol2 = EditorGUILayout.ColorField("Channel Col 2", ChanCol2);
        }

        PopCols();

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

        undoManager.CheckDirty();
    }
    public override void OnInspectorGUI()
    {
        undoManager.CheckUndo();
        MegaMorph morph = (MegaMorph)target;

        PushCols();

        if (GUILayout.Button("Import Morph File"))
        {
            LoadMorph();
            EditorUtility.SetDirty(target);
        }

        // Basic mod stuff
        showmodparams = EditorGUILayout.Foldout(showmodparams, "Modifier Common Params");

        if (showmodparams)
        {
            morph.ModEnabled   = EditorGUILayout.Toggle("Mod Enabled", morph.ModEnabled);
            morph.DisplayGizmo = EditorGUILayout.Toggle("Display Gizmo", morph.DisplayGizmo);
            morph.Order        = EditorGUILayout.IntField("Order", morph.Order);
            morph.gizCol1      = EditorGUILayout.ColorField("Giz Col 1", morph.gizCol1);
            morph.gizCol2      = EditorGUILayout.ColorField("Giz Col 2", morph.gizCol2);
        }

        morph.animate = EditorGUILayout.Toggle("Animate", morph.animate);

        if (morph.animate)
        {
            morph.animtime   = EditorGUILayout.FloatField("AnimTime", morph.animtime);
            morph.looptime   = EditorGUILayout.FloatField("LoopTime", morph.looptime);
            morph.speed      = EditorGUILayout.FloatField("Speed", morph.speed);
            morph.repeatMode = (MegaRepeatMode)EditorGUILayout.EnumPopup("RepeatMode", morph.repeatMode);
        }

        //ImportParams(morph);

        EditorGUILayout.BeginHorizontal();
        PushCols();
        if (morph.mapping == null || morph.mapping.Length == 0)
        {
            GUI.backgroundColor = Color.red;
        }
        else
        {
            GUI.backgroundColor = Color.green;
        }

        if (GUILayout.Button("Load Mapping"))
        {
            LoadBase(morph);
        }

        PopCols();

        if (GUILayout.Button("Add Channel"))
        {
            if (morph.chanBank == null)
            {
                morph.chanBank = new List <MegaMorphChan>();
            }

            MegaMorphChan nc = new MegaMorphChan();
            nc.mName = "Empty";
            morph.chanBank.Add(nc);
            //ChannelMapping(morph, nc);	// Create 1 to 1 mapping
        }

        EditorGUILayout.EndHorizontal();

        string bname = "Hide Channels";

        if (!showchannels)
        {
            bname = "Show Channels";
        }

        if (GUILayout.Button(bname))
        {
            showchannels = !showchannels;
        }

        if (showchannels && morph.chanBank != null)
        {
            for (int i = 0; i < morph.chanBank.Count; i++)
            {
                PushCols();

                if ((i & 1) == 0)
                {
                    GUI.backgroundColor = ChanCol1;
                }
                else
                {
                    GUI.backgroundColor = ChanCol2;
                }

                DisplayChannel(morph, morph.chanBank[i], i);
                PopCols();
            }
        }

        extraparams = EditorGUILayout.Foldout(extraparams, "Extra Params");

        if (extraparams)
        {
            ChanCol1 = EditorGUILayout.ColorField("Channel Col 1", ChanCol1);
            ChanCol2 = EditorGUILayout.ColorField("Channel Col 2", ChanCol2);

            //int mem = CalcMemoryUsage(morph) / 1024;
            if (morph.compressedmem == 0)
            {
                morph.memuse = CalcMemoryUsage(morph);
                morph.Compress();
            }
            EditorGUILayout.LabelField("Memory: ", (morph.memuse / 1024) + "KB");
            EditorGUILayout.LabelField("Channel Compressed: ", (morph.compressedmem / 1024) + "KB");
        }

        PopCols();

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

        undoManager.CheckDirty();
    }