1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 17:26:03 +08:00

Added DOTween.useSmoothDeltaTime option, and relative setting in the Utility Panel Preferences

This commit is contained in:
Daniele Giardini 2015-05-30 19:38:21 +02:00
parent f8a483d91d
commit f73c8454a0
24 changed files with 43 additions and 5 deletions

View File

@ -1500,6 +1500,12 @@
<summary>Global DOTween timeScale. <summary>Global DOTween timeScale.
<para>Default: 1</para></summary> <para>Default: 1</para></summary>
</member> </member>
<member name="F:DG.Tweening.DOTween.useSmoothDeltaTime">
<summary>If TRUE, DOTween will use Time.smoothDeltaTime instead of Time.deltaTime for UpdateType.Normal and UpdateType.Late tweens
(unless they're set as timeScaleIndependent, in which case this setting will be ignored).
Setting this to TRUE will lead to smoother animations.
<para>Default: FALSE</para></summary>
</member>
<member name="F:DG.Tweening.DOTween.drawGizmos"> <member name="F:DG.Tweening.DOTween.drawGizmos">
<summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). <summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary> Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>

View File

@ -1500,6 +1500,12 @@
<summary>Global DOTween timeScale. <summary>Global DOTween timeScale.
<para>Default: 1</para></summary> <para>Default: 1</para></summary>
</member> </member>
<member name="F:DG.Tweening.DOTween.useSmoothDeltaTime">
<summary>If TRUE, DOTween will use Time.smoothDeltaTime instead of Time.deltaTime for UpdateType.Normal and UpdateType.Late tweens
(unless they're set as timeScaleIndependent, in which case this setting will be ignored).
Setting this to TRUE will lead to smoother animations.
<para>Default: FALSE</para></summary>
</member>
<member name="F:DG.Tweening.DOTween.drawGizmos"> <member name="F:DG.Tweening.DOTween.drawGizmos">
<summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). <summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary> Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>

View File

@ -1500,6 +1500,12 @@
<summary>Global DOTween timeScale. <summary>Global DOTween timeScale.
<para>Default: 1</para></summary> <para>Default: 1</para></summary>
</member> </member>
<member name="F:DG.Tweening.DOTween.useSmoothDeltaTime">
<summary>If TRUE, DOTween will use Time.smoothDeltaTime instead of Time.deltaTime for UpdateType.Normal and UpdateType.Late tweens
(unless they're set as timeScaleIndependent, in which case this setting will be ignored).
Setting this to TRUE will lead to smoother animations.
<para>Default: FALSE</para></summary>
</member>
<member name="F:DG.Tweening.DOTween.drawGizmos"> <member name="F:DG.Tweening.DOTween.drawGizmos">
<summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). <summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary> Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>

View File

