mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add 'frames' particles setting
This commit is contained in:
parent
39893ee940
commit
b9b122dc83
6 changed files with 48 additions and 1 deletions
|
|
@ -36,6 +36,12 @@ dv::value ParticlesPreset::serialize() const {
|
|||
root["spawn_spread"] = dv::to_value(size);
|
||||
root["spawn_shape"] = to_string(spawnShape);
|
||||
root["random_sub_uv"] = randomSubUV;
|
||||
if (!frames.empty()) {
|
||||
auto& arr = root.list("animation");
|
||||
for (const auto& frame : frames) {
|
||||
arr.add(frame);
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
@ -63,4 +69,13 @@ void ParticlesPreset::deserialize(const dv::value& src) {
|
|||
if (src.has("spawn_shape")) {
|
||||
spawnShape = ParticleSpawnShape_from(src["spawn_shape"].asString());
|
||||
}
|
||||
if (src.has("frames")) {
|
||||
for (const auto& frame : src["frames"]) {
|
||||
frames.push_back(frame.asString());
|
||||
}
|
||||
if (!frames.empty()) {
|
||||
texture = frames.at(0);
|
||||
randomSubUV = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue