コード例 #1
0
    public override bool Inspector()
    {
        MegaMultiVolSelect mod = (MegaMultiVolSelect)target;

#if !UNITY_5 && !UNITY_2017 && !UNITY_2018 && !UNITY_2019
        EditorGUIUtility.LookLikeControls();
#endif
        mod.Label      = EditorGUILayout.TextField("Label", mod.Label);
        mod.MaxLOD     = EditorGUILayout.IntField("MaxLOD", mod.MaxLOD);
        mod.ModEnabled = EditorGUILayout.Toggle("Enabled", mod.ModEnabled);
        int order = EditorGUILayout.IntField("Order", mod.Order);
        if (order != mod.Order)
        {
            mod.Order = order;

            MegaModifiers context = mod.GetComponent <MegaModifiers>();

            if (context != null)
            {
                context.BuildList();
            }
        }

        mod.freezeSelection = EditorGUILayout.Toggle("Freeze Selection", mod.freezeSelection);
        mod.useCurrentVerts = EditorGUILayout.Toggle("Use Stack Verts", mod.useCurrentVerts);

        mod.displayWeights = EditorGUILayout.Toggle("Show Weights", mod.displayWeights);
        mod.gizCol         = EditorGUILayout.ColorField("Gizmo Col", mod.gizCol);
        mod.gizSize        = EditorGUILayout.FloatField("Gizmo Size", mod.gizSize);

        if (GUILayout.Button("Add Volume"))
        {
            mod.volumes.Add(MegaVolume.Create());
            EditorUtility.SetDirty(target);
        }

        for (int v = 0; v < mod.volumes.Count; v++)
        {
            MegaVolume vol = mod.volumes[v];

            vol.enabled = EditorGUILayout.BeginToggleGroup("Enabled", vol.enabled);
            vol.volType = (MegaVolumeType)EditorGUILayout.EnumPopup("Type", vol.volType);

            if (vol.volType == MegaVolumeType.Sphere)
            {
                vol.radius = EditorGUILayout.FloatField("Radius", vol.radius);
            }
            else
            {
                vol.boxsize = EditorGUILayout.Vector3Field("Size", vol.boxsize);
            }

            vol.weight  = EditorGUILayout.Slider("Weight", vol.weight, 0.0f, 1.0f);
            vol.falloff = EditorGUILayout.FloatField("Falloff", vol.falloff);
            vol.origin  = EditorGUILayout.Vector3Field("Origin", vol.origin);
            vol.target  = (Transform)EditorGUILayout.ObjectField("Target", vol.target, typeof(Transform), true);
            vol.inverse = EditorGUILayout.Toggle("Inverse", vol.inverse);

            EditorGUILayout.EndToggleGroup();

            if (GUILayout.Button("Delete Volume"))
            {
                mod.volumes.RemoveAt(v);
                v--;
                EditorUtility.SetDirty(target);
            }
        }

        return(false);
    }