Beispiel #1
0
        public bool OnInputGui(int groupIndex, ref RecorderInputSetting input)
        {
            if (!m_Groups.ContainsKey(groupIndex))
            {
                return(false);
            }
            if (m_Groups[groupIndex].types.Length < 2)
            {
                return(false);
            }

            int index = 0;

            for (int i = 0; i < m_Groups[groupIndex].types.Length; i++)
            {
                if (m_Groups[groupIndex].types[i] == input.GetType())
                {
                    index = i;
                    break;
                }
            }
            var newIndex = EditorGUILayout.Popup("Collection method", index, m_Groups[groupIndex].captions);

            if (index != newIndex)
            {
                input = recSettings.NewInputSettingsObj(m_Groups[groupIndex].types[newIndex], m_Groups[groupIndex].title);
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        public bool OnInputGui(ref RecorderInputSetting input)
        {
            var index = input.GetType() == typeof(CBRenderTextureInputSettings) ? 0 :
                        input.GetType() == typeof(AdamBeautyInputSettings) ? 1 : 2;
            var newIndex = EditorGUILayout.Popup("Collection method", index, candidates);

            if (index != newIndex)
            {
                switch (newIndex)
                {
                case 0:
                    input = recSettings.NewInputSettingsObj <CBRenderTextureInputSettings>(title);
                    break;

                case 1:
                    input = recSettings.NewInputSettingsObj <AdamBeautyInputSettings>(title);
                    break;

                case 2:
                    input = recSettings.NewInputSettingsObj <RenderTextureInputSettings>(title);
                    break;
                }
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        protected void AddInputSettings(RecorderInputSetting inputSettings)
        {
            var inputs = (target as RecorderSettings).inputsSettings;

            inputs.Add(inputSettings);
            m_InputEditors.Add(new InputEditorState(GetFieldDisplayState, inputSettings)
            {
                visible = true
            });
        }
        protected void ChangeInputSettings(int atIndex, RecorderInputSetting newSettings)
        {
            newSettings.name = GUID.Generate().ToString();

            AssetDatabase.AddObjectToAsset(newSettings, serializedObject.targetObject);
            AssetDatabase.SaveAssets();

            var arryItem = m_Inputs.GetArrayElementAtIndex(atIndex);

            UnityHelpers.Destroy(arryItem.objectReferenceValue, true);
            arryItem.objectReferenceValue = newSettings;
        }
        protected void AddSourceSettings(RecorderInputSetting sourceSettings)
        {
            sourceSettings.name = GUID.Generate().ToString();

            AssetDatabase.AddObjectToAsset(sourceSettings, serializedObject.targetObject);
            AssetDatabase.SaveAssets();

            m_Inputs.InsertArrayElementAtIndex(m_Inputs.arraySize);
            var arryItem = m_Inputs.GetArrayElementAtIndex(m_Inputs.arraySize - 1);

            arryItem.objectReferenceValue = sourceSettings;
        }
Beispiel #6
0
 public void ChangeInputSettings(int atIndex, RecorderInputSetting newSettings)
 {
     if (newSettings != null)
     {
         var inputs = (target as RecorderSettings).inputsSettings;
         inputs.ReplaceAt(atIndex, newSettings);
         m_InputEditors[atIndex].settingsObj = newSettings;
     }
     else if (m_InputEditors.Count == 0)
     {
         throw new Exception("Source removal not implemented");
     }
 }
Beispiel #7
0
        protected void AddInputSettings(RecorderInputSetting inputSettings)
        {
            m_Inputs.InsertArrayElementAtIndex(m_Inputs.arraySize);
            var arryItem = m_Inputs.GetArrayElementAtIndex(m_Inputs.arraySize - 1);

            arryItem.objectReferenceValue = inputSettings;

            m_InputEditors.Add(new InputEditorState(GetFieldDisplayState, inputSettings)
            {
                visible = true
            });

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #8
0
        public void ChangeInputSettings(int atIndex, RecorderInputSetting newSettings)
        {
            if (newSettings != null)
            {
                AssetDatabase.AddObjectToAsset(newSettings, serializedObject.targetObject);
                AssetDatabase.Refresh();

                var arryItem = m_Inputs.GetArrayElementAtIndex(atIndex);
                UnityHelpers.Destroy(arryItem.objectReferenceValue, true);
                arryItem.objectReferenceValue = newSettings;

                m_InputEditors[atIndex].settingsObj = newSettings;
            }
            else if (m_InputEditors.Count == 0)
            {
                throw new Exception("Source removal not implemented");
            }
        }
Beispiel #9
0
 public InputEditorState(InputEditor.IsFieldAvailableDelegate validator, RecorderInputSetting settings)
 {
     m_Validator = validator;
     settingsObj = settings;
 }