add more NotePreset properties
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "data/dv_util.hpp"
|
||||
|
||||
std::string to_string(NoteDisplayMode mode) {
|
||||
static std::vector<std::string> names = {
|
||||
"static_billboard",
|
||||
@@ -29,7 +31,10 @@ std::optional<NoteDisplayMode> NoteDisplayMode_from(std::string_view s) {
|
||||
|
||||
dv::value NotePreset::serialize() const {
|
||||
return dv::object({
|
||||
{"display", to_string(displayMode)}
|
||||
{"display", to_string(displayMode)},
|
||||
{"color", dv::to_value(color)},
|
||||
{"scale", scale},
|
||||
{"render_distance", renderDistance}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,4 +42,9 @@ void NotePreset::deserialize(const dv::value& src) {
|
||||
if (src.has("display")) {
|
||||
displayMode = NoteDisplayMode_from(src["display"].asString()).value();
|
||||
}
|
||||
if (src.has("color")) {
|
||||
dv::get_vec(src["color"], color);
|
||||
}
|
||||
src.at("scale").get(scale);
|
||||
src.at("render_distance").get(renderDistance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user