Scene Modification Algorithm
- Home
- Casсadeur Architecture
- Scene Modification Algorithm
Cascadeur uses a lot of physics-based tools and features for creating realistic character movement. Many of these features (such as Relaxation) are not controlled by the user, but do react to the user's actions.
Because of this, Cascadeur includes a somewhat complex algorithm for updating the scene after any change made by the user.
Understanding this algorithm is important if you’d like to use Python scripting or working with Node Editor, as these features use it for making changes to scenes and objects.
Scene Modify Algorithm
The scene is updated in the following way:
1. Save Old State
First, a copy of the scene’s current state is created. This copy can later be used by the Undo feature for restoring the scene to its original state.
2. User Update
After this, the software listens to the user input and changes the scene accordingly. For example, if the user drags an object, the position of this object is changed.
If the user cancels their action, the scene is restored to its original state saved at the stage 1.
If the user completes the action, the next step is called.
3. Interpolation
After the user makes changes to the scene, Interpolation is called to update the scene using physics instruments.
4. Save New State
Then, the new state of the scene is saved.
5. Add Command
When the scene is saved, a new Command is added to the command stack. This signifies that changes have been made to the scene.
A copy of the state of the scene - taken at the stage 1 - is placed inside this command.
The command can later be used for undoing the changes done to the scene.
6. Update Event
At the final stage, an Event is sent to the services in the program (such as Timeline, Outliner, Object Properties panel etc.) to inform them that the scene has been updated. After receiving the event, the services update their own states to reflect the updated state of the scene.
Then, the updated scene is recorded again, and the whole process continues. This is how scenes are updated in Cascadeur.