mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Get the new animation framework properly working
Store start and end frames as v2f Also move bone animations to their own function instead of object properties
This commit is contained in:
committed by
Perttu Ahola
parent
ba4d93027f
commit
118285e6ba
@@ -39,8 +39,6 @@ ObjectProperties::ObjectProperties():
|
||||
makes_footstep_sound(false),
|
||||
automatic_rotate(0)
|
||||
{
|
||||
// Nothing to do for animation_bone_position
|
||||
// Nothing to do for animation_bone_rotation
|
||||
textures.push_back("unknown_object.png");
|
||||
}
|
||||
|
||||
@@ -54,22 +52,6 @@ std::string ObjectProperties::dump()
|
||||
os<<", visual="<<visual;
|
||||
os<<", mesh="<<mesh;
|
||||
os<<", visual_size="<<PP2(visual_size);
|
||||
|
||||
os<<", animation_bone_position=[";
|
||||
for(std::map<std::string, v3f>::const_iterator ii = animation_bone_position.begin(); ii != animation_bone_position.end(); ++ii){
|
||||
std::string bone_name = (*ii).first;
|
||||
v3f bone_pos = (*ii).second;
|
||||
os<<bone_name<<" "<<bone_pos.X<<","<<bone_pos.Y<<","<<bone_pos.Z<<"\"";
|
||||
}
|
||||
os<<"]";
|
||||
os<<", animation_bone_rotation=[";
|
||||
for(std::map<std::string, v3f>::const_iterator ii = animation_bone_rotation.begin(); ii != animation_bone_rotation.end(); ++ii){
|
||||
std::string bone_name = (*ii).first;
|
||||
v3f bone_rot = (*ii).second;
|
||||
os<<bone_name<<" "<<bone_rot.X<<","<<bone_rot.Y<<","<<bone_rot.Z<<"\"";
|
||||
}
|
||||
os<<"]";
|
||||
|
||||
os<<", textures=[";
|
||||
for(u32 i=0; i<textures.size(); i++){
|
||||
os<<"\""<<textures[i]<<"\" ";
|
||||
@@ -93,24 +75,11 @@ void ObjectProperties::serialize(std::ostream &os) const
|
||||
writeV3F1000(os, collisionbox.MaxEdge);
|
||||
os<<serializeString(visual);
|
||||
os<<serializeString(mesh);
|
||||
|
||||
writeU16(os, animation_bone_position.size());
|
||||
for(std::map<std::string, v3f>::const_iterator ii = animation_bone_position.begin(); ii != animation_bone_position.end(); ++ii){
|
||||
os<<serializeString((*ii).first);
|
||||
writeV3F1000(os, (*ii).second);
|
||||
}
|
||||
writeU16(os, animation_bone_rotation.size());
|
||||
for(std::map<std::string, v3f>::const_iterator ii = animation_bone_rotation.begin(); ii != animation_bone_rotation.end(); ++ii){
|
||||
os<<serializeString((*ii).first);
|
||||
writeV3F1000(os, (*ii).second);
|
||||
}
|
||||
|
||||
writeV2F1000(os, visual_size);
|
||||
writeU16(os, textures.size());
|
||||
for(u32 i=0; i<textures.size(); i++){
|
||||
os<<serializeString(textures[i]);
|
||||
}
|
||||
|
||||
writeV2S16(os, spritediv);
|
||||
writeV2S16(os, initial_sprite_basepos);
|
||||
writeU8(os, is_visible);
|
||||
@@ -130,27 +99,12 @@ void ObjectProperties::deSerialize(std::istream &is)
|
||||
collisionbox.MaxEdge = readV3F1000(is);
|
||||
visual = deSerializeString(is);
|
||||
mesh = deSerializeString(is);
|
||||
|
||||
u32 animation_bone_position_count = readU16(is);
|
||||
for(u32 i=0; i<animation_bone_position_count; i++){
|
||||
std::string bone_name = deSerializeString(is);
|
||||
v3f bone_pos = readV3F1000(is);
|
||||
animation_bone_position[bone_name] = bone_pos;
|
||||
}
|
||||
u32 animation_bone_rotation_count = readU16(is);
|
||||
for(u32 i=0; i<animation_bone_rotation_count; i++){
|
||||
std::string bone_name = deSerializeString(is);
|
||||
v3f bone_rot = readV3F1000(is);
|
||||
animation_bone_rotation[bone_name] = bone_rot;
|
||||
}
|
||||
|
||||
visual_size = readV2F1000(is);
|
||||
textures.clear();
|
||||
u32 texture_count = readU16(is);
|
||||
for(u32 i=0; i<texture_count; i++){
|
||||
textures.push_back(deSerializeString(is));
|
||||
}
|
||||
|
||||
spritediv = readV2S16(is);
|
||||
initial_sprite_basepos = readV2S16(is);
|
||||
is_visible = readU8(is);
|
||||
|
Reference in New Issue
Block a user