コード例 #1
0
    private static RecorderController GetRecorder(string levelName)
    {
        // Create the settings and setup the controller with them
        RecorderControllerSettings controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>();
        MovieRecorderSettings      movieSettings      = ScriptableObject.CreateInstance <MovieRecorderSettings>();
        RecorderController         controller         = new RecorderController(controllerSettings);

        // Set the controller settings
        controllerSettings.SetRecordModeToManual();
        controllerSettings.FrameRatePlayback = FrameRatePlayback.Constant;
        controllerSettings.FrameRate         = 30;
        controllerSettings.CapFrameRate      = true;
        controllerSettings.AddRecorderSettings(movieSettings);

        // Set the movie settings
        movieSettings.Enabled = true;
        movieSettings.AudioInputSettings.PreserveAudio = true;
        movieSettings.CaptureAlpha           = false;
        movieSettings.ImageInputSettings     = new GameViewInputSettings();
        movieSettings.OutputFormat           = MovieRecorderSettings.VideoRecorderOutputFormat.MP4;
        movieSettings.OutputFile             = levelName;
        movieSettings.FileNameGenerator.Root = OutputPath.Root.Project;
        movieSettings.FileNameGenerator.Leaf = "Recordings";
        movieSettings.Take = 1;

        return(controller);
    }
コード例 #2
0
    public void StartRecord()
    {
        controllerSettings     = ScriptableObject.CreateInstance <RecorderControllerSettings>();
        TestRecorderController = new RecorderController(controllerSettings);

        videoRecorder                    = ScriptableObject.CreateInstance <MovieRecorderSettings>();
        videoRecorder.name               = "My Video Recorder";
        videoRecorder.Enabled            = true;
        videoRecorder.VideoBitRateMode   = VideoBitrateMode.High;
        videoRecorder.ImageInputSettings = new GameViewInputSettings
        {
            OutputWidth  = 1920,
            OutputHeight = 1080
        };

        videoRecorder.AudioInputSettings.PreserveAudio = false;

        string str = DateTime.Now.Day + "_" + DateTime.Now.Month + "_" + DateTime.Now.Year.ToString() + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second;

        videoRecorder.OutputFile = "Registrazione_" + str;

        controllerSettings.AddRecorderSettings(videoRecorder);
        controllerSettings.SetRecordModeToManual();
        controllerSettings.FrameRate = 30;

        RecorderOptions.VerboseMode = false;
        TestRecorderController.PrepareRecording();
        TestRecorderController.StartRecording();
    }
コード例 #3
0
        public void StartRecording(GameObject target)
        {
            if (target == null)
            {
                return;
            }
            if (!(recordTransform || recordBlendShapeProxy))
            {
                Debug.LogWarning("It can not be recorded because there are no valid elements.");
                return;
            }

            // 未使用のアセットを開放する
            Resources.UnloadUnusedAssets();

            // Animation
            var animationRecorder = ScriptableObject.CreateInstance <AnimationRecorderSettings> ();

            animationRecorder.name    = "My Animation Recorder";
            animationRecorder.enabled = true;

            animationRecorder.animationInputSettings = new AnimationInputSettings {
                gameObject = target,
                recursive  = true,
            };

            if (recordTransform)
            {
                animationRecorder.animationInputSettings.AddComponentToRecord(typeof(Transform));
            }
            if (recordBlendShapeProxy)
            {
                animationRecorder.animationInputSettings.AddComponentToRecord(typeof(VMCBlendShapeProxy));
            }

            SafeCreateDirectory("Assets/Recordings");

            var recordingAnimationClipPath = $"Assets/Recordings/{target.name}_{_startTime:yyMMddHHmmss}_{RecordedObjectEntity.take}";

            recordingAnimationClipPath   = AssetDatabase.GenerateUniqueAssetPath(recordingAnimationClipPath);
            animationRecorder.outputFile = System.IO.Path.GetFullPath(recordingAnimationClipPath);

            // Setup Recording
            controllerSettings.AddRecorderSettings(animationRecorder);
            controllerSettings.SetRecordModeToManual();
            controllerSettings.frameRate         = frameRate;
            controllerSettings.capFrameRate      = capFrameRate;
            controllerSettings.frameRatePlayback = frameRatePlayback;

            Options.verboseMode = false;
            m_RecorderController.StartRecording();

            _onEndRecorded = () => {
                var latestRecordedClip = AssetDatabase.LoadAssetAtPath <AnimationClip> (recordingAnimationClipPath + ".anim");

                //RecordedObjectEntity.latestEntities = new RecordedObjectEntity[0];
                RecordedObjectEntity.latestEntities.Add(new RecordedObjectEntity(target.GetComponent <Animator> (), latestRecordedClip));
            };
        }
コード例 #4
0
    void SetupNewRecorder()
    {
        // creating animation recorder and assigning the camera to it
        animationRecorderSettings = ScriptableObject.CreateInstance("AnimationRecorderSettings") as AnimationRecorderSettings;
        animationRecorderSettings.animationInputSettings.recursive  = true;
        animationRecorderSettings.animationInputSettings.gameObject = this.gameObject;
        animationRecorderSettings.animationInputSettings.AddComponentToRecord(typeof(Transform));

        // creating recorder settings and assigning our animation recorder settings to it
        actorRecorderSettings = ScriptableObject.CreateInstance("RecorderControllerSettings") as RecorderControllerSettings;
        actorRecorderSettings.AddRecorderSettings(animationRecorderSettings);
        actorRecorderSettings.SetRecordModeToManual();

        // creating a new recorder instance with the correct settings
        actorRecorder = new RecorderController(actorRecorderSettings);
    }
コード例 #5
0
    void SetupNewRecorder()
    {
        // creating animation recorder and assigning the camera to it
        cameraMovementRecorderSettings = ScriptableObject.CreateInstance("AnimationRecorderSettings") as AnimationRecorderSettings;
        cameraMovementRecorderSettings.animationInputSettings.recursive  = false;
        cameraMovementRecorderSettings.animationInputSettings.gameObject = this.gameObject;
        cameraMovementRecorderSettings.animationInputSettings.AddComponentToRecord(typeof(Transform));
        cameraMovementRecorderSettings.animationInputSettings.AddComponentToRecord(typeof(Camera));


        // creating recorder settings and assigning our animation recorder settings to it
        filmbackRecorderSettings = ScriptableObject.CreateInstance("RecorderControllerSettings") as RecorderControllerSettings;
        filmbackRecorderSettings.AddRecorderSettings(cameraMovementRecorderSettings);
        filmbackRecorderSettings.SetRecordModeToManual();

        // creating a new recorder instance with the correct settings
        filmbackRecorder = new RecorderController(filmbackRecorderSettings);
    }