Improved undo redo function and timelines

This commit is contained in:
AbstractConcept 2022-09-21 00:40:58 -05:00
parent 1af7f41d63
commit e36ef6a368
372 changed files with 4086 additions and 211 deletions

View File

@ -63,6 +63,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\DecimalValidator.cs" />
<Compile Include="Assets\Scripts\AdvancedPolygonCollider\AdvancedPolygonCollider.cs" />
<Compile Include="Assets\Scripts\AdvancedPolygonCollider\AdvancedPolygonColliderUtilities.cs" />
<Compile Include="Assets\Scripts\AnimationComponents\Actor.cs" />
@ -88,7 +89,9 @@
<Compile Include="Assets\Scripts\GUI\AddSoundDefButton.cs" />
<Compile Include="Assets\Scripts\GUI\AnimationDefCard.cs" />
<Compile Include="Assets\Scripts\GUI\AnimationTimeline.cs" />
<Compile Include="Assets\Scripts\GUI\DialogBoxes\ConsoleMessagesDialog.cs" />
<Compile Include="Assets\Scripts\GUI\DialogBoxes\DialogBox.cs" />
<Compile Include="Assets\Scripts\GUI\DialogBoxes\SelectActorLayerDialog.cs" />
<Compile Include="Assets\Scripts\GUI\DialogBoxes\SelectAnimationDialog.cs" />
<Compile Include="Assets\Scripts\GUI\DialogBoxes\SelectBodyDefTypesDialog.cs" />
<Compile Include="Assets\Scripts\GUI\DialogBoxes\SelectBodyPartsDialog.cs" />
@ -98,6 +101,7 @@
<Compile Include="Assets\Scripts\GUI\DialogBoxes\SelectSoundDefDialog.cs" />
<Compile Include="Assets\Scripts\GUI\KeyframeSlider.cs" />
<Compile Include="Assets\Scripts\GUI\QuiverToggle.cs" />
<Compile Include="Assets\Scripts\GUI\SelectActorLayerButton.cs" />
<Compile Include="Assets\Scripts\GUI\StageCard.cs" />
<Compile Include="Assets\Scripts\Managers\AnimationController.cs" />
<Compile Include="Assets\Scripts\Managers\ApplicationManager.cs" />
@ -124,8 +128,8 @@
<Compile Include="Assets\Scripts\StandaloneFileBrowser\StandaloneFileBrowserWindows.cs" />
<Compile Include="Assets\Scripts\Utilities\PawnUtility.cs" />
<Compile Include="Assets\Scripts\Utilities\XmlUtility.cs" />
<Compile Include="Assets\Scripts\Workspace\HistoricRecord.cs" />
<Compile Include="Assets\Scripts\Workspace\Workspace.cs" />
<Compile Include="Assets\Scripts\Workspace\WorkspaceSnapShot.cs" />
<None Include="Assets\StreamingAssets\AnimationDefs\newAnimationDef.xml" />
<Reference Include="UnityEngine">
<HintPath>C:/Program Files/Unity/Hub/Editor/2019.4.20f1/Editor/Data/Managed/UnityEngine/UnityEngine.dll</HintPath>

View File

