From 67017fcaf47a9a72fc9c8b7379d3c8aeb0f548f9 Mon Sep 17 00:00:00 2001 From: antc13 Date: Wed, 16 Dec 2015 11:33:42 +0100 Subject: [PATCH] Stepping through the timeline. --- .../MayaExporter/MayaExporter.vcxproj | 2 - .../MayaExporter/MayaExporter.vcxproj.filters | 6 -- .../MayaExporter/MayaExporter/MayaIncludes.h | 3 + tools/MayaExporter/MayaExporter/Menu.cpp | 26 +++++-- tools/MayaExporter/MayaExporter/Var.cpp | 70 ------------------- tools/MayaExporter/MayaExporter/Var.h | 32 --------- 6 files changed, 22 insertions(+), 117 deletions(-) delete mode 100644 tools/MayaExporter/MayaExporter/Var.cpp delete mode 100644 tools/MayaExporter/MayaExporter/Var.h diff --git a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj index b04d032f..50577919 100644 --- a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj +++ b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj @@ -175,7 +175,6 @@ - @@ -200,7 +199,6 @@ - Moc%27ing Menu.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp diff --git a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters index 6f836155..cf4a5a35 100644 --- a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters +++ b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters @@ -59,9 +59,6 @@ Source Files - - Source Files - @@ -90,8 +87,5 @@ Header Files - - Header Files - \ No newline at end of file diff --git a/tools/MayaExporter/MayaExporter/MayaIncludes.h b/tools/MayaExporter/MayaExporter/MayaIncludes.h index 6c092052..9186bfe6 100644 --- a/tools/MayaExporter/MayaExporter/MayaIncludes.h +++ b/tools/MayaExporter/MayaExporter/MayaIncludes.h @@ -31,6 +31,8 @@ #include #include #include +#include +#include // 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 \ No newline at end of file diff --git a/tools/MayaExporter/MayaExporter/Menu.cpp b/tools/MayaExporter/MayaExporter/Menu.cpp index 8eb245e2..06c115c8 100644 --- a/tools/MayaExporter/MayaExporter/Menu.cpp +++ b/tools/MayaExporter/MayaExporter/Menu.cpp @@ -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* AllMaterials = m_SkeletonHandler->DoIt(); + std::vector*> 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*& 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()); + } } } } diff --git a/tools/MayaExporter/MayaExporter/Var.cpp b/tools/MayaExporter/MayaExporter/Var.cpp deleted file mode 100644 index adfcb212..00000000 --- a/tools/MayaExporter/MayaExporter/Var.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "Var.h" -#include "MayaIncludes.h" -#include - -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; -} \ No newline at end of file diff --git a/tools/MayaExporter/MayaExporter/Var.h b/tools/MayaExporter/MayaExporter/Var.h deleted file mode 100644 index b0ec66dd..00000000 --- a/tools/MayaExporter/MayaExporter/Var.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef Var_Var_h__ -#define Var_Var_h__ - -#include - -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 \ No newline at end of file