Skip to content

Commit

Permalink
fix: GLTFRecorder should respect existing settings for animation poin…
Browse files Browse the repository at this point in the history
…ter usage
  • Loading branch information
hybridherbst committed Jan 16, 2024
1 parent d2031e6 commit d465057
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Runtime/Scripts/Timeline/GLTFRecorder.cs
Expand Up @@ -8,6 +8,7 @@
using GLTF.Schema;
using Unity.Profiling;
using UnityEngine;
using UnityGLTF.Plugins;
using Object = UnityEngine.Object;

namespace UnityGLTF.Timeline
Expand Down Expand Up @@ -321,6 +322,7 @@ internal void EndRecording(out Dictionary<Transform, AnimationData> param)

public void EndRecording(string filename, string sceneName = "scene", GLTFSettings settings = null)
{
if (!isRecording) return;
if (!hasRecording) return;

var dir = Path.GetDirectoryName(filename);
Expand All @@ -345,8 +347,15 @@ public void EndRecording(Stream stream, string sceneName = "scene", GLTFSettings
settings = adjustedSettings;
}

// ensure correct animation pointer plugin settings are used
if (!recordAnimationPointer)
settings.ExportPlugins.RemoveAll(x => x is AnimationPointerExport);
else
if (!settings.ExportPlugins.Any(x => x is AnimationPointerExport))
settings.ExportPlugins.Add(ScriptableObject.CreateInstance<AnimationPointerExport>());

if (!recordBlendShapes)
settings.BlendShapeExportProperties = GLTFSettings.BlendShapeExportPropertyFlags.None;
settings.BlendShapeExportProperties = GLTFSettings.BlendShapeExportPropertyFlags.None;

var logHandler = new StringBuilderLogHandler();

Expand Down
1 change: 1 addition & 0 deletions Runtime/Scripts/Timeline/GLTFRecorderClip.cs
Expand Up @@ -14,6 +14,7 @@ public class GLTFRecorderClip : PlayableAsset, ITimelineClipAsset
public string m_AnimationName = "Recording";
public int m_CaptureFrameRate = 60;
public bool m_RecordBlendShapes = true;
[Tooltip("Enable the KHR_animation_pointer extension. This allows recording material and script properties, but is not supported in all viewers.")]
public bool m_RecordAnimationPointer = false;

public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
Expand Down

0 comments on commit d465057

Please sign in to comment.