Stuff
This commit is contained in:
@@ -149,6 +149,9 @@ var VAR := preload("res://addons/dialogic/Modules/Variable/subsystem_variables.g
|
||||
var Voice := preload("res://addons/dialogic/Modules/Voice/subsystem_voice.gd").new():
|
||||
get: return get_subsystem("Voice")
|
||||
|
||||
var Visual := preload("res://addons/dialogic/Modules/Visual/subsystem_visual.gd").new():
|
||||
get: return get_subsystem("Visual")
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -264,4 +264,3 @@ func _on_value_1_variable_value_changed(property_name: Variant, value: Variant)
|
||||
%Value2Type.index_pressed(1)
|
||||
|
||||
something_changed()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://kdpp3mibml33"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_number.gd" id="1_0jdnn"]
|
||||
[ext_resource type="Script" uid="uid://deg8fblljuxmf" path="res://addons/dialogic/Editor/Events/Fields/field_number.gd" id="1_0jdnn"]
|
||||
[ext_resource type="Texture2D" uid="uid://dh1ycbmw8anqh" path="res://addons/dialogic/Editor/Images/Interactable/increment_icon.svg" id="3_v5cne"]
|
||||
[ext_resource type="Texture2D" uid="uid://brjikovneb63n" path="res://addons/dialogic/Editor/Images/Interactable/decrement_icon.svg" id="4_ph52o"]
|
||||
|
||||
@@ -31,7 +31,7 @@ bg_color = Color(0.94, 0.94, 0.94, 0)
|
||||
border_color = Color(0, 0, 0, 0)
|
||||
|
||||
[node name="Field_Number" type="HBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchors_preset = -1
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = -1102.0
|
||||
@@ -60,8 +60,8 @@ size_flags_vertical = 4
|
||||
mouse_filter = 1
|
||||
mouse_default_cursor_shape = 1
|
||||
theme_override_colors/default_color = Color(0.54099, 0.540991, 0.54099, 1)
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_sj3oj")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_sj3oj")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_sj3oj")
|
||||
bbcode_enabled = true
|
||||
fit_content = true
|
||||
scroll_active = false
|
||||
@@ -78,8 +78,8 @@ size_flags_horizontal = 3
|
||||
focus_mode = 1
|
||||
theme_override_constants/minimum_character_width = 0
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_8yqsu")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_8yqsu")
|
||||
theme_override_styles/read_only = SubResource("StyleBoxEmpty_8yqsu")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_8yqsu")
|
||||
text = "0"
|
||||
alignment = 1
|
||||
expand_to_text_length = true
|
||||
@@ -95,8 +95,8 @@ size_flags_horizontal = 8
|
||||
size_flags_vertical = 4
|
||||
mouse_default_cursor_shape = 1
|
||||
theme_override_colors/default_color = Color(0.435192, 0.435192, 0.435192, 1)
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_smq50")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_smq50")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_smq50")
|
||||
bbcode_enabled = true
|
||||
fit_content = true
|
||||
scroll_active = false
|
||||
@@ -113,17 +113,17 @@ theme_override_constants/separation = 0
|
||||
alignment = 1
|
||||
|
||||
[node name="Increment" type="Button" parent="Value_Panel/Layout/Spin"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
auto_translate = false
|
||||
focus_neighbor_left = NodePath("../../Value")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../Decrement")
|
||||
theme_override_colors/icon_hover_color = Color(0.412738, 0.550094, 0.760917, 1)
|
||||
theme_override_colors/icon_focus_color = Color(0.412738, 0.550094, 0.760917, 1)
|
||||
theme_override_colors/icon_hover_color = Color(0.412738, 0.550094, 0.760917, 1)
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_increment")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_increment")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_increment")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_increment")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxFlat_increment")
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_increment")
|
||||
icon = ExtResource("3_v5cne")
|
||||
@@ -131,17 +131,17 @@ flat = true
|
||||
vertical_icon_alignment = 2
|
||||
|
||||
[node name="Decrement" type="Button" parent="Value_Panel/Layout/Spin"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
auto_translate = false
|
||||
focus_neighbor_left = NodePath("../../Value")
|
||||
focus_neighbor_top = NodePath("../Increment")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
theme_override_colors/icon_hover_color = Color(0.412738, 0.550094, 0.760917, 1)
|
||||
theme_override_colors/icon_focus_color = Color(0.412738, 0.550094, 0.760917, 1)
|
||||
theme_override_colors/icon_hover_color = Color(0.412738, 0.550094, 0.760917, 1)
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_decrement")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_decrement")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_decrement")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_decrement")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxFlat_decrement")
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_decrement")
|
||||
icon = ExtResource("4_ph52o")
|
||||
|
||||
@@ -235,5 +235,3 @@ func _on_search_up_pressed() -> void:
|
||||
get_current_editor()._search_navigate_up()
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
156
addons/dialogic/Modules/Visual/event_visual.gd
Normal file
156
addons/dialogic/Modules/Visual/event_visual.gd
Normal file
@@ -0,0 +1,156 @@
|
||||
@tool
|
||||
class_name DialogicVisualEvent
|
||||
extends DialogicEvent
|
||||
|
||||
## Event to show pictures in the foreground and switch between them.
|
||||
|
||||
### Settings
|
||||
|
||||
## The scene to use. If empty, this will default to the DefaultVisual.gd scene.
|
||||
## This scene supports images and fading.
|
||||
## If you set it to a scene path, then that scene will be instanced.
|
||||
## Learn more about custom visuals in the Subsystem_Visual.gd docs.
|
||||
var scene := ""
|
||||
## The argument that is passed to the visual scene.
|
||||
## For the default scene it's the path to the image to show.
|
||||
var argument := ""
|
||||
## The time the fade animation will take. Leave at 0 for instant change.
|
||||
var fade: float = 0.0
|
||||
## Name of the transition to use.
|
||||
var transition := ""
|
||||
|
||||
## Helpers for visual editor
|
||||
enum ArgumentTypes {IMAGE, CUSTOM}
|
||||
var _arg_type := ArgumentTypes.IMAGE :
|
||||
get:
|
||||
if argument.begins_with("res://"):
|
||||
return ArgumentTypes.IMAGE
|
||||
else:
|
||||
return _arg_type
|
||||
set(value):
|
||||
if value == ArgumentTypes.CUSTOM:
|
||||
if argument.begins_with("res://"):
|
||||
argument = " "+argument
|
||||
_arg_type = value
|
||||
|
||||
enum SceneTypes {DEFAULT, CUSTOM}
|
||||
var _scene_type := SceneTypes.DEFAULT :
|
||||
get:
|
||||
if scene.is_empty():
|
||||
return _scene_type
|
||||
else:
|
||||
return SceneTypes.CUSTOM
|
||||
set(value):
|
||||
if value == SceneTypes.DEFAULT:
|
||||
scene = ""
|
||||
_scene_type = value
|
||||
|
||||
#region EXECUTION
|
||||
################################################################################
|
||||
|
||||
func _execute() -> void:
|
||||
var final_fade_duration := fade
|
||||
|
||||
if dialogic.Inputs.auto_skip.enabled:
|
||||
var time_per_event: float = dialogic.Inputs.auto_skip.time_per_event
|
||||
final_fade_duration = min(fade, time_per_event)
|
||||
|
||||
dialogic.Visual.update_visual(scene, argument, final_fade_duration, transition)
|
||||
|
||||
finish()
|
||||
|
||||
#endregion
|
||||
|
||||
#region INITIALIZE
|
||||
################################################################################
|
||||
|
||||
func _init() -> void:
|
||||
event_name = "Visual"
|
||||
set_default_color('Color8')
|
||||
event_category = "Visuals"
|
||||
event_sorting_index = 2
|
||||
|
||||
#endregion
|
||||
|
||||
#region SAVE & LOAD
|
||||
################################################################################
|
||||
|
||||
func get_shortcode() -> String:
|
||||
return "visual"
|
||||
|
||||
|
||||
func get_shortcode_parameters() -> Dictionary:
|
||||
return {
|
||||
#param_name : property_info
|
||||
"scene" : {"property": "scene", "default": ""},
|
||||
"arg" : {"property": "argument", "default": ""},
|
||||
"fade" : {"property": "fade", "default": 0},
|
||||
"transition" : {"property": "transition", "default": "",
|
||||
"suggestions": get_transition_suggestions},
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region EDITOR REPRESENTATION
|
||||
################################################################################
|
||||
|
||||
func build_event_editor() -> void:
|
||||
add_header_edit('_scene_type', ValueType.FIXED_OPTIONS, {
|
||||
'left_text' :'Show',
|
||||
'options': [
|
||||
{
|
||||
'label': 'Visual',
|
||||
'value': SceneTypes.DEFAULT,
|
||||
'icon': ["GuiRadioUnchecked", "EditorIcons"]
|
||||
},
|
||||
{
|
||||
'label': 'Custom Scene',
|
||||
'value': SceneTypes.CUSTOM,
|
||||
'icon': ["PackedScene", "EditorIcons"]
|
||||
}
|
||||
]})
|
||||
add_header_label("with image", "_scene_type == SceneTypes.DEFAULT")
|
||||
add_header_edit("scene", ValueType.FILE,
|
||||
{'file_filter':'*.tscn, *.scn; Scene Files',
|
||||
'placeholder': "Custom scene",
|
||||
'editor_icon': ["PackedScene", "EditorIcons"],
|
||||
}, '_scene_type == SceneTypes.CUSTOM')
|
||||
add_header_edit('_arg_type', ValueType.FIXED_OPTIONS, {
|
||||
'left_text' : 'with',
|
||||
'options': [
|
||||
{
|
||||
'label': 'Image',
|
||||
'value': ArgumentTypes.IMAGE,
|
||||
'icon': ["Image", "EditorIcons"]
|
||||
},
|
||||
{
|
||||
'label': 'Custom Argument',
|
||||
'value': ArgumentTypes.CUSTOM,
|
||||
'icon': ["String", "EditorIcons"]
|
||||
}
|
||||
], "symbol_only": true}, "_scene_type == SceneTypes.CUSTOM")
|
||||
add_header_edit('argument', ValueType.FILE,
|
||||
{'file_filter':'*.jpg, *.jpeg, *.png, *.webp, *.tga, *svg, *.bmp, *.dds, *.exr, *.hdr; Supported Image Files',
|
||||
'placeholder': "No Image",
|
||||
'editor_icon': ["Image", "EditorIcons"],
|
||||
},
|
||||
'_arg_type == ArgumentTypes.IMAGE or _scene_type == SceneTypes.DEFAULT')
|
||||
add_header_edit('argument', ValueType.SINGLELINE_TEXT, {}, '_arg_type == ArgumentTypes.CUSTOM')
|
||||
|
||||
add_body_edit("transition", ValueType.DYNAMIC_OPTIONS,
|
||||
{'left_text':'Transition:',
|
||||
'empty_text':'Simple Fade',
|
||||
'suggestions_func':get_transition_suggestions,
|
||||
'editor_icon':["PopupMenu", "EditorIcons"]})
|
||||
add_body_edit("fade", ValueType.NUMBER, {'left_text':'Fade time:'})
|
||||
|
||||
|
||||
func get_transition_suggestions(_filter:String="") -> Dictionary:
|
||||
var transitions := DialogicResourceUtil.list_special_resources("BackgroundTransition")
|
||||
var suggestions := {}
|
||||
for i in transitions:
|
||||
suggestions[DialogicUtil.pretty_name(i)] = {'value': DialogicUtil.pretty_name(i), 'editor_icon': ["PopupMenu", "EditorIcons"]}
|
||||
return suggestions
|
||||
|
||||
#endregion
|
||||
1
addons/dialogic/Modules/Visual/event_visual.gd.uid
Normal file
1
addons/dialogic/Modules/Visual/event_visual.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bflq0peywpm2l
|
||||
BIN
addons/dialogic/Modules/Visual/icon.png
Normal file
BIN
addons/dialogic/Modules/Visual/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 846 B |
40
addons/dialogic/Modules/Visual/icon.png.import
Normal file
40
addons/dialogic/Modules/Visual/icon.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b72ikmdpt6dme"
|
||||
path="res://.godot/imported/icon.png-f5a2e1d70773a06808be10747d898c4d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/dialogic/Modules/Visual/icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-f5a2e1d70773a06808be10747d898c4d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
10
addons/dialogic/Modules/Visual/index.gd
Normal file
10
addons/dialogic/Modules/Visual/index.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
@tool
|
||||
extends DialogicIndexer
|
||||
|
||||
|
||||
func _get_events() -> Array:
|
||||
return [this_folder.path_join('event_visual.gd')]
|
||||
|
||||
|
||||
func _get_subsystems() -> Array:
|
||||
return [{'name':'Visual', 'script':this_folder.path_join('subsystem_visual.gd')}]
|
||||
1
addons/dialogic/Modules/Visual/index.gd.uid
Normal file
1
addons/dialogic/Modules/Visual/index.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dccv6ady6vp7t
|
||||
186
addons/dialogic/Modules/Visual/subsystem_visual.gd
Normal file
186
addons/dialogic/Modules/Visual/subsystem_visual.gd
Normal file
@@ -0,0 +1,186 @@
|
||||
extends DialogicSubsystem
|
||||
## Subsystem for managing visuals.
|
||||
##
|
||||
## This subsystem has many different helper methods for managing backgrounds.
|
||||
## For instance, you can listen to background changes via
|
||||
## [signal background_changed].
|
||||
|
||||
|
||||
## Whenever a new background is set, this signal is emitted and contains a
|
||||
## dictionary with the following keys: [br]
|
||||
## [br]
|
||||
## Key | Value Type | Value [br]
|
||||
## ----------- | ------------- | ----- [br]
|
||||
## `scene` | [type String] | The scene path of the new background. [br]
|
||||
## `argument` | [type String] | Information given to the background on its update routine. [br]
|
||||
## `fade_time` | [type float] | The time the background may take to transition in. [br]
|
||||
## `same_scene`| [type bool] | If the new background uses the same Godot scene. [br]
|
||||
signal background_changed(info: Dictionary)
|
||||
|
||||
## The default background scene Dialogic will use.
|
||||
var default_background_scene: PackedScene = load(get_script().resource_path.get_base_dir().path_join('DefaultBackgroundScene/default_background.tscn'))
|
||||
## The default transition Dialogic will use.
|
||||
var default_transition: String = get_script().resource_path.get_base_dir().path_join("Transitions/Defaults/simple_fade.gd")
|
||||
|
||||
|
||||
#region STATE
|
||||
####################################################################################################
|
||||
|
||||
## Empties the current background state.
|
||||
func clear_game_state(_clear_flag := DialogicGameHandler.ClearFlags.FULL_CLEAR) -> void:
|
||||
update_visual()
|
||||
|
||||
## Loads the background state from the current state info.
|
||||
func load_game_state(_load_flag := LoadFlags.FULL_LOAD) -> void:
|
||||
update_visual(dialogic.current_state_info.get('background_scene', ''), dialogic.current_state_info.get('background_argument', ''), 0.0, default_transition, true)
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region MAIN METHODS
|
||||
####################################################################################################
|
||||
|
||||
## Method that adds a given scene as child of the DialogicNode_BackgroundHolder.
|
||||
## It will call [_update_background()] on that scene with the given argument [argument].
|
||||
## It will call [_fade_in()] on that scene with the given fade time.
|
||||
## Will call fade_out on previous backgrounds scene.
|
||||
##
|
||||
## If the scene is the same as the last background you can bypass another instantiating
|
||||
## and use the same scene.
|
||||
## To do so implement [_should_do_background_update()] on the custom background scene.
|
||||
## Then [_update_background()] will be called directly on that previous scene.
|
||||
func update_visual(scene := "", argument := "", fade_time := 0.0, transition_path:=default_transition, force := false) -> void:
|
||||
var background_holder: DialogicNode_BackgroundHolder
|
||||
if dialogic.has_subsystem('Styles'):
|
||||
background_holder = dialogic.Styles.get_first_node_in_layout('dialogic_background_holders')
|
||||
else:
|
||||
background_holder = get_tree().get_first_node_in_group('dialogic_background_holders')
|
||||
|
||||
var info := {'scene':scene, 'argument':argument, 'fade_time':fade_time, 'same_scene':false}
|
||||
if background_holder == null:
|
||||
background_changed.emit(info)
|
||||
return
|
||||
|
||||
|
||||
var bg_set := false
|
||||
|
||||
# First try just updating the existing scene.
|
||||
if scene == dialogic.current_state_info.get('visual_scene', ''):
|
||||
|
||||
if not force and argument == dialogic.current_state_info.get('visual_argument', ''):
|
||||
return
|
||||
|
||||
for old_bg in background_holder.get_children():
|
||||
if !old_bg.has_meta('node') or not old_bg.get_meta('node') is DialogicBackground:
|
||||
continue
|
||||
|
||||
var prev_bg_node: DialogicBackground = old_bg.get_meta('node')
|
||||
if prev_bg_node._should_do_background_update(argument):
|
||||
prev_bg_node._update_background(argument, fade_time)
|
||||
bg_set = true
|
||||
info['same_scene'] = true
|
||||
|
||||
dialogic.current_state_info['visual_scene'] = scene
|
||||
dialogic.current_state_info['visual_argument'] = argument
|
||||
|
||||
if bg_set:
|
||||
background_changed.emit(info)
|
||||
return
|
||||
|
||||
var old_viewport: SubViewportContainer = null
|
||||
if background_holder.has_meta('current_viewport'):
|
||||
old_viewport = background_holder.get_meta('current_viewport', null)
|
||||
|
||||
var new_viewport: SubViewportContainer
|
||||
if scene.ends_with('.tscn') and ResourceLoader.exists(scene):
|
||||
new_viewport = add_background_node(load(scene), background_holder)
|
||||
elif argument:
|
||||
new_viewport = add_background_node(default_background_scene, background_holder)
|
||||
else:
|
||||
new_viewport = null
|
||||
|
||||
var trans_script: Script = load(DialogicResourceUtil.guess_special_resource("BackgroundTransition", transition_path, {"path":default_transition}).path)
|
||||
var trans_node := Node.new()
|
||||
trans_node.set_script(trans_script)
|
||||
trans_node = (trans_node as DialogicBackgroundTransition)
|
||||
trans_node.bg_holder = background_holder
|
||||
trans_node.time = fade_time
|
||||
|
||||
if old_viewport:
|
||||
trans_node.prev_scene = old_viewport.get_meta('node', null)
|
||||
trans_node.prev_texture = old_viewport.get_child(0).get_texture()
|
||||
old_viewport.get_meta('node')._custom_fade_out(fade_time)
|
||||
old_viewport.hide()
|
||||
# TODO We have to call this again here because of https://github.com/godotengine/godot/issues/23729
|
||||
old_viewport.get_child(0).render_target_update_mode = SubViewport.UPDATE_ALWAYS
|
||||
trans_node.transition_finished.connect(old_viewport.queue_free)
|
||||
if new_viewport:
|
||||
trans_node.next_scene = new_viewport.get_meta('node', null)
|
||||
trans_node.next_texture = new_viewport.get_child(0).get_texture()
|
||||
new_viewport.get_meta('node')._update_background(argument, fade_time)
|
||||
new_viewport.get_meta('node')._custom_fade_in(fade_time)
|
||||
else:
|
||||
background_holder.remove_meta('current_viewport')
|
||||
|
||||
add_child(trans_node)
|
||||
if fade_time == 0:
|
||||
trans_node.transition_finished.emit()
|
||||
_on_transition_finished(background_holder, trans_node)
|
||||
else:
|
||||
trans_node.transition_finished.connect(_on_transition_finished.bind(background_holder, trans_node))
|
||||
# We need to break this connection if the background_holder get's removed during the transition
|
||||
background_holder.tree_exited.connect(trans_node.disconnect.bind("transition_finished", _on_transition_finished))
|
||||
trans_node._fade()
|
||||
|
||||
background_changed.emit(info)
|
||||
|
||||
|
||||
func _on_transition_finished(background_node:DialogicNode_BackgroundHolder, transition_node:DialogicBackgroundTransition) -> void:
|
||||
if background_node.has_meta("current_viewport"):
|
||||
if background_node.get_meta("current_viewport").get_meta("node", null) == transition_node.next_scene:
|
||||
background_node.get_meta("current_viewport").show()
|
||||
background_node.material = null
|
||||
background_node.color = Color.TRANSPARENT
|
||||
transition_node.queue_free()
|
||||
|
||||
|
||||
## Adds sub-viewport with the given background scene as child to
|
||||
## Dialogic scene.
|
||||
func add_background_node(scene:PackedScene, parent:DialogicNode_BackgroundHolder) -> SubViewportContainer:
|
||||
var v_con := SubViewportContainer.new()
|
||||
var viewport := SubViewport.new()
|
||||
var b_scene := scene.instantiate()
|
||||
if not b_scene is DialogicBackground:
|
||||
printerr("[Dialogic] Given background scene was not of type DialogicBackground! Make sure the scene has a script that extends DialogicBackground.")
|
||||
v_con.queue_free()
|
||||
viewport.queue_free()
|
||||
b_scene.queue_free()
|
||||
return null
|
||||
|
||||
parent.add_child(v_con)
|
||||
v_con.hide()
|
||||
v_con.stretch = true
|
||||
v_con.size = parent.size
|
||||
v_con.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
|
||||
v_con.add_child(viewport)
|
||||
viewport.transparent_bg = true
|
||||
viewport.disable_3d = true
|
||||
viewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS
|
||||
viewport.canvas_item_default_texture_filter = ProjectSettings.get_setting("rendering/textures/canvas_textures/default_texture_filter")
|
||||
|
||||
viewport.add_child(b_scene)
|
||||
b_scene.viewport = viewport
|
||||
b_scene.viewport_container = v_con
|
||||
|
||||
parent.set_meta('current_viewport', v_con)
|
||||
v_con.set_meta('node', b_scene)
|
||||
|
||||
return v_con
|
||||
|
||||
|
||||
## Whether a visual is set.
|
||||
func has_visual() -> bool:
|
||||
return !dialogic.current_state_info.get('visual_scene', '').is_empty() or !dialogic.current_state_info.get('visual_argument','').is_empty()
|
||||
|
||||
#endregion
|
||||
1
addons/dialogic/Modules/Visual/subsystem_visual.gd.uid
Normal file
1
addons/dialogic/Modules/Visual/subsystem_visual.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://digbgc8bv3bg6
|
||||
Reference in New Issue
Block a user