Skip to content

Commit 04fe4e3

Browse files
committed
create basic recorder shell
1 parent 9383351 commit 04fe4e3

14 files changed

+321
-3
lines changed

com.unity.formats.fbx/Editor/Sources.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.unity.formats.fbx/Editor/Sources/Recorders.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.unity.formats.fbx/Editor/Sources/Recorders/FbxRecorder.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor.Recorder.Input;
5+
6+
7+
namespace UnityEditor.Recorder
8+
{
9+
class FbxInput : RecorderInput
10+
{
11+
public FbxInput()
12+
{
13+
}
14+
15+
public override void BeginRecording(RecordingSession session)
16+
{
17+
base.BeginRecording(session);
18+
}
19+
20+
public override void EndRecording(RecordingSession session)
21+
{
22+
base.EndRecording(session);
23+
}
24+
25+
public override bool Equals(object obj)
26+
{
27+
return base.Equals(obj);
28+
}
29+
30+
public override void FrameDone(RecordingSession session)
31+
{
32+
base.FrameDone(session);
33+
Debug.LogWarning("frame " + session.frameIndex + ": " + ((FbxInputSettings)settings).gameObject.transform.localEulerAngles);
34+
}
35+
36+
public override int GetHashCode()
37+
{
38+
return base.GetHashCode();
39+
}
40+
41+
public override void NewFrameReady(RecordingSession session)
42+
{
43+
base.NewFrameReady(session);
44+
}
45+
46+
public override void NewFrameStarting(RecordingSession session)
47+
{
48+
base.NewFrameStarting(session);
49+
}
50+
51+
public override void SessionCreated(RecordingSession session)
52+
{
53+
base.SessionCreated(session);
54+
}
55+
56+
public override string ToString()
57+
{
58+
return base.ToString();
59+
}
60+
61+
protected override void Dispose(bool disposing)
62+
{
63+
base.Dispose(disposing);
64+
}
65+
}
66+
}

com.unity.formats.fbx/Editor/Sources/Recorders/FbxRecorder/FbxInput.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using UnityEngine;
6+
using UnityEditor;
7+
8+
namespace UnityEditor.Recorder
9+
{
10+
[Serializable]
11+
[DisplayName("Fbx")]
12+
public class FbxInputSettings : RecorderInputSettings
13+
{
14+
15+
[SerializeField] string m_BindingId = null;
16+
17+
static string GenerateBindingId()
18+
{
19+
return GUID.Generate().ToString();
20+
}
21+
22+
/// <summary>
23+
/// The gameObject to record from.
24+
/// </summary>
25+
public GameObject gameObject
26+
{
27+
get
28+
{
29+
if (string.IsNullOrEmpty(m_BindingId))
30+
return null;
31+
32+
return BindingManager.Get(m_BindingId) as GameObject;
33+
}
34+
35+
set
36+
{
37+
if (string.IsNullOrEmpty(m_BindingId))
38+
m_BindingId = GenerateBindingId();
39+
40+
BindingManager.Set(m_BindingId, value);
41+
}
42+
}
43+
44+
internal override bool ValidityCheck(List<string> errors)
45+
{
46+
return true;
47+
}
48+
49+
internal override Type inputType
50+
{
51+
get { return typeof(FbxInput); }
52+
}
53+
}
54+
55+
[CustomPropertyDrawer(typeof(FbxInputSettings))]
56+
class AnimationInputSettingsPropertyDrawer : InputPropertyDrawer<FbxInputSettings>
57+
{
58+
59+
protected override void Initialize(SerializedProperty prop)
60+
{
61+
base.Initialize(prop);
62+
}
63+
64+
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
65+
{
66+
Initialize(property);
67+
68+
EditorGUI.BeginChangeCheck();
69+
70+
var gameObject = EditorGUILayout.ObjectField("Game Object", target.gameObject, typeof(GameObject), true) as GameObject;
71+
72+
if (EditorGUI.EndChangeCheck())
73+
{
74+
target.gameObject = gameObject;
75+
76+
//if (gameObject != null)
77+
// target.AddComponentToRecord(gameObject.GetComponent<Component>().GetType());
78+
}
79+
}
80+
}
81+
}

com.unity.formats.fbx/Editor/Sources/Recorders/FbxRecorder/FbxInputSettings.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor.Recorder;
5+
using UnityEditor.Recorder.Input;
6+
using UnityEditor;
7+
8+
namespace UnityEditor.Recorder
9+
{
10+
class FbxRecorder : GenericRecorder<FbxRecorderSettings>
11+
{
12+
public override void RecordFrame(RecordingSession ctx)
13+
{
14+
//Debug.LogWarning("Frame " + ctx.frameIndex + ": " + ctx.);
15+
}
16+
17+
public override void EndRecording(RecordingSession session)
18+
{
19+
/*var ars = (AnimationRecorderSettings)session.settings;
20+
21+
foreach (var input in m_Inputs)
22+
{
23+
24+
var aInput = (AnimationInput)input;
25+
26+
if (aInput.gameObjectRecorder == null)
27+
continue;
28+
29+
var clip = new AnimationClip();
30+
31+
ars.fileNameGenerator.CreateDirectory(session);
32+
33+
var absolutePath = FileNameGenerator.SanitizePath(ars.fileNameGenerator.BuildAbsolutePath(session));
34+
var clipName = absolutePath.Replace(FileNameGenerator.SanitizePath(Application.dataPath), "Assets");
35+
36+
//AssetDatabase.CreateAsset(clip, clipName);
37+
#if UNITY_2018_3_OR_NEWER
38+
aInput.gameObjectRecorder.SaveToClip(clip, ars.frameRate);
39+
#else
40+
aInput.gameObjectRecorder.SaveToClip(clip);
41+
#endif
42+
43+
aInput.gameObjectRecorder.ResetRecording();
44+
}
45+
46+
base.EndRecording(session);*/
47+
}
48+
}
49+
}

com.unity.formats.fbx/Editor/Sources/Recorders/FbxRecorder/FbxRecorder.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor.Recorder;
5+
using UnityEditor.Recorder.Input;
6+
7+
namespace UnityEditor.Recorder
8+
{
9+
[RecorderSettings(typeof(FbxRecorder), "FBX", "fbx_recorder")]
10+
public class FbxRecorderSettings : RecorderSettings
11+
{
12+
[SerializeField] FbxInputSettings m_AnimationInputSettings = new FbxInputSettings();
13+
14+
public override IEnumerable<RecorderInputSettings> inputsSettings
15+
{
16+
get { yield return m_AnimationInputSettings; }
17+
}
18+
19+
public override string extension
20+
{
21+
get { return "fbx"; }
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)