@ -47,7 +47,7 @@ namespace DG.Tweening.Core
{ {
_unscaledDeltaTime = Time.realtimeSinceStartup - _unscaledTime; _unscaledDeltaTime = Time.realtimeSinceStartup - _unscaledTime;
if (TweenManager.hasActiveDefaultTweens) { if (TweenManager.hasActiveDefaultTweens) {
TweenManager.Update(UpdateType.Normal, Time.deltaTime * DOTween.timeScale, _unscaledDeltaTime * DOTween.timeScale); TweenManager.Update(UpdateType.Normal, (DOTween.useSmoothDeltaTime ? Time.smoothDeltaTime : Time.deltaTime) * DOTween.timeScale, _unscaledDeltaTime * DOTween.timeScale);
} }
_unscaledTime = Time.realtimeSinceStartup; _unscaledTime = Time.realtimeSinceStartup;
@ -63,14 +63,14 @@ namespace DG.Tweening.Core
void LateUpdate() void LateUpdate()
{ {
if (TweenManager.hasActiveLateTweens) { if (TweenManager.hasActiveLateTweens) {
TweenManager.Update(UpdateType.Late, Time.deltaTime * DOTween.timeScale, _unscaledDeltaTime * DOTween.timeScale); TweenManager.Update(UpdateType.Late, (DOTween.useSmoothDeltaTime ? Time.smoothDeltaTime : Time.deltaTime) * DOTween.timeScale, _unscaledDeltaTime * DOTween.timeScale);
} }
} }
void FixedUpdate() void FixedUpdate()
{ {
if (TweenManager.hasActiveFixedTweens && Time.timeScale > 0) { if (TweenManager.hasActiveFixedTweens && Time.timeScale > 0) {
TweenManager.Update(UpdateType.Fixed, Time.deltaTime * DOTween.timeScale, (Time.deltaTime / Time.timeScale) * DOTween.timeScale); TweenManager.Update(UpdateType.Fixed, (DOTween.useSmoothDeltaTime ? Time.smoothDeltaTime : Time.deltaTime) * DOTween.timeScale, ((DOTween.useSmoothDeltaTime ? Time.smoothDeltaTime : Time.deltaTime) / Time.timeScale) * DOTween.timeScale);
} }
} }

View File

@ -11,6 +11,8 @@ namespace DG.Tweening.Core
public const string AssetName = "DOTweenSettings"; public const string AssetName = "DOTweenSettings";
public bool useSafeMode = true; public bool useSafeMode = true;
public float timeScale = 1;
public bool useSmoothDeltaTime;
public bool showUnityEditorReport; public bool showUnityEditorReport;
public LogBehaviour logBehaviour = LogBehaviour.ErrorsOnly; public LogBehaviour logBehaviour = LogBehaviour.ErrorsOnly;
public bool drawGizmos = true; public bool drawGizmos = true;

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.755"; public static readonly string Version = "1.0.765";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////
@ -49,6 +49,11 @@ namespace DG.Tweening
/// <summary>Global DOTween timeScale. /// <summary>Global DOTween timeScale.
/// <para>Default: 1</para></summary> /// <para>Default: 1</para></summary>
public static float timeScale = 1; public static float timeScale = 1;
/// <summary>If TRUE, DOTween will use Time.smoothDeltaTime instead of Time.deltaTime for UpdateType.Normal and UpdateType.Late tweens
/// (unless they're set as timeScaleIndependent, in which case this setting will be ignored).
/// Setting this to TRUE will lead to smoother animations.
/// <para>Default: FALSE</para></summary>
public static bool useSmoothDeltaTime;
/// <summary>DOTween's log behaviour. /// <summary>DOTween's log behaviour.
/// <para>Default: LogBehaviour.ErrorsOnly</para></summary> /// <para>Default: LogBehaviour.ErrorsOnly</para></summary>
public static LogBehaviour logBehaviour { public static LogBehaviour logBehaviour {
@ -167,6 +172,8 @@ namespace DG.Tweening
if (useSafeMode == null) DOTween.useSafeMode = settings.useSafeMode; if (useSafeMode == null) DOTween.useSafeMode = settings.useSafeMode;
if (logBehaviour == null) DOTween.logBehaviour = settings.logBehaviour; if (logBehaviour == null) DOTween.logBehaviour = settings.logBehaviour;
if (recycleAllByDefault == null) DOTween.defaultRecyclable = settings.defaultRecyclable; if (recycleAllByDefault == null) DOTween.defaultRecyclable = settings.defaultRecyclable;
DOTween.timeScale = settings.timeScale;
DOTween.useSmoothDeltaTime = settings.useSmoothDeltaTime;
DOTween.defaultRecyclable = recycleAllByDefault == null ? settings.defaultRecyclable : (bool)recycleAllByDefault; DOTween.defaultRecyclable = recycleAllByDefault == null ? settings.defaultRecyclable : (bool)recycleAllByDefault;
DOTween.showUnityEditorReport = settings.showUnityEditorReport; DOTween.showUnityEditorReport = settings.showUnityEditorReport;
DOTween.drawGizmos = settings.drawGizmos; DOTween.drawGizmos = settings.drawGizmos;
@ -219,6 +226,7 @@ namespace DG.Tweening
showUnityEditorReport = false; showUnityEditorReport = false;
drawGizmos = true; drawGizmos = true;
timeScale = 1; timeScale = 1;
useSmoothDeltaTime = false;
logBehaviour = LogBehaviour.ErrorsOnly; logBehaviour = LogBehaviour.ErrorsOnly;
defaultEaseType = Ease.OutQuad; defaultEaseType = Ease.OutQuad;
defaultEaseOvershootOrAmplitude = 1.70158f; defaultEaseOvershootOrAmplitude = 1.70158f;

View File

@ -45,7 +45,7 @@ namespace DG.DOTweenEditor
static void ShowWindow() { Open(); } static void ShowWindow() { Open(); }
const string _Title = "DOTween Utility Panel"; const string _Title = "DOTween Utility Panel";
static readonly Vector2 _WinSize = new Vector2(300,365); static readonly Vector2 _WinSize = new Vector2(300,405);
public const string Id = "DOTweenVersion"; public const string Id = "DOTweenVersion";
public const string IdPro = "DOTweenProVersion"; public const string IdPro = "DOTweenProVersion";
static readonly float _HalfBtSize = _WinSize.x * 0.5f - 6; static readonly float _HalfBtSize = _WinSize.x * 0.5f - 6;
@ -170,6 +170,8 @@ namespace DG.DOTweenEditor
// Reset to original defaults // Reset to original defaults
_src.useSafeMode = true; _src.useSafeMode = true;
_src.showUnityEditorReport = false; _src.showUnityEditorReport = false;
_src.timeScale = 1;
_src.useSmoothDeltaTime = false;
_src.logBehaviour = LogBehaviour.ErrorsOnly; _src.logBehaviour = LogBehaviour.ErrorsOnly;
_src.drawGizmos = true; _src.drawGizmos = true;
_src.defaultRecyclable = false; _src.defaultRecyclable = false;
@ -185,6 +187,8 @@ namespace DG.DOTweenEditor
} }
GUILayout.Space(8); GUILayout.Space(8);
_src.useSafeMode = EditorGUILayout.Toggle("Safe Mode", _src.useSafeMode); _src.useSafeMode = EditorGUILayout.Toggle("Safe Mode", _src.useSafeMode);
_src.timeScale = EditorGUILayout.FloatField("DOTween's TimeScale", _src.timeScale);
_src.useSmoothDeltaTime = EditorGUILayout.Toggle("Smooth DeltaTime", _src.useSmoothDeltaTime);
_src.showUnityEditorReport = EditorGUILayout.Toggle("Editor Report", _src.showUnityEditorReport); _src.showUnityEditorReport = EditorGUILayout.Toggle("Editor Report", _src.showUnityEditorReport);
_src.logBehaviour = (LogBehaviour)EditorGUILayout.EnumPopup("Log Behaviour", _src.logBehaviour); _src.logBehaviour = (LogBehaviour)EditorGUILayout.EnumPopup("Log Behaviour", _src.logBehaviour);
_src.drawGizmos = EditorGUILayout.Toggle("Draw Path Gizmos", _src.drawGizmos); _src.drawGizmos = EditorGUILayout.Toggle("Draw Path Gizmos", _src.drawGizmos);

View File

@ -1500,6 +1500,12 @@
<summary>Global DOTween timeScale. <summary>Global DOTween timeScale.
<para>Default: 1</para></summary> <para>Default: 1</para></summary>
</member> </member>
<member name="F:DG.Tweening.DOTween.useSmoothDeltaTime">
<summary>If TRUE, DOTween will use Time.smoothDeltaTime instead of Time.deltaTime for UpdateType.Normal and UpdateType.Late tweens
(unless they're set as timeScaleIndependent, in which case this setting will be ignored).
Setting this to TRUE will lead to smoother animations.
<para>Default: FALSE</para></summary>
</member>
<member name="F:DG.Tweening.DOTween.drawGizmos"> <member name="F:DG.Tweening.DOTween.drawGizmos">
<summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). <summary>If TRUE draws path gizmos in Unity Editor (if the gizmos button is active).
Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary> Deactivate this if you want to avoid gizmos overhead while in Unity Editor</summary>

Binary file not shown.