Merge branch 'Importer' of https://github.com/teamfisk/TacticalZ into Importer
Conflicts: tools/MayaExporter/MayaExporter/Skeleton.cpp
This commit is contained in:
@@ -47,13 +47,24 @@ bool Export::Meshes(std::string pathName, bool selectedOnly)
|
||||
|
||||
for (unsigned int i = 0; i < connections.length(); i++) {
|
||||
if (connections[i].node().apiType() == MFn::kSkinClusterFilter) {
|
||||
MGlobal::select(shape.parent(i), MGlobal::kReplaceList);
|
||||
MGlobal::displayInfo(MString() + "Moving " + thisNode.name() + " to bindPose.");
|
||||
shape.parent(0, &status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "shape.parent(0, &status) failed with: " + status.errorString());
|
||||
}
|
||||
status = MGlobal::select(shape.parent(0), MGlobal::kReplaceList);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "Parent to " + thisNode.name() + " failed");
|
||||
}
|
||||
|
||||
MFnDependencyNode tmp(shape.parent(0));
|
||||
MGlobal::displayInfo(MString() + "Moving " + tmp.name() + " to bindPose.");
|
||||
|
||||
status = MGlobal::executeCommand("GoToBindPose;");
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "GoToBindPose: " + status.errorString());
|
||||
}
|
||||
MGlobal::displayInfo(MString() + "Has moved " + thisNode.name() + " to bindPose.");
|
||||
|
||||
MGlobal::displayInfo(MString() + "Has moved " + tmp.name() + " to bindPose.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,9 +85,6 @@ bool Material::findColorTexture(MaterialNode& material_node, MFnDependencyNode&
|
||||
material_node.ColorMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
|
||||
material_node.ColorMapFileLength = material_node.ColorMapFile.length() + 1;
|
||||
// Test
|
||||
MGlobal::displayInfo(MString() + "getAbsolutePathToResources: " + workspace);
|
||||
MGlobal::displayInfo(MString() + "Texture file: " + FullPath.c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -209,6 +206,7 @@ std::vector<MaterialNode>* Material::DoIt(Mesh mesh)
|
||||
meshHasMaterial = true;
|
||||
MaterialStorage.IndexStart = totalIndices;
|
||||
MaterialStorage.IndexEnd = totalIndices + aMeshMaterial.second.size() - 1;
|
||||
MGlobal::displayInfo("Oh noes, breaking in material");
|
||||
break;
|
||||
}
|
||||
totalIndices += aMeshMaterial.second.size();
|
||||
|
||||
@@ -19,18 +19,18 @@ public:
|
||||
float ReflectionFactor;
|
||||
float SpecularExponent;
|
||||
|
||||
float DiffuseColor[3]{ 1.0f };
|
||||
float DiffuseColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
unsigned int ColorMapFileLength = 0;
|
||||
std::string ColorMapFile;
|
||||
|
||||
float SpecularColor[3]{ 1.0f };
|
||||
float SpecularColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
unsigned int SpecularMapFileLength = 0;
|
||||
std::string SpecularMapFile;
|
||||
|
||||
unsigned int NormalMapFileLength = 0;
|
||||
std::string NormalMapFile;
|
||||
|
||||
float IncandescenceColor[3]{ 1.0f };
|
||||
float IncandescenceColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
unsigned int IncandescenceMapFileLength = 0;
|
||||
std::string IncandescenceMapFile;
|
||||
|
||||
|
||||
@@ -87,10 +87,6 @@ std::map<int, MeshClass::WeightInfo> MeshClass::GetWeightData()
|
||||
}
|
||||
weightMap[geomIter.index()] = weightInfo;
|
||||
|
||||
|
||||
for (unsigned int k = 0; k!=nrOfWeights; k++) {
|
||||
MGlobal::displayInfo(MString() + "influence: " + weightInfo.BoneIndices[k] + " weight: " + weightInfo.BoneWeights[k]);
|
||||
}
|
||||
geomIter.next();
|
||||
}
|
||||
it.next();
|
||||
@@ -112,7 +108,6 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
MFnDependencyNode thisNode(node);
|
||||
MPlugArray connections;
|
||||
thisNode.findPlug("inMesh").connectedTo(connections, true, true);
|
||||
MGlobal::displayInfo(MString() + "inMesh");
|
||||
bool hasSkin = false;
|
||||
MPlug weightList, weights;
|
||||
MObject weightListObject;
|
||||
@@ -138,7 +133,6 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
}
|
||||
|
||||
for (int pathID = 0; pathID < dagPaths.length(); pathID++) {
|
||||
MGlobal::displayInfo(dagPaths[pathID].fullPathName());
|
||||
MDagPath thisMeshPath(dagPaths[pathID]);
|
||||
|
||||
MMatrix transformMatrix = thisMeshPath.inclusiveMatrix(&status);
|
||||
@@ -173,8 +167,7 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
break;
|
||||
}
|
||||
map<string, vector<int>> materialFaceIDs;
|
||||
MGlobal::displayInfo(MString() + "shaderIndexList: " + shaderIndexList.length());
|
||||
MGlobal::displayInfo(MString() + "shaderList: " + shaderList.length());
|
||||
|
||||
MPlugArray plugArray;
|
||||
for (int i = 0; i < shaderIndexList.length(); i++) {
|
||||
MFnDependencyNode shader(shaderList[shaderIndexList[i]]);
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
//
|
||||
// return m_AllSkeletons;
|
||||
//}
|
||||
std::string attr[9] = { "scaleX", "scaleY", "scaleZ", "translateX", "translateY", "translateZ", "rotateX", "rotateY", "rotateZ" };
|
||||
static std::string attr[9] = { "scaleX", "scaleY", "scaleZ", "translateX", "translateY", "translateZ", "rotateX", "rotateY", "rotateZ" };
|
||||
|
||||
Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int endFrame)
|
||||
{
|
||||
@@ -155,12 +155,22 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
||||
|
||||
MFnAnimCurve jointAnim(connected);
|
||||
|
||||
//MGlobal::displayInfo(MString() + "curve : " + jointAnim.name());
|
||||
//MGlobal::displayInfo(MString() + "curve keys : " + jointAnim.numKeys());
|
||||
//MGlobal::displayInfo(MString() + "curve keyframes : " + jointAnim.numKeyframes());
|
||||
//MGlobal::displayInfo(MString() + "startFrame : " + startFrame);
|
||||
//MGlobal::displayInfo(MString() + "endFrame : " + endFrame);
|
||||
|
||||
unsigned int startKeyFrameIndex = jointAnim.findClosest(MTime(startFrame, MTime::kNTSCField), &tmp);
|
||||
|
||||
if (tmp == MStatus::kFailure)
|
||||
MGlobal::displayInfo(MString() + "Fail :c");
|
||||
|
||||
if (startFrame * oneDivSixty <= jointAnim.time(startKeyFrameIndex).value() && jointAnim.time(startKeyFrameIndex).value() <= endFrame * oneDivSixty) {
|
||||
//MGlobal::displayInfo(MString() + "Start key time : " + jointAnim.time(startKeyFrameIndex).value());
|
||||
|
||||
|
||||
if (startFrame <= jointAnim.time(startKeyFrameIndex).value() && jointAnim.time(startKeyFrameIndex).value() <= endFrame ) {
|
||||
animatedJoints.push_back(jointIt.item());
|
||||
i = 9;
|
||||
break;
|
||||
@@ -168,8 +178,15 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
||||
|
||||
unsigned int endKeyFrameIndex = jointAnim.findClosest(MTime(endFrame, MTime::kNTSCField));
|
||||
MGlobal::displayInfo(MString() + startKeyFrameIndex + " " + endKeyFrameIndex);
|
||||
MGlobal::displayInfo(MString() + "Fail!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
|
||||
if (startFrame * oneDivSixty <= jointAnim.time(endKeyFrameIndex).value() && jointAnim.time(endKeyFrameIndex).value() <= endFrame * oneDivSixty || endKeyFrameIndex - startKeyFrameIndex > 0) {
|
||||
//MGlobal::displayInfo(MString() + "End key index : " + endKeyFrameIndex);
|
||||
//MGlobal::displayInfo(MString() + "end key time : " + jointAnim.time(endKeyFrameIndex).value());
|
||||
|
||||
/*MGlobal::displayInfo(MString() + "start keyfram index: " + startKeyFrameIndex + ". End keyfram index: " + endKeyFrameIndex + ".");*/
|
||||
|
||||
if (startFrame <= jointAnim.time(endKeyFrameIndex).value() && jointAnim.time(endKeyFrameIndex).value() <= endFrame || endKeyFrameIndex - startKeyFrameIndex > 0) {
|
||||
animatedJoints.push_back(jointIt.item());
|
||||
i = 9;
|
||||
break;
|
||||
@@ -191,11 +208,13 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
||||
}
|
||||
}*/
|
||||
|
||||
} // end of int i loop
|
||||
jointIt.next();
|
||||
}
|
||||
jointIt.reset();
|
||||
}
|
||||
|
||||
|
||||
int currentFrame = startFrame;
|
||||
while (currentFrame <= endFrame) { // ANDREAS
|
||||
Animation::Keyframe thisKeyFrame;
|
||||
@@ -314,18 +333,15 @@ std::vector<BindPoseSkeletonNode> Skeleton::GetBindPoses()
|
||||
|
||||
|
||||
MVector tmp = MayaJoint.transformation().getTranslation(MSpace::kObject);
|
||||
MGlobal::displayError(MString() + "translation befor: " + tmp[0] + " " + tmp[1] + " " + tmp[2]);
|
||||
//Matrix[3][0] *= -1;
|
||||
//Matrix[3][2] *= -1;
|
||||
//Matrix[3][1] *= -1;
|
||||
|
||||
double test[3];
|
||||
MayaJoint.transformation().getScale(test, MSpace::kObject);
|
||||
MGlobal::displayError(MString() + "scale: " + test[0] + " " + test[1] + " " + test[2]);
|
||||
|
||||
MTransformationMatrix::RotationOrder order = MTransformationMatrix::RotationOrder::kXYZ;
|
||||
MayaJoint.transformation().getRotation(test, order);
|
||||
MGlobal::displayError(MString() + "rotation: " + test[0] + " " + test[1] + " " + test[2]);
|
||||
|
||||
//----- test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user