Skip to content

2.5D Demo with GDScript Error #1161

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

Closed
AbydosRoad opened this issue Jan 28, 2025 · 6 comments
Closed

2.5D Demo with GDScript Error #1161

AbydosRoad opened this issue Jan 28, 2025 · 6 comments

Comments

@AbydosRoad
Copy link

Which demo project is affected:
2.5D Demo with GDScript

OS/device including version:
Kubuntu 24.04

Issue description:
I searched the issues here in the Godot Github, but could not find an existing bug report on this issue. Upon opening the 2.5D Demo with GDScript for the second time (to ensure all of the assets were properly imported), I got the error: res://addons/node25d/node25d_plugin.gd:13 - Invalid call. Nonexistent function 'get_editor_viewport' in base 'EditorInterface'
I opened the indicated script and found line 13 as indicated in the error, there were no errors indicated in the code. I understand that this demo was created in Godot 4.1, I am running Godot 4.3.stable. I am fairly new to Godot and GDScript, but I do have a background in other OOP languages: C# and VB.NET. Thank you for your time!

Screenshots of issue:

Image

@AbydosRoad AbydosRoad added the bug label Jan 28, 2025
@AbydosRoad
Copy link
Author

Update: In looking further into the code, I suspect that at least part of the problem may be due to the 'get_editor_viewport' was incorrect, and should have been 'get_editor_viewport2d', as this looks to be a Node2D. Changing that removed that error, however, two new errors came up:

Image

The second error runs non-stop with the project open, but not running. I am afraid my current level of GDScript knowledge is insufficient to troubleshoot this further. If you have any ideas or code changes you would like me to make, I would be happy to implement them. Thanks!

@nollanr1
Copy link

I've been working on this for a bit (ran across this report while trying to solve it myself), and I think I have it mostly solved.
It appears the project was ported from Godot 3 but the plugin wasn't, thus the plugin is using commands from Godot 3.
I have the plugin working in all aspects except mouse control (items have to be moved by editing the Spatial Position property in the Node25D object) and making the project actually stay in 2.5D mode (every time a 2.5D node is selected, the project hops back over to 2D view).
To get it working that far, I've made the following changes:

  • Replace node25d_plugin.gd:13 with EditorInterface.get_editor_main_screen().add_child(main_panel_instance)
  • Make sure all six functions (and the function call on line 16) in node25d_plugin are prefaced with an underscore: _enter_tree, _exit_tree, _has_main_screen, _make_visible, _get_plugin_name, and _get_plugin_icon.
  • Swap out the body of the _make_visible function for if main_panel_instance: main_panel_instance.visible = visible
  • Replace viewport_25d.gd:15 with @onready var view_mode_button_group: ButtonGroup = $"../TopBar/ViewModeButtons/45Degree".button_group
  • There's also a couple hacky changes I made that I don't know how to accomplish through code, only the GUI:
  • Open main_screen_25d.tscn, and select the six children of ViewModeButtons. You'll see over in the inspector (at the bottom of the BaseButton section) that their Button Group is . Drag the view_mode_button_group.tres from the file manager into the button group, which should assign all those buttons to that group.
  • Select whichever of those six buttons you prefer, look over in the BaseButton section of the inspector again, and set Button Press to On. This should solve that Cannot call method 'get_pressed_button' on a null value issue (by setting a default button).
  • Also in main_screen_25d.tscn, select the ZoomPercent label, and uncheck the Clip Text property in the inspector.

Aaaand that's as far as I've gotten for now. It's still throwing some errors, which might be related to the problems I mentioned that the beginning, but it's something. The gizmo doesn't work for moving objects and while it does appear when an object is selected, it's not necessarily anywhere near the selected object, although it does maintain the same relative position to said object when that object is moved.

I'll take another look at it when I have the time, but don't let that stop anyone from solving this first? I'm not making any git push/pull requests unless I have the thing fully working, so this comment should be enough for now.

Image
Image

@AbydosRoad
Copy link
Author

Thanks for the work you have done troubleshooting this! You definitely got a lot further than I did.

@nollanr1
Copy link

nollanr1 commented Mar 5, 2025

TL;DR: Download the version here on Github, the one from the Godot Asset Library is a year out of date

Well. I figured it out.

And also, it turns out I've spent the last week chasing my tail.
The issue is that the copy of this project on the Godot Asset Library is a year out of date — when I finally thought I had made enough progress that I should be using git to track my changes, I downloaded the repository... and realized it was notably different from what I'd been working with.
Combed over the project and realized all the changes I had intended to make were already made. And then some.

So it looks like both you and I grabbed the copy from the Asset Library, ran into these problems, and then dropped on over here to raise the issue, without noticing that the version of the project on Github is some eight months newer.

When you first open the project, it throws an error, failing to load the plugin. However, once you've opened it once and the .godot folder is created, opening it at any future point (or going to Project > Reload Current Project) causes it to run seamlessly.

We can probably close this issue, although it may be worth figuring out how to update/sync project changes with the Asset Library...
I did find a different issue while working with this (Edits made with the GUI in 2.5 view cannot be undone with ctrl+z or the like), but that can stand to be its own issue if it isn't one already.

@AbydosRoad
Copy link
Author

Thanks so much for figuring that out! I didn't have a clue that there was a more up-to-date version on Github, I just assumed (wrongly) that whatever was posted on the Godot Asset Library was the most current version. I'll keep a closer eye on this as I test different projects that they post.
I upgraded to 4.4-stable, downloaded the newer version of this demo project and ran it - I didn't get any errors, and after the project upgraded to 4.4-stable, it runs like a dream!
Thanks again for your help! I'll go ahead and close this issue.
Best!

@Calinou
Copy link
Member

Calinou commented Mar 6, 2025

I'll try to update demos on the asset library, but there are a few upgrades to 4.4 that need to be pushed first. Ideally, I'd also like to get #1070 and #1074 in.

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