mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-16 15:45:59 +08:00
add extension property for Animation and AnimationChannel
This commit is contained in:
parent
f68d5e1f2a
commit
4e2988eebd
15
tiny_gltf.h
15
tiny_gltf.h
@ -487,6 +487,7 @@ struct AnimationChannel {
|
|||||||
std::string target_path; // required in ["translation", "rotation", "scale",
|
std::string target_path; // required in ["translation", "rotation", "scale",
|
||||||
// "weights"]
|
// "weights"]
|
||||||
Value extras;
|
Value extras;
|
||||||
|
ExtensionMap extensions;
|
||||||
|
|
||||||
AnimationChannel() : sampler(-1), target_node(-1) {}
|
AnimationChannel() : sampler(-1), target_node(-1) {}
|
||||||
bool operator==(const AnimationChannel &) const;
|
bool operator==(const AnimationChannel &) const;
|
||||||
@ -508,6 +509,7 @@ struct Animation {
|
|||||||
std::vector<AnimationChannel> channels;
|
std::vector<AnimationChannel> channels;
|
||||||
std::vector<AnimationSampler> samplers;
|
std::vector<AnimationSampler> samplers;
|
||||||
Value extras;
|
Value extras;
|
||||||
|
ExtensionMap extensions;
|
||||||
|
|
||||||
bool operator==(const Animation &) const;
|
bool operator==(const Animation &) const;
|
||||||
};
|
};
|
||||||
@ -1411,11 +1413,14 @@ bool Accessor::operator==(const Accessor &other) const {
|
|||||||
this->normalized == other.normalized && this->type == other.type;
|
this->normalized == other.normalized && this->type == other.type;
|
||||||
}
|
}
|
||||||
bool Animation::operator==(const Animation &other) const {
|
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;
|
this->name == other.name && this->samplers == other.samplers;
|
||||||
}
|
}
|
||||||
bool AnimationChannel::operator==(const AnimationChannel &other) const {
|
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_node == other.target_node &&
|
||||||
this->target_path == other.target_path &&
|
this->target_path == other.target_path &&
|
||||||
this->sampler == other.sampler;
|
this->sampler == other.sampler;
|
||||||
@ -3850,6 +3855,7 @@ static bool ParseAnimationChannel(AnimationChannel *channel, std::string *err,
|
|||||||
channel->sampler = samplerIndex;
|
channel->sampler = samplerIndex;
|
||||||
channel->target_node = targetIndex;
|
channel->target_node = targetIndex;
|
||||||
|
|
||||||
|
ParseExtensionsProperty(&channel->extensions, err, o);
|
||||||
ParseExtrasProperty(&(channel->extras), o);
|
ParseExtrasProperty(&(channel->extras), o);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -3909,6 +3915,7 @@ static bool ParseAnimation(Animation *animation, std::string *err,
|
|||||||
|
|
||||||
ParseStringProperty(&animation->name, err, o, "name", false);
|
ParseStringProperty(&animation->name, err, o, "name", false);
|
||||||
|
|
||||||
|
ParseExtensionsProperty(&animation->extensions, err, o);
|
||||||
ParseExtrasProperty(&(animation->extras), o);
|
ParseExtrasProperty(&(animation->extras), o);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -5183,6 +5190,8 @@ static void SerializeGltfAnimationChannel(AnimationChannel &channel, json &o) {
|
|||||||
if (channel.extras.Type() != NULL_TYPE) {
|
if (channel.extras.Type() != NULL_TYPE) {
|
||||||
SerializeValue("extras", channel.extras, o);
|
SerializeValue("extras", channel.extras, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SerializeExtensionMap(channel.extensions, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfAnimationSampler(AnimationSampler &sampler, json &o) {
|
static void SerializeGltfAnimationSampler(AnimationSampler &sampler, json &o) {
|
||||||
@ -5220,6 +5229,8 @@ static void SerializeGltfAnimation(Animation &animation, json &o) {
|
|||||||
if (animation.extras.Type() != NULL_TYPE) {
|
if (animation.extras.Type() != NULL_TYPE) {
|
||||||
SerializeValue("extras", animation.extras, o);
|
SerializeValue("extras", animation.extras, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SerializeExtensionMap(animation.extensions, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SerializeGltfAsset(Asset &asset, json &o) {
|
static void SerializeGltfAsset(Asset &asset, json &o) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user