mirror of
https://github.com/leozide/leocad
synced 2024-12-25 21:58:23 +01:00
Reorganized properties tree.
This commit is contained in:
parent
7d289f2cfe
commit
9648dbb977
2 changed files with 190 additions and 229 deletions
|
@ -430,19 +430,8 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
|
||||||
switch (propertyType)
|
switch (propertyType)
|
||||||
{
|
{
|
||||||
case PropertyGroup:
|
case PropertyGroup:
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
case PropertyBool:
|
case PropertyBool:
|
||||||
{
|
return nullptr;
|
||||||
QCheckBox *editor = new QCheckBox(parent);
|
|
||||||
bool value = item->data(0, PropertyValueRole).toBool();
|
|
||||||
|
|
||||||
editor->setChecked(value);
|
|
||||||
|
|
||||||
connect(editor, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool)));
|
|
||||||
|
|
||||||
return editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
case PropertyFloat:
|
case PropertyFloat:
|
||||||
{
|
{
|
||||||
|
@ -528,9 +517,15 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
QComboBox* editor = new QComboBox(parent);
|
QComboBox* editor = new QComboBox(parent);
|
||||||
|
|
||||||
if (item == mLightTypeItem)
|
if (item == mCameraProjectionItem)
|
||||||
|
{
|
||||||
|
editor->addItems( { tr("Perspective"), tr("Orthographic") } );
|
||||||
|
}
|
||||||
|
else if (item == mLightTypeItem)
|
||||||
|
{
|
||||||
for (int LightTypeIndex = 0; LightTypeIndex < static_cast<int>(lcLightType::Count); LightTypeIndex++)
|
for (int LightTypeIndex = 0; LightTypeIndex < static_cast<int>(lcLightType::Count); LightTypeIndex++)
|
||||||
editor->addItem(lcLight::GetLightTypeString(static_cast<lcLightType>(LightTypeIndex)));
|
editor->addItem(lcLight::GetLightTypeString(static_cast<lcLightType>(LightTypeIndex)));
|
||||||
|
}
|
||||||
|
|
||||||
int value = item->data(0, PropertyValueRole).toInt();
|
int value = item->data(0, PropertyValueRole).toInt();
|
||||||
editor->setCurrentIndex(value);
|
editor->setCurrentIndex(value);
|
||||||
|
@ -578,7 +573,7 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PropertyLightColor:
|
case PropertyColor:
|
||||||
{
|
{
|
||||||
QPushButton *Editor = new QPushButton(parent);
|
QPushButton *Editor = new QPushButton(parent);
|
||||||
QColor Value = item->data(0, PropertyValueRole).value<QColor>();
|
QColor Value = item->data(0, PropertyValueRole).value<QColor>();
|
||||||
|
@ -590,7 +585,7 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
|
||||||
return Editor;
|
return Editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PropertyColor:
|
case PropertyPieceColor:
|
||||||
{
|
{
|
||||||
QPushButton *editor = new QPushButton(parent);
|
QPushButton *editor = new QPushButton(parent);
|
||||||
int value = item->data(0, PropertyValueRole).toInt();
|
int value = item->data(0, PropertyValueRole).toInt();
|
||||||
|
@ -685,19 +680,7 @@ void lcQPropertiesTree::slotToggled(bool Value)
|
||||||
lcModel* Model = gMainWindow->GetActiveModel();
|
lcModel* Model = gMainWindow->GetActiveModel();
|
||||||
lcObject* Focus = Model->GetFocusObject();
|
lcObject* Focus = Model->GetFocusObject();
|
||||||
|
|
||||||
if (mWidgetMode == LC_PROPERTY_WIDGET_CAMERA)
|
if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
||||||
{
|
|
||||||
if (Focus && Focus->IsCamera())
|
|
||||||
{
|
|
||||||
lcCamera* Camera = (lcCamera*)Focus;
|
|
||||||
|
|
||||||
if (Item == cameraOrtho)
|
|
||||||
{
|
|
||||||
Model->SetCameraOrthographic(Camera, Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
|
||||||
{
|
{
|
||||||
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
||||||
|
|
||||||
|
@ -866,7 +849,7 @@ void lcQPropertiesTree::slotReturnPressed()
|
||||||
|
|
||||||
Model->SetCameraZFar(Camera, Value);
|
Model->SetCameraZFar(Camera, Value);
|
||||||
}
|
}
|
||||||
else if (Item == cameraName)
|
else if (Item == mCameraNameItem)
|
||||||
{
|
{
|
||||||
QString Value = Editor->text();
|
QString Value = Editor->text();
|
||||||
|
|
||||||
|
@ -916,20 +899,6 @@ void lcQPropertiesTree::slotReturnPressed()
|
||||||
|
|
||||||
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
||||||
}
|
}
|
||||||
else if (Item == lightColorR || Item == lightColorG || Item == lightColorB)
|
|
||||||
{
|
|
||||||
lcVector3 Color = Light->GetColor();
|
|
||||||
float Value = lcParseValueLocalized(Editor->text());
|
|
||||||
|
|
||||||
if (Item == lightColorR)
|
|
||||||
Color[0] = Value;
|
|
||||||
else if (Item == lightColorG)
|
|
||||||
Color[2] = Value;
|
|
||||||
else if (Item == lightColorB)
|
|
||||||
Color[1] = Value;
|
|
||||||
|
|
||||||
Model->SetLightColor(Light, Color);
|
|
||||||
}
|
|
||||||
else if (Item == lightFactorA || Item == lightFactorB)
|
else if (Item == lightFactorA || Item == lightFactorB)
|
||||||
{
|
{
|
||||||
float Value = lcParseValueLocalized(Editor->text());
|
float Value = lcParseValueLocalized(Editor->text());
|
||||||
|
@ -994,7 +963,7 @@ void lcQPropertiesTree::slotReturnPressed()
|
||||||
Model->UpdateLight(Light, Props, LC_LIGHT_AREA_GRID);
|
Model->UpdateLight(Light, Props, LC_LIGHT_AREA_GRID);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Item == lightName)
|
else if (Item == mLightNameItem)
|
||||||
{
|
{
|
||||||
QString Value = Editor->text();
|
QString Value = Editor->text();
|
||||||
|
|
||||||
|
@ -1011,14 +980,14 @@ void lcQPropertiesTree::slotSetValue(int Value)
|
||||||
|
|
||||||
if (mWidgetMode == LC_PROPERTY_WIDGET_PIECE)
|
if (mWidgetMode == LC_PROPERTY_WIDGET_PIECE)
|
||||||
{
|
{
|
||||||
if (Item == partColor)
|
if (Item == mPieceColorItem)
|
||||||
{
|
{
|
||||||
Model->SetSelectedPiecesColorIndex(Value);
|
Model->SetSelectedPiecesColorIndex(Value);
|
||||||
|
|
||||||
QPushButton *editor = (QPushButton*)mDelegate->editor();
|
QPushButton *editor = (QPushButton*)mDelegate->editor();
|
||||||
updateColorEditor(editor, Value);
|
updateColorEditor(editor, Value);
|
||||||
}
|
}
|
||||||
else if (Item == partID)
|
else if (Item == mPieceIdItem)
|
||||||
{
|
{
|
||||||
QComboBox *editor = (QComboBox*)sender();
|
QComboBox *editor = (QComboBox*)sender();
|
||||||
|
|
||||||
|
@ -1033,6 +1002,20 @@ void lcQPropertiesTree::slotSetValue(int Value)
|
||||||
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
|
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (mWidgetMode == LC_PROPERTY_WIDGET_CAMERA)
|
||||||
|
{
|
||||||
|
lcObject* Focus = Model->GetFocusObject();
|
||||||
|
|
||||||
|
if (Focus && Focus->IsCamera())
|
||||||
|
{
|
||||||
|
lcCamera* Camera = (lcCamera*)Focus;
|
||||||
|
|
||||||
|
if (Item == mCameraProjectionItem)
|
||||||
|
{
|
||||||
|
Model->SetCameraOrthographic(Camera, Value == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
else if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
||||||
{
|
{
|
||||||
lcObject* Focus = Model->GetFocusObject();
|
lcObject* Focus = Model->GetFocusObject();
|
||||||
|
@ -1137,7 +1120,10 @@ QTreeWidgetItem *lcQPropertiesTree::addProperty(QTreeWidgetItem *parent, const Q
|
||||||
newItem = new QTreeWidgetItem(this, QStringList(label));
|
newItem = new QTreeWidgetItem(this, QStringList(label));
|
||||||
|
|
||||||
newItem->setData(0, PropertyTypeRole, QVariant(propertyType));
|
newItem->setData(0, PropertyTypeRole, QVariant(propertyType));
|
||||||
newItem->setFlags(newItem->flags() | Qt::ItemIsEditable);
|
|
||||||
|
if (propertyType != PropertyFloatReadOnly)
|
||||||
|
newItem->setFlags(newItem->flags() | Qt::ItemIsEditable);
|
||||||
|
|
||||||
newItem->setExpanded(true);
|
newItem->setExpanded(true);
|
||||||
|
|
||||||
if (propertyType == PropertyGroup)
|
if (propertyType == PropertyGroup)
|
||||||
|
@ -1146,9 +1132,6 @@ QTreeWidgetItem *lcQPropertiesTree::addProperty(QTreeWidgetItem *parent, const Q
|
||||||
newItem->setIcon(0, m_expandIcon);
|
newItem->setIcon(0, m_expandIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propertyType == PropertyFloatReadOnly)
|
|
||||||
newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable);
|
|
||||||
|
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,6 +1139,7 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
mPieceAttributesItem = nullptr;
|
||||||
partPosition = nullptr;
|
partPosition = nullptr;
|
||||||
partPositionX = nullptr;
|
partPositionX = nullptr;
|
||||||
partPositionY = nullptr;
|
partPositionY = nullptr;
|
||||||
|
@ -1168,8 +1152,8 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
partShow = nullptr;
|
partShow = nullptr;
|
||||||
partHide = nullptr;
|
partHide = nullptr;
|
||||||
partAppearance = nullptr;
|
partAppearance = nullptr;
|
||||||
partColor = nullptr;
|
mPieceColorItem = nullptr;
|
||||||
partID = nullptr;
|
mPieceIdItem = nullptr;
|
||||||
|
|
||||||
cameraPosition = nullptr;
|
cameraPosition = nullptr;
|
||||||
cameraPositionX = nullptr;
|
cameraPositionX = nullptr;
|
||||||
|
@ -1183,12 +1167,12 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
cameraUpX = nullptr;
|
cameraUpX = nullptr;
|
||||||
cameraUpY = nullptr;
|
cameraUpY = nullptr;
|
||||||
cameraUpZ = nullptr;
|
cameraUpZ = nullptr;
|
||||||
cameraSettings = nullptr;
|
mCameraAttributesItem = nullptr;
|
||||||
cameraOrtho = nullptr;
|
mCameraProjectionItem = nullptr;
|
||||||
cameraFOV = nullptr;
|
cameraFOV = nullptr;
|
||||||
cameraNear = nullptr;
|
cameraNear = nullptr;
|
||||||
cameraFar = nullptr;
|
cameraFar = nullptr;
|
||||||
cameraName = nullptr;
|
mCameraNameItem = nullptr;
|
||||||
|
|
||||||
lightConfiguration = nullptr;
|
lightConfiguration = nullptr;
|
||||||
lightPosition = nullptr;
|
lightPosition = nullptr;
|
||||||
|
@ -1199,12 +1183,8 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
lightTargetX = nullptr;
|
lightTargetX = nullptr;
|
||||||
lightTargetY = nullptr;
|
lightTargetY = nullptr;
|
||||||
lightTargetZ = nullptr;
|
lightTargetZ = nullptr;
|
||||||
lightColor = nullptr;
|
mLightColorItem = nullptr;
|
||||||
lightColorIcon = nullptr;
|
mLightAttributesItem = nullptr;
|
||||||
lightColorR = nullptr;
|
|
||||||
lightColorG = nullptr;
|
|
||||||
lightColorB = nullptr;
|
|
||||||
lightProperties = nullptr;
|
|
||||||
lightDiffuse = nullptr;
|
lightDiffuse = nullptr;
|
||||||
lightSpecular = nullptr;
|
lightSpecular = nullptr;
|
||||||
lightCutoff = nullptr;
|
lightCutoff = nullptr;
|
||||||
|
@ -1213,7 +1193,7 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
mLightTypeItem = nullptr;
|
mLightTypeItem = nullptr;
|
||||||
lightFactorA = nullptr;
|
lightFactorA = nullptr;
|
||||||
lightFactorB = nullptr;
|
lightFactorB = nullptr;
|
||||||
lightName = nullptr;
|
mLightNameItem = nullptr;
|
||||||
lightSpotSize = nullptr;
|
lightSpotSize = nullptr;
|
||||||
lightShape = nullptr;
|
lightShape = nullptr;
|
||||||
lightFormat = nullptr;
|
lightFormat = nullptr;
|
||||||
|
@ -1233,6 +1213,14 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
||||||
{
|
{
|
||||||
SetEmpty();
|
SetEmpty();
|
||||||
|
|
||||||
|
mPieceAttributesItem = addProperty(nullptr, tr("Piece Attributes"), PropertyGroup);
|
||||||
|
mPieceIdItem = addProperty(mPieceAttributesItem, tr("Part"), PropertyPart);
|
||||||
|
mPieceColorItem = addProperty(mPieceAttributesItem, tr("Color"), PropertyPieceColor);
|
||||||
|
|
||||||
|
partVisibility = addProperty(nullptr, tr("Visible Steps"), PropertyGroup);
|
||||||
|
partShow = addProperty(partVisibility, tr("Show"), PropertyStep);
|
||||||
|
partHide = addProperty(partVisibility, tr("Hide"), PropertyStep);
|
||||||
|
|
||||||
partPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
partPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
||||||
partPositionX = addProperty(partPosition, tr("X"), PropertyFloat);
|
partPositionX = addProperty(partPosition, tr("X"), PropertyFloat);
|
||||||
partPositionY = addProperty(partPosition, tr("Y"), PropertyFloat);
|
partPositionY = addProperty(partPosition, tr("Y"), PropertyFloat);
|
||||||
|
@ -1243,14 +1231,6 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
||||||
partRotationY = addProperty(partRotation, tr("Y"), PropertyFloat);
|
partRotationY = addProperty(partRotation, tr("Y"), PropertyFloat);
|
||||||
partRotationZ = addProperty(partRotation, tr("Z"), PropertyFloat);
|
partRotationZ = addProperty(partRotation, tr("Z"), PropertyFloat);
|
||||||
|
|
||||||
partVisibility = addProperty(nullptr, tr("Visible Steps"), PropertyGroup);
|
|
||||||
partShow = addProperty(partVisibility, tr("Show"), PropertyStep);
|
|
||||||
partHide = addProperty(partVisibility, tr("Hide"), PropertyStep);
|
|
||||||
|
|
||||||
partAppearance = addProperty(nullptr, tr("Appearance"), PropertyGroup);
|
|
||||||
partColor = addProperty(partAppearance, tr("Color"), PropertyColor);
|
|
||||||
partID = addProperty(partAppearance, tr("Part"), PropertyPart);
|
|
||||||
|
|
||||||
mWidgetMode = LC_PROPERTY_WIDGET_PIECE;
|
mWidgetMode = LC_PROPERTY_WIDGET_PIECE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,14 +1329,14 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
||||||
painter.drawRect(0, 0, img.width() - 1, img.height() - 1);
|
painter.drawRect(0, 0, img.width() - 1, img.height() - 1);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
partColor->setIcon(1, QIcon(QPixmap::fromImage(img)));
|
mPieceColorItem->setIcon(1, QIcon(QPixmap::fromImage(img)));
|
||||||
partColor->setText(1, color->Name);
|
mPieceColorItem->setText(1, color->Name);
|
||||||
partColor->setData(0, PropertyValueRole, ColorIndex);
|
mPieceColorItem->setData(0, PropertyValueRole, ColorIndex);
|
||||||
|
|
||||||
QString text = Info ? Info->m_strDescription : QString();
|
QString text = Info ? Info->m_strDescription : QString();
|
||||||
partID->setText(1, text);
|
mPieceIdItem->setText(1, text);
|
||||||
partID->setToolTip(1, text);
|
mPieceIdItem->setToolTip(1, text);
|
||||||
partID->setData(0, PropertyValueRole, QVariant::fromValue((void*)Info));
|
mPieceIdItem->setData(0, PropertyValueRole, QVariant::fromValue((void*)Info));
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
||||||
|
@ -1365,6 +1345,13 @@ void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
||||||
{
|
{
|
||||||
SetEmpty();
|
SetEmpty();
|
||||||
|
|
||||||
|
mCameraAttributesItem = addProperty(nullptr, tr("Camera Attributes"), PropertyGroup);
|
||||||
|
mCameraNameItem = addProperty(mCameraAttributesItem, tr("Name"), PropertyString);
|
||||||
|
mCameraProjectionItem = addProperty(mCameraAttributesItem, tr("Projection"), PropertyStringList);
|
||||||
|
cameraFOV = addProperty(mCameraAttributesItem, tr("FOV"), PropertyFloat);
|
||||||
|
cameraNear = addProperty(mCameraAttributesItem, tr("Near"), PropertyFloat);
|
||||||
|
cameraFar = addProperty(mCameraAttributesItem, tr("Far"), PropertyFloat);
|
||||||
|
|
||||||
cameraPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
cameraPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
||||||
cameraPositionX = addProperty(cameraPosition, tr("X"), PropertyFloat);
|
cameraPositionX = addProperty(cameraPosition, tr("X"), PropertyFloat);
|
||||||
cameraPositionY = addProperty(cameraPosition, tr("Y"), PropertyFloat);
|
cameraPositionY = addProperty(cameraPosition, tr("Y"), PropertyFloat);
|
||||||
|
@ -1380,13 +1367,6 @@ void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
||||||
cameraUpY = addProperty(cameraUp, tr("Y"), PropertyFloat);
|
cameraUpY = addProperty(cameraUp, tr("Y"), PropertyFloat);
|
||||||
cameraUpZ = addProperty(cameraUp, tr("Z"), PropertyFloat);
|
cameraUpZ = addProperty(cameraUp, tr("Z"), PropertyFloat);
|
||||||
|
|
||||||
cameraSettings = addProperty(nullptr, tr("Up"), PropertyGroup);
|
|
||||||
cameraOrtho = addProperty(cameraSettings, tr("Orthographic"), PropertyBool);
|
|
||||||
cameraFOV = addProperty(cameraSettings, tr("FOV"), PropertyFloat);
|
|
||||||
cameraNear = addProperty(cameraSettings, tr("Near"), PropertyFloat);
|
|
||||||
cameraFar = addProperty(cameraSettings, tr("Far"), PropertyFloat);
|
|
||||||
cameraName = addProperty(cameraSettings, tr("Name"), PropertyString);
|
|
||||||
|
|
||||||
mWidgetMode = LC_PROPERTY_WIDGET_CAMERA;
|
mWidgetMode = LC_PROPERTY_WIDGET_CAMERA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1436,8 +1416,8 @@ void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
||||||
cameraUpZ->setText(1, lcFormatValueLocalized(UpVector[2]));
|
cameraUpZ->setText(1, lcFormatValueLocalized(UpVector[2]));
|
||||||
cameraUpZ->setData(0, PropertyValueRole, UpVector[2]);
|
cameraUpZ->setData(0, PropertyValueRole, UpVector[2]);
|
||||||
|
|
||||||
cameraOrtho->setText(1, Ortho ? "True" : "False");
|
mCameraProjectionItem->setText(1, Ortho ? tr("Orthographic") : tr("Perspective"));
|
||||||
cameraOrtho->setData(0, PropertyValueRole, Ortho);
|
mCameraProjectionItem->setData(0, PropertyValueRole, Ortho);
|
||||||
cameraFOV->setText(1, lcFormatValueLocalized(FoV));
|
cameraFOV->setText(1, lcFormatValueLocalized(FoV));
|
||||||
cameraFOV->setData(0, PropertyValueRole, FoV);
|
cameraFOV->setData(0, PropertyValueRole, FoV);
|
||||||
cameraNear->setText(1, lcFormatValueLocalized(ZNear));
|
cameraNear->setText(1, lcFormatValueLocalized(ZNear));
|
||||||
|
@ -1445,8 +1425,8 @@ void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
||||||
cameraFar->setText(1, lcFormatValueLocalized(ZFar));
|
cameraFar->setText(1, lcFormatValueLocalized(ZFar));
|
||||||
cameraFar->setData(0, PropertyValueRole, ZFar);
|
cameraFar->setData(0, PropertyValueRole, ZFar);
|
||||||
|
|
||||||
cameraName->setText(1, Name);
|
mCameraNameItem->setText(1, Name);
|
||||||
cameraName->setData(0, PropertyValueRole, Name);
|
mCameraNameItem->setData(0, PropertyValueRole, Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQPropertiesTree::SetLight(lcObject* Focus)
|
void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
|
@ -1593,6 +1573,60 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
{
|
{
|
||||||
SetEmpty();
|
SetEmpty();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
mLightAttributesItem = addProperty(nullptr, tr("Light Attributes"), PropertyGroup);
|
||||||
|
mLightNameItem = addProperty(mLightAttributesItem, tr("Name"), PropertyString);
|
||||||
|
mLightTypeItem = addProperty(mLightAttributesItem, tr("Type"), PropertyStringList);
|
||||||
|
mLightColorItem = addProperty(mLightAttributesItem, tr("Color"), PropertyColor);
|
||||||
|
|
||||||
|
lightShadowless = addProperty(mLightAttributesItem, tr("Cast Shadows"), PropertyBool);
|
||||||
|
lightExponent = addProperty(mLightAttributesItem, ExponentLabel, PropertyFloat);
|
||||||
|
|
||||||
|
if ((LightType == lcLightType::Point || LightType == lcLightType::Directional) && !POVRayLight)
|
||||||
|
lightFactorA = addProperty(mLightAttributesItem, FactorALabel, PropertyFloat);
|
||||||
|
|
||||||
|
if (LightType == lcLightType::Spot)
|
||||||
|
{
|
||||||
|
lightSpotSize = addProperty(mLightAttributesItem, tr("Spot Size (°)"), SpotSizeProperty);
|
||||||
|
lightFactorA = addProperty(mLightAttributesItem, FactorALabel, PropertyFloatLightSpotSize);
|
||||||
|
|
||||||
|
if (!POVRayLight)
|
||||||
|
lightFactorB = addProperty(mLightAttributesItem, tr("Spot Blend"), PropertyFloat);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lightSpotFalloff = addProperty(mLightAttributesItem, tr("Spot Falloff (°)"), PropertyFloatLightSpotFalloff);
|
||||||
|
lightSpotTightness = addProperty(mLightAttributesItem, tr("Spot Tightness"), PropertyFloat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (LightType == lcLightType::Area)
|
||||||
|
{
|
||||||
|
lightShape = addProperty(mLightAttributesItem, tr("Shape"), PropertyLightShape);
|
||||||
|
lightFactorA = addProperty(mLightAttributesItem, FactorALabel, PropertyFloat);
|
||||||
|
|
||||||
|
if (ShapeIndex == LC_LIGHT_SHAPE_RECTANGLE || ShapeIndex == LC_LIGHT_SHAPE_ELLIPSE || POVRayLight)
|
||||||
|
lightFactorB = addProperty(mLightAttributesItem, tr("Height"), PropertyFloat);
|
||||||
|
else
|
||||||
|
FactorAToolTip = tr("The size of the area light grid.");
|
||||||
|
|
||||||
|
if (POVRayLight)
|
||||||
|
{
|
||||||
|
lightAreaGridRows = addProperty(mLightAttributesItem, tr("Grid Rows"), PropertyFloat);
|
||||||
|
lightAreaGridColumns = addProperty(mLightAttributesItem, tr("Grid Columns"), PropertyFloat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!POVRayLight)
|
||||||
|
{
|
||||||
|
if (LightType != lcLightType::Directional)
|
||||||
|
{
|
||||||
|
lightEnableCutoff = addProperty(mLightAttributesItem, tr("Cutoff"), PropertyBool);
|
||||||
|
lightCutoff = addProperty(mLightAttributesItem, tr("Cutoff Distance"), PropertyFloat);
|
||||||
|
}
|
||||||
|
|
||||||
|
lightDiffuse = addProperty(mLightAttributesItem, tr("Diffuse"), PropertyFloat);
|
||||||
|
lightSpecular = addProperty(mLightAttributesItem, tr("Specular"), PropertyFloat);
|
||||||
|
}
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
lightConfiguration = addProperty(nullptr, tr("Configuration"), PropertyGroup);
|
lightConfiguration = addProperty(nullptr, tr("Configuration"), PropertyGroup);
|
||||||
lightFormat = addProperty(lightConfiguration, tr("Format"), PropertyLightFormat);
|
lightFormat = addProperty(lightConfiguration, tr("Format"), PropertyLightFormat);
|
||||||
|
@ -1612,66 +1646,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
lightTargetZ = addProperty(lightTarget, tr("Z"), TargetProperty);
|
lightTargetZ = addProperty(lightTarget, tr("Z"), TargetProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Light Color
|
|
||||||
lightColor = addProperty(nullptr, tr("Color"), PropertyGroup);
|
|
||||||
lightColorIcon = addProperty(lightColor, tr("Value"), PropertyLightColor);
|
|
||||||
lightColorR = addProperty(lightColor, tr("Red"), PropertyFloat);
|
|
||||||
lightColorG = addProperty(lightColor, tr("Green"), PropertyFloat);
|
|
||||||
lightColorB = addProperty(lightColor, tr("Blue"), PropertyFloat);
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
lightProperties = addProperty(nullptr, tr("Properties"), PropertyGroup);
|
|
||||||
mLightTypeItem = addProperty(lightProperties, tr("Type"), PropertyStringList);
|
|
||||||
lightShadowless = addProperty(lightProperties, tr("Shadowless"), PropertyBool);
|
|
||||||
lightExponent = addProperty(lightProperties, ExponentLabel, PropertyFloat);
|
|
||||||
|
|
||||||
if ((LightType == lcLightType::Point || LightType == lcLightType::Directional) && !POVRayLight)
|
|
||||||
lightFactorA = addProperty(lightProperties, FactorALabel, PropertyFloat);
|
|
||||||
|
|
||||||
if (LightType == lcLightType::Spot)
|
|
||||||
{
|
|
||||||
lightSpotSize = addProperty(lightProperties, tr("Spot Size (°)"), SpotSizeProperty);
|
|
||||||
lightFactorA = addProperty(lightProperties, FactorALabel, PropertyFloatLightSpotSize);
|
|
||||||
|
|
||||||
if (!POVRayLight)
|
|
||||||
lightFactorB = addProperty(lightProperties, tr("Spot Blend"), PropertyFloat);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lightSpotFalloff = addProperty(lightProperties, tr("Spot Falloff (°)"), PropertyFloatLightSpotFalloff);
|
|
||||||
lightSpotTightness = addProperty(lightProperties, tr("Spot Tightness"), PropertyFloat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (LightType == lcLightType::Area)
|
|
||||||
{
|
|
||||||
lightShape = addProperty(lightProperties, tr("Shape"), PropertyLightShape);
|
|
||||||
lightFactorA = addProperty(lightProperties, FactorALabel, PropertyFloat);
|
|
||||||
|
|
||||||
if (ShapeIndex == LC_LIGHT_SHAPE_RECTANGLE || ShapeIndex == LC_LIGHT_SHAPE_ELLIPSE || POVRayLight)
|
|
||||||
lightFactorB = addProperty(lightProperties, tr("Height"), PropertyFloat);
|
|
||||||
else
|
|
||||||
FactorAToolTip = tr("The size of the area light grid.");
|
|
||||||
|
|
||||||
if (POVRayLight)
|
|
||||||
{
|
|
||||||
lightAreaGridRows = addProperty(lightProperties, tr("Grid Rows"), PropertyFloat);
|
|
||||||
lightAreaGridColumns = addProperty(lightProperties, tr("Grid Columns"), PropertyFloat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!POVRayLight)
|
|
||||||
{
|
|
||||||
if (LightType != lcLightType::Directional)
|
|
||||||
{
|
|
||||||
lightEnableCutoff = addProperty(lightProperties, tr("Cutoff"), PropertyBool);
|
|
||||||
lightCutoff = addProperty(lightProperties, tr("Cutoff Distance"), PropertyFloat);
|
|
||||||
}
|
|
||||||
|
|
||||||
lightDiffuse = addProperty(lightProperties, tr("Diffuse"), PropertyFloat);
|
|
||||||
lightSpecular = addProperty(lightProperties, tr("Specular"), PropertyFloat);
|
|
||||||
}
|
|
||||||
|
|
||||||
lightName = addProperty(lightProperties, tr("Name"), PropertyString);
|
|
||||||
|
|
||||||
mWidgetMode = LC_PROPERTY_WIDGET_LIGHT;
|
mWidgetMode = LC_PROPERTY_WIDGET_LIGHT;
|
||||||
mLightType = LightType;
|
mLightType = LightType;
|
||||||
mLightShape = ShapeIndex;
|
mLightShape = ShapeIndex;
|
||||||
|
@ -1707,19 +1681,9 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
painter.drawRect(0, 0, ColorImage.width() - 1, ColorImage.height() - 1);
|
painter.drawRect(0, 0, ColorImage.width() - 1, ColorImage.height() - 1);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
lightColorIcon->setIcon(1, QIcon(QPixmap::fromImage(ColorImage)));
|
mLightColorItem->setIcon(1, QIcon(QPixmap::fromImage(ColorImage)));
|
||||||
lightColorIcon->setText(1, Color.name().toUpper());
|
mLightColorItem->setText(1, Color.name().toUpper());
|
||||||
lightColorIcon->setData(0, PropertyValueRole, Color);
|
mLightColorItem->setData(0, PropertyValueRole, Color);
|
||||||
|
|
||||||
lightColorR->setText(1, lcFormatValueLocalized(Color.redF()));
|
|
||||||
lightColorR->setData(0, PropertyValueRole, Color.redF());
|
|
||||||
lightColorR->setToolTip(1, tr("Red color using 0 to 1 decimal."));
|
|
||||||
lightColorG->setText(1, lcFormatValueLocalized(Color.greenF()));
|
|
||||||
lightColorG->setData(0, PropertyValueRole, Color.greenF());
|
|
||||||
lightColorG->setToolTip(1, tr("Green color using 0 to 1 decimal."));
|
|
||||||
lightColorB->setText(1, lcFormatValueLocalized(Color.blueF()));
|
|
||||||
lightColorB->setData(0, PropertyValueRole, Color.blueF());
|
|
||||||
lightColorB->setToolTip(1, tr("Blue color using 0 to 1 decimal."));
|
|
||||||
|
|
||||||
lightFormat->setText(1, Format);
|
lightFormat->setText(1, Format);
|
||||||
lightFormat->setData(0, PropertyValueRole, FormatIndex);
|
lightFormat->setData(0, PropertyValueRole, FormatIndex);
|
||||||
|
@ -1727,7 +1691,7 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
mLightTypeItem->setText(1, lcLight::GetLightTypeString(LightType));
|
mLightTypeItem->setText(1, lcLight::GetLightTypeString(LightType));
|
||||||
mLightTypeItem->setData(0, PropertyValueRole, static_cast<int>(LightType));
|
mLightTypeItem->setData(0, PropertyValueRole, static_cast<int>(LightType));
|
||||||
|
|
||||||
lightShadowless->setText(1, Shadowless ? "True" : "False");
|
lightShadowless->setCheckState(1, Shadowless ? Qt::Checked : Qt::Unchecked);
|
||||||
lightShadowless->setData(0, PropertyValueRole, Shadowless);
|
lightShadowless->setData(0, PropertyValueRole, Shadowless);
|
||||||
|
|
||||||
lightExponent->setText(1, lcFormatValueLocalized(Exponent));
|
lightExponent->setText(1, lcFormatValueLocalized(Exponent));
|
||||||
|
@ -1800,7 +1764,7 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
{
|
{
|
||||||
if (LightType != lcLightType::Directional)
|
if (LightType != lcLightType::Directional)
|
||||||
{
|
{
|
||||||
lightEnableCutoff->setText(1, EnableCutoff ? "True" : "False");
|
lightEnableCutoff->setCheckState(1, EnableCutoff ? Qt::Checked : Qt::Unchecked);
|
||||||
lightEnableCutoff->setData(0, PropertyValueRole, EnableCutoff);
|
lightEnableCutoff->setData(0, PropertyValueRole, EnableCutoff);
|
||||||
|
|
||||||
lightCutoff->setText(1, lcFormatValueLocalized(Cutoff));
|
lightCutoff->setText(1, lcFormatValueLocalized(Cutoff));
|
||||||
|
@ -1817,8 +1781,8 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
lightSpecular->setToolTip(1, tr("Specular reflection multiplier factor."));
|
lightSpecular->setToolTip(1, tr("Specular reflection multiplier factor."));
|
||||||
}
|
}
|
||||||
|
|
||||||
lightName->setText(1, Name);
|
mLightNameItem->setText(1, Name);
|
||||||
lightName->setData(0, PropertyValueRole, QVariant::fromValue(Name));
|
mLightNameItem->setData(0, PropertyValueRole, QVariant::fromValue(Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQPropertiesTree::SetMultiple()
|
void lcQPropertiesTree::SetMultiple()
|
||||||
|
|
|
@ -52,8 +52,8 @@ public:
|
||||||
PropertyStringList,
|
PropertyStringList,
|
||||||
PropertyLightFormat,
|
PropertyLightFormat,
|
||||||
PropertyLightShape,
|
PropertyLightShape,
|
||||||
PropertyLightColor,
|
|
||||||
PropertyColor,
|
PropertyColor,
|
||||||
|
PropertyPieceColor,
|
||||||
PropertyPart
|
PropertyPart
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,72 +91,69 @@ protected:
|
||||||
QIcon m_checkedIcon;
|
QIcon m_checkedIcon;
|
||||||
QIcon m_uncheckedIcon;
|
QIcon m_uncheckedIcon;
|
||||||
|
|
||||||
QTreeWidgetItem *partPosition;
|
QTreeWidgetItem* mPieceAttributesItem;
|
||||||
QTreeWidgetItem *partPositionX;
|
QTreeWidgetItem* partPosition;
|
||||||
QTreeWidgetItem *partPositionY;
|
QTreeWidgetItem* partPositionX;
|
||||||
QTreeWidgetItem *partPositionZ;
|
QTreeWidgetItem* partPositionY;
|
||||||
QTreeWidgetItem *partRotation;
|
QTreeWidgetItem* partPositionZ;
|
||||||
QTreeWidgetItem *partRotationX;
|
QTreeWidgetItem* partRotation;
|
||||||
QTreeWidgetItem *partRotationY;
|
QTreeWidgetItem* partRotationX;
|
||||||
QTreeWidgetItem *partRotationZ;
|
QTreeWidgetItem* partRotationY;
|
||||||
QTreeWidgetItem *partVisibility;
|
QTreeWidgetItem* partRotationZ;
|
||||||
QTreeWidgetItem *partShow;
|
QTreeWidgetItem* partVisibility;
|
||||||
QTreeWidgetItem *partHide;
|
QTreeWidgetItem* partShow;
|
||||||
QTreeWidgetItem *partAppearance;
|
QTreeWidgetItem* partHide;
|
||||||
QTreeWidgetItem *partColor;
|
QTreeWidgetItem* partAppearance;
|
||||||
QTreeWidgetItem *partID;
|
QTreeWidgetItem* mPieceColorItem;
|
||||||
|
QTreeWidgetItem* mPieceIdItem;
|
||||||
|
|
||||||
QTreeWidgetItem *cameraPosition;
|
QTreeWidgetItem* cameraPosition;
|
||||||
QTreeWidgetItem *cameraPositionX;
|
QTreeWidgetItem* cameraPositionX;
|
||||||
QTreeWidgetItem *cameraPositionY;
|
QTreeWidgetItem* cameraPositionY;
|
||||||
QTreeWidgetItem *cameraPositionZ;
|
QTreeWidgetItem* cameraPositionZ;
|
||||||
QTreeWidgetItem *cameraTarget;
|
QTreeWidgetItem* cameraTarget;
|
||||||
QTreeWidgetItem *cameraTargetX;
|
QTreeWidgetItem* cameraTargetX;
|
||||||
QTreeWidgetItem *cameraTargetY;
|
QTreeWidgetItem* cameraTargetY;
|
||||||
QTreeWidgetItem *cameraTargetZ;
|
QTreeWidgetItem* cameraTargetZ;
|
||||||
QTreeWidgetItem *cameraUp;
|
QTreeWidgetItem* cameraUp;
|
||||||
QTreeWidgetItem *cameraUpX;
|
QTreeWidgetItem* cameraUpX;
|
||||||
QTreeWidgetItem *cameraUpY;
|
QTreeWidgetItem* cameraUpY;
|
||||||
QTreeWidgetItem *cameraUpZ;
|
QTreeWidgetItem* cameraUpZ;
|
||||||
QTreeWidgetItem *cameraSettings;
|
QTreeWidgetItem* mCameraAttributesItem;
|
||||||
QTreeWidgetItem *cameraOrtho;
|
QTreeWidgetItem* mCameraProjectionItem;
|
||||||
QTreeWidgetItem *cameraFOV;
|
QTreeWidgetItem* cameraFOV;
|
||||||
QTreeWidgetItem *cameraNear;
|
QTreeWidgetItem* cameraNear;
|
||||||
QTreeWidgetItem *cameraFar;
|
QTreeWidgetItem* cameraFar;
|
||||||
QTreeWidgetItem *cameraName;
|
QTreeWidgetItem* mCameraNameItem;
|
||||||
|
|
||||||
QTreeWidgetItem *lightConfiguration;
|
QTreeWidgetItem* lightConfiguration;
|
||||||
QTreeWidgetItem *lightPosition;
|
QTreeWidgetItem* lightPosition;
|
||||||
QTreeWidgetItem *lightPositionX;
|
QTreeWidgetItem* lightPositionX;
|
||||||
QTreeWidgetItem *lightPositionY;
|
QTreeWidgetItem* lightPositionY;
|
||||||
QTreeWidgetItem *lightPositionZ;
|
QTreeWidgetItem* lightPositionZ;
|
||||||
QTreeWidgetItem *lightTarget;
|
QTreeWidgetItem* lightTarget;
|
||||||
QTreeWidgetItem *lightTargetX;
|
QTreeWidgetItem* lightTargetX;
|
||||||
QTreeWidgetItem *lightTargetY;
|
QTreeWidgetItem* lightTargetY;
|
||||||
QTreeWidgetItem *lightTargetZ;
|
QTreeWidgetItem* lightTargetZ;
|
||||||
QTreeWidgetItem *lightColor;
|
QTreeWidgetItem* mLightColorItem;
|
||||||
QTreeWidgetItem *lightColorIcon;
|
QTreeWidgetItem* mLightAttributesItem;
|
||||||
QTreeWidgetItem *lightColorR;
|
QTreeWidgetItem* lightDiffuse;
|
||||||
QTreeWidgetItem *lightColorG;
|
QTreeWidgetItem* lightSpecular;
|
||||||
QTreeWidgetItem *lightColorB;
|
QTreeWidgetItem* lightCutoff;
|
||||||
QTreeWidgetItem *lightProperties;
|
QTreeWidgetItem* lightEnableCutoff;
|
||||||
QTreeWidgetItem *lightDiffuse;
|
QTreeWidgetItem* lightExponent;
|
||||||
QTreeWidgetItem *lightSpecular;
|
QTreeWidgetItem* mLightTypeItem;
|
||||||
QTreeWidgetItem *lightCutoff;
|
QTreeWidgetItem* lightSpotSize;
|
||||||
QTreeWidgetItem *lightEnableCutoff;
|
QTreeWidgetItem* lightShape;
|
||||||
QTreeWidgetItem *lightExponent;
|
QTreeWidgetItem* lightFactorA;
|
||||||
QTreeWidgetItem *mLightTypeItem;
|
QTreeWidgetItem* lightFactorB;
|
||||||
QTreeWidgetItem *lightSpotSize;
|
QTreeWidgetItem* mLightNameItem;
|
||||||
QTreeWidgetItem *lightShape;
|
QTreeWidgetItem* lightFormat;
|
||||||
QTreeWidgetItem *lightFactorA;
|
QTreeWidgetItem* lightShadowless;
|
||||||
QTreeWidgetItem *lightFactorB;
|
QTreeWidgetItem* lightAreaGridRows;
|
||||||
QTreeWidgetItem *lightName;
|
QTreeWidgetItem* lightAreaGridColumns;
|
||||||
QTreeWidgetItem *lightFormat;
|
QTreeWidgetItem* lightSpotFalloff;
|
||||||
QTreeWidgetItem *lightShadowless;
|
QTreeWidgetItem* lightSpotTightness;
|
||||||
QTreeWidgetItem *lightAreaGridRows;
|
|
||||||
QTreeWidgetItem *lightAreaGridColumns;
|
|
||||||
QTreeWidgetItem *lightSpotFalloff;
|
|
||||||
QTreeWidgetItem *lightSpotTightness;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class lcQPropertiesTreeDelegate : public QItemDelegate
|
class lcQPropertiesTreeDelegate : public QItemDelegate
|
||||||
|
|
Loading…
Reference in a new issue