mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-14 03:15:53 +08:00
Merge pull request #191 from Selmar/animation_extension_properties
Animation extension properties
This commit is contained in:
commit
2f044e77f1
15
tiny_gltf.h
15
tiny_gltf.h
@ -488,6 +488,7 @@ struct AnimationChannel {
|
||||
std::string target_path; // required in ["translation", "rotation", "scale",
|
||||
// "weights"]
|
||||
Value extras;
|
||||
ExtensionMap extensions;
|
||||
|
||||
AnimationChannel() : sampler(-1), target_node(-1) {}
|
||||
bool operator==(const AnimationChannel &) const;
|
||||
@ -509,6 +510,7 @@ struct Animation {
|
||||
std::vector<AnimationChannel> channels;
|
||||
std::vector<AnimationSampler> samplers;
|
||||
Value extras;
|
||||
ExtensionMap extensions;
|
||||
|
||||
bool operator==(const Animation &) const;
|
||||
};
|
||||
@ -1418,11 +1420,14 @@ bool Accessor::operator==(const Accessor &other) const {
|
||||
this->normalized == other.normalized && this->type == other.type;
|
||||
}
|
||||
bool Animation::operator==(const Animation &other) const {
|
||||
return this->channels == other.channels && this->extras == other.extras &&
|
||||
return this->channels == other.channels &&
|
||||
this->extensions == other.extensions &&
|
||||
this->extras == other.extras &&
|
||||
this->name == other.name && this->samplers == other.samplers;
|
||||
}
|
||||
bool AnimationChannel::operator==(const AnimationChannel &other) const {
|
||||
return this->extras == other.extras &&
|
||||
return this->extensions == other.extensions &&
|
||||
this->extras == other.extras &&
|
||||
this->target_node == other.target_node &&
|
||||
this->target_path == other.target_path &&
|
||||
this->sampler == other.sampler;
|
||||
@ -3859,6 +3864,7 @@ static bool ParseAnimationChannel(AnimationChannel *channel, std::string *err,
|
||||
channel->sampler = samplerIndex;
|
||||
channel->target_node = targetIndex;
|
||||
|
||||
ParseExtensionsProperty(&channel->extensions, err, o);
|
||||
ParseExtrasProperty(&(channel->extras), o);
|
||||
|
||||
return true;
|
||||
@ -3918,6 +3924,7 @@ static bool ParseAnimation(Animation *animation, std::string *err,
|
||||
|
||||
ParseStringProperty(&animation->name, err, o, "name", false);
|
||||
|
||||
ParseExtensionsProperty(&animation->extensions, err, o);
|
||||
ParseExtrasProperty(&(animation->extras), o);
|
||||
|
||||
return true;
|
||||
@ -5198,6 +5205,8 @@ static void SerializeGltfAnimationChannel(AnimationChannel &channel, json &o) {
|
||||
if (channel.extras.Type() != NULL_TYPE) {
|
||||
SerializeValue("extras", channel.extras, o);
|
||||
}
|
||||
|
||||
SerializeExtensionMap(channel.extensions, o);
|
||||
}
|
||||
|
||||
static void SerializeGltfAnimationSampler(AnimationSampler &sampler, json &o) {
|
||||
@ -5235,6 +5244,8 @@ static void SerializeGltfAnimation(Animation &animation, json &o) {
|
||||
if (animation.extras.Type() != NULL_TYPE) {
|
||||
SerializeValue("extras", animation.extras, o);
|
||||
}
|
||||
|
||||
SerializeExtensionMap(animation.extensions, o);
|
||||
}
|
||||
|
||||
static void SerializeGltfAsset(Asset &asset, json &o) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user