File Writer WIP. Rework soon™
This commit is contained in:
@@ -175,6 +175,7 @@
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="Mesh.cpp" />
|
||||
<ClCompile Include="Skeleton.cpp" />
|
||||
<ClCompile Include="Var.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="MayaExporter.ui">
|
||||
@@ -199,6 +200,7 @@
|
||||
<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,6 +59,9 @@
|
||||
<ClCompile Include="Skeleton.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Var.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="leeeeel.qrc">
|
||||
@@ -87,5 +90,8 @@
|
||||
<ClInclude Include="Skeleton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Var.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "MayaIncludes.h"
|
||||
#include "Material.h"
|
||||
#include "Mesh.h"
|
||||
#include "Var.h"
|
||||
|
||||
class Menu : public QWidget
|
||||
{
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user