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 var noobs: NoOBSWS
func _init() -> void: func _init() -> void:
name = "Scene Selector" name = "Scene Selector"
node_type = "obs_scene_list" node_type = "obs_scene_list"

View file

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

View file

@ -92,6 +92,12 @@ func update_port(port: Port) -> void:
line_edit.text_changed.connect(port.set_value) line_edit.text_changed.connect(port.set_value)
"singlechoice": "singlechoice":
var box := OptionButton.new() var box := OptionButton.new()
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): for item in descriptor_split.slice(1):
box.add_item(item) box.add_item(item)
add_child(box) add_child(box)