Skip to content

Commit

Permalink
enh: allow editing of event guid. Mark it red when wrong. (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
piiertho authored Oct 31, 2023
1 parent 1785cc7 commit e76734a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions demo/addons/fmod/tool/property_editors/FmodPathEditorProperty.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
var ui: Control
var guid_property: String
var path_property: String
var regex := RegEx.new()

var default_line_edit_modulate: Color

func initialize(open_project_explorer_callable: Callable, path_prop: String, guid_prop: String):
regex.compile("{\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}}")
guid_property = guid_prop
path_property = path_prop
var guid_and_path_ui: FmodGuidAndPathPropertyEditorUi = %FmodGuidAndPathPropertyEditorUi

default_line_edit_modulate = guid_and_path_ui.get_node("%GuidLineEdit").modulate

var open_project_explorer_event = func open_project_explorer_event():
open_project_explorer_callable.call(self._set_path_and_guid)
guid_and_path_ui.set_callables(open_project_explorer_event, _set_path, _set_guid)
Expand All @@ -22,6 +28,11 @@ func _set_path(path: String):
emit_changed(path_property, path)

func _set_guid(guid: String):
var line_edit := %FmodGuidAndPathPropertyEditorUi.get_node("%GuidLineEdit") as LineEdit
if not regex.search(guid):
line_edit.modulate = Color.RED
return
line_edit.modulate = default_line_edit_modulate
emit_changed(guid_property, guid)

func _set_path_and_guid(path: String, guid: String):
Expand Down

0 comments on commit e76734a

Please sign in to comment.