-
Notifications
You must be signed in to change notification settings - Fork 2
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
Optimized changeDetector.gd, some static typing #4
base: main
Are you sure you want to change the base?
Conversation
There are a few issues, but overall you did a good job. |
Please make the changes |
It's okay when forked rep is 2 commits behind original? |
Usually ok since the PR can be merged anyway (unless there are conflicts, but in this case there are not), but I recommend you to always sync so you can work with the current state of the original code and when I'm testing it, it has my latest changes. Basically it makes everything easier, but it's usually still fine if you keep the fork behind. |
There's a big issue, |
src/scripts/changeDetector.gd
Outdated
if not main: return | ||
|
||
var root = EditorInterface.get_edited_scene_root() | ||
|
||
var root := EditorInterface.call_deferred("get_edited_scene_root") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call_deferred()
doesn't return the called function's result.
Here's how it can be fixed:
func _ready() -> void:
var t: Thread = Thread.new()
refrate.wait_time = 0.1
var root = EditorInterface.get_edited_scene_root() # Get scene root in the main thread
refrate.timeout.connect(func():
if t.start(cycle.bind(root)) == ERR_CANT_CREATE: # Pass `root` to the thread
print_debug(error_string(ERR_CANT_CREATE))
return
while true:
if not t.is_alive():
t.wait_to_finish()
break
)
add_child(refrate)
refrate.start()
func cycle(root: Node) -> void:
if not main: return
if not root: return
....
I can't get the functions to properly talk to each on the separate threads. And next time I recommend you commit more frequently so splitting a PR would be as simple as going back to an older commit and creating a branch off of it then submitting a PR. |
create other PR for multithreading issues, and leave this one for other optimizations? |
Yeah, remove the multithreading changes for this PR. Also what version of Godot are you using and did you test if the multithreading works for you? Btw, I wrote some development tips in the CONTRIBUTING.md file. |
It doesn't work for me either, I probably hastened with writing code. Godot version 4.3.stable
uzful :D |
Make sure to test it next time
Latest, good |
On enabling plugin, this shows up: tf this come from? Probably from my other project, where I testing plugin |
changeDetector.gd
now uses a thread, significantly increasing fps (at least on my laptop).load()
replaced withpreload()
, for static file paths.This is my first time contributing to other projects, and therefore, having poor experience working with git.
I started to write weeks ago, look for downgrades!