void OnAnimatorComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == takeDeactivate) { gameObject.SetActive(false); } }
void loadAnimatorData() { if (AMTimeline.window) { __aData = AMTimeline.window.aData; if (aData == null) { return; } if (aData.currentTake == null) { return; } AMTakeData take = aData.currentTake; endFramePadding = take.endFramePadding; frameRate = take.frameRate; loopCount = take.numLoop; loopMode = take.loopMode; loopBackFrame = take.loopBackToFrame; loopBackFrameCheck = loopBackFrame > 0; totalFrames = take.totalFrames; } }
public void reloadAnimatorData() { aData = null; loadAnimatorData(); bool shouldClose = true; if (aData != null) { AMTakeData take = aData.currentTake; // update references for track and key foreach (AMTrack _track in take.trackValues) { if (track == _track) { track = _track; foreach (AMKey _key in track.keys) { if (key == _key) { key = _key; shouldClose = false; } } } } } if (shouldClose) { this.Close(); } }
void OnAnimatorComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == stats.takeDeath) { Release(); } }
public int getTotalSelectedFrames(AMTakeData take) { int total = 0; for (int i = 0; i < contextSelectionTracks.Count; i++) { int trackId = contextSelectionTracks[i]; AMTrack track = null; for (int j = 0; j < take.trackValues.Count; j++) { if (take.trackValues[j].id == trackId) { track = take.trackValues[j]; break; } } if (track != null) { int lastFrame = track.getLastFrame(take.frameRate); if (lastFrame > total) { total = lastFrame; } } } return(total); }
public void MakeTakeNameUnique(AMTakeData take) { bool loop = false; int count = 0; do { if (loop) { loop = false; } foreach (AMTakeData _take in takes) { if (_take != take && _take.name == take.name) { if (count > 0) { take.name = take.name.Substring(0, take.name.Length - 3); } count++; take.name += "(" + count + ")"; loop = true; break; } } } while(loop); }
void OnDisable() { window = null; if (aData != null && saveChanges) { AMTakeData take = aData.currentTake; bool saveNumFrames = true; string label = take.name + ": Modify Settings"; AMTimeline.RegisterTakesUndo(aData, label, true); take = aData.currentTake; if (saveNumFrames) { Undo.RegisterCompleteObjectUndo(AnimatorDataEdit.GetKeysAndTracks(take), label); // save end frame padding take.endFramePadding = endFramePadding; } // save frameRate take.frameRate = frameRate; //save other data take.numLoop = loopCount; take.loopMode = loopMode; take.loopBackToFrame = loopBackFrameCheck ? Mathf.Clamp(loopBackFrame, 1, totalFrames) : 0; EditorWindow.GetWindow(typeof(AMTimeline)).Repaint(); } }
public AMKey[] removeSelectedKeysFromTrack(AMTakeData take, AMITarget itarget, int track_id) { List <AMKey> dkeys = new List <AMKey>(); bool didDeleteKeys = false; AMTrack track = take.getTrack(track_id); for (int i = 0; i < track.keys.Count; i++) { if (!isFrameInContextSelection(track.keys[i].frame)) { continue; } dkeys.Add(track.keys[i]); track.keys.Remove(track.keys[i]); i--; didDeleteKeys = true; } if (didDeleteKeys) { track.updateCache(itarget); } return(dkeys.ToArray()); }
public bool isGroupSelected(AMTakeData take, int group_id, ref int numTracks) { AMGroup grp = take.getGroup(group_id); for (int i = 0; i < grp.elements.Count; i++) { // select track if (grp.elements[i] > 0) { if (!contextSelectionTracks.Contains(grp.elements[i])) { return(false); } numTracks++; } else { if (isGroupSelected(take, grp.elements[i], ref numTracks) == false) { return(false); } } } return(true); }
/*public void contextSelectGroup(int group_id, bool deselect) { * AMGroup grp = getGroup(group_id); * for(int i=0;i<grp.elements.Count;i++) { * // select track * if(grp.elements[i] > 0) { * bool isSelected = contextSelectionTracks.Contains(grp.elements[i]); * if(deselect) { * if(isSelected) contextSelectionTracks.Remove(grp.elements[i]); * } else { * if(!isSelected) contextSelectionTracks.Add(grp.elements[i]); * } * } else { * contextSelectGroup(grp.elements[i],deselect); * } * } * }*/ public void contextSelectGroup(AMTakeData take, int group_id, bool isControlDown) { AMGroup grp = take.getGroup(group_id); int numTracks = 0; bool deselect = isControlDown && isGroupSelected(take, group_id, ref numTracks); for (int i = 0; i < grp.elements.Count; i++) { // select track if (grp.elements[i] > 0) { bool isSelected = contextSelectionTracks.Contains(grp.elements[i]); if (deselect) { if (isSelected) { contextSelectionTracks.Remove(grp.elements[i]); } } else { if (!isSelected) { contextSelectionTracks.Add(grp.elements[i]); } } } else { contextSelectGroup(take, grp.elements[i], deselect); } } }
public void selectGroup(AMTakeData take, int group_id, bool isShiftDown, bool isControlDown, bool softSelect = false) { if (isShiftDown || isControlDown) { contextSelectGroup(take, group_id, isControlDown); // select range if ((selectedTrack != -1 || selectedGroup != 0) && isShiftDown) { List <int> range = take.getTrackIDsForRange((selectedTrack != -1 ? selectedTrack : selectedGroup), group_id); foreach (int track_id in range) { if (!contextSelectionTracks.Contains(track_id)) { contextSelectionTracks.Add(track_id); } } } } else if (!softSelect) { if (contextSelectionTracks.Count == 1) { contextSelectionTracks = new List <int>(); } } selectedGroup = group_id; }
void OnAnimationComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == takeLeave || take.name == takeExplode) { Release(); } }
public int[] getKeyFramesInGhostSelection(AMTakeData take, int startFrame, int endFrame, int track_id) { List <int> key_frames = new List <int>(); if (track_id <= -1) { return(key_frames.ToArray()); } foreach (AMKey key in take.getTrack(track_id).keys) { if (key.frame + ghost_selection_total_offset < startFrame) { continue; } if (key.frame + ghost_selection_total_offset > endFrame) { break; } if (isFrameInContextSelection(key.frame)) { key_frames.Add(key.frame + ghost_selection_total_offset); } } return(key_frames.ToArray()); }
public AMTrack getSelectedTrack(AMTakeData take) { if (selectedTrack == -1) { return(null); } int ind = take.getTrackIndex(selectedTrack); return(ind == -1 || ind >= take.trackValues.Count ? null : take.trackValues[ind]); }
/// <summary> /// Only call this during OnDestroy /// </summary> public void Destroy() { if (mSequence != null) { mSequence.Kill(); mSequence = null; } mTarget = null; mTake = null; }
void OnAnimatorTakeFinish(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == takePumping) { isPumping = false; } else if (take.name == takeLiftoff) { isLiftingOff = false; } }
public void addGroup(AMTakeData take) { take.initGroups(); AMGroup g = new AMGroup(); g.init(take.getUniqueGroupID()); take.groupValues.Add(g); take.rootGroup.elements.Add(g.group_id); // select new group when it has been created selectedGroup = g.group_id; }
//frames // select a frame public void selectFrame(AMTakeData take, int track, int num, float numFramesToRender, bool isShiftDown, bool isControlDown) { selectedFrame = num; selectTrack(take, track, isShiftDown, isControlDown); if ((selectedFrame < startFrame) || (selectedFrame > endFrame)) { startFrame = selectedFrame; endFrame = startFrame + (int)numFramesToRender - 1; } take.selectedFrame = selectedFrame; }
public AMTakeData AddNewTake() { string name = "Take" + (takes.Count + 1); AMTakeData a = new AMTakeData(); // set defaults a.name = name; MakeTakeNameUnique(a); takes.Add(a); return(a); }
public int GetTakeIndex(AMTakeData take) { List <AMTakeData> _t = takes; for (int i = 0; i < _t.Count; i++) { if (_t[i] == take) { return(i); } } return(-1); }
void OnAnimatorComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == takeEat) { if (mArms.Count > 0) { anim.Play(takeSeek); } else { anim.Play(takeNormal); } } }
/*public bool setShowWarningForLostReferences(bool showWarningForLostReferences) { * if(this.showWarningForLostReferences != showWarningForLostReferences) { * this.showWarningForLostReferences = showWarningForLostReferences; * return true; * } * return false; * }*/ public void DeleteAllTakesExcept(AMTakeData take) { List <AMTakeData> _t = takes; for (int index = 0; index < _t.Count; index++) { if (_t[index] == take) { continue; } DeleteTake(index); index--; } }
void OnAnimationComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == takeResultProceedShow) { mResultProceedActive = true; if (mRout != null) { StopCoroutine(mRout); } mRout = StartCoroutine(DoHideResultProceed()); } }
public void GotoFrame(float frame) { AMTakeData take = mCurrentPlayingTake; Sequence seq = currentPlayingSequence; if (take != null && seq != null) { float t = frame / take.frameRate; seq.Goto(t); } else { Debug.LogWarning("No take playing..."); } }
void OnAnimatorComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == stats.data.takeSpawn) { if (!string.IsNullOrEmpty(stats.data.takeNormal)) { animator.Play(stats.data.takeNormal); } } else if (take.name == stats.data.takeDeath) { if (stats.data.releaseOnDeath) { Release(); } } }
public void Resume() { AMTakeData take = mCurrentPlayingTake; if (take == null) { return; } take.Resume(this); Sequence seq = currentPlayingSequence; if (seq != null) { seq.Play(); } }
public List <GameObject> GetDependencies(AMTakeData take = null) { // if only one take if (take != null) { return(take.getDependencies(mDataTarget)); } // if all takes List <GameObject> ls = new List <GameObject>(); foreach (AMTakeData t in takes) { ls = ls.Union(t.getDependencies(mDataTarget)).ToList(); } return(ls); }
void OnAnimatorComplete(M8.Animator.AnimatorData anim, M8.Animator.AMTakeData take) { if (take.name == stats.data.takeSpawn) { animator.Play(stats.data.takeNormal); } else if (take.name == stats.data.takeDeath) { if (stats.data.releaseOnDeath) { Release(); } } else if (take.name == stats.data.takeDeathInstant) { Release(); } }
public void PlayAtTime(int index, float time, bool loop = false) { if (mNowPlayingTakeIndex == index) { return; } mLastPlayingTakeIndex = mNowPlayingTakeIndex; Pause(); if (mLastPlayingTakeIndex != -1) { mSequences[mLastPlayingTakeIndex].take.PlaySwitch(this); //notify take that we are switching } AMSequence amSeq = mSequences[index]; AMTakeData newPlayTake = amSeq.take; Sequence seq = amSeq.sequence; if (seq == null) { amSeq.Build(sequenceKillWhenDone, updateType, updateTimeIndependent); seq = amSeq.sequence; } mNowPlayingTakeIndex = index; newPlayTake.PlayStart(this, newPlayTake.frameRate * time, 1.0f); //notify take that we are playing if (seq != null) { /*if(loop) { * seq.loops = -1; * } * else { * seq.loops = newPlayTake.numLoop; * }*/ seq.timeScale = mAnimScale; seq.Goto(time, true); } }
// select a track by index public void selectTrack(AMTakeData take, int index, bool isShiftDown, bool isControlDown) { bool isInContextSelection = contextSelectionTracks.Contains(index); if (!isShiftDown && !isControlDown) { if (selectedTrack != index) { selectedTrack = index; if (!isInContextSelection) { // clear context selection contextSelection = new List <int>(); contextSelectionTracks = new List <int>(); } } if (index > -1) { selectGroup(take, take.getTrackGroup(index), false, false, true); } } if (!isInContextSelection) { contextSelectionTracks.Add(index); } else if (isControlDown && selectedTrack != index && !isShiftDown) { contextSelectionTracks.Remove(index); } // select range if ((selectedTrack != -1 || selectedGroup != 0) && isShiftDown) { List <int> range = take.getTrackIDsForRange((selectedTrack != -1 ? selectedTrack : selectedGroup), index); foreach (int track_id in range) { if (!contextSelectionTracks.Contains(track_id)) { contextSelectionTracks.Add(track_id); } } } }