Skip to content

Conversation

LuoZheng2002
Copy link
Contributor

Description

We need a uniform naming convention for the functionality of retrieving pool objects or their variants from the pool and the graph. Currently there are typed_ref, try_get_of_type, etc. I think it is beneficial to unify them into the vanilla name try_get. For current occurrences of try_get for the Graph, I renamed it to try_get_node. Specifying "node" for Graph is appropriate because Graph uses Node as the pool object type.

I also added a prelude module for the fyrox_graph crate containing AbstractSceneGraph, BaseSceneGraph and SceneGraph, and added use fyrox::graph::prelude::* in the script template so that functionalities like try_get are exposed by default.

Related Issue(s)

Review Guidance

The code passed all auto tests.

Screenshots/GIFs

Checklist

  • My code follows the project's code style guidelines
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes don't generate new warnings or errors
  • No unsafe code introduced (or if introduced, thoroughly justified and documented)

@mrDIMAS
Copy link
Member

mrDIMAS commented Sep 30, 2025

Could you please fix the code generated by the project template generator? Check the CI for project template, it highlighted that there's an unused import there. The changes should be done in template-core

@LuoZheng2002
Copy link
Contributor Author

It is supposed to be unused before the user uses the try_get method from the Graph or UserInterface. Users are likely to call try_get in their scripts so I think the use is necessary. Maybe I can mark it as something like #[allow(unused)]?

@mrDIMAS
Copy link
Member

mrDIMAS commented Sep 30, 2025

I think it is actually unused now with your changes. You can check it by generating a project with the project manager (compiled from the source code), if the removal of the import will allow the game build with no issues then you should definitely delete that in the project manager.

@LuoZheng2002
Copy link
Contributor Author

I've added the #[allow(unused_imports)] to the template. My idea is that using try_get methods happen in almost every script, but try_get cannot be exposed unless the users import the SceneGraph trait themselves. They would have to remember the exact directory use fyrox::graph::prelude::* because there is no one-click solution for that. (because traits like SceneGraph are defined in fyrox-graph while the Graph is defined in fyrox-impl)

@mrDIMAS mrDIMAS merged commit 7ec002f into FyroxEngine:master Oct 1, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants