|
24 | 24 | #include "App.h" |
25 | 25 | #include "Backend.h" |
26 | 26 | #include "component/ActionComponent.h" |
| 27 | +#include "component/AlphaActionComponent.h" |
27 | 28 | #include "component/AnimationComponent.h" |
28 | 29 | #include "component/BoneComponent.h" |
| 30 | +#include "component/ColorActionComponent.h" |
29 | 31 | #include "component/KeyframeTracksComponent.h" |
30 | | -#include "component/TranslateTracksComponent.h" |
| 32 | +#include "component/PositionActionComponent.h" |
31 | 33 | #include "component/RotateTracksComponent.h" |
| 34 | +#include "component/RotationActionComponent.h" |
| 35 | +#include "component/ScaleActionComponent.h" |
32 | 36 | #include "component/ScaleTracksComponent.h" |
| 37 | +#include "component/TimedActionComponent.h" |
| 38 | +#include "component/TranslateTracksComponent.h" |
33 | 39 | #include "component/MorphTracksComponent.h" |
34 | 40 | #include "util/SHA1.h" |
35 | 41 | #include "util/ProjectUtils.h" |
@@ -7072,6 +7078,31 @@ void editor::Properties::startActionPreview(Entity entity, Scene* scene, ScenePr |
7072 | 7078 | void editor::Properties::stopActionPreview(Scene* scene, SceneProject* sceneProject) { |
7073 | 7079 | if (!actionPreviewing) return; |
7074 | 7080 |
|
| 7081 | + // Update snapshots with current user-editable config values before restoring |
| 7082 | + for (ActionPreviewState& state : actionPreviewStates) { |
| 7083 | + if (state.entity == NULL_ENTITY || !scene->isEntityCreated(state.entity) || !state.components || state.components.IsNull()) { |
| 7084 | + continue; |
| 7085 | + } |
| 7086 | + if (auto* comp = scene->findComponent<TimedActionComponent>(state.entity)) { |
| 7087 | + state.components[Catalog::getComponentName(ComponentType::TimedActionComponent, true)] = Stream::encodeTimedActionComponent(*comp); |
| 7088 | + } |
| 7089 | + if (auto* comp = scene->findComponent<PositionActionComponent>(state.entity)) { |
| 7090 | + state.components[Catalog::getComponentName(ComponentType::PositionActionComponent, true)] = Stream::encodePositionActionComponent(*comp); |
| 7091 | + } |
| 7092 | + if (auto* comp = scene->findComponent<RotationActionComponent>(state.entity)) { |
| 7093 | + state.components[Catalog::getComponentName(ComponentType::RotationActionComponent, true)] = Stream::encodeRotationActionComponent(*comp); |
| 7094 | + } |
| 7095 | + if (auto* comp = scene->findComponent<ScaleActionComponent>(state.entity)) { |
| 7096 | + state.components[Catalog::getComponentName(ComponentType::ScaleActionComponent, true)] = Stream::encodeScaleActionComponent(*comp); |
| 7097 | + } |
| 7098 | + if (auto* comp = scene->findComponent<ColorActionComponent>(state.entity)) { |
| 7099 | + state.components[Catalog::getComponentName(ComponentType::ColorActionComponent, true)] = Stream::encodeColorActionComponent(*comp); |
| 7100 | + } |
| 7101 | + if (auto* comp = scene->findComponent<AlphaActionComponent>(state.entity)) { |
| 7102 | + state.components[Catalog::getComponentName(ComponentType::AlphaActionComponent, true)] = Stream::encodeAlphaActionComponent(*comp); |
| 7103 | + } |
| 7104 | + } |
| 7105 | + |
7075 | 7106 | for (const ActionPreviewState& state : actionPreviewStates) { |
7076 | 7107 | if (state.entity == NULL_ENTITY || !scene->isEntityCreated(state.entity) || !state.components || state.components.IsNull()) { |
7077 | 7108 | continue; |
|
0 commit comments