mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Improved adding and removal of anim events
This commit is contained in:
parent
f0d46df3d6
commit
8523abf957
276 changed files with 1401 additions and 5422 deletions
96
Assets/Scripts/Workspace/Workspace.cs
Normal file
96
Assets/Scripts/Workspace/Workspace.cs
Normal file
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class Workspace : Singleton<Workspace>
|
||||
{
|
||||
public static AnimationDef animationDef;
|
||||
public static int stageID = 0;
|
||||
public static int actorID = 0;
|
||||
public static int keyframeID = 0;
|
||||
public static bool isDirty = false;
|
||||
|
||||
public static List<string> defNames = new List<string>() { "Human" };
|
||||
public static List<string> bodyParts = new List<string>() { "Penis", "Vagina", "Anus", "Breasts", "Mouth" };
|
||||
public static List<string> bodyDefTypes = new List<string>() { "Human" };
|
||||
public static List<string> sexTypes = new List<string>() { "None", "Vaginal", "Anal", "Oral", "Masturbation", "DoublePenetration", "Boobjob", "Handjob", "Footjob", "Fingering", "Scissoring", "MutualMasturbation", "Fisting", "MechImplant", "Rimming", "Fellatio", "Cunnilingus", "Sixtynine" };
|
||||
public static List<string> interactionDefTypes = new List<string>();
|
||||
|
||||
private static List<WorkspaceSnapShot> workspaceHistory = new List<WorkspaceSnapShot>();
|
||||
private static int maxHistoryDepth = 100;
|
||||
private static int historyIndex = 0;
|
||||
|
||||
public static ActorManipulationMode actorManipulationMode = ActorManipulationMode.Pan;
|
||||
public static int animationClipWindowSize = 600;
|
||||
|
||||
public PawnKeyframe GetCurrentPawnKeyframe(bool makeNewIfNull = true)
|
||||
{
|
||||
int stageTick = AnimationController.Instance.stageTick;
|
||||
PawnKeyframe keyframe = animationDef?.animationStages[stageID]?.animationClips[actorID]?.keyframes.FirstOrDefault(x => x.atTick == stageTick);
|
||||
|
||||
if (keyframe != null || makeNewIfNull == false)
|
||||
{ return keyframe; }
|
||||
|
||||
AnimationController.Instance.AddPawnKeyframe();
|
||||
return animationDef?.animationStages[stageID]?.animationClips[actorID]?.keyframes.FirstOrDefault(x => x.atTick == stageTick);
|
||||
}
|
||||
|
||||
public PawnAnimationClip GetCurrentPawnAnimationClip()
|
||||
{
|
||||
return animationDef.animationStages[stageID].animationClips[actorID];
|
||||
}
|
||||
|
||||
public PawnAnimationClip GetPawnAnimationClip(int actorID)
|
||||
{
|
||||
return animationDef.animationStages[stageID].animationClips[actorID];
|
||||
}
|
||||
|
||||
public PawnKeyframe GetPawnKeyframe(int actorID, int keyframeID)
|
||||
{
|
||||
return animationDef.animationStages[stageID].animationClips[actorID].keyframes.FirstOrDefault(x => x.keyframeID == keyframeID);
|
||||
}
|
||||
|
||||
public void TrackChanges()
|
||||
{
|
||||
if (historyIndex < workspaceHistory.Count - 1)
|
||||
{ workspaceHistory.RemoveRange(historyIndex + 1, workspaceHistory.Count - historyIndex); }
|
||||
|
||||
if (workspaceHistory.Any() && workspaceHistory.Count >= maxHistoryDepth)
|
||||
{ workspaceHistory.RemoveAt(0); }
|
||||
|
||||
WorkspaceSnapShot workspaceSnapShot = new WorkspaceSnapShot();
|
||||
workspaceSnapShot.animationDef = animationDef;
|
||||
workspaceSnapShot.stageID = stageID;
|
||||
|
||||
workspaceHistory.Add(workspaceSnapShot);
|
||||
|
||||
// track bType for actors, stageID, isdirty
|
||||
|
||||
historyIndex++;
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
historyIndex = Mathf.Clamp(historyIndex - 1, 0, workspaceHistory.Count - 1);
|
||||
LoadHistoricState();
|
||||
}
|
||||
|
||||
public void Redo()
|
||||
{
|
||||
historyIndex = Mathf.Clamp(historyIndex - 1, 0, workspaceHistory.Count - 1);
|
||||
LoadHistoricState();
|
||||
}
|
||||
|
||||
public void LoadHistoricState()
|
||||
{
|
||||
animationDef = workspaceHistory[historyIndex].animationDef;
|
||||
|
||||
// All other data
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Workspace/Workspace.cs.meta
Normal file
11
Assets/Scripts/Workspace/Workspace.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf0f782b7c407bf4896b633d509f5568
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
14
Assets/Scripts/Workspace/WorkspaceSnapShot.cs
Normal file
14
Assets/Scripts/Workspace/WorkspaceSnapShot.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class WorkspaceSnapShot
|
||||
{
|
||||
public AnimationDef animationDef;
|
||||
public int stageID = 0;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Workspace/WorkspaceSnapShot.cs.meta
Normal file
11
Assets/Scripts/Workspace/WorkspaceSnapShot.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d877470affbfa194db9947e8bdd1bcb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue