godotengine / godot-demo-projects

Demonstration and Template Projects
https://godotengine.org
MIT License
5.44k stars 1.52k forks source link

Update 2.5D GDScript demo to display the editor plugin in Godot 4. #1041

Closed chrisl8 closed 2 months ago

chrisl8 commented 2 months ago

This works now in Godot 4, but I still get this error when it starts:

  .\scene/main/node.h:445 - Parameter "data.tree" is null.
  res://addons/node25d/main_screen/viewport_25d.gd:23 - Invalid access to property or key 'process_frame' on a base object of type 'null instance'.

I'm not sure how to fix it though. I feel like there is something hacky about this line, but I'm not sure what the correct solution is:

https://github.com/godotengine/godot-demo-projects/blob/d190e73ad3af67447bb43ebe1ae0bcd01152e149/misc/2.5d/addons/node25d/main_screen/viewport_25d.gd#L20-L22

This should fix: https://github.com/godotengine/godot-demo-projects/issues/1040 and https://github.com/godotengine/godot-demo-projects/issues/1016

I did hit the files I edited with the gdformat as well. If you prefer the changes without white-space updates I can remove those changes.

UPDATE: The error mentioned above only seems to happen if you open the main_screen_25d scene in the editor, then leave it open, and close and open the editor again. image

chrisl8 commented 2 months ago

@aaronfranke and @Calinou Let me know if you need me to change anything else. Also if you need this squashed.

Calinou commented 4 days ago

Note that I fixed incorrect static typing in a follow-up commit: https://github.com/godotengine/godot-demo-projects/commit/7223aec0012ba5f89b7f9f28a65e91abb30be0cc