Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get tree() null ref fix #2051

Closed
wants to merge 83 commits into from

Conversation

Invertex
Copy link
Contributor

get_tree() can return null when the Dialogic view isn't open but this function is being called by an external system. No node tree exists to wait for or manipulate, so errors are spammed.

Invertex and others added 30 commits November 4, 2023 07:46
When the custom defined portrait path fails to load, the code still tries to interact with the null instance, since it only handled the case where the path was Empty, but not when simply incorrect/broken path.

Instead of `scene_path.is_empty()`, we could also use `FileAccess.file_exists(scene_path)`, but figured I'd avoid the double file access command.
get_tree() can return null when the Dialogic view isn't open but this function is being called by an external system. No node tree exists to wait for or manipulate, and so errors are spammed.
* Use `toggled` signal to provide boolean.

* Remove `print`.
* Use `keycode` instead of `scancode`.

* Connect choice hotkeys to `BaseButton.pressed`.

* Add customisable choice keys to Choice buttons.

* Handle customisable Choice input keys.

* Fix assigning `shortcut.events`.

* Fix `if`-statement for 1-9 Choice keys.

* Remove press_choice_keys and simplify code

---------

Co-authored-by: Jowan-Spooner <[email protected]>
* Allow a .png icon in the repo (update to gitignore)

* Make sure undo history of text editor is cleared on load

Fix dialogic-godot#1817

* Clear up character editor scripts

- also fix dialogic-godot#1830
- fixes type sound (per portrait) visibility update

* Remove print

* Improve DGH

Adds lot's of documentation to the DGH
- rename State.SHOWING_TEXT to State.REVEALING_TEXT
- rename _add_layout_node to add_layout_node
- reorder methods
- change to region comments
* Fix incorrect description of `DialogicAutoAdvance`.

* Add `per_word_delay` variable.

* Add `per_character_delay` variable.

* Add variables for ignoring characters.

* Add `await_playing_voice` variable.

* Add `fixed_delay` variable.

* Add `override_delay_for_current_event` variable.

* Add `waiting_for_next_event` variable.

* Add `waiting_for_system` variable.

* Add `waiting_for_user_input` variable.

* Add `delay_modifier` variable.

* Remove `get_autoadvance_info` method.

* Rename variables and signals.

* Adjust API of Auto-Advance and Auto-Skip.
Change signals to `toggled`.
Change Auto-Advance method approach to variables.
Rename Auto-Advance enable flags.

* Move `ProjectSettings` configuration to `_init`.

* Add missing word.

* Move `class_name` before documentation.

* Fixed variable doc referencing itself.

* Improve signal receiver name.

* Rename `start_autoadvance` to `start`.

* Simplify method naming.

* Remove setters for stacking enable flags.

* Move `class_name` up.

* Use delay override variable directly.

* Rename `_emit_autoadvance_enabled`.

* Remove invalid access.

* Use correct user-input enable flag.
Update badge and some other stuff to.
Add #Dialogic back in.
* Change small margin

* Fix pause effect not working

* Make sure deleted files are closed correctly

Also removes deleted files from the resource list instantly.
- fixes dialogic-godot#1807

Implements a clear method on the character editor (just switches back to "No Character Screen")
…dialogic-godot#1839)

This keeps all the new viewport and shader stuff but offloads most of the work to behind the scenes. This means background scenes can work just as they did previously. However they are manually put into subvieports+subviewportcontainers. The backgrounds-holder is now also the background-displayer.

_fade_out() and _fade_in() have been renamed to _custom_fade_out() and _custom_fade_in(). Right now they work "additionally" to the default fade which happens as well. If you know what you are doing you can work around this though.
I have to put further thought into custom transitions as I have no real idea what the best user-experience/use case might be.

---------

Co-authored-by: Jowan-Spooner <[email protected]>
* Fix choice buttons connected too many times.
If a choice gets revisited, it errors because of connecting to
the `BaseButton.pressed` again.

* Update signals on already connected buttons.
* Use `ProjectSettings` to get settings.

* Rework updating CSV.
Move CSV file handling to class.
Reduce code repetition.
Update project settings when changing translation file mode.
Add save file location mode.

* Relocate tooltips on translation settings.

* Improve translation settings text.

* Add event statistics to `DialogicCsvFile`

* Properly clear and write to the file.

* Improve collecting translations.
Remove invalid translation file paths.
Find the the correct translation file ending.

* Improve tooltip wording.

* Improve tooltip.

* Create the file if it does not exist.
Use `WRITE` instead of `READ`.

* Improve node naming.

* Update tooltips.

* Conditionally disable the `Update CSV` button.

* Add `_verify_translation_file` method.

* Minor variable  improvements.

* Minor style guide improvements.

* Add trailing newline at the file end.

* Fix `class_name` and `extends` order.

* Fix comment text.

* Remove `print`.

* Add extra newline between methods.

* Reorder translation settings and reword labels.

* Improve text on translation settings page.
* Fix animation suggestion on leave event

* Update version number
* Set string empty and add static typing.
Before, if `null`, `speaker_updated` never got emitted and state info was not updated.

* Add documentation to `update_name_label`.

* Simplify `if` condition.

* Add newlines to each section.
* Generate translation for character names.

* Add property translation to `DialogicCharacter`.

* Fix property key.

* Improve counting CSV updates and additions.

* Improve `Update CSV files` status message.

* Add check if `current_resource` is not `null`.

* Fix file paths for characters and `Per Timeline` mode.

* Refactor CSV and translation deletion.

* Fix using wrong default name for character CSV.

* Lock Translation Settings if CSV were generated.

* Improve deletion of CSV related items.

* Hide dialogue window.

* Improve Translation Settings text.

* Add info about deleting translation IDs.

* Use translated character nicknames.

* Add missing type.

* Remove unused variable.

* Add missing newlines.

* Remove redundant `await`.

* Add `get_display_name_translated`.

* Check if event has `character`.

* Add type Godot cannot infer.

* Fix `characters` variable exist check.

* Update method usage.

* Check if translation is translation key.

* Fix check if translation is translation key.

* Fix duplicates of character properties in the CSV.
They duplicated if there were multiple timelines referencing characters.

* Fix word.

* Fix handling timeline CSV collecting.

* Small fixes for character line collection

* Fix two translation bugs

- Fixed translated nicknames method complaining about PackedStringArray (godot being stupid)
- Fixed event translations being compared to incorrect key for fallback.

* Fix closing and opening editor timeline on deletion.

---------

Co-authored-by: Jowan-Spooner <[email protected]>
* First commit with a ton of style-editor work

* Improvements to realizing layouts

* Add inheritance (and other stuff)

* Another Update

* Make Styles actual Resources

This makes a lot of the implementation a lot cleaner.

* Rename and Remove stuff

* Remove some trash

* Remove old layouts

* Remove my testing stuff

* A bunch of renames and a new textbubble style!

* Small Style adjustments

* Fix for character styles and style event UI

* Fixes to hint tooltips

* Add many preview images to premade styles & layers

* A bunch of fixes

* More fixes

* Small UX improvements

* Another UX improvement

Set's the style name as expected when creating style resource (based on the file name).

* Small Addition
- fixes dialogic-godot#1890
- fixes dialogic-godot#1896
- fixes/implements dialogic-godot#1903
- fixes/implements dialogic-godot#1310
- fixes dialogic-godot#1907
- fixes dialogic-godot#1926

# Bigger changes
- Makes it so when a glossary is hovered all dialogic input is blocked.
- Moves Portrait Z-index to a tree-order based system that sorts the portrait containers. This simplifies layout setups. Discussed on discord.
- removes old files/folders
* Initial implementation of floating window mode

* Small adjustments to opening/closing behaviour
* Fix simple-string portraits

* Fix _highlight & _unhighlight and make custom portrait easier

This offloads a lot of the work for simple Sprite and TextureRect based portraits a lot easier by having helper methods on the portrait do that work.
This will allow us to make more variations of these kinds of portraits very easily.

* Example Custom Portrait with Highlighting

Also small jump suggestions change.
* Fix audio bug

* Hide loop field on WAV files
…godot#1945)

