Skip to content

Commit

Permalink
Fix setting default editor setting for color pickers on label click
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Aug 15, 2024
1 parent d86ddd4 commit 4c2247c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions project/addons/terrain_3d/src/tool_settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ func add_setting(p_args: Dictionary) -> void:
func(value, path):
plugin.set_setting(path, value)
).bind(ES_TOOL_SETTINGS + p_name) )

checkbox.pressed.connect(_on_setting_changed)
pending_children.push_back(checkbox)
control = checkbox
Expand Down Expand Up @@ -553,6 +552,7 @@ func set_setting(p_setting: String, p_value: Variant) -> void:
object.button_pressed = p_value
elif object is ColorPickerButton:
object.color = p_value
plugin.set_setting(ES_TOOL_SETTINGS + p_setting, p_value) # Signal doesn't fire on CPB
elif object is MultiPicker: # Expects p_value is PackedVector3Array
object.points = p_value
_on_setting_changed(object)
Expand All @@ -578,13 +578,12 @@ func _on_setting_changed(p_data: Variant = null) -> void:
if p_data is Button and p_data.get_parent().get_parent() is PopupPanel:
if p_data.get_parent().name == "BrushList":
# Optionally Set selected brush texture in main brush button
# p_data.get_parent().get_parent().get_parent().set_button_icon(p_data.get_button_icon())
# p_data.get_parent().get_parent().get_parent().set_button_icon(p_data.get_button_icon())
# Hide popup
p_data.get_parent().get_parent().set_visible(false)
# Hide label
if p_data.get_child_count() > 0:
p_data.get_child(0).visible = false

emit_signal("setting_changed")


Expand All @@ -597,7 +596,6 @@ func _get_brush_preview_material() -> ShaderMaterial:
if !brush_preview_material:
brush_preview_material = ShaderMaterial.new()
var shader: Shader = Shader.new()

var code: String = "shader_type canvas_item;\n"
code += "varying vec4 v_vertex_color;\n"
code += "void vertex() {\n"
Expand All @@ -608,13 +606,11 @@ func _get_brush_preview_material() -> ShaderMaterial:
code += " COLOR.a *= pow(tex.r, 0.666);\n"
code += " COLOR.rgb = v_vertex_color.rgb;\n"
code += "}\n"

shader.set_code(code)
brush_preview_material.set_shader(shader)
return brush_preview_material



# Counts digits of a number including negative sign, decimal points, and up to 3 decimals
func count_digits(p_value: float) -> int:
var count: int = 1
Expand Down

0 comments on commit 4c2247c

Please sign in to comment.