Description
The Opacity
property in the BrushSettings
class of the Editor.TerrainEditor
namespace represents the transparency level of the brush used in terrain editing. This property allows you to control how much of the brush effect is applied to the terrain, with a range from fully transparent to fully opaque.
Usage
To use the Opacity
property, you can get or set its value within the range of 0 to 1. A value of 0 means the brush is fully transparent and will not affect the terrain, while a value of 1 means the brush is fully opaque and will apply its full effect.
The property is decorated with the Sandbox.PropertyAttribute
and Sandbox.RangeAttribute
, ensuring that the value is clamped between 0 and 1, with a step increment of 0.01.
Example
// Example of setting the Opacity property
BrushSettings brushSettings = new BrushSettings();
// Set the opacity to 50%
brushSettings.Opacity = 0.5f;
// Get the current opacity
float currentOpacity = brushSettings.Opacity;
// Output the current opacity
// Note: Use appropriate logging or UI display methods instead of Console.WriteLine
// Console.WriteLine($"Current Opacity: {currentOpacity}");