Tint the Art Kit marker icon from its selected color
This commit is contained in:
parent
405bdaa2d2
commit
552af7a58c
2 changed files with 24 additions and 1 deletions
|
|
@ -389,6 +389,17 @@ func _run() -> void:
|
||||||
assert(service.get_color_id() == &"ocean_teal")
|
assert(service.get_color_id() == &"ocean_teal")
|
||||||
assert(service.get_brush_size() == 4)
|
assert(service.get_brush_size() == 4)
|
||||||
assert(service.get_grid_size() == 128)
|
assert(service.get_grid_size() == 128)
|
||||||
|
var marker_mode_material := mode_button.material as ShaderMaterial
|
||||||
|
assert(marker_mode_material != null)
|
||||||
|
assert(
|
||||||
|
marker_mode_material.shader.resource_path.ends_with(
|
||||||
|
"/ui/art_kit_marker_icon.gdshader"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
marker_mode_material.get_shader_parameter("marker_color")
|
||||||
|
== SurfaceDrawingPalette.get_color(&"ocean_teal")
|
||||||
|
)
|
||||||
|
|
||||||
mode_button.pressed.emit()
|
mode_button.pressed.emit()
|
||||||
assert(service.is_placement_mode())
|
assert(service.is_placement_mode())
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ const UtilityPageStyleType = preload("res://ui/utility_page_style.gd")
|
||||||
const MARKER_MODE_ICON: Texture2D = preload(
|
const MARKER_MODE_ICON: Texture2D = preload(
|
||||||
"res://items/icons/art/art_kit_marker.png"
|
"res://items/icons/art/art_kit_marker.png"
|
||||||
)
|
)
|
||||||
|
const MARKER_MODE_SHADER: Shader = preload(
|
||||||
|
"res://ui/art_kit_marker_icon.gdshader"
|
||||||
|
)
|
||||||
const GRID_MODE_ICON: Texture2D = preload(
|
const GRID_MODE_ICON: Texture2D = preload(
|
||||||
"res://items/icons/art/art_kit_grid_light.png"
|
"res://items/icons/art/art_kit_grid_light.png"
|
||||||
)
|
)
|
||||||
|
|
@ -28,6 +31,7 @@ var _service: NetworkSurfaceDrawingService
|
||||||
var _unlocks: PlayerArtUnlocks
|
var _unlocks: PlayerArtUnlocks
|
||||||
var _color_buttons: Dictionary[StringName, Button] = {}
|
var _color_buttons: Dictionary[StringName, Button] = {}
|
||||||
var _dock_right: bool = true
|
var _dock_right: bool = true
|
||||||
|
var _marker_mode_material: ShaderMaterial
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
|
@ -44,6 +48,13 @@ func _ready() -> void:
|
||||||
_mode_button.custom_minimum_size = Vector2(48, 48)
|
_mode_button.custom_minimum_size = Vector2(48, 48)
|
||||||
_make_button_round(_mode_button, 24)
|
_make_button_round(_mode_button, 24)
|
||||||
_enlarge_action_icon(_mode_button)
|
_enlarge_action_icon(_mode_button)
|
||||||
|
_marker_mode_material = ShaderMaterial.new()
|
||||||
|
_marker_mode_material.shader = MARKER_MODE_SHADER
|
||||||
|
_marker_mode_material.set_shader_parameter(
|
||||||
|
"marker_color",
|
||||||
|
SurfaceDrawingPalette.get_color(SurfaceDrawingPalette.DEFAULT_COLOR_ID),
|
||||||
|
)
|
||||||
|
_mode_button.material = _marker_mode_material
|
||||||
for button: Button in _action_buttons():
|
for button: Button in _action_buttons():
|
||||||
_enlarge_action_icon(button)
|
_enlarge_action_icon(button)
|
||||||
_mode_button.pressed.connect(_toggle_mode)
|
_mode_button.pressed.connect(_toggle_mode)
|
||||||
|
|
@ -290,7 +301,7 @@ func _on_service_state_changed(
|
||||||
is_active: bool,
|
is_active: bool,
|
||||||
mode_name: String,
|
mode_name: String,
|
||||||
_color_name: String,
|
_color_name: String,
|
||||||
_color_value: Color,
|
color_value: Color,
|
||||||
brush_size: int,
|
brush_size: int,
|
||||||
grid_size: int,
|
grid_size: int,
|
||||||
_status: String,
|
_status: String,
|
||||||
|
|
@ -301,6 +312,7 @@ func _on_service_state_changed(
|
||||||
_mode_button.icon = (
|
_mode_button.icon = (
|
||||||
GRID_MODE_ICON if mode_name == "place grid" else MARKER_MODE_ICON
|
GRID_MODE_ICON if mode_name == "place grid" else MARKER_MODE_ICON
|
||||||
)
|
)
|
||||||
|
_marker_mode_material.set_shader_parameter("marker_color", color_value)
|
||||||
_mode_button.accessibility_name = (
|
_mode_button.accessibility_name = (
|
||||||
"switch to marker mode"
|
"switch to marker mode"
|
||||||
if mode_name == "place grid"
|
if mode_name == "place grid"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue