mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Bug fixes plus extra features
- Insert adds a new keyframe to the selected timeline - New stages have frames cloned from the last frame of current stage - Existing key are now replaced when another key is dropped on them - Fixed bug where starting a new animation could result in errors
This commit is contained in:
parent
ca22fa0c18
commit
2989d9a72c
137 changed files with 527 additions and 668 deletions
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
[Serializable]
|
||||
public class HistoricRecord
|
||||
public class WorkspaceRecord
|
||||
{
|
||||
public int recordID = 0;
|
||||
public string eventDesc;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public static List<int> keyframeID = new List<int>();
|
||||
|
||||
[SerializeField] private List<HistoricRecord> workspaceHistory = new List<HistoricRecord>();
|
||||
[SerializeField] private List<WorkspaceRecord> workspaceHistory = new List<WorkspaceRecord>();
|
||||
[SerializeField] private int maxHistoryDepth = 100;
|
||||
|
||||
public static ActorManipulationMode actorManipulationMode = ActorManipulationMode.Pan;
|
||||
|
@ -53,6 +53,11 @@ namespace RimWorldAnimationStudio
|
|||
return animationDef?.animationStages[stageID]?.animationClips[actorID]?.keyframes.FirstOrDefault(x => x.atTick == stageTick);
|
||||
}
|
||||
|
||||
public List<PawnKeyframe> GetPawnKeyframesAtTick(int actorID, int atTick)
|
||||
{
|
||||
return animationDef?.animationStages[stageID]?.animationClips[actorID]?.keyframes.Where(x => x.atTick == atTick)?.ToList();
|
||||
}
|
||||
|
||||
public PawnAnimationClip GetCurrentPawnAnimationClip()
|
||||
{
|
||||
return animationDef.animationStages[stageID].animationClips[actorID];
|
||||
|
@ -74,7 +79,7 @@ namespace RimWorldAnimationStudio
|
|||
return animationDef.animationStages[stageID].animationClips[actorID].keyframes.FirstOrDefault(x => x.keyframeID == keyframeID);
|
||||
}
|
||||
|
||||
public List<PawnKeyframe> GetPawnKeyframes(List<int> keyframeIDs)
|
||||
public List<PawnKeyframe> GetPawnKeyframesByID(List<int> keyframeIDs)
|
||||
{
|
||||
List<PawnKeyframe> pawnKeyframes = new List<PawnKeyframe>();
|
||||
|
||||
|
@ -203,12 +208,23 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
|
||||
[SerializeField]
|
||||
public LinkedList<HistoricRecord> pastSnapshots = new LinkedList<HistoricRecord>();
|
||||
public LinkedList<HistoricRecord> futureSnapshots = new LinkedList<HistoricRecord>();
|
||||
public LinkedList<WorkspaceRecord> pastSnapshots = new LinkedList<WorkspaceRecord>();
|
||||
public LinkedList<WorkspaceRecord> futureSnapshots = new LinkedList<WorkspaceRecord>();
|
||||
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
actorID = 0;
|
||||
stageID = 0;
|
||||
keyframeID.Clear();
|
||||
selectedBodyPart = null;
|
||||
|
||||
ClearHistory();
|
||||
}
|
||||
|
||||
public void MakeHistoricRecord(string eventDesc)
|
||||
{
|
||||
HistoricRecord record = new HistoricRecord();
|
||||
WorkspaceRecord record = new WorkspaceRecord();
|
||||
record.recordID = pastSnapshots.Count;
|
||||
record.eventDesc = eventDesc;
|
||||
record.animationDef = animationDef.Copy();
|
||||
|
@ -221,7 +237,7 @@ namespace RimWorldAnimationStudio
|
|||
{ pastSnapshots.RemoveFirst(); }
|
||||
}
|
||||
|
||||
public void RestoreToHistoricRecord(HistoricRecord record)
|
||||
public void RestoreToHistoricRecord(WorkspaceRecord record)
|
||||
{
|
||||
animationDef = record.animationDef.Copy();
|
||||
stageID = record.stageID;
|
||||
|
@ -232,8 +248,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Undo()
|
||||
{
|
||||
HistoricRecord recordToRead = pastSnapshots.Last?.Previous?.Value;
|
||||
HistoricRecord recordToStore = pastSnapshots.Last?.Value;
|
||||
WorkspaceRecord recordToRead = pastSnapshots.Last?.Previous?.Value;
|
||||
WorkspaceRecord recordToStore = pastSnapshots.Last?.Value;
|
||||
|
||||
if (recordToRead == null || recordToStore == null) return;
|
||||
|
||||
|
@ -246,7 +262,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Redo()
|
||||
{
|
||||
HistoricRecord recordToReadAndStore = futureSnapshots.Last?.Value;
|
||||
WorkspaceRecord recordToReadAndStore = futureSnapshots.Last?.Value;
|
||||
|
||||
if (recordToReadAndStore == null) return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue