Class Filter
Provides methods 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.TerrainTools
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)
Draws the GUI for the Filter.
Declaration
public void DrawGUI(Rect rect, FilterContext filterContext)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.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.
Declaration
public void Eval(FilterContext filterContext, RenderTexture source, RenderTexture dest)
Parameters
Type | Name | Description |
---|---|---|
FilterContext | filterContext | The FilterContext related to the current evaluation. |
UnityEngine.RenderTexture | source | The source RenderTexture on which the Filter operates. |
UnityEngine.RenderTexture | dest | The destination RenderTexture to which the Filter blits the results of the Filter evaluation. |
Remarks
This method calls ValidateFilter(FilterContext, out String) and checks if it returns false performing a default blit instead of calling OnEval.
GetDisplayName()
Gets 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 | Returns the display name of the Filter. |
GetElementHeight()
Gets 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()
Gets a list of Unity Objects to serialize along with the Filter object.
Declaration
public virtual List<Object> GetObjectsToSerialize()
Returns
Type | Description |
---|---|
List<UnityEngine.Object> | List of Unity Objects to serialize. |
GetToolTip()
Gets the tooltip for the Filter.
Declaration
public virtual string GetToolTip()
Returns
Type | Description |
---|---|
String | Returns the tooltip of the Filter. |
OnDisable()
Sets data when the Filter is disabled.
Declaration
public virtual void OnDisable()
OnDrawGUI(Rect, FilterContext)
Draws the GUI for the Filter.
Declaration
protected virtual void OnDrawGUI(Rect rect, FilterContext filterContext)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.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()
Sets data when the Filter is first created.
Declaration
public virtual void OnEnable()
OnEval(FilterContext, RenderTexture, RenderTexture)
Evaluates 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 | The FilterContext related to the current evaluation. |
UnityEngine.RenderTexture | source | The source RenderTexture on which the Filter operates. |
UnityEngine.RenderTexture | dest | The destination RenderTexture to which the Filter blits the results of the Filter operation. |
OnSceneGUI(SceneView, FilterContext)
Handles SceneView related logic or rendering.
Declaration
protected virtual void OnSceneGUI(SceneView sceneView, FilterContext filterContext)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.SceneView | sceneView | The UnityEditor.SceneView in focus. |
FilterContext | filterContext | The FilterContext related to the current evaluation. |
SceneGUI(SceneView, FilterContext)
Handles SceneView related logic or rendering.
Declaration
public void SceneGUI(SceneView sceneView, FilterContext filterContext)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.SceneView | sceneView | The UnityEditor.SceneView in focus. |
FilterContext | filterContext | The FilterContext related to the current evaluation. |
ValidateFilter(FilterContext, out String)
Sets up necessary data needed before the Filter is evaluated.
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 | The message to display from validation results. |
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. |
Remarks
While the data is being set the system is informed whether or not the Filter is supported based on current hardware, the data provided by the provided FilterContext, etc. This is completed by returning True or False. This method is called before OnEval.