Skip to content

Commit

Permalink
Merge pull request #800 from Autodesk/analytics-fix
Browse files Browse the repository at this point in the history
Fix Modal Exit Exception, Restore Velocity Data on Modal Close, UI Fixes, Update to 5.0.0
  • Loading branch information
NickBurrell authored Aug 27, 2022
2 parents cb514a6 + 388bad0 commit 4fa8585
Show file tree
Hide file tree
Showing 29 changed files with 2,756 additions and 2,730 deletions.
2 changes: 1 addition & 1 deletion VersionManager.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"Version": "4.3.3",
"Version": "5.0.0",
"URL": "https://synthesis.autodesk.com/download.html"
}
1,437 changes: 726 additions & 711 deletions engine/Assembly-CSharp.csproj

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions engine/Assets/Prefabs/MainMenu/MenuPanel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000061035156, y: -17.5}
m_AnchoredPosition: {x: 0.00012207031, y: -17.5}
m_SizeDelta: {x: 0, y: -35}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7476564013342952241
Expand Down Expand Up @@ -1835,8 +1835,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 10}
m_SizeDelta: {x: -20, y: 60}
m_AnchoredPosition: {x: -3.7450027, y: 10}
m_SizeDelta: {x: -27.49, y: 60}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &8178300921656266155
CanvasRenderer:
Expand Down Expand Up @@ -1868,8 +1868,8 @@ MonoBehaviour:
m_Calls: []
m_text: Settings
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: d773a0b9b3212ab4fb694b91237f4660, type: 2}
m_sharedMaterial: {fileID: 7508162858481735423, guid: d773a0b9b3212ab4fb694b91237f4660, type: 2}
m_fontAsset: {fileID: 11400000, guid: 98cce4828f4b4e04997da22ea07c56cf, type: 2}
m_sharedMaterial: {fileID: -4735131342780090120, guid: 98cce4828f4b4e04997da22ea07c56cf, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
Expand Down Expand Up @@ -2059,9 +2059,9 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 8178300922566973820}
m_TargetAssemblyTypeName: MenuManager, Assembly-CSharp
m_MethodName: ButtonPrint
m_Mode: 5
m_TargetAssemblyTypeName: Synthesis.UI.MenuManager, CoreEngine
m_MethodName: Singleplayer
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
Expand Down Expand Up @@ -2412,7 +2412,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &8178300922175038050
RectTransform:
m_ObjectHideFlags: 0
Expand All @@ -2431,7 +2431,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 985.0001, y: -84.99998}
m_AnchoredPosition: {x: 445, y: -265}
m_SizeDelta: {x: 170, y: 170}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8178300922175038077
Expand All @@ -2455,7 +2455,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.36078432, g: 0.48627454, b: 0.9803922, a: 1}
m_Color: {r: 0.80784315, g: 0.37254903, b: 0.44313726, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
Expand Down Expand Up @@ -2517,9 +2517,9 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 8178300922566973820}
m_TargetAssemblyTypeName: MenuManager, Assembly-CSharp
m_MethodName: ButtonPrint
m_Mode: 5
m_TargetAssemblyTypeName: Synthesis.UI.MenuManager, CoreEngine
m_MethodName: OpenSettingsPanel
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
Expand All @@ -2540,7 +2540,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 08fc19faaeba3544b82c75c038a060c5, type: 3}
m_Name:
m_EditorClassIdentifier:
IndicateScaleFactor: 1.117647
IndicateScaleFactor: 1.05
ClickedScaleFactor: 0.98
--- !u!1 &8178300922366409720
GameObject:
Expand Down Expand Up @@ -3494,7 +3494,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &8178300923016162136
RectTransform:
m_ObjectHideFlags: 0
Expand Down
136 changes: 0 additions & 136 deletions engine/Assets/Scenes/GridMenuScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -6055,94 +6055,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 817081843}
m_Modifications:
- target: {fileID: 2265115877353416166, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2265115877353416166, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2265115877353416166, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2265115877353416166, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2690117318601439900, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2690117318601439900, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2690117318601439900, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2690117318601439900, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3276807242788799584, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3276807242788799584, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3276807242788799584, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3276807242788799584, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6193327979032553445, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6193327979032553445, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6193327979032553445, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6193327979032553445, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8178300921564503001, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8178300921643922103, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8178300921710398091, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8178300921710398091, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: Singleplayer
objectReference: {fileID: 0}
- target: {fileID: 8178300921710398091, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: Synthesis.UI.MenuManager, CoreEngine
objectReference: {fileID: 0}
- target: {fileID: 8178300921806933664, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 21300000, guid: d939e97073dcb0440b758a3d8648149a, type: 3}
- target: {fileID: 8178300921806933670, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_Name
value: MenuPanel
Expand Down Expand Up @@ -6231,53 +6143,5 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8178300922175038049, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8178300922175038050, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.x
value: 445
objectReference: {fileID: 0}
- target: {fileID: 8178300922175038050, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.y
value: -265
objectReference: {fileID: 0}
- target: {fileID: 8178300922175038051, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8178300922175038051, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OpenSettingsPanel
objectReference: {fileID: 0}
- target: {fileID: 8178300922175038051, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: Synthesis.UI.MenuManager, CoreEngine
objectReference: {fileID: 0}
- target: {fileID: 8178300922822037920, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8178300923016162143, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8525743289434460525, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8525743289434460525, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8525743289434460525, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8525743289434460525, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a164eb99c8d3069438923ac0c0b61657, type: 3}
53 changes: 51 additions & 2 deletions engine/Assets/Scripts/Physics/PhysicsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using SynthesisAPI.EventBus;
using Synthesis.Replay;
using Synthesis.Runtime;
using UnityEngine.UIElements;

#nullable enable

Expand All @@ -16,6 +17,10 @@ public static class PhysicsManager {
private static Dictionary<int, IPhysicsOverridable> _physObjects = new Dictionary<int, IPhysicsOverridable>();
private static Dictionary<int, List<ContactRecorder>> _contactRecorders = new Dictionary<int, List<ContactRecorder>>();

private static Dictionary<Rigidbody, RigidbodyFrameData> _storedValues = new Dictionary<Rigidbody, RigidbodyFrameData>();

private static bool _storeOnFreeze = true;

private static bool _isFrozen;
private static int _frozenCounter;
public static bool IsFrozen {
Expand All @@ -42,14 +47,52 @@ public static bool IsFrozen {
SimulationRunner.RemoveContext(SimulationRunner.RUNNING_SIM_CONTEXT);
SimulationRunner.AddContext(SimulationRunner.PAUSED_SIM_CONTEXT);
//UnityEngine.Physics.autoSimulation = false;
_physObjects.ForEach(x => { x.Value.Freeze(); });
_physObjects.ForEach(x =>
{
if (_storeOnFreeze)
{
x.Value.GetAllRigidbodies().ForEach(rb =>
{
var data = new RigidbodyFrameData
{
Velocity = rb.velocity,
AngularVelocity = rb.angularVelocity
};
_storedValues[rb] = data;
});
}
x.Value.Freeze();
});
}
else
{
SimulationRunner.RemoveContext(SimulationRunner.PAUSED_SIM_CONTEXT);
SimulationRunner.AddContext(SimulationRunner.RUNNING_SIM_CONTEXT);
//UnityEngine.Physics.autoSimulation = true;
_physObjects.ForEach(x => { x.Value.Unfreeze(); });

_physObjects.ForEach(x =>
{

x.Value.Unfreeze();
if (_storeOnFreeze)
{
_storedValues.ForEach((rb, f) =>
{
try
{
rb.velocity = f.Velocity;
rb.angularVelocity = f.AngularVelocity;
}
catch (Exception e)
{
// ignored
}
});
}

_storedValues.Clear();
_storeOnFreeze = true;
});
}
EventBus.Push(new PhysicsFreezeChangeEvent { IsFrozen = _isFrozen });
}
Expand Down Expand Up @@ -86,6 +129,12 @@ public static bool Unregister<T>(T overridable) where T: class, IPhysicsOverrida
return true;
}

public static void DisableLoadFromStoredDataOnce()
{
_storeOnFreeze = false;
_storedValues.Clear();
}

public static List<IPhysicsOverridable> GetAllOverridable()
=> new List<IPhysicsOverridable>(_physObjects.Values);

Expand Down
1 change: 1 addition & 0 deletions engine/Assets/Scripts/Physics/ReplayRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private void TogglePlay(IEvent e) {
if (de.State == DigitalState.Down) {
// if (PhysicsManager.IsFrozen)
// ReplayManager.MakeCurrentNewestFrame();
PhysicsManager.DisableLoadFromStoredDataOnce();
PhysicsManager.IsFrozen = !PhysicsManager.IsFrozen;
if (PhysicsManager.IsFrozen) {
ReplayManager.NewestFrame.ApplyFrame();
Expand Down
2 changes: 2 additions & 0 deletions engine/Assets/Scripts/SimObjects/RobotSimObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public IntakeTriggerData? IntakeData {
}

SimulationPreferences.SetRobotIntakeTriggerData(MiraLive.MiraAssembly.Info.GUID, _intakeData);
PreferenceManager.Save();
}
}

Expand All @@ -95,6 +96,7 @@ public ShotTrajectoryData? TrajectoryData {
}

SimulationPreferences.SetRobotTrajectoryData(MiraLive.MiraAssembly.Info.GUID, _trajectoryData);
PreferenceManager.Save();
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/Assets/Scripts/UI/Dynamic/DynamicUIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static bool CloseActivePanel() {

EventBus.Push(new PanelClosedEvent(ActivePanel));

AnalyticsManager.LogEvent(new AnalyticsEvent(category: "ui", action: $"{ActiveModal.GetType().Name}", label:"create"));
AnalyticsManager.LogEvent(new AnalyticsEvent(category: "ui", action: $"{ActivePanel.GetType().Name}", label:"create"));
AnalyticsManager.PostData();

ActivePanel.Delete();
Expand Down
Loading

0 comments on commit 4fa8585

Please sign in to comment.