diff --git a/addons/dialogic/Editor/Events/EventBlock/event_block.gd b/addons/dialogic/Editor/Events/EventBlock/event_block.gd index 86f154d19..bb6c3d50e 100644 --- a/addons/dialogic/Editor/Events/EventBlock/event_block.gd +++ b/addons/dialogic/Editor/Events/EventBlock/event_block.gd @@ -48,8 +48,8 @@ func _ready(): printerr("[Dialogic] Event block was added without a resource specified.") return - initialize_logic() initialize_ui() + initialize_logic() func initialize_ui() -> void: @@ -63,7 +63,7 @@ func initialize_ui() -> void: %Warning.position = Vector2(-5 * _scale, -10 * _scale) # Expand Button - %ExpandButton.icon = get_theme_icon("CodeFoldDownArrow", "EditorIcons") + %ExpandButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons") %ExpandButton.modulate = get_theme_color("readonly_color", "Editor") # Icon Panel @@ -90,6 +90,8 @@ func initialize_ui() -> void: %CollapseButton.icon = get_theme_icon("Collapse", "EditorIcons") %CollapseButton.hide() + %Body.add_theme_constant_override("margin_left", icon_size * _scale) + visual_deselect() @@ -99,10 +101,10 @@ func initialize_logic() -> void: resource.ui_update_needed.connect(_on_resource_ui_update_needed) resource.ui_update_warning.connect(set_warning) - _on_ExpandButton_toggled(resource.expand_by_default) - content_changed.connect(recalculate_field_visibility) + _on_ExpandButton_toggled(resource.expand_by_default or resource.created_by_button) + #endregion @@ -162,6 +164,7 @@ var FIELD_SCENES := { func build_editor(build_header:bool = true, build_body:bool = false) -> void: var current_body_container: HFlowContainer = null + if build_body and body_was_build: build_body = false @@ -348,13 +351,14 @@ func _on_ExpandButton_toggled(button_pressed:bool) -> void: if button_pressed and !body_was_build: build_editor(false, true) %ExpandButton.set_pressed_no_signal(button_pressed) + if button_pressed: %ExpandButton.icon = get_theme_icon("CodeFoldDownArrow", "EditorIcons") else: %ExpandButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons") + expanded = button_pressed %Body.visible = button_pressed - %Body.add_theme_constant_override("margin_left", icon_size*DialogicUtil.get_editor_scale()) if find_parent('VisualEditor') != null: find_parent('VisualEditor').indent_events() diff --git a/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd b/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd index 874448030..43fe5cd86 100644 --- a/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd +++ b/addons/dialogic/Editor/TimelineEditor/VisualEditor/timeline_editor_visual.gd @@ -290,7 +290,7 @@ func _on_event_block_gui_input(event, item: Node): if len(selected_items) > 0 and event is InputEventMouseMotion: if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - if !%TimelineArea.dragging: + if !%TimelineArea.dragging and !get_viewport().gui_is_dragging(): sort_selection() %TimelineArea.start_dragging(%TimelineArea.DragTypes.EXISTING_EVENTS, selected_items) diff --git a/addons/dialogic/Modules/Background/event_background.gd b/addons/dialogic/Modules/Background/event_background.gd index 4e9279d85..1c860e4f4 100644 --- a/addons/dialogic/Modules/Background/event_background.gd +++ b/addons/dialogic/Modules/Background/event_background.gd @@ -19,9 +19,33 @@ var fade: float = 0.0 ## Name of the transition to use. var transition: String = "" - -################################################################################ -## EXECUTION +## 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: @@ -35,9 +59,9 @@ func _execute() -> void: finish() +#endregion -################################################################################ -## INITIALIZE +#region INITIALIZE ################################################################################ func _init() -> void: @@ -46,9 +70,9 @@ func _init() -> void: event_category = "Visuals" event_sorting_index = 0 +#endregion -################################################################################ -## SAVING/LOADING +#region SAVE & LOAD ################################################################################ func get_shortcode() -> String: @@ -66,29 +90,58 @@ func get_shortcode_parameters() -> Dictionary: } -################################################################################ -## EDITOR REPRESENTATION +#endregion + +#region EDITOR REPRESENTATION ################################################################################ func build_event_editor(): - add_header_edit('argument', ValueType.FILE, - {'left_text' : 'Show', - 'file_filter':'*.jpg, *.jpeg, *.png, *.webp, *.tga, *svg, *.bmp, *.dds, *.exr, *.hdr; Supported Image Files', - 'placeholder': "No background", - 'editor_icon':["Image", "EditorIcons"]}, - 'scene == ""') + add_header_edit('_scene_type', ValueType.FIXED_OPTIONS, { + 'left_text' :'Show', + 'options': [ + { + 'label': 'Default Scene', + 'value': SceneTypes.DEFAULT, + 'icon': ["GuiRadioUnchecked", "EditorIcons"] + }, + { + 'label': 'Custom Scene', + 'value': SceneTypes.CUSTOM, + 'icon': ["PackedScene", "EditorIcons"] + } + ], "symbol_only": true}) + add_header_label("Default BG Scene with", '_scene_type == SceneTypes.DEFAULT') add_header_edit("scene", ValueType.FILE, - {'left_text' :'Scene:', - 'file_filter':'*.tscn, *.scn; Scene Files', + {'file_filter':'*.tscn, *.scn; Scene Files', 'placeholder': "Default scene", - 'editor_icon':["PackedScene", "EditorIcons"]}) - add_body_edit('argument', ValueType.SINGLELINE_TEXT, {'left_text':'Argument:'}, 'scene != ""') + }, '_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", + }, + '_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:'}) + add_body_edit("fade", ValueType.NUMBER, {'left_text':'Fade time:'}) func get_transition_suggestions(filter:String="") -> Dictionary: @@ -97,3 +150,5 @@ func get_transition_suggestions(filter:String="") -> Dictionary: for i in transitions: suggestions[DialogicUtil.pretty_name(i)] = {'value': DialogicUtil.pretty_name(i), 'editor_icon': ["PopupMenu", "EditorIcons"]} return suggestions + +#endregion