//private void Start()
    //{
    //    renderTexture = new RenderTexture(1920, 1080, 24);
    //}

    private void OnPreRender()
    {
        if (RecordingLord.IsRecording())
        {
            cam.targetTexture = renderTexture;
        }
    }
Exemple #2
0
 protected override IEnumerator ExecuteStep()
 {
     Debug.Log("Stopping recording!");
     RecordingLord.StopRecording();
     Router.FireEvent(EndEventName);
     yield return(null);
 }
Exemple #3
0
 private void LocateCamera()
 {
     if (RecordingLord.IsRecording())
     {
         return;
     }
     //FoundCamera = Camera.allCameras.Where(c => c.enabled).OrderByDescending(c => c.depth).First();
     FoundCamera = Camera.allCameras.Where(c => c.enabled && ((c.cullingMask & LayerMask.NameToLayer("UI")) != 0)).OrderByDescending(c => c.depth).First();
 }
Exemple #4
0
        private void HandleStepStateChanged(Step step, TimelineState state)
        {
            // If playing, check if we're done.

            if (!RegisteredSteps.Any(s => s.IsBusy))
            {
                State = TimelineState.Stopped;

                RecordingLord.StopRecording();

                Camera.main.orthographic = false;

                if (HaxxisGlobalSettings.Instance.IsVgsJob == true)
                {
                    if (TimelineViewBehaviour.Instance.NumRecordingsStartedThisPlayback == 0)
                    {
                        HaxxisGlobalSettings.Instance.ReportVgsError(6, "Choreography had no recording step");
                    }
                }

                if (HaxxisGlobalSettings.Instance.IsVgsJob == true)
                {
                    HaxxisGlobalSettings.Instance.ReportVgsVideoDuration();
                }
            }


            // Check for seek arrival

            if (IsSeeking)
            {
                if (step == SeekTarget)
                {
                    // Hmm I thought something like this was going to be needed...?
                    //if ( state == TimelineState.Playing )

                    IsSeeking = false;

                    if (SeekThrough)
                    {
                        SetNormalSpeed();
                    }
                    else
                    {
                        Pause();
                    }
                }
            }
        }
    private void OnPostRender()
    {
        if (RecordingLord.IsRecording())
        {
            cam.targetTexture = null;

            if (RecordingLord.MainSatellite == this)
            {
                if (SystemInfo.graphicsDeviceID != 0)
                {
                    Graphics.Blit(renderTexture, null as RenderTexture);
                }
                RecordingLord.RenderedFrame(renderTexture);
            }
        }
    }
Exemple #6
0
        public void Cancel()
        {
            foreach (var step in RegisteredSteps)
            {
                step.Cancel();
            }


            SetNormalSpeed();


            RecordingLord.StopRecording();


            State = TimelineState.Stopped;
        }
