fix: restore particle timeline readiness after field adapter
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -340,6 +340,8 @@ void RasterArraySource::tryLoad() {
|
||||
observer->onSourceChanged(*this);
|
||||
tryInitializeTimeline();
|
||||
} catch (const std::exception& error) {
|
||||
Log::Warning(Event::Render, "ParticleField: event=ADAPTER_REJECTED sourceId=" + getID() +
|
||||
" error=" + error.what());
|
||||
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(error.what())));
|
||||
}
|
||||
}
|
||||
@@ -348,13 +350,23 @@ void RasterArraySource::tryLoadRuntimeField(const size_t index) {
|
||||
auto& candidate = runtimeFields.at(index);
|
||||
if (candidate.snapshot || !candidate.metadata || !candidate.fieldBytes) return;
|
||||
try {
|
||||
// A candidate is already a Core-owned runtime snapshot when it leaves
|
||||
// the adapter. Do not defer the required revision assignment until
|
||||
// timeline construction; that made valid preload data fail closed.
|
||||
candidate.snapshot = particle::OfflineFixtureParticleAdapter::load(
|
||||
candidate.descriptor.fixtureID, *candidate.metadata, *candidate.fieldBytes, 0);
|
||||
candidate.descriptor.fixtureID, *candidate.metadata, *candidate.fieldBytes,
|
||||
++nextRasterArrayFieldGeneration);
|
||||
Log::Info(Event::Render,
|
||||
"ParticleField: runtime candidate ready fieldId=" + candidate.snapshot->fieldID +
|
||||
" dataVersion=" + std::to_string(candidate.snapshot->dataVersion));
|
||||
tryInitializeTimeline();
|
||||
} catch (const std::exception& error) {
|
||||
Log::Warning(Event::Render, "ParticleField: event=ADAPTER_REJECTED sourceId=" + getID() +
|
||||
" candidateIndex=" + std::to_string(index) + " fieldId=" +
|
||||
candidate.descriptor.fixtureID + " generation=" +
|
||||
std::to_string(candidate.snapshot ? candidate.snapshot->generation : 0) +
|
||||
" validTime=" + std::to_string(candidate.snapshot ? candidate.snapshot->validTime : 0) +
|
||||
" error=" + error.what());
|
||||
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(error.what())));
|
||||
}
|
||||
}
|
||||
@@ -368,7 +380,6 @@ void RasterArraySource::tryInitializeTimeline() {
|
||||
for (size_t index = 0; index < runtimeFields.size(); ++index) {
|
||||
if (!runtimeFields[index].snapshot) return;
|
||||
auto field = *runtimeFields[index].snapshot;
|
||||
field.generation = ++nextRasterArrayFieldGeneration;
|
||||
entries.push_back({std::make_shared<particle::ParticleFieldSnapshot>(std::move(field)),
|
||||
80000 + static_cast<uint64_t>(index) * 40000});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user