-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adds simple updater to ScenelessProject #120
base: main
Are you sure you want to change the base?
Conversation
|
||
// In lieu of a versioning system, this can be used | ||
// to update a ScenelessProject if its base structure changes. | ||
export const updateToLatest = async (_project: ScenelessProject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, there's a series of ensure* functions in this file that are called when a project loads. If this function isn’t much different from those, I'd recommend moving it to that list to keep things uniform. This way, we won’t need to call it manually from Studio-next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I already did this, but maybe it got deleted during some revision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point on the ensure()
. The main problem is that these methods run asynchronously while the commands
returns synchronously, so we're setting ourselves up for a race condition.
But I'd rather not have two different places where we handle this logic, so I'll keep this PR up as a reference until we decide on a unified solution
src/helpers/sceneless-project.ts
Outdated
// Ensure audioContainer exists | ||
const audioContainer = root.children.find((x) => x.props.id === 'audio') | ||
if (!audioContainer) { | ||
await coreProject.compositor.insert( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's possible to insert at a specific index, let's insert at index 0 please. I know that this layer is invisible, but in case that gets broken somehow, it will at least then be rendering in the back, which is the next best thing I think
|
||
// In lieu of a versioning system, this can be used | ||
// to update a ScenelessProject if its base structure changes. | ||
export const updateToLatest = async (_project: ScenelessProject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I already did this, but maybe it got deleted during some revision.
We need a way to ensure that older projects are kept up to date when the ScenelessProject
create()
method changes.This adds a basic function that should be called upon loading a project to ensure it has all of the components expected by ScenelessProject commands
Currently, existing projects encounter a breaking error on startup:
This is because
audioContainer
was never created.https://xsolla.atlassian.net/browse/LSTREAM-678