protected void OnEnable()
        {
            HDRaytracingEnvironment rtEnv = (HDRaytracingEnvironment)target;

            // Get & automatically add additional HD data if not present
            m_SerializedHDRaytracingEnvironment = new SerializedHDRaytracingEnvironment(rtEnv);

            k_ExpandedState = new ExpandedState <Expandable, HDRaytracingEnvironment>(~(-1), "HDRP");
        }
 // This one is private as we do not want to have unhandled advanced switch. Change it if necessary.
 static IDrawer FoldoutGroup <TEnum, TState>(GUIContent title, TEnum mask, ExpandedState <TEnum, TState> state, FoldoutOption options, Enabler isAdvanced, SwitchEnabler switchAdvanced, params ActionDrawer[] contentDrawers)
     where TEnum : struct, IConvertible
 {
     return(Group((data, owner) =>
     {
         bool isBoxed = (options & FoldoutOption.Boxed) != 0;
         bool isIndented = (options & FoldoutOption.Indent) != 0;
         bool isSubFoldout = (options & FoldoutOption.SubFoldout) != 0;
         bool noSpaceAtEnd = (options & FoldoutOption.NoSpaceAtEnd) != 0;
         bool expended = state[mask];
         bool newExpended = expended;
         if (isSubFoldout)
         {
             newExpended = CoreEditorUtils.DrawSubHeaderFoldout(title, expended, isBoxed,
                                                                isAdvanced == null ? (Func <bool>)null : () => isAdvanced(data, owner),
                                                                switchAdvanced == null ? (Action)null : () => switchAdvanced(data, owner));
         }
         else
         {
             CoreEditorUtils.DrawSplitter(isBoxed);
             newExpended = CoreEditorUtils.DrawHeaderFoldout(title, expended, isBoxed,
                                                             isAdvanced == null ? (Func <bool>)null : () => isAdvanced(data, owner),
                                                             switchAdvanced == null ? (Action)null : () => switchAdvanced(data, owner));
         }
         if (newExpended ^ expended)
         {
             state[mask] = newExpended;
         }
         if (newExpended)
         {
             if (isIndented)
             {
                 ++EditorGUI.indentLevel;
             }
             for (var i = 0; i < contentDrawers.Length; i++)
             {
                 contentDrawers[i](data, owner);
             }
             if (isIndented)
             {
                 --EditorGUI.indentLevel;
             }
             if (!noSpaceAtEnd)
             {
                 EditorGUILayout.Space();
             }
         }
     }));
 }
