public ParameterSelector(AnimNodeItem item, AnimationTreeParameterType type, int parameterCount) { this.Height = 20; this.Item = item; this.ColumnDefinitions.Add(1, GridUnitType.Star); for (int i = 0; i < parameterCount; i++) { this.ColumnDefinitions.Add(1, GridUnitType.Star); } this._Label = new Label() { Column = 0, VerticalAlignment = Framework.UI.VerticalAlignment.Center }; this._Label.Text = (parameterCount > 1) ? "Parameters" : "Parameter"; this.Controls.Add(this._Label); this._ParamType = type; this._Params = new UI.IntPopup[parameterCount]; for (int i = 0; i < parameterCount; i++) { this._Params[i] = new UI.IntPopup() { Column = i + 1, UserData = i, VerticalAlignment = Framework.UI.VerticalAlignment.Center }; this._Params[i].OptionChanged += ParameterSelector_OptionChanged; this.Controls.Add(this._Params[i]); } }
private void AddNewParameter(AnimationTreeParameterType type) { AnimationTreeParameter Parameter = new AnimationTreeParameter() { Type = type }; Parameter.Name = GetUniqueParameterName(string.Format("new{0}", type)); AnimationTreeParameter[] preParameters = _Editor.Tree.Parameters; AnimationTreeParameter[] newParameters = new AnimationTreeParameter[preParameters.Length + 1]; preParameters.CopyTo(newParameters, 0); newParameters[newParameters.Length - 1] = Parameter; _Editor.Tree.Parameters = newParameters; Add(Parameter); SetButtonsEnable(); }