The perpare() method should preload all the packed scenes needed for the particular style, thus fixing a lag-spike. Needs to be called manually right now.
This fixes the link in the getting started related to dialogic-godot#1948
This moves the unique-identifier directories to a new DialogicResourceUtil class.
It simplifies the creation, access and modification of these directories.

Importantly the timeline and character directory are now saved in the project settings. This allows us to make them editable.

This also adds a Unique Identifiers tab to the Reference Manager window where you can edit them.

This PR does a bunch of other restructuring as well.
Jowan-Spooner and others added 28 commits January 25, 2024 20:21
* Improve README.md Organization and Visual Appeal

Enhanced the structure and visual appeal of the README.md file. Added a table of contents for easier navigation, centered the main title and image for visual appeal, and organized the sections in a more structured way.
- fixes dialogic-godot#2008
- fixes dialogic-godot#2007
- fixes dialogic-godot#2003
- partially adresses dialogic-godot#1995

- also cleans up character and timeline resource scripts
This allows CTRL+Clicking Characters and Timelines to open them instantly.
…warnings or errors (dialogic-godot#1975)

Adds static type hints to default style layers

---------

Co-authored-by: Jowan-Spooner <[email protected]>
Co-authored-by: Jowan-Spooner <[email protected]>
* Fix incorrect Auto-Advance flag being disabled.

* Add missing double newline between methods.

* Add tests for Auto-Advance.

* Add `[autoload]` to the project file.

* Remove `class_name` from unit tests.
When setting a dialogic variable in code, it showed a bug here after alpha 12.

The method called _set_value_in_dictionary in outside as VariableFolder has been removed since commit Variables Rework (second PR attempt) (dialogic-godot#1972)
* Extend `DialogicPortrait` by custom portraits.

* Fix root name's extra `s`.

* Format and fix errors.

* Simplify by using `self`.
…ogic-godot#2012)

* Refactor plugin.gd for improved readability and maintainability

This commit includes several changes to improve the readability and maintainability of the plugin.gd file:

1. More descriptive comments have been added to provide better context for the code.
2. Repeated code checking the existence of `editor_view` and `editor_view.editors_manager` has been moved into a helper function `_editor_view_and_manager_exist()`.
3. String literals that were used multiple times in the code have been replaced with constants to avoid magic strings and make future changes easier.

* Update plugin.gd

Updated the requested changes

* Make some style changes

- adds code regions
- uses tabs
- makes a few things statically typed
- simplifies some methods

---------

Co-authored-by: Jowan-Spooner <[email protected]>
* Move unit tests outside of Dialogic.

* Move more tests.
This makes it so a custom layout will auto-reload when it's script was changed. Unfortunately it's pretty hard to listen to a scene getting saved right now, but that will be implemented in the future, once it's easily doable.

Also makes sure the simple_highlight_portrait doesn't dim in editor.
…" debugged (dialogic-godot#2009)

* dialogic-1 converter change_timeline -> jump fix by prep loop func

* 1.x vs 2.x character positions now match, converter updated

* fixed empty if-statement conversion break
- Makes subsystems actual properties on the DialogicGameHandler.
- Renames 3 subsystems for name-conflict reasons.
- Adds a method to dynamically rewrite the subsystem list when needed.
Should fix dialogic-godot#2038 and a problem reported on discord
* Some renames and lot's of small code-cleanup

* Small empty line changes

* Small code style changes
* Fix typo

Wrong reference to Animation subsystem
* Clear any remaining event-connections with Timeline.clean()

Adds a method that clears any remaining connections so we can safely reuse all the event resources.

* Fix and improve text event

Does:
- allows mid-text event loading (only between sections)
- makes sure textbox visibility is correct when loading

* Small typo fix
Makes the code so that it should work in 4.2 (scripts only) and 4.3 (scripts+scene saves).
get_tree() can return null when the Dialogic view isn't open but this function is being called by an external system. No node tree exists to wait for or manipulate, and so errors are spammed.
@Invertex Invertex closed this Jan 26, 2024
@Invertex Invertex deleted the get_tree()-null-ref-fix branch January 26, 2024 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.