Class Filter
Base class for implementing Filters that operate on Textures. Used as elements in a FilterStack but can also be used by themselves. Inherit from this class and override functions to create your own Filter.
Inherited Members
Namespace: UnityEditor.Experimental.TerrainAPI
Syntax
[Serializable]
public class Filter : ScriptableObject
Fields
enabled
Flag that is used to determine whether or not the Filter is enabled and should be evaluated when part of a FilterStack. If it is not enabled, it is skipped during FilterStack evaluation
Declaration
[SerializeField]
public bool enabled
Field Value
| Type | Description |
|---|---|
| Boolean |
Methods
DrawGUI(Rect, FilterContext)
Draw the GUI for the Filter
Declaration
public void DrawGUI(Rect rect, FilterContext filterContext)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | rect | The Rect where the GUI should be drawn |
| FilterContext | filterContext | The FilterContext related to the current evaluation. Use this to show different information in the Filter GUI |
Eval(FilterContext, RenderTexture, RenderTexture)
Evaluates the Filter. Calls ValidateFilter and if that returns false, a default blit is performed instead of calling OnEval
Declaration
public void Eval(FilterContext filterContext, RenderTexture source, RenderTexture dest)
Parameters
| Type | Name | Description |
|---|---|---|
| FilterContext | filterContext | The FilterContext related to the current evaluation |
| RenderTexture | source | The source RenderTexture on which the Filter operates |
| RenderTexture | dest | The destination RenderTexture to which the Filter blits the results of the Filter evaluation |
GetDisplayName()
Get the display name for the Filter. This is used when drawing the Filter's user interface.
Declaration
public virtual string GetDisplayName()
Returns
| Type | Description |
|---|---|
| String |
GetElementHeight()
Get the height of the Filter element when drawn as part of a FilterStack GUI
Declaration
public virtual float GetElementHeight()
Returns
| Type | Description |
|---|---|
| Single | The height of the Filter in the FilterStack GUI |
GetObjectsToSerialize()
Get a list of Unity Objects to serialize along with the Filter object
Declaration
public virtual List<Object> GetObjectsToSerialize()
Returns
| Type | Description |
|---|---|
| List<Object> | List of Unity Objects to serialize |
GetToolTip()
Get the tooltip for the Filter.
Declaration
public virtual string GetToolTip()
Returns
| Type | Description |
|---|---|
| String |
OnDisable()
Called when the Filter is disabled
Declaration
public virtual void OnDisable()
OnDrawGUI(Rect, FilterContext)
Draw the GUI for the Filter
Declaration
protected virtual void OnDrawGUI(Rect rect, FilterContext filterContext)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | rect | The Rect where the GUI should be drawn |
| FilterContext | filterContext | The FilterContext related to the current evaluation. Use this to show different information in the Filter GUI |
OnEnable()
Called when the Filter is first created
Declaration
public virtual void OnEnable()
OnEval(FilterContext, RenderTexture, RenderTexture)
Evaluate the Filter. Override this function for custom Filter logic
Declaration
protected virtual void OnEval(FilterContext filterContext, RenderTexture source, RenderTexture dest)
Parameters
| Type | Name | Description |
|---|---|---|
| FilterContext | filterContext | |
| RenderTexture | source | |
| RenderTexture | dest |
OnSceneGUI(SceneView, FilterContext)
Handle SceneView related logic or rendering
Declaration
protected virtual void OnSceneGUI(SceneView sceneView, FilterContext filterContext)
Parameters
| Type | Name | Description |
|---|---|---|
| SceneView | sceneView | |
| FilterContext | filterContext |
SceneGUI(SceneView, FilterContext)
Handle SceneView related logic or rendering
Declaration
public void SceneGUI(SceneView sceneView, FilterContext filterContext)
Parameters
| Type | Name | Description |
|---|---|---|
| SceneView | sceneView | |
| FilterContext | filterContext |
ValidateFilter(FilterContext, out String)
Called before OnEval. Use this to set up anything needed before Filter evaluation and to also tell the system whether or not the Filter is supported based on current hardware, the data provided by the provided FilterContext, etc. Do this by returning True or False.
Declaration
public virtual bool ValidateFilter(FilterContext filterContext, out string message)
Parameters
| Type | Name | Description |
|---|---|---|
| FilterContext | filterContext | The FilterContext related to the current evaluation |
| String | message |
Returns
| Type | Description |
|---|---|
| Boolean | Whether or not the Filter is supported and should be evaluated. True = supported and is okay to evaluate. False = the Filter is not supported with the current hardware and should be skipped |