Added bool, removed unused debug parameter
parent
d75d59a4fd
commit
6d85280c8d
|
@ -796,6 +796,7 @@ struct CustomExtension : public Object {
|
||||||
Nullable<double> mDoubleValue;
|
Nullable<double> mDoubleValue;
|
||||||
Nullable<uint64_t> mUint64Value;
|
Nullable<uint64_t> mUint64Value;
|
||||||
Nullable<int64_t> mInt64Value;
|
Nullable<int64_t> mInt64Value;
|
||||||
|
Nullable<bool> mBoolValue;
|
||||||
|
|
||||||
// std::vector<CustomExtension> handles both Object and Array
|
// std::vector<CustomExtension> handles both Object and Array
|
||||||
Nullable<std::vector<CustomExtension>> mValues;
|
Nullable<std::vector<CustomExtension>> mValues;
|
||||||
|
@ -807,7 +808,7 @@ struct CustomExtension : public Object {
|
||||||
size_t Size() const {
|
size_t Size() const {
|
||||||
if (mValues.isPresent) {
|
if (mValues.isPresent) {
|
||||||
return mValues.value.size();
|
return mValues.value.size();
|
||||||
} else if (mStringValue.isPresent || mDoubleValue.isPresent || mUint64Value.isPresent || mInt64Value.isPresent) {
|
} else if (mStringValue.isPresent || mDoubleValue.isPresent || mUint64Value.isPresent || mInt64Value.isPresent || mBoolValue.isPresent) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -821,6 +822,7 @@ struct CustomExtension : public Object {
|
||||||
, mDoubleValue(other.mDoubleValue)
|
, mDoubleValue(other.mDoubleValue)
|
||||||
, mUint64Value(other.mUint64Value)
|
, mUint64Value(other.mUint64Value)
|
||||||
, mInt64Value(other.mInt64Value)
|
, mInt64Value(other.mInt64Value)
|
||||||
|
, mBoolValue(other.mBoolValue)
|
||||||
, mValues(other.mValues)
|
, mValues(other.mValues)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1241,6 +1241,10 @@ inline CustomExtension ReadExtensions(const char *name, Value& obj) {
|
||||||
ReadValue(obj, ret.mStringValue);
|
ReadValue(obj, ret.mStringValue);
|
||||||
ret.mStringValue.isPresent = true;
|
ret.mStringValue.isPresent = true;
|
||||||
}
|
}
|
||||||
|
else if (obj.IsBool()) {
|
||||||
|
ret.mBoolValue.value = obj.GetBool();
|
||||||
|
ret.mBoolValue.isPresent = true;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -847,7 +847,7 @@ static std::string GetNodeName(const Node &node) {
|
||||||
return node.name.empty() ? node.id : node.name;
|
return node.name.empty() ? node.id : node.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension, unsigned int depth = 0) {
|
void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension) {
|
||||||
if (extension.mStringValue.isPresent) {
|
if (extension.mStringValue.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), aiString(extension.mStringValue.value));
|
metadata->Add(extension.name.c_str(), aiString(extension.mStringValue.value));
|
||||||
} else if (extension.mDoubleValue.isPresent) {
|
} else if (extension.mDoubleValue.isPresent) {
|
||||||
|
@ -856,10 +856,12 @@ void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension, uns
|
||||||
metadata->Add(extension.name.c_str(), extension.mUint64Value.value);
|
metadata->Add(extension.name.c_str(), extension.mUint64Value.value);
|
||||||
} else if (extension.mInt64Value.isPresent) {
|
} else if (extension.mInt64Value.isPresent) {
|
||||||
metadata->Add(extension.name.c_str(), static_cast<int32_t>(extension.mInt64Value.value));
|
metadata->Add(extension.name.c_str(), static_cast<int32_t>(extension.mInt64Value.value));
|
||||||
|
} else if (extension.mBoolValue.isPresent) {
|
||||||
|
metadata->Add(extension.name.c_str(), extension.mBoolValue.value);
|
||||||
} else if (extension.mValues.isPresent) {
|
} else if (extension.mValues.isPresent) {
|
||||||
aiMetadata val;
|
aiMetadata val;
|
||||||
for (size_t i = 0; i < extension.mValues.value.size(); ++i) {
|
for (size_t i = 0; i < extension.mValues.value.size(); ++i) {
|
||||||
ParseExtensions(&val, extension.mValues.value[i], depth + 2);
|
ParseExtensions(&val, extension.mValues.value[i]);
|
||||||
}
|
}
|
||||||
metadata->Add(extension.name.c_str(), val);
|
metadata->Add(extension.name.c_str(), val);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue