augmented exported and other class changes

This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent 11e22b1c10
commit a09a4f548a
4 changed files with 22 additions and 13 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ namespace vb01{
Vector3 Bone::getModelSpacePos(){
Vector3 modelSpacePos = Vector3::VEC_ZERO;
Bone *rootBone = skeleton->getRootBone();
vector<Node*> boneHierarchy = getAncestors();
vector<Node*> boneHierarchy = getAncestors(rootBone);
while(!boneHierarchy.empty()){
int id = boneHierarchy.size() - 1;
+12 -3
View File
@@ -41,7 +41,16 @@ 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:
file.write("\nanimations: " + str(numAnims))
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))
for nlaStrip in ob.animation_data.nla_tracks[0].strips:
animName = nlaStrip.name
action = bpy.data.actions[animName]
@@ -57,12 +66,12 @@ def exportData(ob):
start = nlaStrip.frame_start
end = nlaStrip.frame_end
file.write(animName + ' ' + group.name + ' ')
file.write(animName + ' ' + group.name + ' ' + str(len(group.channels)) + ' ')
for channel in group.channels:
numKeyframes = len(channel.keyframe_points)
channelType = getChannelType(channel)
file.write(str(numKeyframes) + ' ' + channelType + ' ')
file.write(channelType + ' ')
file.write('\n')
+8 -6
View File
@@ -25,19 +25,19 @@ namespace vb01{
vector<string> data;
for(it = skeletonBracketIds.begin(); it != skeletonBracketIds.end(); ++it){
int key = it->first;
readFile(path, data, key, skeletonBracketIds[key]);
readFile(path, data, key + 1, skeletonBracketIds[key]);
skeletons.push_back(readSkeleton(data));
data.clear();
}
for(it = meshBracketIds.begin(); it != meshBracketIds.end(); ++it){
int key = it->first;
readFile(path, data, key, meshBracketIds[key]);
readFile(path, data, key + 1, meshBracketIds[key]);
buildMesh(data);
data.clear();
}
for(it = lightBracketIds.begin(); it != lightBracketIds.end(); ++it){
int key = it->first;
readFile(path, data, key, lightBracketIds[key]);
readFile(path, data, key + 1, lightBracketIds[key]);
readLights(data);
data.clear();
}
@@ -222,13 +222,15 @@ namespace vb01{
string data[3];
getLineData(line, data, 3);
int boneStartLine = 6;
int numBones = atoi(data[1].c_str());
line = skeletonData[6 + numBones].substr(getCharId(skeletonData[6 + numBones], ':') + 2);
line = skeletonData[boneStartLine + numBones].substr(getCharId(skeletonData[boneStartLine + numBones], ':') + 2);
int numAnimations = atoi(line.c_str());
line = skeletonData[7 + numBones].substr(getCharId(skeletonData[7 + numBones], ':') + 2);
line = skeletonData[boneStartLine + numBones + 1].substr(getCharId(skeletonData[boneStartLine + numBones + 1], ':') + 2);
int numKeyframeGroups = atoi(line.c_str());
int boneStartLine = 6;
int animationStartLine = boneStartLine + numBones + 2;
int keyframeGroupStartLine = animationStartLine + numAnimations;
int keyframeStartLine = keyframeGroupStartLine + numKeyframeGroups;
+1 -3
View File
@@ -48,7 +48,7 @@ namespace vb01{
skeletonData.push_back(b.name + ": " + b.parent + " " + headStr + xAxisStr + yAxisStr + b.ikTarget + " " + to_string(b.ikChainLength) + " ");
}
skeletonData.push_back("animations: 1 ");
skeletonData.push_back("channels: 2 ");
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 ");
@@ -144,12 +144,10 @@ namespace vb01{
CPPUNIT_ASSERT(skeleton->getBone(i)->getName() == bones[i].name);
vb01::Bone *parent = (vb01::Bone*)skeleton->getBone(i)->getParent();
/*
if(parent->getName() != "")
CPPUNIT_ASSERT(parent->getName() == bones[i].parent);
else
CPPUNIT_ASSERT(bones[i].parent == "-");
*/
}
AnimationController *controller = skeleton->getAnimationController();
Animation *animation = controller->getAnimation("Action");