public void RemoveMorph(SelectedMorph sm) { if (modifier_ == null) { return; } modifier_.RemoveMorph(sm.Morph); for (int i = 0; i < selectedMorphs_.Count; ++i) { if (selectedMorphs_[i].SelectedMorph == sm) { selectedMorphsCollapsible_.Remove( selectedMorphs_[i].Collapsible); selectedMorphs_.RemoveAt(i); if (selectedMorphsCollapsible_.Expanded) { ui_.NeedsReset("selected morph removed"); } return; } } Synergy.LogError( "can't remove morph " + sm.Morph.displayName + ", " + "not in list"); }
private void AddSelectedMorphUI(SelectedMorph sm) { var smw = new SelectedMorphWidget(this, sm, Widget.Right); selectedMorphs_.Add(smw); selectedMorphsCollapsible_.Add(smw.Collapsible); }
public SelectedMorph Clone(int cloneFlags) { var sm = new SelectedMorph(); CopyTo(sm, cloneFlags); return(sm); }
public void CopyTo(SelectedMorph sm, int cloneFlags) { sm.atom_ = atom_; sm.morph_ = morph_; sm.enabled_.Value = enabled_.Value; sm.Movement = Movement?.Clone(cloneFlags); sm.magnitude_ = magnitude_; }
private MorphMonitor CreateMorphMonitor(int morphIndex) { SelectedMorph sm = modifier_.Morphs[morphIndex]; var mm = new MorphMonitor(); mm.sm = sm; mm.collapsible = new Collapsible(sm.DisplayName, null, Widget.Right); mm.movement = new MovementMonitorWidgets(Widget.Right); mm.collapsible.Add(mm.movement.GetWidgets()); // todo var natpro = modifier_.Progression as NaturalMorphProgression; if (natpro != null) { var mi = natpro.GetMorphInfoFor(sm); if (mi != null) { mm.duration = new DurationMonitorWidgets("Duration", Widget.Right); mm.delay = new DelayMonitor(Widget.Right); mm.stopping = new Checkbox("Stopping", null, Widget.Right); mm.finished = new Checkbox("Finished", null, Widget.Right); mm.customTargetTime = new FloatSlider( "Custom target time", null, Widget.Right); mm.customTargetMovePerTick = new FloatSlider( "Custom target move per tick", null, Widget.Right); mm.customTargetValue = new FloatSlider( "Custom target value", null, Widget.Right); mm.collapsible.Add(mm.duration.GetWidgets(mi.duration)); mm.collapsible.Add(mm.delay.GetWidgets(mi.delay)); mm.collapsible.Add(mm.stopping); mm.collapsible.Add(mm.finished); mm.collapsible.Add(mm.customTargetTime); mm.collapsible.Add(mm.customTargetMovePerTick); mm.collapsible.Add(mm.customTargetValue); } } if (modifier_.Progression is OrderedMorphProgression) { var omp = modifier_.Progression as OrderedMorphProgression; mm.timeRemaining = new FloatSlider( "Morph time remaining", null, Widget.Right | Widget.Disabled); mm.progress = new FloatSlider( "Progress", null, Widget.Right | Widget.Disabled); mm.collapsible.Add(mm.timeRemaining); mm.collapsible.Add(mm.progress); } return(mm); }
public static SelectedMorph Create(Atom atom, DAZMorph morph) { var sm = new SelectedMorph(); sm.Atom = atom; sm.Morph = morph; return(sm); }
public void SetMorphs(List <DAZMorph> morphs) { var fixedMorphs = new List <SelectedMorph>(); foreach (var m in morphs) { bool found = false; foreach (var sm in morphs_) { if (sm.Morph == m) { fixedMorphs.Add(sm); found = true; break; } } if (!found) { var nsm = SelectedMorph.Create(Atom, m); nsm.Movement = new Movement(0, 1); fixedMorphs.Add(nsm); } } int i = 0; while (i < morphs_.Count) { if (fixedMorphs.Contains(morphs_[i])) { ++i; } else { morphs_[i].Removed(); morphs_.RemoveAt(i); } } morphs_.Clear(); morphs_.AddRange(fixedMorphs); Synergy.LogError("new morphs: " + morphs.Count.ToString()); Progression.MorphsChanged(); }
public SelectedMorph AddMorph(DAZMorph m, Movement mv) { if (m == null) { return(null); } var sm = SelectedMorph.Create(Atom, m); if (mv != null) { sm.Movement = mv; } AddMorph(sm); return(sm); }
public override bool FromJSON(J.Node n) { if (!base.FromJSON(n)) { return(false); } var o = n.AsObject("MorphModifier"); if (o == null) { return(false); } if (Atom != null) { var morphsArray = o.Get("selectedMorphs").AsArray(); if (morphsArray != null) { morphsArray.ForEach((morphNode) => { var sm = SelectedMorph.Create(Atom, null); if (sm.FromJSON(morphNode)) { morphs_.Add(sm); } }); } IMorphProgression p = null; o.Opt <MorphProgressionFactory, IMorphProgression>( "progression", ref p); Progression = p; } return(true); }
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(); }
public void AddMorph(SelectedMorph sm) { morphs_.Add(sm); Progression.MorphAdded(morphs_.Count - 1); FireNameChanged(); }