예제 #3
0
 /// <summary> Create an IDrawer foldout header using an ExpandedState </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="contentDrawer">The content of the foldout header</param>
 public static IDrawer FoldoutGroup <TEnum, TState>(string title, TEnum mask, ExpandedState <TEnum, TState> state, params ActionDrawer[] contentDrawer)
     where TEnum : struct, IConvertible
 {
     return(Action((uiState, data, editor) =>
     {
         CoreEditorUtils.DrawSplitter();
         bool expended = state[mask];
         bool newExpended = CoreEditorUtils.DrawHeaderFoldout(title, expended);
         if (newExpended ^ expended)
         {
             state[mask] = newExpended;
         }
         if (newExpended)
         {
             ++EditorGUI.indentLevel;
             for (var i = 0; i < contentDrawer.Length; i++)
             {
                 contentDrawer[i](uiState, data, editor);
             }
             --EditorGUI.indentLevel;
             EditorGUILayout.Space();
         }
     }));
 }
 /// <summary> Helper to draw a foldout with an advanced switch on it. </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="isAdvanced"> Delegate allowing to check if advanced mode is active. </param>
 /// <param name="switchAdvanced"> Delegate to know what to do when advance is switched. </param>
 /// <param name="normalContent"> The content of the foldout header always visible if expended. </param>
 /// <param name="advancedContent"> The content of the foldout header only visible if advanced mode is active and if foldout is expended. </param>
 public static IDrawer AdvancedFoldoutGroup <TEnum, TState>(GUIContent foldoutTitle, TEnum foldoutMask, ExpandedState <TEnum, TState> foldoutState, Enabler isAdvanced, SwitchEnabler switchAdvanced, ActionDrawer normalContent, ActionDrawer advancedContent, FoldoutOption options = FoldoutOption.Indent)
     where TEnum : struct, IConvertible
 {
     return(FoldoutGroup(foldoutTitle, foldoutMask, foldoutState, options, isAdvanced, switchAdvanced,
                         normalContent,
                         Conditional((serialized, owner) => isAdvanced(serialized, owner) && foldoutState[foldoutMask], advancedContent).Draw
                         ));
 }
 /// <summary> Helper to draw a foldout with an advanced switch on it. </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="isAdvanced"> Delegate allowing to check if advanced mode is active. </param>
 /// <param name="switchAdvanced"> Delegate to know what to do when advance is switched. </param>
 /// <param name="normalContent"> The content of the foldout header always visible if expended. </param>
 /// <param name="advancedContent"> The content of the foldout header only visible if advanced mode is active and if foldout is expended. </param>
 public static IDrawer AdvancedFoldoutGroup <TEnum, TState>(GUIContent foldoutTitle, TEnum foldoutMask, ExpandedState <TEnum, TState> foldoutState, Enabler isAdvanced, SwitchEnabler switchAdvanced, IDrawer normalContent, ActionDrawer advancedContent, FoldoutOption options = FoldoutOption.Indent)
     where TEnum : struct, IConvertible
 {
     return(AdvancedFoldoutGroup(foldoutTitle, foldoutMask, foldoutState, isAdvanced, switchAdvanced, normalContent.Draw, advancedContent, options));
 }
 /// <summary> Create an IDrawer foldout header using an ExpandedState </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="contentDrawers">The content of the foldout header</param>
 public static IDrawer FoldoutGroup <TEnum, TState>(GUIContent title, TEnum mask, ExpandedState <TEnum, TState> state, FoldoutOption options, params ActionDrawer[] contentDrawers)
     where TEnum : struct, IConvertible
 {
     return(FoldoutGroup(title, mask, state, options, null, null, contentDrawers));
 }
 /// <summary>
 /// Create an IDrawer foldout header using an ExpandedState.
 /// The default option is Indent in this version.
 /// </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="contentDrawers">The content of the foldout header</param>
 public static IDrawer FoldoutGroup <TEnum, TState>(GUIContent title, TEnum mask, ExpandedState <TEnum, TState> state, params IDrawer[] contentDrawers)
     where TEnum : struct, IConvertible
 {
     return(FoldoutGroup(title, mask, state, contentDrawers.Draw));
 }
 /// <summary> Create an IDrawer foldout header using an ExpandedState </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="contentDrawers">The content of the foldout header</param>
 public static IDrawer FoldoutGroup <TEnum, TState>(string title, TEnum mask, ExpandedState <TEnum, TState> state, FoldoutOption options, params ActionDrawer[] contentDrawers)
     where TEnum : struct, IConvertible
 {
     return(FoldoutGroup(EditorGUIUtility.TrTextContent(title), mask, state, options, contentDrawers));
 }
예제 #9
0
 /// <summary>
 /// Create an IDrawer foldout header using an ExpandedState.
 /// The default option is Indent in this version.
 /// </summary>
 /// <param name="title">Title wanted for this foldout header</param>
 /// <param name="mask">Bit mask (enum) used to define the boolean saving the state in ExpandedState</param>
 /// <param name="state">The ExpandedState describing the component</param>
 /// <param name="contentDrawers">The content of the foldout header</param>
 public static IDrawer FoldoutGroup <TEnum, TState>(string title, TEnum mask, ExpandedState <TEnum, TState> state, params ActionDrawer[] contentDrawers)
     where TEnum : struct, IConvertible
 {
     return(FoldoutGroup(CoreEditorUtils.GetContent(title), mask, state, contentDrawers));
 }