Class Section
Represents a grouping of controls with an header that can be folded in and out.
Inheritance
Namespace: VRLabs.SimpleShaderInspectors.Controls.Sections
Syntax
public class Section : PropertyControl, IControlContainer, INonAnimatableProperty
Remarks
On bigger shaders it may be needed to organize options in categories to make easier for the user to find the option they want to modify. This control makes you able to organize it with ease, by grouping controls under categories with a dedicated title.
The folding state can be controlled either by the control alone, or driven by a material property. In this last case the folding state will stay saved between editor sessions.
In case a material property isn't used, a default alias is used. This alias is shared between al sections, so you need to override it if you want to use a different string for each section.
Examples
Example usage:
// Adds a section and sets its alias
this.AddSection().Alias("ExampleAlias");
// Adds a section that uses a material property for its folding state.
this.AddSection("_ExampleProperty");
// Adds a section that uses a material property for its folding state.
// When not folded out the property value will be 2, when folded out 6
this.AddSection("_ExampleProperty", 2, 6);
Constructors
| Name | Description |
|---|---|
| Section() | Default constructor of Section. |
| Section(String, Single, Single) | Constructor of Section used when creating a property driven section |
Fields
| Name | Description |
|---|---|
| dictionaryKey | String containing the key value that the section will use for the dictionary. |
| firstCycle | Boolean indicating if it's the first ui update. |
| hideValue | Float value that the Show bool gets converted if false. |
| showValue | Float value that the Show bool gets converted if true. |
| useDictionary | Boolean indicating if the section folding state is driven by an internal dictionary or not. It will be true in case you don't use a material property. |
Properties
| Name | Description |
|---|---|
| AreControlsInHeader | Boolean indicating if child controls will be inside the header background. |
| BackgroundColor | Background color of the header. |
| BackgroundStyle | Style of the header background. |
| Controls | List of controls inside this section. |
| IsPropertyAnimatable | Boolean indicating if the folding state material property is animatable or not. |
| LabelStyle | Style of the header label. |
| NonAnimatablePropertyChanged | Boolean indicating if the folding state material property needs to be updated. Implementation needed by INonAnimatableProperty. |
| Show | Bool indicating if the section is folded out or not. |
| ShowFoldoutArrow | Boolean indicating if the foldout arrow is enabled or not. |
Methods
| Name | Description |
|---|---|
| AddControl(SimpleControl) | |
| ControlGUI(MaterialEditor) | Draws the control represented by this object. |
| DrawControls(MaterialEditor) | Draws the list of controls that can be hidden by this control. |
| GetControlList() | |
| SetupEnabled(MaterialEditor) | Sets the Enabled boolean to the value currently in the source based on the settings of this control. Should only be used inside ControlGUI(MaterialEditor). |
| UpdateEnabled(MaterialEditor) | Updates the source of the Enabled boolean base on the settings of this control. Should only be used inside ControlGUI(MaterialEditor). |
| UpdateNonAnimatableProperty(MaterialEditor) | Updates properties that should not be animated, implementation needed by INonAnimatableProperty |