save selected scene in obs scene list node renderer

This commit is contained in:
Lera Elvoé 2023-11-28 11:13:18 +03:00
parent 1326b3bfad
commit 85b2181622
No known key found for this signature in database
3 changed files with 13 additions and 2 deletions

View file

@ -2,6 +2,7 @@ extends DeckNode
var noobs: NoOBSWS
func _init() -> void:
name = "Scene Selector"
node_type = "obs_scene_list"

View file

@ -27,6 +27,8 @@ var index: int
## The value of this port.
var value: Variant: set = set_value
signal value_updated(new_value: Variant)
func _init(
p_type: DeckType.Types,
@ -50,6 +52,8 @@ func _init(
func set_value(v: Variant) -> void:
if v is Callable:
value = v.call()
value_updated.emit(value)
return
value = v
value_updated.emit(value)

View file

@ -92,8 +92,14 @@ func update_port(port: Port) -> void:
line_edit.text_changed.connect(port.set_value)
"singlechoice":
var box := OptionButton.new()
for item in descriptor_split.slice(1):
box.add_item(item)
if descriptor_split.slice(1).is_empty():
if port.value:
box.add_item(port.value)
else:
box.add_item(port.label)
else:
for item in descriptor_split.slice(1):
box.add_item(item)
add_child(box)
port.value_callback = func(): return box.get_item_text(box.get_selected_id())
if port.type == DeckType.Types.STRING: