/// <summary> /// Show default T pose character when not playback data /// </summary> private void UpdateDefaultActorWhenIdle() { if (!showDefaultActorWhenNoData) { return; } if (actors == null || props == null) { return; } // Crate default actor if (actors.Count == 0 && props.Count == 0) { actors[ACTOR_DEMO_IDLE_NAME].CreateIdle(ACTOR_DEMO_IDLE_NAME); } // No need to update else if (actors.Count == 1 && actors.ContainsKey(ACTOR_DEMO_IDLE_NAME)) { } // Remove default actor when playback data available else { actors.Remove(ACTOR_DEMO_IDLE_NAME); } }
/// <summary> /// Remove all default Actors that doesn't exist in data /// </summary> private void ClearUnusedDefaultInputs(LiveFrame_v4 frame) { if (actors != null) { foreach (Actor actor in new List <Actor>((IEnumerable <Actor>)actors.Values)) { // Don't remove idle demo if (actor.profileName == ACTOR_DEMO_IDLE_NAME) { continue; } if (!frame.HasProfile(actor.profileName)) { actors.Remove(actor.profileName); } } } if (props != null) { foreach (Prop prop in new List <Prop>((IEnumerable <Prop>)props.Values)) { if (!frame.HasProp(prop.propName)) { props.Remove(prop.propName); } } } }
/// <summary> /// Remove all rows that no longer exists in live data /// </summary> private void ClearUnusedInputRows(LiveFrame_v4 frame) { foreach (InputHierarchyRow row in new List <InputHierarchyRow>((IEnumerable <InputHierarchyRow>)rows.Values)) { if (!frame.HasProfile(row.profileName) && !frame.HasProp(row.profileName)) { rows.Remove(row.profileName); } } }