Exemple #1
0
        protected internal override void EndRecording(RecordingSession session)
        {
            var ars = (AnimationRecorderSettings)session.settings;

            foreach (var input in m_Inputs)
            {
                var aInput = (AnimationInput)input;

                if (aInput.GameObjectRecorder == null)
                {
                    continue;
                }

                var clip = new AnimationClip();

                ars.fileNameGenerator.CreateDirectory(session);

                var absolutePath = FileNameGenerator.SanitizePath(ars.fileNameGenerator.BuildAbsolutePath(session));
                var clipName     = absolutePath.Replace(FileNameGenerator.SanitizePath(Application.dataPath), "Assets");

                AssetDatabase.CreateAsset(clip, clipName);
    #if UNITY_2018_3_OR_NEWER
                aInput.GameObjectRecorder.SaveToClip(clip, ars.FrameRate);
    #else
                aInput.gameObjectRecorder.SaveToClip(clip);
    #endif
                aInput.GameObjectRecorder.ResetRecording();
            }

            base.EndRecording(session);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            var indent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;

            float tagWidth = 50;
            float txtWidth = position.width - tagWidth - 5;
            Rect  txtRect  = new Rect(position.x, position.y, txtWidth, position.height);
            Rect  tagRect  = new Rect(position.x + txtWidth + 5, position.y, tagWidth, position.height);

            EditorGUI.PropertyField(txtRect, property.FindPropertyRelative("m_Pattern"), GUIContent.none);

            int value = EditorGUI.Popup(tagRect, 0, m_FileNameTags);

            if (value != 0)
            {
                var pattern = property.FindPropertyRelative("m_Pattern");
                pattern.stringValue = FileNameGenerator.AddTag(pattern.stringValue, (FileNameGenerator.ETags)(value - 1));
            }

            EditorGUI.indentLevel = indent;
            EditorGUI.EndProperty();
        }
Exemple #3
0
        protected internal override void EndRecording(RecordingSession session)
        {
            var ars = (AnimationRecorderSettings)session.settings;

            foreach (var input in m_Inputs)
            {
                var aInput = (AnimationInput)input;

                if (aInput.GameObjectRecorder == null)
                {
                    continue;
                }

                var clip = new AnimationClip();

                ars.fileNameGenerator.CreateDirectory(session);

                var absolutePath = FileNameGenerator.SanitizePath(ars.fileNameGenerator.BuildAbsolutePath(session));
                var clipName     = absolutePath.Replace(FileNameGenerator.SanitizePath(Application.dataPath), "Assets");

                AssetDatabase.CreateAsset(clip, clipName);
                var aniSettings = (aInput.settings as AnimationInputSettings);
                aInput.GameObjectRecorder.SaveToClip(clip, ars.FrameRate, aniSettings.CurveFilterOptions);
                if (aniSettings.ClampedTangents)
                {
                    FilterClip(clip);
                }

                aInput.GameObjectRecorder.ResetRecording();
            }

            base.EndRecording(session);
            UnityEditor.AssetDatabase.SaveAssets();
        }
Exemple #4
0
 protected RecorderSettings()
 {
     fileNameGenerator = new FileNameGenerator(this)
     {
         Root = OutputPath.Root.Project,
         Leaf = "Recordings"
     };
 }