1
This commit is contained in:
parent
baa976d52c
commit
6d43bec786
@ -23,5 +23,27 @@ bool AttrHelper::ParseAttr(std::shared_ptr<a8::XObject> xobj,
|
|||||||
std::array<float, kHAT_End>& attr_abs,
|
std::array<float, kHAT_End>& attr_abs,
|
||||||
std::array<float, kHAT_End>& attr_rate)
|
std::array<float, kHAT_End>& attr_rate)
|
||||||
{
|
{
|
||||||
|
if (xobj->IsArray()) {
|
||||||
|
for (int i = 0; i < xobj->Size(); ++i) {
|
||||||
|
std::shared_ptr<a8::XObject> obj = xobj->At(i);
|
||||||
|
if (obj->IsObject()) {
|
||||||
|
int attr_id = obj->Get("attr_id", 0);
|
||||||
|
int type = obj->Get("type", 0);
|
||||||
|
int val = obj->Get("val", 0);
|
||||||
|
{
|
||||||
|
float* p = GetAttrAbsPtr(attr_abs, attr_id);
|
||||||
|
if (p) {
|
||||||
|
*p = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
float* p = GetAttrRatePtr(attr_rate, attr_id);
|
||||||
|
if (p) {
|
||||||
|
*p = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user