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

Control::has_point not listed as virtual method #8018

Closed
bojidar-bg opened this issue Mar 13, 2017 · 3 comments
Closed

Control::has_point not listed as virtual method #8018

bojidar-bg opened this issue Mar 13, 2017 · 3 comments

Comments

@bojidar-bg
Copy link
Contributor

Operating system or device - Godot version:
Godot 2.1/HEAD, but it seems like master is somewhat affected too

Issue description:
While coding some stuff for a (non-FOSS) game, I named one of my methods as has_point on a CanvasItem-inheriting script that was assigned to some controls. I made it to return true, since that was to be overriden by other scripts... And then, suddenly, all the controls with that script started grabbing all clicks 😆

I decided to search the docs, since I suspected something like this might have happened, but Control::has_point wasn't listed, since it isn't bound at all.

Note that the has_point implementation on scene/gui/control.cpp:572-588 calls the script method.

Steps to reproduce:

  1. Make a script with:
extends Control
func has_point(point):
    return true
  1. Add it to a Button node
  2. Run
  3. Profit (or actually, cry)

Link to minimal example project: Partly in a hurry here, so, maybe later on request.

How to fix:

  1. Go to scene/gui/control.cpp:2516
  2. Add a proper BIND_VMETHOD macro, like here: scene/main/node.cpp:2923
BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta")));
  1. Compile, make sure that the docs list Control::has_point(Vector2 point)
  2. Make a PR
@taylorhansen
Copy link
Contributor

I'd like to try this as my first contribution.

@karroffel
Copy link
Contributor

karroffel commented Mar 13, 2017

Also remove the regular bind_method? Otherwise the ClassDB entries might contain duplicates which mess stuff up. (aka #7960)

Not sure about that though

Edit: I should learn to read. duh.

@akien-mga
Copy link
Member

Fixed by #8023.

akien-mga pushed a commit that referenced this issue Mar 18, 2017
According to Issue #8018, a BIND_VMETHOD macro wasn't present in scene/gui/control.cpp, while it was declared to be a virtual method in scene/gui/control.h.

classes.xml was updated to also list this method in Control.

(cherry picked from commit 9589936)
groscalin pushed a commit to groscalin/godot that referenced this issue Jul 15, 2017
According to Issue godotengine#8018, a BIND_VMETHOD macro wasn't present in scene/gui/control.cpp, while it was declared to be a virtual method in scene/gui/control.h.

classes.xml was updated to also list this method in Control.
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