Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: allow editing of event guid. Mark it red when wrong. #171

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading