godot icon indicating copy to clipboard operation
godot copied to clipboard

Implement `ClassDB::class_call_static_method`

Open radiantgurl opened this issue 1 year ago • 3 comments
trafficstars

Implements a method to allow users to call static methods thru ClassDB The function signature is as follows: ClassDB::class_call_static_method(class: StringName, method: StringName, ...) -> Variant

radiantgurl avatar Jun 13 '24 22:06 radiantgurl

I'll look at a fix for the godot-cpp error with bound names, would be relevant to just prefix with p_ there to prevent these errors

Edit: There's already fixes for this in some cases, will see where they are missing for this particular case

Edit 2: Done:

  • https://github.com/godotengine/godot-cpp/pull/1490

Edit 3: my bad misses this open fix:

  • https://github.com/godotengine/godot-cpp/pull/1485

AThousandShips avatar Jun 14 '24 10:06 AThousandShips

PR https://github.com/godotengine/godot-cpp/pull/1485 was cherry-picked, so tests here should pass. I just kicked off another test run, so we'll see!

dsnopek avatar Jun 14 '24 18:06 dsnopek

Status update?

radiantgurl avatar Aug 17 '24 22:08 radiantgurl

Thanks!

akien-mga avatar Aug 26 '24 21:08 akien-mga

Thank you, too! I'm one more commit away from becoming accredited contributor :tada:

radiantgurl avatar Aug 27 '24 02:08 radiantgurl

It looks like one of my remarks from the original PR got lost here, I never got a response.

Apart from that, what do you think about naming it class_call_static instead of class_call_static_method? Simply because that's consistent with Object::call, which isn't named Object::call_method either.

It's a minor thing, but there's another small point besides consistency: in case there are going to be variants of this method in the future (similar to call + call_deferred), we might benefit from a slightly shorter name.

As it's planned for 4.4, we can still change it. That said, if everyone is OK with the current name, that's fine as well, I just wanted to make sure this is a conscious choice. Overall this is a great PR! :slightly_smiling_face:

Bromeon avatar Oct 28 '24 22:10 Bromeon

Ah, I agree that class_call_static (without _method) is a better name. Who would like to make a PR for that?

dsnopek avatar Oct 29 '24 13:10 dsnopek

I can create one in the next few days 👍

Bromeon avatar Oct 29 '24 15:10 Bromeon