Stepping through the timeline.

This commit is contained in:
antc13
2015-12-16 11:33:42 +01:00
parent 498afb3a5e
commit 67017fcaf4
6 changed files with 22 additions and 117 deletions
@@ -175,7 +175,6 @@
<ClCompile Include="Main.cpp" />
<ClCompile Include="Mesh.cpp" />
<ClCompile Include="Skeleton.cpp" />
<ClCompile Include="Var.cpp" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="MayaExporter.ui">
@@ -200,7 +199,6 @@
<ItemGroup>
<ClInclude Include="Mesh.h" />
<ClInclude Include="Skeleton.h" />
<ClInclude Include="Var.h" />
<CustomBuild Include="Menu.h">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing Menu.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
@@ -59,9 +59,6 @@
<ClCompile Include="Skeleton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Var.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="leeeeel.qrc">
@@ -90,8 +87,5 @@
<ClInclude Include="Skeleton.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Var.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -31,6 +31,8 @@
#include <maya/MFnNurbsCurve.h>
#include <maya/MCommandMessage.h>
#include <maya/MPlug.h>
#include <maya/MAnimControl.h>
#include <maya/MTime.h>
// Wrappers
@@ -59,5 +61,6 @@
#pragma comment(lib,"Foundation.lib")
#pragma comment(lib,"OpenMaya.lib")
#pragma comment(lib,"OpenMayaUI.lib")
#pragma comment (lib, "OpenMayaAnim.lib")
#endif
+19 -7
View File
@@ -187,17 +187,29 @@ void Menu::GetMaterialData()
void Menu::GetSkeletonData()
{
this->m_SkeletonHandler = new Skeleton();
MTime startFrame = MAnimControl::animationStartTime();
MTime endFrame = MAnimControl::animationEndTime();
// Traverse scene and return vector with all materials
std::vector<SkeletonNode>* AllMaterials = m_SkeletonHandler->DoIt();
std::vector<std::vector<SkeletonNode>*> AllSkeletons;
MGlobal::displayInfo(MString() + AllMaterials->size());
for (int i = 0; i < AllMaterials->size(); i++)
for (int i = startFrame.value(); i < endFrame.value();i++)
{
for (int j = 0; j < AllMaterials->at(i).Joints.size(); j++)
MAnimControl::setCurrentTime(MTime(i, MTime::kNTSCField));
// Traverse scene and return vector with all materials
AllSkeletons.push_back(m_SkeletonHandler->DoIt());
}
MGlobal::displayInfo(MString() + AllSkeletons.size());
for (int i = 0; i < AllSkeletons.size(); i++)
{
std::vector<SkeletonNode>*& thisSkeleton = AllSkeletons.at(i);
for (int k = 0; k < thisSkeleton->size(); k++)
{
MGlobal::displayInfo(MString() + AllMaterials->at(i).Joints.at(j).Name.c_str());
for (int j = 0; j < thisSkeleton->at(k).Joints.size(); j++)
{
MGlobal::displayInfo(MString() + thisSkeleton->at(k).Joints.at(j).Name.c_str());
}
}
}
}
-70
View File
@@ -1,70 +0,0 @@
#include "Var.h"
#include "MayaIncludes.h"
#include <assert.h>
Var::Var(Var::Type type, unsigned int numElements)
{
m_Type = type;
m_NumElements = numElements;
switch (m_Type)
{
case Var::Type::Int:
m_Data = new int[m_NumElements];
break;
case Var::Type::Float:
m_Data = new float[m_NumElements];
break;
case Var::Type::String:
m_Data = new std::string[m_NumElements];
break;
default:
MGlobal::displayError("Var is an invalid type");
assert(0);
break;
}
}
Var& Var::operator=(const int& other)
{
assert(m_Type == Type::Int);
*(int*)m_Data = other;
return *this;
}
Var& Var::operator=(const float& other)
{
assert(m_Type == Type::Float);
*(float*)m_Data = other;
return *this;
}
Var& Var::operator=(const std::string& other)
{
assert(m_Type == Type::String);
std::string tmp(other);
(*(std::string*)m_Data).swap(tmp);
return *this;
}
//Var& Var::operator=(const Var& other)
//{
// m_Data = other.m_Data;
// m_Type = other.m_Type;
// return *this;
//}
Var::Type Var::isType() const
{
return m_Type;
}
unsigned int Var::NumElements() const
{
return m_NumElements;
}
void* Var::Data()
{
return m_Data;
}
-32
View File
@@ -1,32 +0,0 @@
#ifndef Var_Var_h__
#define Var_Var_h__
#include <string>
class Var
{
public:
enum class Type
{
Int,
Float,
String
};
Var(Var::Type type, unsigned int numElements = 1);
~Var() { delete[] m_Data; };
Var& operator=(const int& other);
Var& operator=(const float& other);
Var& operator=(const std::string& other);
//Var& operator=(const Var& other);
Type isType() const;
unsigned int NumElements() const;
void* Data();
private:
Type m_Type;
unsigned int m_NumElements;
void* m_Data;
};
#endif