Skip to content

The draw_rect() "width" argument has no effect when "filled" is "true" warning #1017

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
yue4u opened this issue Jan 29, 2023 · 4 comments
Closed
Labels
c: bindings Component: GDNative bindings (mod api) quality-of-life No new functionality, but improves ergonomics/internals
Milestone

Comments

@yue4u
Copy link

yue4u commented Jan 29, 2023

draw_rect method requires width parameter even when setting filled to true which results the following warning being printed.

W 0:00:02.779   draw_rect: The draw_rect() "width" argument has no effect when "filled" is "true".
  <C++ Source>  scene/2d/canvas_item.cpp:756 @ draw_rect()

API Interface:

image

Example: https://github.com/yue4u/zf/blob/7c6b4c68e9ab4129386c06299e265242a605bf4d/crates/zf/src/ui/terminal.rs#L475

I did some search but couldn't find a way to disable this warning. Maybe set the type of width parameter to optional or passing width optionally on the library side can resolve this problem?

@yue4u yue4u added the quality-of-life No new functionality, but improves ergonomics/internals label Jan 29, 2023
@chitoyuu chitoyuu added this to the v0.13.0 milestone Jan 29, 2023
@chitoyuu chitoyuu added the c: bindings Component: GDNative bindings (mod api) label Jan 29, 2023
@chitoyuu
Copy link
Contributor

Related to #814. This is something we've been trying to find a way to deal with for a long while.

Unfortunately, there isn't a good workaround for the time being. If the warning must be suppressed, you can try calling the method with Object::call, which does allow you to omit parameters, at the cost of not being statically typed.

Keeping this open as a reference for the method generator redesign.

@yue4u
Copy link
Author

yue4u commented Jan 29, 2023

Thanks for your quick reply!

you can try calling the method with Object::call,

Nice, changing to Object::call makes a lot of sense to me even with the cost of losing typing as this is the only API I have problem with.

@hanya
Copy link

hanya commented Aug 19, 2023

Width == 1.0 does not make the warning.

@chitoyuu
Copy link
Contributor

Thanks for the information! Since it has been a while since this issue was first reported, it's possible that this was fixed upstream, which would explain the change in behavior. For now, I'll proceed to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bindings Component: GDNative bindings (mod api) quality-of-life No new functionality, but improves ergonomics/internals
Projects
None yet
Development

No branches or pull requests

3 participants