godot-headers icon indicating copy to clipboard operation
godot-headers copied to clipboard

Missing getter/setter for RootMotionView properties

Open tayloraswift opened this issue 3 years ago • 4 comments

The property RootMotionView::animation_path defined in the api.json uses accessors get_animation_path, set_animation_path, but these functions are not present in the api description. there is a similar issue with the following properties:

  • cell_size
  • color
  • radius
  • zero_y

tayloraswift avatar Apr 29 '21 00:04 tayloraswift

This seems to be because RootMotionView is registered as an editor-only class with a somewhat unconventional pattern: it's registered as core class, then disabled, and re-enabled in the editor:

https://github.com/godotengine/godot/blob/690c00d52261ab3132c520ddb317dd1c4e5f23b1/scene/register_scene_types.cpp#L477-L478

https://github.com/godotengine/godot/blob/690c00d52261ab3132c520ddb317dd1c4e5f23b1/editor/editor_node.cpp#L5870

This was done on purpose by @reduz in https://github.com/godotengine/godot/commit/c633b770cb6.

ClassDB::get_method_list() ignores disabled classes, while ClassDB::get_property_list() doesn't, which is why properties end up listed but not the methods. Not sure if that's a bug or just a design quirk from this weird pattern.

See also https://github.com/godotengine/godot/pull/46432#issuecomment-824287974.

akien-mga avatar Apr 29 '21 07:04 akien-mga

@akien-mga I don't know if we changed this for extensions but on a broader discussion, I don't think we should filter out editor only classes, maybe just flag them in the api.json. We need those classes in order to make plugins that add features for the editor. I guess we just need to figure out a good way to prevent those classes from being used in runtime as they will give an error.

To this particular problem, I wonder why its done this way? Sounds like Reduz only did the trick so he could debug an in editor issue and should probably have reverted it.

BastiaanOlij avatar Sep 27 '21 04:09 BastiaanOlij

To this particular problem, I wonder why its done this way? Sounds like Reduz only did the trick so he could debug an in editor issue and should probably have reverted it.

RootMotionView is an editor-specific helper node, but as it's a node it's something which you place in your scene tree directly - and thus it needs to be registered in core. It's the only component which is like this in Godot AFAIK.

akien-mga avatar Sep 27 '21 07:09 akien-mga

Excuse me for necroposting, but descriptions for RootMotionView members are up from 3.3 to present (4.0). I don’t know what issue/PR is associated as I haven’t searched deeply.

ParadoxV5 avatar Apr 29 '23 19:04 ParadoxV5