2023-12-31 21:55:35 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "lc_array.h"
|
2024-01-07 20:39:34 +01:00
|
|
|
#include "lc_objectproperty.h"
|
2023-12-31 21:55:35 +01:00
|
|
|
|
2023-12-31 23:00:33 +01:00
|
|
|
class lcCollapsibleWidgetButton;
|
2024-01-15 02:41:01 +01:00
|
|
|
class lcKeyFrameWidget;
|
2023-12-31 23:00:33 +01:00
|
|
|
|
2023-12-31 21:55:35 +01:00
|
|
|
class lcPropertiesWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
lcPropertiesWidget(QWidget* Parent);
|
|
|
|
|
|
|
|
void Update(const lcArray<lcObject*>& Selection, lcObject* Focus);
|
|
|
|
|
|
|
|
protected slots:
|
2023-12-31 23:00:33 +01:00
|
|
|
void CategoryStateChanged(bool Expanded);
|
2024-01-15 02:41:01 +01:00
|
|
|
void KeyFrameChanged();
|
2024-01-06 03:56:43 +01:00
|
|
|
void BoolChanged();
|
2023-12-31 21:55:35 +01:00
|
|
|
void FloatChanged();
|
2024-01-06 03:56:43 +01:00
|
|
|
void IntegerChanged();
|
2023-12-31 21:55:35 +01:00
|
|
|
void StepNumberChanged();
|
2024-01-02 03:57:54 +01:00
|
|
|
void StringChanged();
|
|
|
|
void StringListChanged(int Index);
|
2024-01-06 03:56:43 +01:00
|
|
|
void ColorButtonClicked();
|
2023-12-31 21:55:35 +01:00
|
|
|
void PieceColorButtonClicked();
|
|
|
|
void PieceColorChanged(int ColorIndex);
|
|
|
|
void PieceIdButtonClicked();
|
|
|
|
void PieceIdChanged(PieceInfo* Info);
|
|
|
|
|
|
|
|
protected:
|
2024-01-07 02:33:43 +01:00
|
|
|
enum class CategoryIndex
|
|
|
|
{
|
|
|
|
Piece,
|
|
|
|
Camera,
|
|
|
|
CameraTransform,
|
|
|
|
Light,
|
2024-04-25 01:53:49 +02:00
|
|
|
LightBlender,
|
|
|
|
LightPOVRay,
|
2024-01-07 02:33:43 +01:00
|
|
|
ObjectTransform,
|
|
|
|
Count
|
|
|
|
};
|
|
|
|
|
2023-12-31 21:55:35 +01:00
|
|
|
enum class PropertyType
|
|
|
|
{
|
|
|
|
Bool,
|
|
|
|
Float,
|
|
|
|
Integer,
|
|
|
|
StepNumber,
|
|
|
|
String,
|
|
|
|
StringList,
|
|
|
|
Color,
|
|
|
|
PieceColor,
|
|
|
|
PieceId
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class LayoutMode
|
|
|
|
{
|
|
|
|
Empty,
|
|
|
|
Piece,
|
|
|
|
Camera,
|
|
|
|
Light,
|
2024-01-07 02:33:43 +01:00
|
|
|
Multiple,
|
|
|
|
Count
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CategoryWidgets
|
|
|
|
{
|
|
|
|
lcCollapsibleWidgetButton* Button = nullptr;
|
2024-01-07 20:39:34 +01:00
|
|
|
std::vector<lcObjectPropertyId> Properties;
|
2024-01-07 02:33:43 +01:00
|
|
|
std::vector<int> SpacingRows;
|
2024-04-25 01:53:49 +02:00
|
|
|
CategoryIndex CategoryIndex;
|
2024-01-07 02:33:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PropertyWidgets
|
|
|
|
{
|
|
|
|
QLabel* Label = nullptr;
|
2024-01-15 02:41:01 +01:00
|
|
|
QWidget* Editor = nullptr;
|
|
|
|
lcKeyFrameWidget* KeyFrame = nullptr;
|
2024-04-25 01:53:49 +02:00
|
|
|
CategoryIndex CategoryIndex;
|
|
|
|
bool Visible = true;
|
2023-12-31 21:55:35 +01:00
|
|
|
};
|
|
|
|
|
2024-01-15 02:41:01 +01:00
|
|
|
lcObjectPropertyId GetEditorWidgetPropertyId(QWidget* Widget) const;
|
|
|
|
lcObjectPropertyId GetKeyFrameWidgetPropertyId(QWidget* Widget) const;
|
2023-12-31 21:55:35 +01:00
|
|
|
|
2024-01-07 02:33:43 +01:00
|
|
|
void AddCategory(CategoryIndex Index, const QString& Title);
|
2023-12-31 23:00:33 +01:00
|
|
|
void AddSpacing();
|
2024-01-07 20:39:34 +01:00
|
|
|
void AddLabel(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip);
|
2024-01-15 02:41:01 +01:00
|
|
|
void AddKeyFrameWidget(lcObjectPropertyId PropertyId);
|
|
|
|
void AddBoolProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames);
|
|
|
|
void AddFloatProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames, float Min, float Max);
|
|
|
|
void AddIntegerProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames, int Min, int Max);
|
|
|
|
void AddStepNumberProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames);
|
|
|
|
void AddStringProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames);
|
|
|
|
void AddStringListProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames, const QStringList& Strings);
|
|
|
|
void AddColorProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames);
|
|
|
|
void AddPieceColorProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames);
|
|
|
|
void AddPieceIdProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames);
|
2024-01-07 20:39:34 +01:00
|
|
|
|
2024-03-03 02:40:08 +01:00
|
|
|
std::pair<QVariant, bool> GetUpdateValue(lcObjectPropertyId PropertyId);
|
2024-02-20 01:31:02 +01:00
|
|
|
|
2024-01-15 02:41:01 +01:00
|
|
|
void UpdateKeyFrameWidget(lcObjectPropertyId PropertyId);
|
2024-02-20 01:45:14 +01:00
|
|
|
void UpdateBool(lcObjectPropertyId PropertyId);
|
2024-01-07 20:39:34 +01:00
|
|
|
void UpdateFloat(lcObjectPropertyId PropertyId, float Value);
|
2024-02-20 01:45:14 +01:00
|
|
|
void UpdateInteger(lcObjectPropertyId PropertyId);
|
2024-01-07 20:39:34 +01:00
|
|
|
void UpdateStepNumber(lcObjectPropertyId PropertyId, lcStep Step, lcStep Min, lcStep Max);
|
2024-02-20 02:38:04 +01:00
|
|
|
void UpdateString(lcObjectPropertyId PropertyId);
|
2024-02-20 01:45:14 +01:00
|
|
|
void UpdateStringList(lcObjectPropertyId PropertyId);
|
|
|
|
void UpdateColor(lcObjectPropertyId PropertyId);
|
2024-03-03 02:37:46 +01:00
|
|
|
void UpdatePieceColor(lcObjectPropertyId PropertyId);
|
|
|
|
void UpdatePieceId(lcObjectPropertyId PropertyId);
|
2023-12-31 21:55:35 +01:00
|
|
|
|
|
|
|
void SetEmpty();
|
|
|
|
void SetPiece(const lcArray<lcObject*>& Selection, lcObject* Focus);
|
2024-01-21 21:53:18 +01:00
|
|
|
void SetCamera(const lcArray<lcObject*>& Selection, lcObject* Focus);
|
|
|
|
void SetLight(const lcArray<lcObject*>& Selection, lcObject* Focus);
|
2023-12-31 21:55:35 +01:00
|
|
|
|
2024-01-07 02:33:43 +01:00
|
|
|
void CreateWidgets();
|
|
|
|
void SetLayoutMode(LayoutMode Mode);
|
2024-01-07 20:39:34 +01:00
|
|
|
void SetPropertyVisible(lcObjectPropertyId PropertyId, bool Visible);
|
2024-04-25 01:53:49 +02:00
|
|
|
void SetPropertyWidgetsVisible(lcObjectPropertyId PropertyId, bool Visible);
|
2024-01-07 02:33:43 +01:00
|
|
|
void SetCategoryVisible(CategoryIndex Index, bool Visible);
|
|
|
|
void SetCategoryWidgetsVisible(CategoryWidgets& Category, bool Visible);
|
2023-12-31 23:00:33 +01:00
|
|
|
|
2024-01-21 21:53:18 +01:00
|
|
|
lcArray<lcObject*> mSelection;
|
2023-12-31 23:00:33 +01:00
|
|
|
lcObject* mFocusObject = nullptr;
|
|
|
|
|
2024-01-07 20:39:34 +01:00
|
|
|
std::array<PropertyWidgets, static_cast<int>(lcObjectPropertyId::Count)> mPropertyWidgets = {};
|
2024-01-07 02:33:43 +01:00
|
|
|
std::array<CategoryWidgets, static_cast<int>(CategoryIndex::Count)> mCategoryWidgets = {};
|
2023-12-31 23:00:33 +01:00
|
|
|
|
|
|
|
CategoryWidgets* mCurrentCategory = nullptr;
|
|
|
|
QGridLayout* mLayout = nullptr;
|
|
|
|
int mLayoutRow = 0;
|
|
|
|
|
2024-01-07 02:33:43 +01:00
|
|
|
LayoutMode mLayoutMode = LayoutMode::Count;
|
2023-12-31 21:55:35 +01:00
|
|
|
};
|