`Control` has no setter for many properties such as `anchor*`, `rectPosition`, etc.
open val anchorRight: Double
get() {
TransferContext.writeArguments()
TransferContext.callMethod(rawPtr, ENGINEMETHOD_ENGINECLASS_CONTROL_GET_ANCHOR_RIGHT, DOUBLE)
return TransferContext.readReturnValue(DOUBLE, false) as Double
}
Hello ! We cannot do much on this. Control::_set_anchor is private method. This is why no setter is generated.
I was comparing it with a C# API and it was there
public float AnchorRight
{
get => this.GetAnchor(Margin.Right);
set => this._SetAnchor(Margin.Right, value);
}
I'm not sure about exposing private c++ method. Is it possible in gdscript ? If so maybe we should expose private method. But I would first look if this can introduce side effects.
EDIT: you also have setAnchor method.
I'm against exposing private methods. If one really wants to set it, he can set it dynamically.
I agree, the point of being private is that we can't use them
I'm just curious about that following. If they are private, why are they available in the API in the first place?
hum I'm confused. Isn't a method starting with an underscore is just to say that the function is virtual, not private, like _ready?

If this was really private, that wouldn't be in the ClassDB in the first place.
It is private in control cpp: https://github.com/godotengine/godot/blob/8e68f2e5f48c66bfa80b9bb7746a488afb70086d/scene/gui/control.h#L216
yeah but it's still registered to the classDB: https://github.com/godotengine/godot/blob/8e68f2e5f48c66bfa80b9bb7746a488afb70086d/scene/gui/control.cpp#L2834
the true question: Can you call it from Gdscript ? if that's the case we should follow that as a reference
We can definitely call it from C#
The question to me is: Even if other languages allow it for whatever reason, should we really allow it? I mean we are quite strict up until now. Should we be more permissive? To me not the other languages are the source of truth. Cpp is.
The question to me is: Even if other languages allow it for whatever reason, should we really allow it? I mean we are quite strict up until now. Should we be more permissive? To me not the other languages are the source of truth. Cpp is.
I totally agree with you. I think we should open an issue on Godot if that's not fixed in master. It is pretty weird to expose private method through ClassDB.
We won't expose methods declared private in the api.json.
If one want's to call those (which other languages seemingly provide) one can still do that with the not typesafe call functions.