Class BaseBrushUIGroup
Provides methods for altering brush data.
Inherited Members
Namespace: UnityEditor.TerrainTools
Assembly: Unity.TerrainTools.Editor.dll
Syntax
public abstract class BaseBrushUIGroup : IBrushUIGroup, IBrushEventHandler, IBrushTerrainCache
Constructors
BaseBrushUIGroup(string, Func<IBrushParameter[]>)
Initializes and returns an instance of BaseBrushUIGroup.
Declaration
protected BaseBrushUIGroup(string name, Func<TerrainToolsAnalytics.IBrushParameter[]> analyticsCall = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the brush. |
Func<TerrainToolsAnalytics.IBrushParameter[]> | analyticsCall | The brush's analytics function. |
Fields
isRecording
Checks if the brush strokes are being recorded.
Declaration
public static bool isRecording
Field Value
Type | Description |
---|---|
bool |
Properties
InvertStrength
Inverts the brush strength.
Declaration
public bool InvertStrength { get; }
Property Value
Type | Description |
---|---|
bool |
allowPaint
Checks if painting is allowed.
Declaration
public virtual bool allowPaint { get; }
Property Value
Type | Description |
---|---|
bool |
brushMaskFilterStack
Gets the brush mask's FilterStack.
Declaration
public FilterStack brushMaskFilterStack { get; }
Property Value
Type | Description |
---|---|
FilterStack |
brushMaskFilterStackView
Gets the brush mask's FilterStackView.
Declaration
public FilterStackView brushMaskFilterStackView { get; }
Property Value
Type | Description |
---|---|
FilterStackView |
brushName
Returns the brush name.
Declaration
public string brushName { get; }
Property Value
Type | Description |
---|---|
string |
brushRotation
Gets and sets the brush rotation.
Declaration
public float brushRotation { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
Gets a value of 0 if the brush size controller isn't initialized.
brushScatter
Returns the brush scatter.
Declaration
public float brushScatter { get; }
Property Value
Type | Description |
---|---|
float |
Remarks
Returns a value of 0 if the brush size controller isn't initialized.
brushSize
Gets and sets the brush size.
Declaration
public float brushSize { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
Gets a value of 100 if the brush size controller isn't initialized.
brushSpacing
Returns the brush spacing.
Declaration
public float brushSpacing { get; }
Property Value
Type | Description |
---|---|
float |
Remarks
Returns a value of 0 if the brush size controller isn't initialized.
brushStrength
Gets and sets the brush strength.
Declaration
public float brushStrength { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
Gets a value of 1 if the brush size controller isn't initialized.
canUpdateTerrainUnderCursor
Checks if the cursor is currently locked and can not be updated.
Declaration
public bool canUpdateTerrainUnderCursor { get; }
Property Value
Type | Description |
---|---|
bool |
hasEnabledFilters
Checks if Filters are enabled.
Declaration
public bool hasEnabledFilters { get; }
Property Value
Type | Description |
---|---|
bool |
isInUse
Checks if the brush is in use.
Declaration
public bool isInUse { get; }
Property Value
Type | Description |
---|---|
bool |
isRaycastHitUnderCursorValid
Gets and sets the value associated to whether there is a raycast hit detecting a terrain under the cursor.
Declaration
public bool isRaycastHitUnderCursorValid { get; }
Property Value
Type | Description |
---|---|
bool |
raycastHitUnderCursor
Gets and sets the raycast hit that was under the cursor's position.
Declaration
public RaycastHit raycastHitUnderCursor { get; protected set; }
Property Value
Type | Description |
---|---|
RaycastHit |
terrainUnderCursor
Gets and sets the terrain in focus.
Declaration
public Terrain terrainUnderCursor { get; protected set; }
Property Value
Type | Description |
---|---|
Terrain |
validationMessage
Gets and sets the message for validating terrain parameters.
Declaration
public virtual string validationMessage { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
AddController<TController>(TController)
Adds a generic controller of type IBrushController to the brush's controller list.
Declaration
protected TController AddController<TController>(TController newController) where TController : IBrushController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new generic controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushController. |
AddModifierKeyController<TController>(TController)
Adds a modifier key controller of type IBrushModifierKeyController to the brush's controller list.
Declaration
protected TController AddModifierKeyController<TController>(TController newController) where TController : IBrushModifierKeyController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new modifier key controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushModifierKeyController. |
AddRotationController<TController>(TController)
Adds a rotation controller of type IBrushRotationController to the brush's controller list.
Declaration
protected TController AddRotationController<TController>(TController newController) where TController : IBrushRotationController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new rotation controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushRotationController. |
AddScatterController<TController>(TController)
Adds a scatter controller of type IBrushScatterController to the brush's controller list.
Declaration
protected TController AddScatterController<TController>(TController newController) where TController : IBrushScatterController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new scatter controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushScatterController. |
AddSizeController<TController>(TController)
Adds a size controller of type IBrushSizeController to the brush's controller list.
Declaration
protected TController AddSizeController<TController>(TController newController) where TController : IBrushSizeController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new size controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushSizeController. |
AddSmoothingController<TController>(TController)
Adds a smoothing controller of type IBrushSmoothController to the brush's controller list.
Declaration
protected TController AddSmoothingController<TController>(TController newController) where TController : IBrushSmoothController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new smoothing controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushSmoothController. |
AddSpacingController<TController>(TController)
Adds a spacing controller of type IBrushSpacingController to the brush's controller list.
Declaration
protected TController AddSpacingController<TController>(TController newController) where TController : IBrushSpacingController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new spacing controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushSpacingController. |
AddStrengthController<TController>(TController)
Adds a strength controller of type IBrushStrengthController to the brush's controller list.
Declaration
protected TController AddStrengthController<TController>(TController newController) where TController : IBrushStrengthController
Parameters
Type | Name | Description |
---|---|---|
TController | newController | The new controller to add. |
Returns
Type | Description |
---|---|
TController | Returns the new strength controller. |
Type Parameters
Name | Description |
---|---|
TController | A generic controller type of IBrushStrengthController. |
AppendBrushInfo(Terrain, IOnSceneGUI, StringBuilder)
Adds basic information to the selected brush.
Declaration
public virtual void AppendBrushInfo(Terrain terrain, IOnSceneGUI editContext, StringBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The Terrain in focus. |
IOnSceneGUI | editContext | The IOnSceneGUI to reference. |
StringBuilder | builder | The StringBuilder containing the brush information. |
ConsumeEvents(Terrain, IOnSceneGUI)
Calls the Use function of the registered events.
Declaration
public void ConsumeEvents(Terrain terrain, IOnSceneGUI editContext)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
IOnSceneGUI | editContext | The editcontext to repaint. |
See Also
GenerateBrushMask(IBrushRenderUnderCursor, RenderTexture)
Generates the brush mask.
Declaration
public void GenerateBrushMask(IBrushRenderUnderCursor brushRender, RenderTexture destinationRenderTexture)
Parameters
Type | Name | Description |
---|---|---|
IBrushRenderUnderCursor | brushRender | The brushRender object used for acquiring the heightmap and splatmap texture to blit from. |
RenderTexture | destinationRenderTexture | The destination render texture for bliting to. |
GenerateBrushMask(RenderTexture, RenderTexture)
Generates the brush mask.
Declaration
public void GenerateBrushMask(RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture)
Parameters
Type | Name | Description |
---|---|---|
RenderTexture | sourceRenderTexture | The source render texture to blit from. |
RenderTexture | destinationRenderTexture | The destination render texture for bliting to. |
See Also
GenerateBrushMask(Terrain, IBrushRenderUnderCursor, RenderTexture, Vector3, float, float)
Generates the brush mask.
Declaration
public void GenerateBrushMask(Terrain terrain, IBrushRenderUnderCursor brushRender, RenderTexture destinationRenderTexture, Vector3 position, float scale, float rotation)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
IBrushRenderUnderCursor | brushRender | The brushRender object used for acquiring the heightmap and splatmap texture to blit from. |
RenderTexture | destinationRenderTexture | The destination render texture for bliting to. |
Vector3 | position | The brush's position. |
float | scale | The brush's scale. |
float | rotation | The brush's rotation. |
Remarks
Note: Using this version of the overloaded method allows for the use of the Layer Filter
GenerateBrushMask(Terrain, RenderTexture, RenderTexture)
Generates the brush mask.
Declaration
public void GenerateBrushMask(Terrain terrain, RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
RenderTexture | sourceRenderTexture | The source render texture to blit from. |
RenderTexture | destinationRenderTexture | The destination render texture for bliting to. |
See Also
GenerateBrushMask(Terrain, RenderTexture, RenderTexture, Vector3, float, float)
Generates the brush mask.
Declaration
public void GenerateBrushMask(Terrain terrain, RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture, Vector3 position, float scale, float rotation)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
RenderTexture | sourceRenderTexture | The source render texture to blit from. |
RenderTexture | destinationRenderTexture | The destination render texture for bliting to. |
Vector3 | position | The brush's position. |
float | scale | The brush's scale. |
float | rotation | The brush's rotation. |
Remarks
Note: Use GenerateBrushMask(Terrain terrain, IBrushRenderUnderCursor brushRender, RenderTexture destinationRenderTexture, Vector3 position, float scale, float rotation) if Layer Filtering capabilities are desired.
LockTerrainUnderCursor(bool)
Handles the locking of the terrain cursor in it's current position.
Declaration
public void LockTerrainUnderCursor(bool cursorVisible)
Parameters
Type | Name | Description |
---|---|---|
bool | cursorVisible | Whether the cursor is visible within the scene. When the value is |
Remarks
This method is commonly used when utilizing shortcuts.
See Also
ModifierActive(BrushModifierKey)
Activates a modifier key controller.
Declaration
public bool ModifierActive(BrushModifierKey k)
Parameters
Type | Name | Description |
---|---|---|
BrushModifierKey | k | The modifier key to activate. |
Returns
Type | Description |
---|---|
bool | Returns false when the modifier key controller is null. |
OnEnterToolMode()
Defines data when the brush is selected.
Declaration
public virtual void OnEnterToolMode()
See Also
OnExitToolMode()
Defines data when the brush is deselected.
Declaration
public virtual void OnExitToolMode()
See Also
OnInspectorGUI(Terrain, IOnInspectorGUI, BrushGUIEditFlags)
Renders the brush's GUI within the inspector view.
Declaration
public virtual void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext, BrushGUIEditFlags brushFlags = BrushGUIEditFlags.SelectAndInspect)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
IOnInspectorGUI | editContext | The editcontext used to show the brush GUI. |
BrushGUIEditFlags | brushFlags | The brushflags to use when displaying the brush GUI. |
OnPaint(Terrain, IOnPaint)
Triggers events when painting on a terrain.
Declaration
public virtual void OnPaint(Terrain terrain, IOnPaint editContext)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
IOnPaint | editContext | The editcontext to reference. |
OnSceneGUI(Terrain, IOnSceneGUI)
Triggers events to render objects and displays within Scene view.
Declaration
public virtual void OnSceneGUI(Terrain terrain, IOnSceneGUI editContext)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
IOnSceneGUI | editContext | The editcontext to reference. |
See Also
OnSceneGUI2D(Terrain, IOnSceneGUI)
Triggers events to render a 2D GUI within the Scene view.
Declaration
public virtual void OnSceneGUI2D(Terrain terrain, IOnSceneGUI editContext)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in focus. |
IOnSceneGUI | editContext | The editcontext to reference. |
See Also
RegisterEvent(Event)
Registers a new event to be used witin OnSceneGUI(Terrain, IOnSceneGUI).
Declaration
public void RegisterEvent(Event newEvent)
Parameters
Type | Name | Description |
---|---|---|
Event | newEvent | The event to add. |
RequestRepaint()
Sets the repaint request to true
.
Declaration
public void RequestRepaint()
ScatterBrushStamp(ref Terrain, ref Vector2)
Scatters the location of the brush's stamp operation.
Declaration
public bool ScatterBrushStamp(ref Terrain terrain, ref Vector2 uv)
Parameters
Type | Name | Description |
---|---|---|
Terrain | terrain | The terrain in reference. |
Vector2 | uv | The UV location to scatter at. |
Returns
Type | Description |
---|---|
bool | Returns false if there aren't any terrains to scatter the stamp on. |
UnlockTerrainUnderCursor()
Handles unlocking of the terrain cursor.
Declaration
public void UnlockTerrainUnderCursor()