@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DecimalValidator : MonoBehaviour
{
public void Start()
{
InputField inputField = GetComponent<InputField>();
if (inputField)
{
inputField.characterValidation = InputField.CharacterValidation.Decimal;
inputField.onEndEdit.AddListener(delegate { MakeDecimal(); });
}
}
public void MakeDecimal()
{
InputField inputField = GetComponent<InputField>();
if (inputField)
{ inputField.text = string.Format("{0:0.00}", float.Parse(inputField.text)); }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f3886223a697384abc8109a51c855e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2474974560830809494
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1769068046450960379}
- component: {fileID: 651756258176834111}
- component: {fileID: 7477949838743698238}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1769068046450960379
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2474974560830809494}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3344209966827567458}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &651756258176834111
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2474974560830809494}
m_CullTransparentMesh: 0
--- !u!114 &7477949838743698238
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2474974560830809494}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u25BC"
--- !u!1 &3541467645058788217
GameObject:
m_ObjectHideFlags: 0
@ -29,7 +107,9 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 6944627227611333707}
- {fileID: 3344209966827567458}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -90,3 +170,341 @@ MonoBehaviour:
actorID: 0
keyframeSliderPrefab: {fileID: 7758949423219383195, guid: 2482d1331163f49448eea3e9be15324b,
type: 3}
--- !u!1 &5691284147685664125
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6944627227611333707}
- component: {fileID: 4983457135487690825}
- component: {fileID: 1769483352731082045}
- component: {fileID: 8103557626281169821}
m_Layer: 5
m_Name: UpButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6944627227611333707
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5691284147685664125}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4719072754726017379}
m_Father: {fileID: 1744744219600391858}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: -35, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4983457135487690825
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5691284147685664125}
m_CullTransparentMesh: 0
--- !u!114 &1769483352731082045
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5691284147685664125}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8103557626281169821
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5691284147685664125}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1769483352731082045}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: -2766969839996019941}
m_MethodName: OnMoveTimeline
m_Mode: 3
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: -1
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &7547206027253468922
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4719072754726017379}
- component: {fileID: 7956138109239309533}
- component: {fileID: 6081434553307882351}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4719072754726017379
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7547206027253468922}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6944627227611333707}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7956138109239309533
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7547206027253468922}
m_CullTransparentMesh: 0
--- !u!114 &6081434553307882351
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7547206027253468922}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u25B2"
--- !u!1 &7651278788833778284
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3344209966827567458}
- component: {fileID: 850438026055126927}
- component: {fileID: 1776297993150304002}
- component: {fileID: 8159954764734361215}
m_Layer: 5
m_Name: DownButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3344209966827567458
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7651278788833778284}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1769068046450960379}
m_Father: {fileID: 1744744219600391858}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: -15, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &850438026055126927
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7651278788833778284}
m_CullTransparentMesh: 0
--- !u!114 &1776297993150304002
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7651278788833778284}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8159954764734361215
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7651278788833778284}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1776297993150304002}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: -2766969839996019941}
m_MethodName: OnMoveTimeline
m_Mode: 3
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 1
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2

View File

