2017-07-19 23:20:32 +02:00
|
|
|
#pragma once
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
#include "lc_glwidget.h"
|
2012-05-19 03:13:05 +02:00
|
|
|
#include "lc_math.h"
|
2011-09-07 23:06:51 +02:00
|
|
|
|
|
|
|
enum LC_MFW_TYPES
|
|
|
|
{
|
2012-07-20 23:32:27 +02:00
|
|
|
LC_MFW_HATS,
|
|
|
|
LC_MFW_HATS2,
|
2011-09-07 23:06:51 +02:00
|
|
|
LC_MFW_HEAD,
|
|
|
|
LC_MFW_NECK,
|
2012-07-20 23:32:27 +02:00
|
|
|
LC_MFW_BODY,
|
|
|
|
LC_MFW_BODY2,
|
|
|
|
LC_MFW_BODY3,
|
|
|
|
LC_MFW_RARM,
|
|
|
|
LC_MFW_LARM,
|
|
|
|
LC_MFW_RHAND,
|
|
|
|
LC_MFW_LHAND,
|
|
|
|
LC_MFW_RHANDA,
|
|
|
|
LC_MFW_LHANDA,
|
|
|
|
LC_MFW_RLEG,
|
|
|
|
LC_MFW_LLEG,
|
|
|
|
LC_MFW_RLEGA,
|
|
|
|
LC_MFW_LLEGA,
|
2011-09-07 23:06:51 +02:00
|
|
|
LC_MFW_NUMITEMS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcMinifigPieceInfo
|
|
|
|
{
|
2012-02-08 23:48:51 +01:00
|
|
|
char Description[128];
|
2011-09-07 23:06:51 +02:00
|
|
|
PieceInfo* Info;
|
2012-05-19 03:13:05 +02:00
|
|
|
lcMatrix44 Offset;
|
2011-09-07 23:06:51 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
struct lcMinifig
|
|
|
|
{
|
|
|
|
PieceInfo* Parts[LC_MFW_NUMITEMS];
|
|
|
|
int Colors[LC_MFW_NUMITEMS];
|
|
|
|
float Angles[LC_MFW_NUMITEMS];
|
|
|
|
lcMatrix44 Matrices[LC_MFW_NUMITEMS];
|
|
|
|
};
|
|
|
|
|
2018-03-12 04:35:04 +01:00
|
|
|
struct lcMinifigTemplate
|
|
|
|
{
|
|
|
|
QString Parts[LC_MFW_NUMITEMS];
|
|
|
|
int Colors[LC_MFW_NUMITEMS];
|
|
|
|
float Angles[LC_MFW_NUMITEMS];
|
|
|
|
};
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
class MinifigWizard : public lcGLWidget
|
2011-09-07 23:06:51 +02:00
|
|
|
{
|
|
|
|
public:
|
2016-08-01 05:44:15 +02:00
|
|
|
MinifigWizard();
|
|
|
|
~MinifigWizard();
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2018-03-12 04:35:04 +01:00
|
|
|
const std::map<QString, lcMinifigTemplate>& GetTemplates() const
|
|
|
|
{
|
|
|
|
return mTemplates;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SaveTemplate(const QString& TemplateName, const lcMinifigTemplate& Template);
|
|
|
|
void DeleteTemplate(const QString& TemplateName);
|
2019-09-15 02:05:13 +02:00
|
|
|
void AddTemplatesJson(const QByteArray& TemplateData);
|
|
|
|
QByteArray GetTemplatesJson() const;
|
2018-03-12 04:35:04 +01:00
|
|
|
|
2020-03-22 23:44:41 +01:00
|
|
|
void OnDraw() override;
|
|
|
|
void OnLeftButtonDown() override;
|
|
|
|
void OnLeftButtonUp() override;
|
|
|
|
void OnLeftButtonDoubleClick() override;
|
|
|
|
void OnRightButtonDown() override;
|
|
|
|
void OnRightButtonUp() override;
|
|
|
|
void OnMouseMove() override;
|
|
|
|
void OnInitialUpdate() override;
|
2011-09-07 23:06:51 +02:00
|
|
|
|
|
|
|
void Calculate();
|
|
|
|
int GetSelectionIndex(int Type) const;
|
|
|
|
void SetSelectionIndex(int Type, int Index);
|
|
|
|
void SetColor(int Type, int Color);
|
|
|
|
void SetAngle(int Type, float Angle);
|
|
|
|
|
2012-03-23 00:44:56 +01:00
|
|
|
void ParseSettings(lcFile& Settings);
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2019-06-05 03:45:22 +02:00
|
|
|
std::vector<lcMinifigPieceInfo> mSettings[LC_MFW_NUMITEMS];
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2016-08-01 05:44:15 +02:00
|
|
|
lcMinifig mMinifig;
|
2013-01-29 01:43:34 +01:00
|
|
|
|
2016-08-01 05:44:15 +02:00
|
|
|
int mTracking;
|
|
|
|
int mDownX;
|
|
|
|
int mDownY;
|
2013-01-29 01:43:34 +01:00
|
|
|
|
2016-08-01 05:44:15 +02:00
|
|
|
float mDistance;
|
|
|
|
float mRotateX;
|
|
|
|
float mRotateZ;
|
|
|
|
bool mAutoZoom;
|
2018-03-12 04:35:04 +01:00
|
|
|
|
|
|
|
protected:
|
2019-06-21 03:52:33 +02:00
|
|
|
void LoadSettings();
|
2018-03-12 04:35:04 +01:00
|
|
|
void LoadTemplates();
|
|
|
|
void SaveTemplates();
|
|
|
|
|
|
|
|
std::map<QString, lcMinifigTemplate> mTemplates;
|
|
|
|
static const char* mSectionNames[LC_MFW_NUMITEMS];
|
2011-09-07 23:06:51 +02:00
|
|
|
};
|
|
|
|
|