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:
AbstractConcept 2022-10-18 21:57:43 -05:00
parent ca22fa0c18
commit 2989d9a72c
137 changed files with 527 additions and 668 deletions

View file

@ -31,10 +31,8 @@ namespace RimWorldAnimationStudio
public void LogMessage(string logString, string stackTrace, LogType type)
{
if (currentMessages > maxMessages)
{ return; }
currentMessages++;
if (currentMessages > maxMessages) return;
currentMessages++;
currentMessage.text = logString;

View file

@ -17,7 +17,7 @@ namespace RimWorldAnimationStudio
public void Start()
{
keybindLabel = GetComponent<Text>();
keybindLabel.text = KeybindConfig.Instance.GetKeybindLabel(command);
keybindLabel.text = KeybindConfig.GetKeybindLabel(command);
}
}
}

View file

@ -117,7 +117,7 @@ namespace RimWorldAnimationStudio
if (Workspace.keyframeID.NullOrEmpty() || Workspace.keyframeID.Contains(keyframeID) == false)
{ Workspace.keyframeID = new List<int> { keyframeID }; }
List<PawnKeyframe> selectedKeyframes = Workspace.Instance.GetPawnKeyframes(Workspace.keyframeID).Except(new List<PawnKeyframe>() { keyframe })?.ToList();
List<PawnKeyframe> selectedKeyframes = Workspace.Instance.GetPawnKeyframesByID(Workspace.keyframeID).Except(new List<PawnKeyframe>() { keyframe })?.ToList();
// Link other slected keyframes to the movement of this one
if (selectedKeyframes.NotNullOrEmpty())
@ -170,12 +170,39 @@ namespace RimWorldAnimationStudio
if (keyframe.atTick == Constants.minTick)
{ value = Constants.minTick; return; }
foreach (Selectable linkedSlider in Selectable.allSelectablesArray)
List<PawnKeyframe> keyframesToCheck = Workspace.Instance.GetPawnKeyframesAtTick(actorID, keyframe.atTick.Value);
if (keyframesToCheck.NotNullOrEmpty())
{
if (linkedSlider is KeyframeSlider)
{
(linkedSlider as KeyframeSlider).linkedSlider = null;
(linkedSlider as KeyframeSlider).pivotKeyframe = null;
foreach (PawnKeyframe _keyframe in keyframesToCheck)
{
if (_keyframe != keyframe)
{ AnimationController.Instance.RemovePawnKeyframe(actorID, _keyframe.keyframeID); }
}
}
foreach (Selectable selectable in Selectable.allSelectablesArray)
{
if (selectable is KeyframeSlider)
{
KeyframeSlider linkedSlider = selectable.GetComponent<KeyframeSlider>();
PawnKeyframe linkedKeyframe = linkedSlider.keyframe;
if (linkedSlider.linkedSlider != null)
{
keyframesToCheck = Workspace.Instance.GetPawnKeyframesAtTick(actorID, linkedKeyframe.atTick.Value);
if (keyframesToCheck.NotNullOrEmpty() && keyframesToCheck.Count > 1)
{
foreach (PawnKeyframe _keyframe in keyframesToCheck)
{
if (_keyframe.keyframeID != linkedKeyframe.keyframeID)
{ AnimationController.Instance.RemovePawnKeyframe(actorID, _keyframe.keyframeID); Debug.Log("delete"); }
}
}
}
linkedSlider.linkedSlider = null;
linkedSlider.pivotKeyframe = null;
}
}