Example #1
0
        public static void DrawEnabledButton <T>(ICEDataObject _object, EditorHeaderType _type, List <T> _list) where T : new()
        {
            if (_object == null || _list == null)
            {
                return;
            }

            if (IsEnabledType(_type))
            {
                bool _enabled = ICEEditorLayout.EnableButton(_object.Enabled);

                // if enabled was canged to true we will prepare some thinks to optimize the handling for the user
                if (_enabled && _enabled != _object.Enabled)
                {
                    // if the list is empty we will insert a first item
                    if (_list.Count == 0)
                    {
                        _list.Add(ICEObjectFactory.Create <T>());
                    }

                    // we foldout the parent object
                    _object.Foldout = true;
                }

                // update the enabled status of the parent object
                _object.Enabled = _enabled;
            }
        }
Example #2
0
        public static bool DrawAddButton <T>(ICEDataObject _object, EditorHeaderType _type, List <T> _list) where T : new()
        {
            if (_object == null || _list == null)
            {
                return(false);
            }

            if (ICEEditorLayout.AddButtonSmall(""))
            {
                _list.Add(ICEObjectFactory.Create <T>());

                _object.Enabled = true;
                _object.Foldout = true;
                return(true);
            }
            return(false);
        }