Skip to content

Commit

Permalink
Disallow negative brush sizes, minimum size 4
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Jan 19, 2024
1 parent c6a5fb9 commit a85d40c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions project/addons/terrain_3d/editor/components/tool_settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const BRUSH_PATH: String = "res://addons/terrain_3d/editor/brushes"
const PICKER_ICON: String = "res://addons/terrain_3d/icons/icon_picker.svg"

const NONE: int = 0x0
const ALLOW_OUT_OF_BOUNDS: int = 0x1
const ALLOW_LARGER: int = 0x1
const ALLOW_SMALLER: int = 0x2
const ALLOW_OUT_OF_BOUNDS: int = 0x3

var brush_preview_material: ShaderMaterial

Expand All @@ -37,7 +39,7 @@ func _ready() -> void:

add_brushes(list)

add_setting(SettingType.SLIDER, "size", 50, list, "m", 2, 200, 1, ALLOW_OUT_OF_BOUNDS)
add_setting(SettingType.SLIDER, "size", 50, list, "m", 4, 200, 1, ALLOW_LARGER)
add_setting(SettingType.SLIDER, "opacity", 10, list, "%", 1, 100)
add_setting(SettingType.CHECKBOX, "enable", true, list)

Expand Down Expand Up @@ -220,8 +222,9 @@ func add_setting(p_type: SettingType, p_name: StringName, p_value: Variant, p_pa

slider = HSlider.new()
slider.share(control)
if p_flags & ALLOW_OUT_OF_BOUNDS:
if p_flags & ALLOW_LARGER:
slider.set_allow_greater(true)
if p_flags & ALLOW_SMALLER:
slider.set_allow_lesser(true)

else:
Expand Down

0 comments on commit a85d40c

Please sign in to comment.