Godot: Control::has_point not listed as virtual method

Created on 13 Mar 2017  路  3Comments  路  Source: godotengine/godot

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 :laughing:

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
bug documentation junior job

Most helpful comment

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

All 3 comments

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

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.

Fixed by #8023.

Was this page helpful?
0 / 5 - 0 ratings