@ -0,0 +1,124 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4836711652305244024
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2366752761053038996}
- component: {fileID: 73982527543990176}
- component: {fileID: 7082774796440540818}
- component: {fileID: 5961644881242490065}
m_Layer: 5
m_Name: LogMessage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2366752761053038996
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4836711652305244024}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &73982527543990176
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4836711652305244024}
m_CullTransparentMesh: 0
--- !u!114 &7082774796440540818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4836711652305244024}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Log message
--- !u!114 &5961644881242490065
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4836711652305244024}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 7082774796440540818}
m_OnClick:
m_PersistentCalls:
m_Calls: []

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a29caea8e4b276d4c861e9eb083562fc
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -91,7 +91,7 @@ namespace RimWorldAnimationStudio
public bool MakeNew()
{
PawnKeyframe keyframeA = new PawnKeyframe();
keyframeA.tickDuration = 60;
keyframeA.tickDuration = Constants.defaultAnimationClipLength - 1;
keyframes.Add(keyframeA);
PawnKeyframe keyframeB = new PawnKeyframe();

View File

@ -6,7 +6,7 @@ using UnityEngine.EventSystems;
namespace RimWorldAnimationStudio
{
public class ActorBody : MonoBehaviour, IPointerClickHandler, IDragHandler
public class ActorBody : MonoBehaviour, IPointerClickHandler, IDragHandler, IEndDragHandler
{
public int actorID;
public string bodyType = "Male";
@ -78,6 +78,11 @@ namespace RimWorldAnimationStudio
clip.BuildSimpleCurves();
}
public void OnEndDrag(PointerEventData eventData)
{
Workspace.Instance.RecordEvent("Actor position / orientation");
}
public void Activate()
{
Workspace.actorID = actorID;

View File

@ -6,7 +6,7 @@ using UnityEngine.EventSystems;
namespace RimWorldAnimationStudio
{
public class ActorBodyPart : MonoBehaviour, IDragHandler, IPointerClickHandler
public class ActorBodyPart : MonoBehaviour, IPointerClickHandler, IDragHandler, IEndDragHandler
{
public SpriteRenderer bodyPartRenderer;
public ActorBody parent;
@ -82,6 +82,11 @@ namespace RimWorldAnimationStudio
clip.BuildSimpleCurves();
}
public void OnEndDrag(PointerEventData eventData)
{
Workspace.Instance.RecordEvent("Actor position / orientation");
}
public void Activate()
{
Workspace.actorID = parent.actorID;

View File

@ -43,7 +43,7 @@ namespace RimWorldAnimationStudio
bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString();
}
public void UpdateAnimationDef()
public void OnValueChanged()
{
if (Workspace.animationDef == null || isDirty) return;
@ -65,10 +65,10 @@ namespace RimWorldAnimationStudio
default: actor.requiredGender = null; break;
}
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Actor body type offset data");
}
public void OpenSelectBodyPartsDialog()
/*public void OpenSelectBodyPartsDialog()
{
if (Workspace.animationDef == null) return;
@ -99,7 +99,7 @@ namespace RimWorldAnimationStudio
if (dialog != null)
{ dialog[0].Initialize(actor); dialog[0].Pop(); }
}
}*/
public void Update()
{

View File

@ -75,7 +75,7 @@ namespace RimWorldAnimationStudio
Workspace.Instance.GetPawnAnimationClip(Workspace.actorID).BuildSimpleCurves();
isDirty = true;
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Actor position / orientation");
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 329a2ecc35813f94fa879c7f434c8fb7
guid: b7e9565ba13ac2e469767bcfad7da5d3
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -68,5 +68,37 @@ namespace RimWorldAnimationStudio
{
BroadcastMessage("UpdateGhostFrames");
}
public void OnMoveTimeline(int delta)
{
int? siblingIndex = transform.parent.GetComponentsInChildren<AnimationTimeline>()?.ToList()?.IndexOf(this);
int? siblingCount = transform.parent.GetComponentsInChildren<AnimationTimeline>()?.ToList()?.Count();
if (siblingIndex != null && siblingCount != null && MoveAnimationTimeline(siblingIndex.Value, delta))
{
//siblingIndex = Mathf.Clamp(siblingCount.Value + delta, 0, siblingCount.Value - 1);
transform.SetSiblingIndex(transform.GetSiblingIndex() + delta);
}
}
public bool MoveAnimationTimeline(int startIndex, int delta)
{
if (startIndex + delta < 0 || startIndex + delta >= Workspace.animationDef.animationStages[Workspace.stageID].animationClips.Count)
{ return false; }
Actor actor = Workspace.animationDef.actors[startIndex];
Workspace.animationDef.actors[startIndex] = Workspace.animationDef.actors[startIndex + delta];
Workspace.animationDef.actors[startIndex + delta] = actor;
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(startIndex);
Workspace.animationDef.animationStages[Workspace.stageID].animationClips[startIndex] = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[startIndex + delta];
Workspace.animationDef.animationStages[Workspace.stageID].animationClips[startIndex + delta] = clip;
Workspace.actorID = startIndex + delta;
Workspace.Instance.RecordEvent("Timeline move");
return true;
}
}
}

View 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;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c62f9942e9d933848913ee2b28f65791
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ce4b68a13ad01b14f97697ab310a74d9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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>();

View File

@ -99,7 +99,7 @@ namespace RimWorldAnimationStudio
if (eventData.clickCount >= 2)
{ AnimationController.Instance.stageTick = keyframe.atTick.Value; }
Workspace.Instance.MakeDirty();
//Workspace.Instance.RecordEvent("Keyframe selected");
}
public void OnBeginDrag(PointerEventData eventData)
@ -126,7 +126,7 @@ namespace RimWorldAnimationStudio
{
interactable = false;
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Keyframe tick");
}
protected override void Update()
@ -145,7 +145,7 @@ namespace RimWorldAnimationStudio
else
{ handleImage.color = Constants.ColorWhite; }
string soundDef = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID).soundEffect;
string soundDef = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID)?.soundEffect;
if (soundDef != null && soundDef != "" && soundDef != "None")
{ soundIcon.SetActive(true); }

View File

@ -19,6 +19,8 @@ namespace RimWorldAnimationStudio
if (keyframe != null)
{ keyframe.quiver = GetComponent<Toggle>().isOn; }
Workspace.Instance.RecordEvent("Actor quiver");
}
}
}

