private static SGT_MultiMesh MultiMeshFieldWithLabel(Rect rect, string label, int labelWidth, SGT_MultiMesh field, bool required = false)
    {
        if (CanDraw == true && field != null)
        {
            if (required == true)
            {
                if (field.ContainsSomething == false)
                {
                    var redRect = new Rect(rect);
                    redRect = SGT_RectHelper.ExpandPx(redRect, 1.0f, 1.0f, 1.0f, 1.0f);
                    GUI.DrawTexture(redRect, SGT_Helper.RedTexture);
                }
            }

            var labelRect = SGT_RectHelper.GetLeftPx(ref rect, labelWidth);

            EditorGUI.LabelField(labelRect, new GUIContent(label, string.Empty), EditorStyles.label);

            var curMesh = field.GetSharedMesh(0);
            var newMesh = (Mesh)EditorGUI.ObjectField(rect, curMesh, typeof(Mesh), false);

            if (curMesh != newMesh)
            {
                field.ReplaceAll(newMesh);
            }
        }

        return field;
    }
Esempio n. 2
0
    private static SGT_MultiMesh MultiMeshFieldWithLabel(Rect rect, string label, int labelWidth, SGT_MultiMesh field, bool required = false)
    {
        if (CanDraw == true && field != null)
        {
            if (required == true)
            {
                if (field.ContainsSomething == false)
                {
                    var redRect = new Rect(rect);
                    redRect = SGT_RectHelper.ExpandPx(redRect, 1.0f, 1.0f, 1.0f, 1.0f);
                    GUI.DrawTexture(redRect, SGT_Helper.RedTexture);
                }
            }

            var labelRect = SGT_RectHelper.GetLeftPx(ref rect, labelWidth);

            EditorGUI.LabelField(labelRect, new GUIContent(label, string.Empty), EditorStyles.label);

            var curMesh = field.GetSharedMesh(0);
            var newMesh = (Mesh)EditorGUI.ObjectField(rect, curMesh, typeof(Mesh), false);

            if (curMesh != newMesh)
            {
                field.ReplaceAll(newMesh);
            }
        }

        return(field);
    }
    public static SGT_MultiMesh MultiMeshField(string handle, string tooltip, SGT_MultiMesh field, bool required = false, bool isField = true)
    {
        if (CanDraw == true && field != null)
        {
            var curMesh = field.GetSharedMesh(0);
            var newMesh = ObjectField(handle, tooltip, curMesh, required, isField);

            if (curMesh != newMesh)
            {
                field.ReplaceAll(newMesh);
            }
        }

        return field;
    }
Esempio n. 4
0
    public static SGT_MultiMesh MultiMeshField(string handle, string tooltip, SGT_MultiMesh field, bool required = false, bool isField = true)
    {
        if (CanDraw == true && field != null)
        {
            var curMesh = field.GetSharedMesh(0);
            var newMesh = ObjectField(handle, tooltip, curMesh, required, isField);

            if (curMesh != newMesh)
            {
                field.ReplaceAll(newMesh);
            }
        }

        return(field);
    }