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

[Bug]: Can't use DebugDraw in a Viewport-extending scripts #15

Closed
mieldepoche opened this issue May 30, 2023 · 2 comments
Closed

[Bug]: Can't use DebugDraw in a Viewport-extending scripts #15

mieldepoche opened this issue May 30, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mieldepoche
Copy link

mieldepoche commented May 30, 2023

Godot version

4.0.3

DebugDraw3D version

1.0.0 (downloaded from the asset lib, not sure where to check for the version)

On which operating systems the error occurs

Linux

Using which renderers the error occurs

Vulkan, GLES3

Issue description

For some reason when trying to use DebugDraw in a Viewport script (or SubViewport, etc.) it refuses to work, yielding two possible errors:

  • "Cannot find member "draw_a" in base "Viewport.DebugDraw"." -- when typing, and
  • "The native enum "DebugDraw" does not behave like Dictionary and does not have methods of its own." when typed a valid member/function name.

Those errors don't show up on a Node-extending script, and the DebugDraw thing seem to work correctly in a Node script.

simplescreenrecorder-2023-05-30_15.22.29.webm

Steps to reproduce

create a script file in a project with DebugDraw installed, and put that in it:

extends Viewport

func _process(delta: float) -> void:
    DebugDraw.draw_sphere(Vector3.ZERO)

Minimal reproduction project

(contains literally a clean install of the addon from the asset lib and the above script)
DebugDrawViewportBug.zip

@mieldepoche mieldepoche added the bug Something isn't working label May 30, 2023
@DmitriySalnikov
Copy link
Owner

This is because the viewports have the debug_draw parameter and the associated enum with it. I didn't think much about it before, but I added an abbreviation for DebugDraw to Dbg3 in advance. You can use it to avoid conflict.

In this case, it's probably worth completely renaming the singleton to something like DebugDraw3 and adding DebugDraw2 (for 2d).
Or maybe Dd3d or Dd3 is better? What do you think is the best name to use?

@mieldepoche
Copy link
Author

Oooh okay I see, thanks!
As for the name I would vote for DebugDraw3D/2D as I'm personally okay with "long" explicit names like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants