protected void AddAtomWithMovementWidgets(IModifier m) { if (currentModifier_ != null) { currentModifier_.PreferredRangeChanged -= PreferredRangeChanged; } currentModifier_ = m as AtomWithMovementModifier; if (currentModifier_ != null) { currentModifier_.PreferredRangeChanged += PreferredRangeChanged; } movementUI_.SetValue( currentModifier_?.Movement, currentModifier_?.PreferredRange ?? new FloatRange(0, 1)); foreach (var w in movementUI_.GetWidgets()) { widgets_.AddToUI(w); } }
public SelectedMorphWidget( MorphModifierUI ui, SelectedMorph sm, int flags = 0) { ui_ = ui; sm_ = sm; collapsible_ = new Collapsible(sm_.DisplayName, null, flags); enabled_ = new Checkbox("Enabled", EnabledChanged, flags); remove_ = new ConfirmableButton("Remove", Remove, flags); movementUI_ = new MovementUI(flags); enabled_.Parameter = sm_.EnabledParameter; movementUI_.SetValue(sm_.Movement, sm_.PreferredRange); collapsible_.Add(enabled_); collapsible_.Add(remove_); foreach (var w in movementUI_.GetWidgets()) { collapsible_.Add(w); } RenameCollapsible(); }