From 428d9993c8f27d205dc54fe515d4cb2d1ea20b3f Mon Sep 17 00:00:00 2001 From: devZoGok Date: Fri, 12 Feb 2021 12:30:03 +0200 Subject: [PATCH] multiple animation reading export script update --- animation.cpp | 10 +++- animation.h | 2 +- script.py | 54 +++++++---------- vbModelReader.cpp | 132 ++++++++++++++++++++---------------------- vbModelReader.h | 5 +- vbModelReaderTest.cpp | 75 +++++++++++++----------- 6 files changed, 136 insertions(+), 142 deletions(-) diff --git a/animation.cpp b/animation.cpp index e8f1221..c030e6a 100644 --- a/animation.cpp +++ b/animation.cpp @@ -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; } diff --git a/animation.h b/animation.h index af3c450..c60becc 100644 --- a/animation.h +++ b/animation.h @@ -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);} diff --git a/script.py b/script.py index 6488704..0ef1e86 100644 --- a/script.py +++ b/script.py @@ -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() diff --git a/vbModelReader.cpp b/vbModelReader.cpp index 153c9de..28c056d 100644 --- a/vbModelReader.cpp +++ b/vbModelReader.cpp @@ -172,63 +172,69 @@ namespace vb01{ } } - void VbModelReader::readAnimations(Skeleton *skeleton, vector &meshData){ + void VbModelReader::readAnimations(Skeleton *skeleton, vector &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 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 &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 &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(skeletonData.begin() + animationStartLine, skeletonData.begin() + animationStartLine + numAnimations); - readAnimations(skeleton, skeletonSubData); - skeletonSubData.clear(); - - skeletonSubData = vector(skeletonData.begin() + keyframeGroupStartLine, skeletonData.begin() + keyframeGroupStartLine + numKeyframeGroups); - readKeyframesGroups(skeleton, skeletonSubData); - skeletonSubData.clear(); - - skeletonSubData = vector(skeletonData.begin() + keyframeStartLine, skeletonData.end()); - readKeyframes(skeleton, skeletonSubData); + skeletonSubData = vector(skeletonData.begin() + animStartLine, skeletonData.end()); + readAnimations(skeleton, skeletonSubData, numAnimations); skeletonSubData.clear(); return skeleton; diff --git a/vbModelReader.h b/vbModelReader.h index b9a82f3..b3520e7 100644 --- a/vbModelReader.h +++ b/vbModelReader.h @@ -25,9 +25,7 @@ namespace vb01{ void connectNodes(); void createBones(Skeleton*, std::vector&); - void readAnimations(Skeleton*, std::vector&); - void readKeyframesGroups(Skeleton*, std::vector&); - void readKeyframes(Skeleton*, std::vector&); + void readAnimations(Skeleton*, std::vector&, int); Skeleton* readSkeleton(std::vector&); void readVertices(std::vector&, std::vector&, std::vector&, std::vector&, int); void readFaces(std::vector&, std::vector&, std::vector&, std::vector&, int, Mesh::Vertex*, u32*); @@ -41,6 +39,7 @@ namespace vb01{ std::vector skeletons; std::vector meshes; std::vector nodes; + std::string currentAnim = ""; friend class VbModelReaderTest; }; diff --git a/vbModelReaderTest.cpp b/vbModelReaderTest.cpp index 1badf7b..16ab3c1 100644 --- a/vbModelReaderTest.cpp +++ b/vbModelReaderTest.cpp @@ -29,7 +29,8 @@ namespace vb01{ bones = vector({ 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"));