mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
save selected scene in obs scene list node renderer
This commit is contained in:
parent
1326b3bfad
commit
85b2181622
3 changed files with 13 additions and 2 deletions
|
@ -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"
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -92,8 +92,14 @@ 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()
|
||||||
for item in descriptor_split.slice(1):
|
if descriptor_split.slice(1).is_empty():
|
||||||
box.add_item(item)
|
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)
|
add_child(box)
|
||||||
port.value_callback = func(): return box.get_item_text(box.get_selected_id())
|
port.value_callback = func(): return box.get_item_text(box.get_selected_id())
|
||||||
if port.type == DeckType.Types.STRING:
|
if port.type == DeckType.Types.STRING:
|
||||||
|
|
Loading…
Reference in a new issue