View File

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace RimWorldAnimationStudio
{
public class SelectActorLayerButton : MonoBehaviour
{
private Text text;
public void Start()
{
text = GetComponentInChildren<Text>();
}
void Update()
{
if (Workspace.animationDef == null) return;
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
if (clip != null)
{ text.text = clip.layer; }
else
{ text.text = "Pawn"; }
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 329a2ecc35813f94fa879c7f434c8fb7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -19,7 +19,7 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.animationStages[Workspace.stageID].stageName = stageName.text;
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Stage renamed");
}
public void OnMoveStage(int delta)
@ -62,9 +62,10 @@ namespace RimWorldAnimationStudio
stageNameField.gameObject.SetActive(true);
}
Workspace.stageID = transform.GetSiblingIndex();
if (Workspace.stageID != transform.GetSiblingIndex())
{ Workspace.Instance.RecordEvent("Stage selected"); }
Workspace.Instance.MakeDirty();
Workspace.stageID = transform.GetSiblingIndex();
}
}
}

View File

@ -27,7 +27,7 @@ namespace RimWorldAnimationStudio
public Transform animationTimelines;
public Transform actorBodies;
public Toggle stretchkeyframesToggle;
public InputField playBackSpeedField;
[Header("Prefabs")]
public ActorBody actorBodyPrefab;
@ -39,7 +39,8 @@ namespace RimWorldAnimationStudio
private int cycleIndex = 0;
private bool isDirty = true;
private bool isTimelineDirty = true;
private float playBackSpeed = 1f;
public void MakeDirty()
{ isDirty = true; }
@ -53,17 +54,17 @@ namespace RimWorldAnimationStudio
// Dirty animation, reset
if (Workspace.animationDef != null && isDirty)
{ Initialize(); return; }
{ Initialize(); }
// Update tick if animating
if (isAnimating)
{
timeSinceLastUpdate += Time.deltaTime;
if (timeSinceLastUpdate < 1f / 60f)
if (timeSinceLastUpdate < 1 / (playBackSpeed * 60f))
{ return; }
timeSinceLastUpdate -= 1f / 60f;
timeSinceLastUpdate -= 1 / (playBackSpeed * 60f);
stageTick += 1;
if (stageTick > Workspace.StageWindowSize)
@ -237,7 +238,7 @@ namespace RimWorldAnimationStudio
Actor actor = new Actor();
actor.MakeNew();
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Actor addition");
}
public void RemoveActor()
@ -254,7 +255,7 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.actors.RemoveAt(Workspace.actorID);
Workspace.actorID = Workspace.actorID >= Workspace.animationDef.actors.Count ? Workspace.actorID = Workspace.animationDef.actors.Count - 1 : Workspace.actorID;
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Actor deletion");
}
public void AddPawnKeyframe()
@ -294,14 +295,12 @@ namespace RimWorldAnimationStudio
animationTimelines.GetComponentsInChildren<AnimationTimeline>()[Workspace.actorID].AddPawnKeyFrame(keyframe.keyframeID);
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Keyframe addition");
}
public void RemovePawnKeyframe()
{
RemovePawnKeyframe(Workspace.actorID, Workspace.keyframeID);
Workspace.Instance.MakeDirty();
}
public void RemovePawnKeyframe(int actorID, int keyframeID)
@ -318,9 +317,9 @@ namespace RimWorldAnimationStudio
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[actorID];
clip.keyframes.Remove(keyframe);
clip.BuildSimpleCurves();
}
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Keyframe deletion");
}
}
public void ToggleAnimation()
@ -351,8 +350,6 @@ namespace RimWorldAnimationStudio
int.TryParse(animationClipTimeField.text, out int newStageTick);
stageTick = Mathf.Clamp(newStageTick, 1, Workspace.StageWindowSize);
stageTimelineSlider.value = stageTick;
Workspace.Instance.MakeDirty();
}
public void OnAnimationClipLengthFieldChange()
@ -390,7 +387,7 @@ namespace RimWorldAnimationStudio
animationClipLengthField.text = newStageWindowSize.ToString();
Workspace.animationDef.animationStages[Workspace.stageID].stageWindowSize = newStageWindowSize;
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Stage length");
}
public void StretchKeyframes(int newStageWindowSize)
@ -418,7 +415,7 @@ namespace RimWorldAnimationStudio
if (int.TryParse(cyclesNormalField.text, out int cycles))
{ Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicks = cycles * Workspace.StageWindowSize; }
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Cycle count (normal)");
}
public void OnCycleFastFieldChange()
@ -428,7 +425,13 @@ namespace RimWorldAnimationStudio
if (int.TryParse(cyclesFastField.text, out int cycles))
{ Workspace.animationDef.animationStages[Workspace.stageID].playTimeTicksQuick = cycles * Workspace.StageWindowSize; }
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Cycle count (fast)");
}
public void OnPlayBackSpeedChange()
{
if (float.TryParse(playBackSpeedField.text, out playBackSpeed))
{ playBackSpeed = Mathf.Clamp(playBackSpeed, 0.01f, 4f); }
}
private int lastactorCount = 0;

View File

@ -54,7 +54,7 @@ namespace RimWorldAnimationStudio
animationDef.Initialize();
Workspace.Instance.ClearHistory();
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("AnimationDef loaded");
AnimationController.Instance.MakeDirty();

View File

@ -42,7 +42,7 @@ namespace RimWorldAnimationStudio
{
AnimationStage stage = new AnimationStage();
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Stage addition");
return stage.MakeNew();
}
@ -64,7 +64,7 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.animationStages.Insert(Workspace.stageID + 1, stage);
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Stage clone");
return true;
}
@ -78,7 +78,9 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.animationStages[startIndex] = Workspace.animationDef.animationStages[startIndex + delta];
Workspace.animationDef.animationStages[startIndex + delta] = stage;
Workspace.Instance.MakeDirty();
Workspace.stageID = startIndex + delta;
Workspace.Instance.RecordEvent("Stage move");
return true;
}
@ -100,7 +102,7 @@ namespace RimWorldAnimationStudio
Workspace.animationDef.animationStages.RemoveAt(Workspace.stageID);
Workspace.stageID = Workspace.stageID >= Workspace.animationDef.animationStages.Count ? Workspace.stageID = Workspace.animationDef.animationStages.Count - 1 : Workspace.stageID;
Workspace.Instance.MakeDirty();
Workspace.Instance.RecordEvent("Stage deletion");
return true;
}

View File

@ -19,5 +19,6 @@ namespace RimWorldAnimationStudio
public static Color ColorCyan = new Color(0.0f, 1.0f, 1.0f);
public static Color ColorPurple = new Color(0.85f, 0.0f, 1.0f);
public static Color ColorGhost = new Color(0.5f, 0.5f, 0.5f, 0.5f);
public static Color ColorRed = new Color(0.9f, 0f, 0f);
}
}

View File

@ -7,8 +7,10 @@ using System.Threading.Tasks;
namespace RimWorldAnimationStudio
{
[Serializable]
public class WorkspaceSnapShot
public class HistoricRecord
{
public int recordID = 0;
public string eventDesc;
public AnimationDef animationDef;
public int stageID = 0;
public int actorID = 0;

View File

@ -11,8 +11,8 @@ namespace RimWorldAnimationStudio
{
public static AnimationDef animationDef;
public static int stageID = 0;
public static int actorID = 0;
public static int keyframeID = 0;
public static int keyframeID = 0;
public static List<string> defNames = new List<string>() { "Human" };
public static List<string> bodyParts = new List<string>() { "Any appendage", "Any orifice", "Penis", "Vagina", "Anus", "Breasts", "Mouth" };
@ -20,8 +20,9 @@ namespace RimWorldAnimationStudio
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>();
public static List<string> soundDefs = new List<string>() { "None", "Sex", "Fuck", "Slimy", "Suck", "Cum" };
public static List<string> actorLayers = new List<string>() { "Building", "BuildingOnTop", "MoteBelowThings", "Item", "ItemImportant", "LayingPawn", "PawnRope", "Projectile", "Pawn", "PawnUnused", "PawnState" };
[SerializeField] private List<WorkspaceSnapShot> workspaceHistory = new List<WorkspaceSnapShot>();
[SerializeField] private List<HistoricRecord> workspaceHistory = new List<HistoricRecord>();
[SerializeField] private int historyIndex = 0;
[SerializeField] private int maxHistoryDepth = 100;
private bool isDirty = false;
@ -29,9 +30,12 @@ namespace RimWorldAnimationStudio
public static ActorManipulationMode actorManipulationMode = ActorManipulationMode.Pan;
public static ActorBodyPart selectedBodyPart;
public static int StageWindowSize
{
get
static int _actorID = 0;
public static int actorID { get { return Mathf.Clamp(_actorID, 0, animationDef.actors.Count - 1); } set { _actorID = value; } }
public static int StageWindowSize
{
get
{
if (animationDef == null)
{ return -1; }
@ -40,13 +44,13 @@ namespace RimWorldAnimationStudio
{ return animationDef.animationStages[stageID].animationClips.Select(x => x.duration).Max(); }
return animationDef.animationStages[stageID].stageWindowSize;
}
}
}
public void Update()
{
if (isDirty)
{ TrackChanges(); }
//if (isDirty)
//{ TrackChanges(); }
}
public PawnKeyframe GetCurrentPawnKeyframe(bool makeKeyframe = false)
@ -76,58 +80,70 @@ namespace RimWorldAnimationStudio
return animationDef.animationStages[stageID].animationClips[actorID].keyframes.FirstOrDefault(x => x.keyframeID == keyframeID);
}
public void TrackChanges()
[SerializeField]
public LinkedList<HistoricRecord> pastSnapshots = new LinkedList<HistoricRecord>();
public LinkedList<HistoricRecord> futureSnapshots = new LinkedList<HistoricRecord>();
public void MakeHistoricRecord(string eventDesc)
{
if (historyIndex < workspaceHistory.Count - 1)
{ workspaceHistory.RemoveRange(historyIndex + 1, workspaceHistory.Count - historyIndex - 1); }
HistoricRecord record = new HistoricRecord();
record.recordID = pastSnapshots.Count;
record.eventDesc = eventDesc;
record.animationDef = animationDef.Copy();
record.stageID = stageID;
if (workspaceHistory.Any() && workspaceHistory.Count >= maxHistoryDepth)
{ workspaceHistory.RemoveAt(0); }
futureSnapshots.Clear();
pastSnapshots.AddLast(record);
WorkspaceSnapShot workspaceSnapShot = new WorkspaceSnapShot();
workspaceSnapShot.animationDef = animationDef.Copy();
workspaceSnapShot.stageID = stageID;
workspaceSnapShot.actorID = actorID;
workspaceSnapShot.keyframeID = keyframeID;
if (pastSnapshots.Count > maxHistoryDepth)
{ pastSnapshots.RemoveFirst(); }
}
workspaceHistory.Add(workspaceSnapShot);
historyIndex = workspaceHistory.Count - 1;
public void RestoreToHistoricRecord(HistoricRecord record)
{
animationDef = record.animationDef.Copy();
stageID = record.stageID;
isDirty = false;
AnimationController.Instance.MakeDirty();
}
public void Undo()
{
historyIndex = Mathf.Clamp(historyIndex - 1, 0, workspaceHistory.Count - 1);
LoadHistoricState();
HistoricRecord recordToRead = pastSnapshots.Last?.Previous?.Value;
HistoricRecord recordToStore = pastSnapshots.Last?.Value;
if (recordToRead == null || recordToStore == null) return;
pastSnapshots.RemoveLast();
futureSnapshots.AddLast(recordToStore);
RestoreToHistoricRecord(recordToRead);
Debug.Log("Undo : " + recordToStore.eventDesc + " (record ID: " + recordToStore.recordID + ")");
}
public void Redo()
{
historyIndex = Mathf.Clamp(historyIndex + 1, 0, workspaceHistory.Count - 1);
LoadHistoricState();
}
HistoricRecord recordToReadAndStore = futureSnapshots.Last?.Value;
public void LoadHistoricState()
{
if (workspaceHistory.NullOrEmpty())
{ Debug.LogWarning("Cannot load historic state - workspace history is empty"); return; }
if (recordToReadAndStore == null) return;
animationDef = workspaceHistory[historyIndex].animationDef.Copy();
stageID = workspaceHistory[historyIndex].stageID;
actorID = workspaceHistory[historyIndex].actorID;
keyframeID = workspaceHistory[historyIndex].keyframeID;
futureSnapshots.RemoveLast();
pastSnapshots.AddLast(recordToReadAndStore);
AnimationController.Instance.MakeTimelineDirty();
RestoreToHistoricRecord(recordToReadAndStore);
Debug.Log("Redo : " + recordToReadAndStore.eventDesc + " (record ID: " + recordToReadAndStore.recordID + ")");
}
public void ClearHistory()
{
workspaceHistory.Clear();
historyIndex = 0;
pastSnapshots.Clear();
futureSnapshots.Clear();
}
public void MakeDirty()
{ isDirty = true; }
public void RecordEvent(string eventDesc)
{
Debug.Log("Recording event: " + eventDesc + " (record ID: " + pastSnapshots.Count + ")");
MakeHistoricRecord(eventDesc);
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More