Exemple #7
0
        // TODO:  Make whether the game time is paused a mutable bool.  Perhaps even whether the recording is paused.  (Do the same for the corresponding UnPauseMutator)
        // Another potential issue with this is if the author 'nests' pause/unpause nodes; currently that won't work properly

        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            if (RecordingLord.IsRecording())
            {
                RecordingLord.PauseRecording();
                Time.timeScale = 0.0f;
                //Debug.Log("PauseMutator: Pausing recording at frame " + Time.frameCount);
            }

            var iterator = Router.TransmitAll(payload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
Exemple #8
0
        private void Update()
        {
            if (InputFieldComponent.isFocused)
            {
                return;
            }
            if (RecordingLord.IsRecording())
            {
                return;
            }

            InputFieldComponent.text = Camera.main.orthographic ? Camera.main.orthographicSize.ToString() : Camera.main.fieldOfView.ToString();

            OrthoButtonComponent.interactable       = !Camera.main.orthographic;
            PerspectiveButtonComponent.interactable = Camera.main.orthographic;
        }
Exemple #9
0
    void Update()
    {
        if (RecordingLord.IsRecording())
        {
            return;
        }
        var deactivatedNodesDiscovered = 0;

        while (nodesToUpdate.Count > 0 && nodesGenerating.Count < OnscreenNodesToGenerateConcurrently)
        {
            var node = nodesToUpdate.Dequeue();
            if (!node.RectTransform)
            {
                continue;
            }
            if (!node.IsVisible)
            {
                nodesToUpdate.Enqueue(node);
                deactivatedNodesDiscovered++;
                if (deactivatedNodesDiscovered > nodesToUpdate.Count)
                {
                    break;
                }
                continue;
            }
            node.UpdateQueuedControllableGeneration();
            nodesGenerating.Enqueue(node);
            deactivatedNodesDiscovered = 0;
        }
        while (nodesToUpdate.Count > 0 && nodesGenerating.Count < OffscreenNodesToGenerateConcurrently)
        {
            var node = nodesToUpdate.Dequeue();
            if (!node.RectTransform)
            {
                continue;
            }
            node.UpdateQueuedControllableGeneration();
            nodesGenerating.Enqueue(node);
        }

        if (ChainView.Instance.Dragging || ChainView.Instance.Zooming)
        {
            return;
        }
        mbbUpdate();
    }
Exemple #10
0
        public void Pause()
        {
            if (State == TimelineState.Paused)
            {
                return;
            }

            foreach (var step in RegisteredSteps)
            {
                step.Pause();
            }

            RecordingLord.PauseRecording();

            SetPausedSpeed();

            State = TimelineState.Paused;
        }
Exemple #11
0
        public void Resume()
        {
            if (State != TimelineState.Paused)
            {
                return;
            }

            foreach (var step in RegisteredSteps)
            {
                step.Resume();
            }



            SetNormalSpeed();
            // ^ and v order dependent
            RecordingLord.ResumeRecording();


            State = TimelineState.Playing;
        }
        protected override IEnumerator ExecuteStep()
        {
            if (!TemporarilyDisable)
            {
                if (!Timeline.IsSeeking)
                {
                    Debug.Log("Starting recording!");

                    var filename = CommandLineArgs.GetArgumentValue("VideoFilename");
                    if (string.IsNullOrEmpty(filename))
                    {
                        filename = "Choreography.mp4";
                    }

                    RecordingLord.StartRecording(filename);

                    TimelineViewBehaviour.Instance.NumRecordingsStartedThisPlayback++;
                }
            }

            Router.FireEvent(EndEventName);

            yield return(null);
        }
Exemple #13
0
 private IEnumerator StartRecordingMovie(string filename)
 {
     RecordingLord.StartRecording(filename);
     yield return(null);
 }
Exemple #14
0
        public bool Execute()
        {
            var videoCodecSet = false;

            //var videoCodecIndex = -1;

            if (SetVideoCodecOption.IsPresent)
            {
                var name = (string)SetVideoCodecOption.Arguments[0].Value;
                if (RecordingLord.CheckCodec(name))
                {
                    videoCodecSet        = true;
                    RecordingLord.Vcodec = name;
                }

                else
                {
                    Debug.Log("Error:  No match found for video codec \"" + name + "\"");
                    return(false);
                }
            }

            if (SetVideoCodecFromCmdLineArgOption.IsPresent)
            {
                var videoCodecString = CommandLineArgs.GetArgumentValue((string)SetVideoCodecFromCmdLineArgOption.Arguments[0].Value);

                if (string.IsNullOrEmpty(videoCodecString))
                {
                    // Commenting this out to help avoid confusion
                    //Debug.Log("Error:  Cannot set video codec because that command line argument was not found or had no value");
                    return(true);    // Don't report this as an error
                }

                if (RecordingLord.CheckCodec(videoCodecString))
                {
                    videoCodecSet        = true;
                    RecordingLord.Vcodec = videoCodecString;
                }
                else
                {
                    Debug.Log("Error:  No match found for video codec \"" + videoCodecString + "\"");
                    return(false);
                }
            }

            if (videoCodecSet)
            {
                Debug.Log("Video codec index set to " + RecordingLord.Vcodec);
            }

            var frameRateSet = false;
            var frameRate    = 30;

            if (FrameRateOption.IsPresent)
            {
                frameRate    = (int)FrameRateOption.Arguments[0].Value;
                frameRateSet = true;
            }

            if (FrameRateFromCmdLineArgOption.IsPresent)
            {
                var frameRateString = CommandLineArgs.GetArgumentValue((string)FrameRateFromCmdLineArgOption.Arguments[0].Value);

                if (string.IsNullOrEmpty(frameRateString))
                {
                    //Debug.Log("Error:  Cannot set frame rate because that command line argument was not found or had no value");
                    return(false);
                }

                object value = null;
                if (!frameRateString.StringToValueOfType(typeof(int), ref value, true))
                {
                    return(false);
                }

                frameRate    = (int)value;
                frameRateSet = true;
            }

            if (frameRateSet)
            {
                RecordingLord.FrameRate = frameRate;
                Debug.Log("Movie frame rate set to " + RecordingLord.FrameRate);
            }

            var jqualitySet = false;
            var jquality    = 100;

            if (JpegQualityOption.IsPresent)
            {
                jquality    = (int)JpegQualityOption.Arguments[0].Value;
                jqualitySet = true;
            }

            if (JpegQualityFromCmdLineArgOption.IsPresent)
            {
                var jqualityString = CommandLineArgs.GetArgumentValue((string)JpegQualityFromCmdLineArgOption.Arguments[0].Value);

                if (string.IsNullOrEmpty(jqualityString))
                {
                    //Debug.Log("Error:  Cannot set frame rate because that command line argument was not found or had no value");
                    return(false);
                }

                object value = null;
                if (!jqualityString.StringToValueOfType(typeof(int), ref value, true))
                {
                    return(false);
                }

                jquality    = (int)value;
                jqualitySet = true;
            }

            if (jqualitySet)
            {
                RecordingLord.JpegQuality = jquality;
                Debug.Log("Movie JPEG quality set to " + RecordingLord.JpegQuality);
            }

            if (StartOption.IsPresent)
            {
                if (!RecordingLord.IsRecording())
                {
                    // We start recording in a job, which happens as a coroutine.  This fixes (11/10/2015) an issue where videos
                    // were black for several seconds at the beginning, which I think was related to choreography-triggered
                    // video recording that were also being started in jobs.

                    var filename = (string)StartOption.Arguments[0].Value;
                    JobManager.Instance.StartJob(StartRecordingMovie(filename), jobName: "RecordMovieFromDevCmd");
                }
                else
                {
                    Debug.Log("Error:  Movie already being captured");
                    return(false);
                }
            }

            if (StopOption.IsPresent)
            {
                if (RecordingLord.IsRecording())
                {
                    RecordingLord.StopRecording();
                    Debug.Log("Frames captured: " + RecordingLord.FrameTotal + "; total duration " + RecordingLord.Duration + " seconds");
                }
                else
                {
                    Debug.Log("Error:  No movie being captured");
                    return(false);
                }
            }

            if (PauseOption.IsPresent)
            {
                if (!RecordingLord.IsRecording())
                {
                    Debug.Log("Error:  No movie being captured");
                    return(false);
                }
                if (RecordingLord.IsPaused())
                {
                    Debug.Log("Warning:  Pause request made but movie recording is already paused");
                    return(true);
                }
                RecordingLord.PauseRecording();
                Debug.Log("Movie recording paused; duration so far is " + RecordingLord.Duration + " seconds");
            }

            if (ResumeOption.IsPresent)
            {
                if (!RecordingLord.IsRecording())
                {
                    Debug.Log("Error:  No movie being captured");
                    return(false);
                }
                if (!RecordingLord.IsPaused())
                {
                    Debug.Log("Warning:  Resume request made but movie recording is not paused");
                    return(true);
                }
                RecordingLord.ResumeRecording();
                Debug.Log("Movie recording resumed");
            }

            return(true);
        }