-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Refactoring the MovieSystem so that it may be moved into a gem #18541
Conversation
Signed-off-by: Luis Sempé <[email protected]>
Signed-off-by: Luis Sempé <[email protected]>
Signed-off-by: Luis Sempé <[email protected]>
Signed-off-by: Luis Sempé <[email protected]>
Code/Legacy/CrySystem/System.cpp
Outdated
@@ -241,6 +241,9 @@ CSystem::CSystem() | |||
#endif | |||
|
|||
m_ConfigPlatform = CONFIG_INVALID_PLATFORM; | |||
|
|||
m_movieSystem = nullptr; | |||
Maestro::MovieSystemRequestBus::BroadcastResult(m_movieSystem, &Maestro::MovieSystemRequestBus::Events::GetMovieSystem); |
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 expect CrySystem/System to be init super early, we're sure that we won't end up in a case where m_movieSystem is always nullptr because Maestro hasn't been init ?
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.
It gets set during OnCrySystemInitialized
which is also where gEnv->pMovieSystem was being populated before, the behavior/timing did not change
Signed-off-by: Luis Sempé <[email protected]>
Maestro::MovieSystemRequestBus::BroadcastResult(movieSystem, &Maestro::MovieSystemRequestBus::Events::GetMovieSystem); | ||
|
||
float elapsedTime = movieSystem ? movieSystem->GetPlayingTime(pCurSeq) - rng.start : 0.f; | ||
int percentage = int(100.0f * (m_renderContext.spentTime + elapsedTime) / m_renderContext.expectedTotalTime); |
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.
Can we protect against a divide by zero here?
Signed-off-by: Luis Sempé <[email protected]>
Signed-off-by: Luis Sempé <[email protected]>
Signed-off-by: Luis Sempé <[email protected]>
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.
Great!
What does this PR do?
The MovieSystem is still using the legacy paradigm of keeping global pointers in gEnv, this creates a tight coupling that is undesirable given O3DE's modular design. This is the first part of a refactor that aims to move the MovieSystem entirely proviedd by a gem and all the legacy code moved out of Legacy/CryCommon
Removed the global pointer to IMovieSystem and replaced it with an EBus call, this decouples the MovieSystem from the Editor itself and allows it to be provided by a gem, in this case the Maestro gem which creates the MovieSystem in its system component.
While this does not entirely decouple the movie system from the editor, it's a step in that direction. Next step will be for the MovieSystem to receive update events rather than having them called directly from the editor.
How was this PR tested?
Used TrackView to make a simple sequence that moved and rotated an entity.