Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            myTarget = target as GrassPostProcessProfile;
            Undo.RecordObject(myTarget, "Update in " + myTarget.name);

            EditorGUI.BeginChangeCheck();
            ShowGUI();
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(myTarget);
            }
        }
Esempio n. 2
0
 public ReorderableListForPostProcesses(ReorderableList reorderable, GrassPostProcessProfile profile)
 {
     m_Profile                                      = profile;
     m_ReorderableList                              = reorderable;
     m_ReorderableList.displayAdd                   = true;
     m_ReorderableList.drawHeaderCallback           = DrawHeaderCallback;
     m_ReorderableList.drawElementCallback          = DrawElementCallback;
     m_ReorderableList.onAddDropdownCallback        = OnAddDropdownCallback;
     m_ReorderableList.onRemoveCallback             = OnRemoveCallback;
     m_ReorderableList.elementHeightCallback        = ElementHeightCallback;
     m_ReorderableList.onReorderCallbackWithDetails = OnReorderableWithDetails;
 }
Esempio n. 3
0
        private void CreateNewProfile(SerializedProperty property)
        {
            GrassPostProcessProfile profile = AssetsManager.CreateNewScriptableObjectOfType <GrassPostProcessProfile>("Grass Post Process Profile location",
                                                                                                                      AssetsManager.GetScenePath(property),
                                                                                                                      "GrassPostProcessProfile",
                                                                                                                      "asset");

            if (null != profile)
            {
                property.objectReferenceValue = profile;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Shows <see cref="ReorderableList"/> of <see cref="GrassPostProcessProfile.postProcesses"/>
        /// </summary>
        /// <param name="myTarget">Target <see cref="GrassPostProcessProfile"/> object</param>
        /// <param name="property"><see cref="GrassPostProcessProfile"/> property</param>
        private void PostProcessesGUI(GrassPostProcessProfile myTarget, SerializedProperty property)
        {
            SerializedObject profileSerialized = new SerializedObject(myTarget);

            profileSerialized.Update();
            if (postProcessesListHandler == null)
            {
                postProcessesListHandler = new ReorderableListForPostProcesses(GetPostProcesses(myTarget, profileSerialized), myTarget);
            }
            GetPostProcesses(myTarget, profileSerialized).DoLayoutList();
            profileSerialized.ApplyModifiedProperties();
        }
Esempio n. 5
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUIHelper.ProfilePropertyAndNewButtonGUI(position, property, label, () => CreateNewProfile(property));

            GrassPostProcessProfile myTarget = (property.objectReferenceValue as GrassPostProcessProfile);

            if (null == myTarget)
            {
                return;
            }

            PostProcessesGUI(myTarget, property);
        }
Esempio n. 6
0
        /// <summary>
        /// Returns <see cref="ReorderableList"/> from <see cref="GrassPostProcess"/> list and creates
        /// <see cref="GrassPostProcessProfile.postProcesses"/> list and <see cref="reorderableList"/> objects
        /// if either of them is null
        /// </summary>
        /// <param name="myTarget">Target <see cref="GrassPostProcessProfile"/> object</param>
        /// <param name="profileSerialized"><see cref="SerializedObject"/> of target profile</param>
        /// <returns><see cref="ReorderableList"/> for <see cref="GrassPostProcessProfile.postProcesses"/></returns>
        private ReorderableList GetPostProcesses(GrassPostProcessProfile myTarget, SerializedObject profileSerialized)
        {
            if (myTarget.postProcesses == null)
            {
                myTarget.postProcesses = new List <GrassPostProcess>();
            }

            if (reorderableList == null)
            {
                reorderableList = new ReorderableList(profileSerialized, profileSerialized.FindProperty("postProcesses"), true, true, true, true);
            }
            reorderableList.serializedProperty = profileSerialized.FindProperty("postProcesses");
            return(reorderableList);
        }