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

update() is not renamed to queue_redraw() for Node2D(or anything that inherits CanvasItem) #67003

Open
Tracked by #73960
Anutrix opened this issue Oct 6, 2022 · 4 comments

Comments

@Anutrix
Copy link
Contributor

Anutrix commented Oct 6, 2022

Godot version

v4.0.beta.custom_build [0c23a2c]

System information

Windows 11 Pro 22H2 64 bit

Issue description

update() is not renamed to queue_redraw() for Node2D(or anything that inherits CanvasItem) after #64377.

Additional info:
I thought of making a simple MR to add it myself in ProjectConverter3To4 but I wasn't sure simply if replacing update() function in all script files will work since other classes also have update() method.
image

Steps to reproduce

  1. Import Bullet Shower demo from https://github.com/godotengine/godot-demo-projects.
  2. Convert full project.
  3. Try running it.
  4. Observe Parse Error: Function "update()" not found in base self error.

OR

  1. Import Bullet Shower demo from https://github.com/godotengine/godot-demo-projects 4.0-dev branch.
  2. Try running it.
  3. Observe Parse Error: Function "update()" not found in base self error.

Minimal reproduction project

Bullet Shower demo from https://github.com/godotengine/godot-demo-projects

@KoBeWi
Copy link
Member

KoBeWi commented Oct 6, 2022

The project converter has no information about the script type, it operates only using text. Thus update() can't be auto-converted, because it would change methods that shouldn't be changed.

@Mickeon
Copy link
Contributor

Mickeon commented Oct 6, 2022

It would take a lot of effort to have the converter discern type by context, and therefore being able to appropriately convert update where needed. In the end it may be worth it, but there's so many things to focus on.

@Anutrix
Copy link
Contributor Author

Anutrix commented Oct 6, 2022

The project converter has no information about the script type, it operates only using text. Thus update() can't be auto-converted, because it would change methods that shouldn't be changed.

Exactly.

It would take a lot of effort to have the converter discern type by context, and therefore being able to appropriately convert update where needed. In the end it may be worth it, but there's so many things to focus on.

But the files are converted one at a time so reading first non-empty line to see what type it extends should work, right? Then, we can make type-specific method/property name conversions.

Also, we would need to inform the user someway if conversion is not possible. I had to dig the repo and file commit history to find out what update method was renamed to.

@Calinou
Copy link
Member

Calinou commented Oct 6, 2022

What can be done in those situations is to add a command at the end of the line, like this:

func _ready():
	$Something.update()  # 3to4: `update()` may have to be renamed to `queue_redraw()`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants