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