mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Improved undo redo function and timelines
This commit is contained in:
parent
1af7f41d63
commit
e36ef6a368
372 changed files with 4086 additions and 211 deletions
70
Assets/Scripts/GUI/DialogBoxes/ConsoleMessagesDialog.cs
Normal file
70
Assets/Scripts/GUI/DialogBoxes/ConsoleMessagesDialog.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ConsoleMessagesDialog : MonoBehaviour
|
||||
{
|
||||
public bool isExpanded = false;
|
||||
public GameObject consoleWindow;
|
||||
public Transform logContent;
|
||||
public Text stackTrace;
|
||||
public Text currentMessage;
|
||||
public Text logMessagePrefab;
|
||||
public int maxMessages = 500;
|
||||
|
||||
private int currentMessages = 0;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Application.logMessageReceived += LogMessage;
|
||||
}
|
||||
|
||||
public void ToggleExpand()
|
||||
{
|
||||
isExpanded = !isExpanded;
|
||||
|
||||
consoleWindow.SetActive(isExpanded);
|
||||
}
|
||||
|
||||
public void LogMessage(string logString, string stackTrace, LogType type)
|
||||
{
|
||||
if (currentMessages > maxMessages)
|
||||
{ return; }
|
||||
|
||||
currentMessages++;
|
||||
|
||||
currentMessage.text = logString;
|
||||
|
||||
Text logMessage = Instantiate(logMessagePrefab, logContent);
|
||||
logMessage.text = logString;
|
||||
|
||||
logMessage.GetComponent<Button>().onClick.AddListener(delegate { OpenStackTrace(stackTrace); });
|
||||
|
||||
if (type == LogType.Warning)
|
||||
{
|
||||
currentMessage.color = Constants.ColorGoldYellow;
|
||||
logMessage.color = Constants.ColorGoldYellow;
|
||||
}
|
||||
|
||||
else if (type == LogType.Exception || type == LogType.Error)
|
||||
{
|
||||
currentMessage.color = Constants.ColorRed;
|
||||
logMessage.color = Constants.ColorRed;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
currentMessage.color = Constants.ColorDarkGrey;
|
||||
logMessage.color = Constants.ColorDarkGrey;
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenStackTrace(string stackTrace)
|
||||
{
|
||||
this.stackTrace.text = stackTrace;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/DialogBoxes/ConsoleMessagesDialog.cs.meta
Normal file
11
Assets/Scripts/GUI/DialogBoxes/ConsoleMessagesDialog.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c62f9942e9d933848913ee2b28f65791
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
54
Assets/Scripts/GUI/DialogBoxes/SelectActorLayerDialog.cs
Normal file
54
Assets/Scripts/GUI/DialogBoxes/SelectActorLayerDialog.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SelectActorLayerDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.actorLayers.Count; i++)
|
||||
{
|
||||
string actorLayer = Workspace.actorLayers[i];
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = actorLayer;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.Instance.GetCurrentPawnAnimationClip().layer == actorLayer;
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip != null)
|
||||
{ clip.layer = actorLayer; }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor layer set");
|
||||
});
|
||||
|
||||
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
RemoveCloneObjectsFromParent(contentWindow);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ce4b68a13ad01b14f97697ab310a74d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -10,9 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectBodyDefTypesDialog : DialogBox
|
||||
{
|
||||
private Actor actor;
|
||||
|
||||
public void Start()
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -27,18 +25,12 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
Workspace.bodyDefTypes.Add(field.text);
|
||||
|
||||
Initialize(null, true);
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(Actor actor = null, bool addedNewTag = false)
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (actor != null)
|
||||
{ this.actor = actor; }
|
||||
|
||||
if (actor == null)
|
||||
{ actor = this.actor; }
|
||||
|
||||
if (actor == null) return;
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
foreach (string bodyDefType in actor.bodyDefTypes)
|
||||
{
|
||||
|
@ -66,7 +58,7 @@ namespace RimWorldAnimationStudio
|
|||
else if (toggleComp.isOn == false && actor.bodyDefTypes.Contains(bodyDefType))
|
||||
{ actor.bodyDefTypes.Remove(bodyDefType); }
|
||||
|
||||
Workspace.Instance.MakeDirty();
|
||||
Workspace.Instance.RecordEvent("Actor bodyDef type");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
|
|
|
@ -10,9 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectBodyPartsDialog : DialogBox
|
||||
{
|
||||
private Actor actor;
|
||||
|
||||
public void Start()
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -30,18 +28,12 @@ namespace RimWorldAnimationStudio
|
|||
Debug.Log("Add new body part: " + field.text);
|
||||
Workspace.bodyParts.Add(field.text);
|
||||
|
||||
Initialize(null, true);
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(Actor actor = null, bool addedNewTag = false)
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (actor != null)
|
||||
{ this.actor = actor; }
|
||||
|
||||
if (actor == null)
|
||||
{ actor = this.actor; }
|
||||
|
||||
if (actor == null) return;
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
foreach (string bodyPart in actor.requiredGenitals)
|
||||
{
|
||||
|
@ -69,7 +61,7 @@ namespace RimWorldAnimationStudio
|
|||
else if (toggleComp.isOn == false && actor.requiredGenitals.Contains(bodyPart))
|
||||
{ actor.requiredGenitals.Remove(bodyPart); }
|
||||
|
||||
Workspace.Instance.MakeDirty();
|
||||
Workspace.Instance.RecordEvent("Actor required body part");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
|
|
|
@ -10,10 +10,9 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectDefNamesDialog : DialogBox
|
||||
{
|
||||
private Actor actor;
|
||||
|
||||
public void Start()
|
||||
public void OnEnable()
|
||||
{
|
||||
Debug.Log("enabled");
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
@ -27,18 +26,12 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
Workspace.defNames.Add(field.text);
|
||||
|
||||
Initialize(null, true);
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(Actor actor = null, bool addedNewTag = false)
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (actor != null)
|
||||
{ this.actor = actor; }
|
||||
|
||||
if (actor == null)
|
||||
{ actor = this.actor; }
|
||||
|
||||
if (actor == null) return;
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
foreach (string defName in actor.defNames)
|
||||
{
|
||||
|
@ -66,7 +59,7 @@ namespace RimWorldAnimationStudio
|
|||
else if (toggleComp.isOn == false && actor.defNames.Contains(defName))
|
||||
{ actor.defNames.Remove(defName); }
|
||||
|
||||
Workspace.Instance.MakeDirty();
|
||||
Workspace.Instance.RecordEvent("Actor def name");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectInteractionDefsDialog : DialogBox
|
||||
{
|
||||
public void Start()
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace RimWorldAnimationStudio
|
|||
else if (toggleComp.isOn == false && Workspace.animationDef.interactionDefTypes.Contains(interactionDefType))
|
||||
{ Workspace.animationDef.interactionDefTypes.Remove(interactionDefType); }
|
||||
|
||||
Workspace.Instance.MakeDirty();
|
||||
Workspace.Instance.RecordEvent("Animation InteractionDef");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectSexTypesDialog : DialogBox
|
||||
{
|
||||
public void Start()
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace RimWorldAnimationStudio
|
|||
else if (toggleComp.isOn == false && Workspace.animationDef.sexTypes.Contains(sexType))
|
||||
{ Workspace.animationDef.sexTypes.Remove(sexType); }
|
||||
|
||||
Workspace.Instance.MakeDirty();
|
||||
Workspace.Instance.RecordEvent("Animation sex type");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectSoundDefDialog : DialogBox
|
||||
{
|
||||
public void Start()
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace RimWorldAnimationStudio
|
|||
if (keyframe != null)
|
||||
{ keyframe.soundEffect = soundDef; }
|
||||
|
||||
Workspace.Instance.MakeDirty();
|
||||
Workspace.Instance.RecordEvent("Keyframe sound effect");
|
||||
});
|
||||
|
||||
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue