Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✈️ export custom scripts #91

Merged
merged 3 commits into from
Aug 26, 2023
Merged

✈️ export custom scripts #91

merged 3 commits into from
Aug 26, 2023

Conversation

bitbrain
Copy link
Owner

@bitbrain bitbrain commented Aug 26, 2023

Closes #44

Description

This pull request aims to allow for exporting custom scripts in scenes. As a consequence, this pull request removes the concept of a PandoraEntityProxy as we have to store custom types directly.

Open Issues

  • unable to load Pandora entity after re-opening Godot - we require some sort of hook to control how the entity gets initialised (as we are only storing the ID to the scene)
  • filter available entities based on type (e.g. export type Item should only produce entries where entity is Item is true!)

@@ -1,5 +1,6 @@
## An entity acts a container for properties and is used to represent
## a category or an actual concept in any game.
@tool
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is critical that PandoraEntity (and all its custom scripts) are a tool script, as this needs to be accessible inside the editor. No clue if there is another way to solve this!

## .tscn file and then dynamically look up the actual entity
## at runtime by accessing Pandora's API.
@tool
class_name PandoraEntityProxy extends PandoraEntity
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class prevented us from exporting custom types. Instead, we are now relying on class lookup.



# ClassName -> Dictionary
var _global_class_cache = {}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to maintain a class cache so we can lookup class dependency structures. Only exporting custom types of type PandoraEntity should be eligible for selection.

TestScene.tscn Outdated Show resolved Hide resolved
@bitbrain bitbrain marked this pull request as ready for review August 26, 2023 15:40
@bitbrain bitbrain changed the title 🚧 WIP - export custom scripts ✈️ @export custom scripts Aug 26, 2023
@bitbrain bitbrain changed the title ✈️ @export custom scripts ✈️ export custom scripts Aug 26, 2023
@bitbrain bitbrain merged commit 5a2cd10 into godot-4.x Aug 26, 2023
3 checks passed
@bitbrain bitbrain deleted the export-custom-scripts branch August 26, 2023 15:47
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.

✈ @export custom entity types
1 participant