mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-27 03:53:24 +00:00
multiple animation reading
export script update
This commit is contained in:
+8
-2
@@ -4,7 +4,7 @@ using namespace std;
|
||||
|
||||
namespace vb01{
|
||||
Animation::Animation(string name){
|
||||
this->name=name;
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
Animation::~Animation(){
|
||||
@@ -23,7 +23,7 @@ namespace vb01{
|
||||
return id > -1 ? &(keyframeGroups[id]) : nullptr;
|
||||
}
|
||||
|
||||
KeyframeChannelType Animation::getKeyframeChannelType(string &typeString){
|
||||
KeyframeChannelType Animation::getKeyframeChannelType(string typeString){
|
||||
KeyframeChannelType type;
|
||||
if(typeString == "pos_x")
|
||||
type = KeyframeChannelType::POS_X;
|
||||
@@ -39,6 +39,12 @@ namespace vb01{
|
||||
type = KeyframeChannelType::ROT_Y;
|
||||
else if(typeString == "rot_z")
|
||||
type = KeyframeChannelType::ROT_Z;
|
||||
else if(typeString == "scale_x")
|
||||
type = KeyframeChannelType::SCALE_X;
|
||||
else if(typeString == "scale_y")
|
||||
type = KeyframeChannelType::SCALE_Y;
|
||||
else if(typeString == "scale_z")
|
||||
type = KeyframeChannelType::SCALE_Z;
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ namespace vb01{
|
||||
void update();
|
||||
KeyframeGroup* getKeyframeGroup(Bone *b);
|
||||
KeyframeGroup::KeyframeChannel* getKeyframeChannel(Bone *b, KeyframeGroup::KeyframeChannel::Type);
|
||||
static KeyframeGroup::KeyframeChannel::Type getKeyframeChannelType(std::string&);
|
||||
static KeyframeGroup::KeyframeChannel::Type getKeyframeChannelType(std::string);
|
||||
inline int getNumKeyframeGroups(){return keyframeGroups.size();}
|
||||
inline std::string getName(){return name;}
|
||||
inline void addKeyframeGroup(KeyframeGroup k){keyframeGroups.push_back(k);}
|
||||
|
||||
@@ -41,42 +41,32 @@ def exportData(ob):
|
||||
file.write('\n' + bone.name + ': ' + ('None' if bone.parent is None else bone.parent.name) + " " + str(bone.length) + " " + str(head.x) + " " + str(head.y) + " " + str(head.z) + " " + str(xAxis.x) + " " + str(xAxis.y) + " " + str(xAxis.z) + " " + str(yAxis.x) + " " + str(yAxis.y) + " " + str(yAxis.z) + " " + ikTarget + ' ' + str(chainLength) + ' ')
|
||||
|
||||
if numAnims > 0:
|
||||
numGroups = 0
|
||||
for nlaStrip in ob.animation_data.nla_tracks[0].strips:
|
||||
animName = nlaStrip.name
|
||||
action = bpy.data.actions[animName]
|
||||
for group in action.groups:
|
||||
numGroups += 1;
|
||||
|
||||
|
||||
file.write('\nanimations: ' + str(numAnims))
|
||||
file.write('\ngroups: ' + str(numGroups))
|
||||
file.write('\nanimations: ' + str(numAnims) + '\n')
|
||||
for nlaStrip in ob.animation_data.nla_tracks[0].strips:
|
||||
animName = nlaStrip.name
|
||||
action = bpy.data.actions[animName]
|
||||
numAnimBones = len(action.groups)
|
||||
file.write('\nanimation: ' + animName + ' ' + str(numAnimBones) + ' ')
|
||||
file.write('animation: ' + animName)
|
||||
file.write('\ngroups: ' + str(numAnimBones))
|
||||
|
||||
print('Exporting animation '+animName+'...\n')
|
||||
|
||||
file.write('\n')
|
||||
|
||||
for group in action.groups:
|
||||
bone = ob.data.bones[group.name]
|
||||
start = nlaStrip.frame_start
|
||||
end = nlaStrip.frame_end
|
||||
|
||||
file.write(animName + ' ' + group.name + ' ' + str(len(group.channels)) + ' ')
|
||||
file.write(group.name + ' ' + str(len(group.channels)) + ' ')
|
||||
|
||||
for channel in group.channels:
|
||||
numKeyframes = len(channel.keyframe_points)
|
||||
channelType = getChannelType(channel)
|
||||
file.write(channelType + ' ')
|
||||
file.write(channelType + ' ' + str(numKeyframes) + ' ')
|
||||
|
||||
file.write('\n')
|
||||
|
||||
|
||||
for group in action.groups:
|
||||
bone = ob.data.bones[group.name]
|
||||
start = nlaStrip.frame_start
|
||||
end = nlaStrip.frame_end
|
||||
@@ -101,8 +91,6 @@ def exportData(ob):
|
||||
elif interp == 'BEZIER':
|
||||
interpInt = 2
|
||||
|
||||
file.write(animName + ' ' + bone.name + ' ' + channelType + ' ')
|
||||
|
||||
if bpy.context.scene.frame_current > end:
|
||||
bpy.context.scene.frame_current = bpy.context.scene.frame_current - 1
|
||||
if coordType == "location":
|
||||
@@ -118,7 +106,7 @@ def exportData(ob):
|
||||
file.write("\n")
|
||||
|
||||
|
||||
elif(ob.type=="MESH"):
|
||||
elif(ob.type == "MESH"):
|
||||
skeletonName = '-'
|
||||
skeleton = ob.modifiers['Armature'].object
|
||||
if(skeleton):
|
||||
@@ -134,14 +122,14 @@ def exportData(ob):
|
||||
#numShapeKeys=len(mesh.shape_keys[0].key_blocks)-1
|
||||
|
||||
|
||||
file.write("numElements: " + str(numVerts) + " " + str(numFaces) + " " + str(numGroups) + " " + str(numShapeKeys) + " \n")
|
||||
file.write('numElements: ' + str(numVerts) + ' ' + str(numFaces) + ' ' + str(numGroups) + ' ' + str(numShapeKeys) + ' \n')
|
||||
|
||||
if numGroups > 0:
|
||||
file.write('groups:\n')
|
||||
for group in ob.vertex_groups:
|
||||
file.write(group.name + '\n')
|
||||
|
||||
file.write("vertices:\n")
|
||||
file.write('vertices:\n')
|
||||
print('Exporting vertices...\n')
|
||||
for vert in mesh.vertices:
|
||||
pos = vert.co
|
||||
@@ -151,12 +139,12 @@ def exportData(ob):
|
||||
weights.append(0.0)
|
||||
for g in vert.groups:
|
||||
weights[g.group] = g.weight
|
||||
file.write(str(pos.x) + " " + str(pos.y) + " " + str(pos.z) + " " + str(norm.x) + " " + str(norm.y) + " " + str(norm.z) + " ")
|
||||
file.write(str(pos.x) + ' ' + str(pos.y) + ' ' + str(pos.z) + ' ' + str(norm.x) + ' ' + str(norm.y) + ' ' + str(norm.z) + ' ')
|
||||
for w in weights:
|
||||
file.write(str(w)+" ")
|
||||
file.write(str(w) + ' ')
|
||||
file.write('\n')
|
||||
|
||||
file.write("faces:\n")
|
||||
file.write('faces:\n')
|
||||
print('Exporting faces...\n')
|
||||
mesh.calc_tangents()
|
||||
for face in mesh.polygons:
|
||||
@@ -165,7 +153,7 @@ def exportData(ob):
|
||||
loop = mesh.loops[loopInd]
|
||||
tan = loop.tangent
|
||||
bitan = loop.bitangent
|
||||
file.write(str(vert) + " " + str(uv.x) + " " + str(uv.y) + " " + str(tan.x) + " " + str(tan.y) + " " + str(tan.z) + " " + str(bitan.x) + " " + str(bitan.y) + " " + str(bitan.z) + ' \n')
|
||||
file.write(str(vert) + ' ' + str(uv.x) + ' ' + str(uv.y) + ' ' + str(tan.x) + ' ' + str(tan.y) + ' ' + str(tan.z) + ' ' + str(bitan.x) + ' ' + str(bitan.y) + ' ' + str(bitan.z) + ' \n')
|
||||
mesh.free_tangents()
|
||||
|
||||
|
||||
@@ -224,12 +212,12 @@ def getChannelType(channel):
|
||||
arrInd = channel.array_index
|
||||
coords = 'wxyz'
|
||||
|
||||
if coordType == "location":
|
||||
channelType = "pos_" + coords[arrInd + 1]
|
||||
elif coordType == "rotation_quaternion":
|
||||
channelType = "rot_" + coords[arrInd]
|
||||
elif coordType == "scale":
|
||||
channelType = "scale_" + coords[arrInd + 1]
|
||||
if coordType == 'location':
|
||||
channelType = 'pos_' + coords[arrInd + 1]
|
||||
elif coordType == 'rotation_quaternion':
|
||||
channelType = 'rot_' + coords[arrInd]
|
||||
elif coordType == 'scale':
|
||||
channelType = 'scale_' + coords[arrInd + 1]
|
||||
return channelType
|
||||
|
||||
fl = bpy.data.filepath
|
||||
@@ -238,7 +226,7 @@ for i in range(len(fl)):
|
||||
if(fl[i] == '.'):
|
||||
dotId = i
|
||||
break
|
||||
fl = fl[0 : dotId] + ".vb"
|
||||
fl = fl[0 : dotId] + '.vb'
|
||||
|
||||
objects = []
|
||||
selectedObjects = bpy.context.selected_objects
|
||||
@@ -255,8 +243,8 @@ for s in selectedObjects:
|
||||
if inObjects == False:
|
||||
objects.append(sPar)
|
||||
|
||||
file=open(fl, "w")
|
||||
file=open(fl, 'w')
|
||||
for ob in selectedObjects:
|
||||
exportData(ob)
|
||||
file.write("}\n")
|
||||
file.write('}\n')
|
||||
file.close()
|
||||
|
||||
+62
-70
@@ -172,63 +172,69 @@ namespace vb01{
|
||||
}
|
||||
}
|
||||
|
||||
void VbModelReader::readAnimations(Skeleton *skeleton, vector<string> &meshData){
|
||||
void VbModelReader::readAnimations(Skeleton *skeleton, vector<string> &skeletonData, int numAnimations){
|
||||
AnimationController *controller = skeleton->getAnimationController();
|
||||
for(string line : meshData){
|
||||
int colonId = line.find_first_of(':');
|
||||
if(colonId != -1){
|
||||
string data[2];
|
||||
string postCol = line.substr(colonId + 2);
|
||||
getLineData(postCol, data, 2);
|
||||
string animName = data[0];
|
||||
int animStartLine = 0;
|
||||
|
||||
Animation *animation = new Animation(animName);
|
||||
controller->addAnimation(animation);
|
||||
for(int i = 0; i < numAnimations; i++){
|
||||
string animLine = skeletonData[animStartLine];
|
||||
currentAnim = animLine.substr(animLine.find_first_of(':') + 2);
|
||||
string groupsLine = skeletonData[animStartLine + 1];
|
||||
|
||||
Animation *animation = new Animation(currentAnim);
|
||||
controller->addAnimation(animation);
|
||||
|
||||
int numKeyframeGroups = atoi(groupsLine.substr(groupsLine.find_first_of(':') + 2).c_str());
|
||||
int keyframeGroupStartLine = animStartLine + 2;
|
||||
for(int j = 0; j < numKeyframeGroups; j++){
|
||||
string dataLine[2];
|
||||
getLineData(skeletonData[keyframeGroupStartLine], dataLine, 2);
|
||||
|
||||
KeyframeGroup keyframeGroup;
|
||||
keyframeGroup.bone = skeleton->getBone(dataLine[0]);
|
||||
int numKeyframeChannels = atoi(dataLine[1].c_str());
|
||||
string channelData[2 * numKeyframeChannels];
|
||||
getLineData(skeletonData[keyframeGroupStartLine], channelData, 2 * numKeyframeChannels, 2);
|
||||
|
||||
vector<KeyframeChannel> keyframeChannels;
|
||||
int numTypeKeyframes[numKeyframeChannels];
|
||||
int numKeyframes = 0;
|
||||
for(int k = 0; k < numKeyframeChannels; k++){
|
||||
KeyframeChannel keyframeChannel;
|
||||
|
||||
keyframeChannel.type = Animation::getKeyframeChannelType(channelData[2 * k]);
|
||||
numTypeKeyframes[k] = atoi(channelData[2 * k + 1].c_str());
|
||||
numKeyframes += numTypeKeyframes[k];
|
||||
|
||||
keyframeChannels.push_back(keyframeChannel);
|
||||
}
|
||||
|
||||
int keyframeStartLine = keyframeGroupStartLine + 1;
|
||||
int currentChannel = 0, numCurrentTypeKeyframes = 0;
|
||||
for(int k = 0; k < numKeyframes; k++){
|
||||
string keyframeLine = skeletonData[keyframeStartLine + k];
|
||||
string keyframeData[9];
|
||||
getLineData(keyframeLine, keyframeData, 9);
|
||||
|
||||
Keyframe keyframe;
|
||||
keyframe.value = atof(keyframeData[0].c_str());
|
||||
keyframe.frame = atoi(keyframeData[1].c_str());
|
||||
keyframe.interpolation = (KeyframeInterpolation)atoi(keyframeData[2].c_str());
|
||||
keyframeChannels[currentChannel].keyframes.push_back(keyframe);
|
||||
|
||||
numCurrentTypeKeyframes++;
|
||||
if(numCurrentTypeKeyframes == numTypeKeyframes[currentChannel]){
|
||||
currentChannel++;
|
||||
numCurrentTypeKeyframes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
keyframeGroup.keyframeChannels = keyframeChannels;
|
||||
animation->addKeyframeGroup(keyframeGroup);
|
||||
keyframeGroupStartLine += numKeyframes + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VbModelReader::readKeyframesGroups(Skeleton *skeleton, vector<string> &meshData){
|
||||
AnimationController *controller = skeleton->getAnimationController();
|
||||
for(string line : meshData){
|
||||
string data[17];
|
||||
getLineData(line, data, 3);
|
||||
|
||||
Animation *anim = controller->getAnimation(data[0]);
|
||||
Bone *animBone = skeleton->getBone(data[1]);
|
||||
int numChannelTypes = atoi(data[2].c_str());
|
||||
|
||||
getLineData(line, data, numChannelTypes, 3);
|
||||
KeyframeGroup keyframeGroup;
|
||||
keyframeGroup.bone = animBone;
|
||||
for(int i = 0; i < numChannelTypes; i++){
|
||||
string typeString = data[i];
|
||||
KeyframeChannelType type = anim->getKeyframeChannelType(typeString);
|
||||
KeyframeChannel keyframeChannel;
|
||||
keyframeChannel.type = type;
|
||||
keyframeGroup.keyframeChannels.push_back(keyframeChannel);
|
||||
}
|
||||
anim->addKeyframeGroup(keyframeGroup);
|
||||
}
|
||||
}
|
||||
|
||||
void VbModelReader::readKeyframes(Skeleton *skeleton, vector<string> &meshData){
|
||||
AnimationController *controller = skeleton->getAnimationController();
|
||||
for(string line : meshData){
|
||||
int numData = 6;
|
||||
string data[numData];
|
||||
getLineData(line, data, numData);
|
||||
Animation *anim = controller->getAnimation(data[0]);
|
||||
Bone *animBone = skeleton->getBone(data[1]);
|
||||
KeyframeChannelType type = anim->getKeyframeChannelType(data[2]);
|
||||
KeyframeChannel *channel = anim->getKeyframeChannel(animBone, type);
|
||||
|
||||
Keyframe keyframe;
|
||||
keyframe.value = atof(data[3].c_str());
|
||||
keyframe.frame = atoi(data[4].c_str());
|
||||
keyframe.interpolation = (KeyframeInterpolation)atoi(data[5].c_str());
|
||||
|
||||
channel->keyframes.push_back(keyframe);
|
||||
animStartLine = keyframeGroupStartLine;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,13 +249,7 @@ namespace vb01{
|
||||
|
||||
line = skeletonData[boneStartLine + numBones].substr(getCharId(skeletonData[boneStartLine + numBones], ':') + 2);
|
||||
int numAnimations = atoi(line.c_str());
|
||||
|
||||
line = skeletonData[boneStartLine + numBones + 1].substr(getCharId(skeletonData[boneStartLine + numBones + 1], ':') + 2);
|
||||
int numKeyframeGroups = atoi(line.c_str());
|
||||
|
||||
int animationStartLine = boneStartLine + numBones + 2;
|
||||
int keyframeGroupStartLine = animationStartLine + numAnimations;
|
||||
int keyframeStartLine = keyframeGroupStartLine + numKeyframeGroups;
|
||||
int animStartLine = boneStartLine + numBones + 1;
|
||||
|
||||
Skeleton *skeleton = new Skeleton(name);
|
||||
|
||||
@@ -257,16 +257,8 @@ namespace vb01{
|
||||
createBones(skeleton, skeletonSubData);
|
||||
skeletonSubData.clear();
|
||||
|
||||
skeletonSubData = vector<string>(skeletonData.begin() + animationStartLine, skeletonData.begin() + animationStartLine + numAnimations);
|
||||
readAnimations(skeleton, skeletonSubData);
|
||||
skeletonSubData.clear();
|
||||
|
||||
skeletonSubData = vector<string>(skeletonData.begin() + keyframeGroupStartLine, skeletonData.begin() + keyframeGroupStartLine + numKeyframeGroups);
|
||||
readKeyframesGroups(skeleton, skeletonSubData);
|
||||
skeletonSubData.clear();
|
||||
|
||||
skeletonSubData = vector<string>(skeletonData.begin() + keyframeStartLine, skeletonData.end());
|
||||
readKeyframes(skeleton, skeletonSubData);
|
||||
skeletonSubData = vector<string>(skeletonData.begin() + animStartLine, skeletonData.end());
|
||||
readAnimations(skeleton, skeletonSubData, numAnimations);
|
||||
skeletonSubData.clear();
|
||||
|
||||
return skeleton;
|
||||
|
||||
+2
-3
@@ -25,9 +25,7 @@ namespace vb01{
|
||||
void connectNodes();
|
||||
|
||||
void createBones(Skeleton*, std::vector<std::string>&);
|
||||
void readAnimations(Skeleton*, std::vector<std::string>&);
|
||||
void readKeyframesGroups(Skeleton*, std::vector<std::string>&);
|
||||
void readKeyframes(Skeleton*, std::vector<std::string>&);
|
||||
void readAnimations(Skeleton*, std::vector<std::string>&, int);
|
||||
Skeleton* readSkeleton(std::vector<std::string>&);
|
||||
void readVertices(std::vector<Vector3>&, std::vector<Vector3>&, std::vector<float>&, std::vector<std::string>&, int);
|
||||
void readFaces(std::vector<Vector3>&, std::vector<Vector3>&, std::vector<float>&, std::vector<std::string>&, int, Mesh::Vertex*, u32*);
|
||||
@@ -41,6 +39,7 @@ namespace vb01{
|
||||
std::vector<Skeleton*> skeletons;
|
||||
std::vector<Mesh*> meshes;
|
||||
std::vector<Node*> nodes;
|
||||
std::string currentAnim = "";
|
||||
|
||||
friend class VbModelReaderTest;
|
||||
};
|
||||
|
||||
+42
-33
@@ -29,7 +29,8 @@ namespace vb01{
|
||||
bones = vector<vbReader::Bone>({
|
||||
Bone("bipod", "-", Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(0, 1, 0), "", 0),
|
||||
Bone("bipod.L", "bipod", Vector3(1, 0, 2), Vector3(1, 0, 0), Vector3(0, 0, -1), "", 0),
|
||||
Bone("bipod.R", "bipod", Vector3(-1, 0, 2), Vector3(-1, 0, 0), Vector3(0, 0, -1), "", 0)
|
||||
Bone("bipod.R", "bipod", Vector3(-1, 0, 2), Vector3(-1, 0, 0), Vector3(0, 0, -1), "", 0),
|
||||
Bone("opening", "-", Vector3(0, 0, 2), Vector3(-1, 0, 0), Vector3(0, 0, -1), "", 0)
|
||||
});
|
||||
skeletonParent = "-";
|
||||
|
||||
@@ -47,37 +48,43 @@ namespace vb01{
|
||||
string yAxisStr = to_string(b.yAxis.x) + " " + to_string(b.yAxis.y) + " " + to_string(b.yAxis.z) + " ";
|
||||
skeletonData.push_back(b.name + ": " + b.parent + " " + headStr + xAxisStr + yAxisStr + b.ikTarget + " " + to_string(b.ikChainLength) + " ");
|
||||
}
|
||||
skeletonData.push_back("animations: 1 ");
|
||||
skeletonData.push_back("animations: 2 ");
|
||||
skeletonData.push_back("animation: Action");
|
||||
skeletonData.push_back("groups: 2 ");
|
||||
skeletonData.push_back("animation: Action ");
|
||||
skeletonData.push_back("Action bipod.L 7 pos_x pos_y pos_z rot_w rot_x rot_y rot_z ");
|
||||
skeletonData.push_back("Action bipod.R 6 pos_x pos_y pos_z rot_w rot_x rot_y ");
|
||||
skeletonData.push_back("Action bipod.L pos_x 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L pos_x 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L pos_y 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L pos_y 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L pos_z 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L pos_z 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_w 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_w 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_x 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_x 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_y 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_y 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_z 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.L rot_z 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R pos_x 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R pos_x 10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R pos_y 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R pos_y 10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R pos_z 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R pos_z 10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R rot_w 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R rot_w 10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R rot_x 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R rot_x 10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R rot_y 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("Action bipod.R rot_y 10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("bipod.L 7 pos_x 2 pos_y 2 pos_z 2 rot_w 2 rot_x 2 rot_y 2 rot_z 2 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("bipod.R 6 pos_x 2 pos_y 2 pos_z 2 rot_w 2 rot_x 2 rot_y 2 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("10 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("animation: open");
|
||||
skeletonData.push_back("groups: 1 ");
|
||||
skeletonData.push_back("opening 1 rot_w 2 rot_x 1");
|
||||
skeletonData.push_back("opening rot_w 1 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("opening rot_w 0 10 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
skeletonData.push_back("opening rot_x 0 1 2 AUTO_CLAMPED 1 1 AUTO_CLAMPED 1 1 ");
|
||||
}
|
||||
|
||||
void VbModelReaderTest::setupMesh(){
|
||||
@@ -150,8 +157,10 @@ namespace vb01{
|
||||
CPPUNIT_ASSERT(bones[i].parent == "-");
|
||||
}
|
||||
AnimationController *controller = skeleton->getAnimationController();
|
||||
Animation *animation = controller->getAnimation("Action");
|
||||
CPPUNIT_ASSERT(animation);
|
||||
string animNames[]{"Action", "open"};
|
||||
CPPUNIT_ASSERT(controller->getAnimation(animNames[0]));
|
||||
CPPUNIT_ASSERT(controller->getAnimation(animNames[1]));
|
||||
Animation *animation = controller->getAnimation(animNames[0]);
|
||||
|
||||
KeyframeGroup *leftBipodGroup = animation->getKeyframeGroup(skeleton->getBone("bipod.L"));
|
||||
KeyframeGroup *rightBipodGroup = animation->getKeyframeGroup(skeleton->getBone("bipod.R"));
|
||||
|
||||
Reference in New Issue
Block a user