Dawn/src/dawntools/vnscenetool/events/VNSetEventParser.cpp
2023-04-23 18:46:03 -07:00

45 lines
1.0 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "VNSetEventParser.hpp"
using namespace Dawn;
std::vector<std::string> VNSetEventParser::getRequiredAttributes() {
return { "property", "type" };
}
std::map<std::string, std::string> VNSetEventParser::getOptionalAttributes() {
return {
{ "to", "" },
{ "value", "" },
{ "from", "" },
{ "duration", "" },
{ "curve", "" }
};
}
int32_t VNSetEventParser::onParse(
Xml *node,
std::map<std::string, std::string> values,
struct VNSetEvent *out,
std::string *error
) {
if(values["to"] != "") {
out->to = values["to"];
} else if(values["value"] != "") {
out->to = values["value"];
} else {
*error = "Either 'to' or 'value' must be specified";
return -1;
}
out->type = values["type"];
out->property = values["property"];
out->from = values["from"];
out->duration = values["duration"];
out->curve = values["curve"];
return 0;
}