void OnAddNewRecorder(RecorderInfo info)
        {
            var recorder = RecordersInventory.CreateDefaultRecorderSettings(info.settingsType);

            AddLastAndSelect(recorder, ObjectNames.NicifyVariableName(info.displayName), true);

            UIElementHelper.SetDirty(m_RecorderSettingPanel);
        }
        static void Init()
        {
            if (s_Recorders == null)
            {
                s_Recorders = new Dictionary <Type, RecorderInfo>();
                foreach (var recorder in FindRecorders())
                {
                    var settingsType    = recorder.Key;
                    var settingsAttribs = recorder.Value;

                    if (settingsType == null || string.IsNullOrEmpty(settingsType.FullName))
                    {
                        continue;
                    }

                    if (settingsAttribs.Length == 1)
                    {
                        var settingsAttrib = (RecorderSettingsAttribute)settingsAttribs[0];

                        var info = new RecorderInfo
                        {
                            settingsType = settingsType,
                            recorderType = settingsAttrib.recorderType,
                            displayName  = settingsAttrib.displayName,
                            iconName     = settingsAttrib.iconName
                        };

                        s_Recorders.Add(settingsType, info);
                    }
                }
            }

            if (s_Recorders != null)
            {
                if (s_BuiltInRecorderInfos == null)
                {
                    s_BuiltInRecorderInfos = new HashSet <RecorderInfo>
                    {
                        s_Recorders[typeof(AnimationRecorderSettings)],
                        s_Recorders[typeof(MovieRecorderSettings)],
                        s_Recorders[typeof(ImageRecorderSettings)],
                        s_Recorders[typeof(GIFRecorderSettings)]
                    };
                }

                if (s_LegacyRecorderInfos == null)
                {
                    s_LegacyRecorderInfos = new HashSet <RecorderInfo>
                    {
                        s_Recorders[typeof(MP4RecorderSettings)],
                        s_Recorders[typeof(EXRRecorderSettings)],
                        s_Recorders[typeof(PNGRecorderSettings)],
                        s_Recorders[typeof(WEBMRecorderSettings)]
                    };
                }
            }
        }
Example #3
0
        static void GetSpecificRecorderInfos(IEnumerable <Recorder> recorders, out List <AnimationRecorderInfo> anim,
                                             out List <ImageRecorderInfo> image, out List <MovieRecorderInfo> movie, out List <GifRecorderInfo> gif, out List <RecorderInfo> recorder)
        {
            anim     = new List <AnimationRecorderInfo>();
            image    = new List <ImageRecorderInfo>();
            movie    = new List <MovieRecorderInfo>();
            gif      = new List <GifRecorderInfo>();
            recorder = new List <RecorderInfo>();

            foreach (var reco in recorders)
            {
                switch (reco)
                {
                case AnimationRecorder r:
                    anim.Add(AnimationRecorderInfo.FromRecorder(r));
                    break;

                case ImageRecorder r:
                    image.Add(ImageRecorderInfo.FromRecorder(r));
                    break;

                case MovieRecorder r:
                    movie.Add(MovieRecorderInfo.FromRecorder(r));
                    break;

                case GIFRecorder r:
                    gif.Add(GifRecorderInfo.FromRecorder(r));
                    break;

                default:
                    recorder.Add(RecorderInfo.FromRecorder(reco));
                    break;
                }
            }

            if (anim.Count == 0)
            {
                anim = null;
            }
            if (image.Count == 0)
            {
                image = null;
            }
            if (movie.Count == 0)
            {
                movie = null;
            }
            if (gif.Count == 0)
            {
                gif = null;
            }
            if (recorder.Count == 0)
            {
                recorder = null;
            }
        }
Example #4
0
 void AddRecorderInfoToMenu(RecorderInfo info, GenericMenu menu)
 {
     if (ShouldDisableRecordSettings())
     {
         menu.AddDisabledItem(new GUIContent(info.displayName));
     }
     else
     {
         menu.AddItem(new GUIContent(info.displayName), false, data => OnAddNewRecorder((RecorderInfo)data), info);
     }
 }