2013-08-09 06:57:18 +02:00
|
|
|
#include "lc_global.h"
|
|
|
|
#include "lc_qpropertiestree.h"
|
2023-05-16 06:12:08 +02:00
|
|
|
#include "lc_colorpicker.h"
|
2013-08-09 06:57:18 +02:00
|
|
|
#include "lc_application.h"
|
2014-12-08 08:32:39 +01:00
|
|
|
#include "lc_model.h"
|
2018-05-12 01:23:43 +02:00
|
|
|
#include "lc_mainwindow.h"
|
2013-08-09 06:57:18 +02:00
|
|
|
#include "object.h"
|
|
|
|
#include "piece.h"
|
|
|
|
#include "camera.h"
|
|
|
|
#include "light.h"
|
|
|
|
#include "pieceinf.h"
|
|
|
|
#include "lc_library.h"
|
2015-01-20 00:48:46 +01:00
|
|
|
#include "lc_qutils.h"
|
2020-12-18 02:59:11 +01:00
|
|
|
#include "lc_viewwidget.h"
|
2020-10-07 12:07:32 +02:00
|
|
|
#include "lc_previewwidget.h"
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
// Draw an icon indicating opened/closing branches
|
|
|
|
static QIcon drawIndicatorIcon(const QPalette &palette, QStyle *style)
|
|
|
|
{
|
|
|
|
QPixmap pix(14, 14);
|
|
|
|
pix.fill(Qt::transparent);
|
|
|
|
QStyleOption branchOption;
|
|
|
|
branchOption.rect = QRect(2, 2, 9, 9); // ### hardcoded in qcommonstyle.cpp
|
|
|
|
branchOption.palette = palette;
|
|
|
|
branchOption.state = QStyle::State_Children;
|
|
|
|
|
|
|
|
QPainter p;
|
|
|
|
// Draw closed state
|
|
|
|
p.begin(&pix);
|
|
|
|
style->drawPrimitive(QStyle::PE_IndicatorBranch, &branchOption, &p);
|
|
|
|
p.end();
|
|
|
|
QIcon rc = pix;
|
|
|
|
rc.addPixmap(pix, QIcon::Selected, QIcon::Off);
|
|
|
|
// Draw opened state
|
|
|
|
branchOption.state |= QStyle::State_Open;
|
|
|
|
pix.fill(Qt::transparent);
|
|
|
|
p.begin(&pix);
|
|
|
|
style->drawPrimitive(QStyle::PE_IndicatorBranch, &branchOption, &p);
|
|
|
|
p.end();
|
|
|
|
|
|
|
|
rc.addPixmap(pix, QIcon::Normal, QIcon::On);
|
|
|
|
rc.addPixmap(pix, QIcon::Selected, QIcon::On);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static QIcon drawCheckBox(bool value)
|
|
|
|
{
|
|
|
|
QStyleOptionButton opt;
|
|
|
|
opt.state |= value ? QStyle::State_On : QStyle::State_Off;
|
|
|
|
opt.state |= QStyle::State_Enabled;
|
|
|
|
const QStyle *style = QApplication::style();
|
|
|
|
// Figure out size of an indicator and make sure it is not scaled down in a list view item
|
|
|
|
// by making the pixmap as big as a list view icon and centering the indicator in it.
|
|
|
|
// (if it is smaller, it can't be helped)
|
|
|
|
const int indicatorWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &opt);
|
|
|
|
const int indicatorHeight = style->pixelMetric(QStyle::PM_IndicatorHeight, &opt);
|
|
|
|
const int listViewIconSize = indicatorWidth;
|
|
|
|
const int pixmapWidth = indicatorWidth;
|
|
|
|
const int pixmapHeight = qMax(indicatorHeight, listViewIconSize);
|
|
|
|
|
|
|
|
opt.rect = QRect(0, 0, indicatorWidth, indicatorHeight);
|
|
|
|
QPixmap pixmap = QPixmap(pixmapWidth, pixmapHeight);
|
|
|
|
pixmap.fill(Qt::transparent);
|
|
|
|
{
|
|
|
|
// Center?
|
|
|
|
const int xoff = (pixmapWidth > indicatorWidth) ? (pixmapWidth - indicatorWidth) / 2 : 0;
|
|
|
|
const int yoff = (pixmapHeight > indicatorHeight) ? (pixmapHeight - indicatorHeight) / 2 : 0;
|
|
|
|
QPainter painter(&pixmap);
|
|
|
|
painter.translate(xoff, yoff);
|
|
|
|
style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &opt, &painter);
|
|
|
|
}
|
|
|
|
return QIcon(pixmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
int lcQPropertiesTreeDelegate::indentation(const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
if (!m_treeWidget)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
QTreeWidgetItem *item = m_treeWidget->indexToItem(index);
|
|
|
|
int indent = 0;
|
|
|
|
while (item->parent())
|
|
|
|
{
|
|
|
|
item = item->parent();
|
|
|
|
++indent;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_treeWidget->rootIsDecorated())
|
|
|
|
++indent;
|
|
|
|
|
|
|
|
return indent * m_treeWidget->indentation();
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTreeDelegate::slotEditorDestroyed(QObject *object)
|
|
|
|
{
|
|
|
|
if (m_editedWidget == object)
|
|
|
|
{
|
2017-04-14 02:26:40 +02:00
|
|
|
m_editedWidget = nullptr;
|
|
|
|
m_editedItem = nullptr;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget *lcQPropertiesTreeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &style, const QModelIndex &index) const
|
|
|
|
{
|
2016-02-17 00:11:52 +01:00
|
|
|
Q_UNUSED(style);
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
if (index.column() == 1 && m_treeWidget)
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *item = m_treeWidget->indexToItem(index);
|
|
|
|
|
|
|
|
if (item && (item->flags() & Qt::ItemIsEnabled))
|
|
|
|
{
|
|
|
|
QWidget *editor = m_treeWidget->createEditor(parent, item);
|
|
|
|
if (editor)
|
|
|
|
{
|
|
|
|
editor->setAutoFillBackground(true);
|
|
|
|
editor->installEventFilter(const_cast<lcQPropertiesTreeDelegate *>(this));
|
|
|
|
|
|
|
|
m_editedItem = item;
|
|
|
|
m_editedWidget = editor;
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *)));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
return nullptr;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTreeDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
Q_UNUSED(index)
|
|
|
|
editor->setGeometry(option.rect.adjusted(0, 0, 0, -1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
bool hasValue = true;
|
|
|
|
if (m_treeWidget)
|
|
|
|
hasValue = m_treeWidget->indexToItem(index)->data(0, lcQPropertiesTree::PropertyTypeRole).toInt() != lcQPropertiesTree::PropertyGroup;
|
|
|
|
|
2019-03-08 14:43:40 +01:00
|
|
|
QStyleOptionViewItem opt = option;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
opt.state &= ~QStyle::State_HasFocus;
|
|
|
|
|
2017-02-13 03:05:20 +01:00
|
|
|
if (index.column() == 1 && m_treeWidget)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
|
|
|
QTreeWidgetItem *item = m_treeWidget->indexToItem(index);
|
|
|
|
if (m_editedItem && m_editedItem == item)
|
|
|
|
m_disablePainting = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QItemDelegate::paint(painter, opt, index);
|
|
|
|
if (option.type)
|
|
|
|
m_disablePainting = false;
|
|
|
|
|
|
|
|
opt.palette.setCurrentColorGroup(QPalette::Active);
|
|
|
|
QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt));
|
|
|
|
painter->save();
|
|
|
|
painter->setPen(QPen(color));
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
if (!m_treeWidget || (!m_treeWidget->lastColumn(index.column()) && hasValue))
|
|
|
|
{
|
|
|
|
int right = (option.direction == Qt::LeftToRight) ? option.rect.right() : option.rect.left();
|
|
|
|
painter->drawLine(right, option.rect.y(), right, option.rect.bottom());
|
|
|
|
}
|
|
|
|
|
|
|
|
painter->restore();
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTreeDelegate::drawDecoration(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QPixmap &pixmap) const
|
|
|
|
{
|
|
|
|
if (m_disablePainting)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QItemDelegate::drawDecoration(painter, option, rect, pixmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTreeDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const
|
|
|
|
{
|
|
|
|
if (m_disablePainting)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QItemDelegate::drawDisplay(painter, option, rect, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSize lcQPropertiesTreeDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
return QItemDelegate::sizeHint(option, index) + QSize(3, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool lcQPropertiesTreeDelegate::eventFilter(QObject *object, QEvent *event)
|
|
|
|
{
|
|
|
|
if (event->type() == QEvent::FocusOut)
|
|
|
|
{
|
|
|
|
QFocusEvent *fe = static_cast<QFocusEvent *>(event);
|
|
|
|
if (fe->reason() == Qt::ActiveWindowFocusReason)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return QItemDelegate::eventFilter(object, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
lcQPropertiesTree::lcQPropertiesTree(QWidget *parent) :
|
|
|
|
QTreeWidget(parent)
|
|
|
|
{
|
|
|
|
setIconSize(QSize(18, 18));
|
|
|
|
setColumnCount(2);
|
|
|
|
QStringList labels;
|
|
|
|
labels.append(tr("Property"));
|
|
|
|
labels.append(tr("Value"));
|
|
|
|
setHeaderLabels(labels);
|
2014-01-26 07:56:36 +01:00
|
|
|
header()->setSectionsMovable(false);
|
|
|
|
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
2013-08-09 06:57:18 +02:00
|
|
|
header()->setVisible(false);
|
|
|
|
setAlternatingRowColors(true);
|
|
|
|
setRootIsDecorated(false);
|
|
|
|
setEditTriggers(QAbstractItemView::EditKeyPressed);
|
|
|
|
|
|
|
|
m_expandIcon = drawIndicatorIcon(palette(), style());
|
|
|
|
m_checkedIcon = drawCheckBox(true);
|
|
|
|
m_uncheckedIcon = drawCheckBox(false);
|
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
mDelegate = new lcQPropertiesTreeDelegate(parent);
|
|
|
|
mDelegate->setTreeWidget(this);
|
|
|
|
setItemDelegate(mDelegate);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
SetEmpty();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
connect(header(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(resizeColumnToContents(int)));
|
|
|
|
}
|
|
|
|
|
|
|
|
QSize lcQPropertiesTree::sizeHint() const
|
|
|
|
{
|
|
|
|
return QSize(200, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTree::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
|
|
{
|
2019-03-08 14:43:40 +01:00
|
|
|
QStyleOptionViewItem opt = option;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
QTreeWidgetItem *item = itemFromIndex(index);
|
|
|
|
|
|
|
|
if (item->data(0, lcQPropertiesTree::PropertyTypeRole).toInt() == lcQPropertiesTree::PropertyGroup)
|
|
|
|
{
|
|
|
|
const QColor c = option.palette.color(QPalette::Dark);
|
|
|
|
painter->fillRect(option.rect, c);
|
|
|
|
opt.palette.setColor(QPalette::AlternateBase, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTreeWidget::drawRow(painter, opt, index);
|
|
|
|
QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt));
|
|
|
|
painter->save();
|
|
|
|
painter->setPen(QPen(color));
|
|
|
|
painter->drawLine(opt.rect.x(), opt.rect.bottom(), opt.rect.right(), opt.rect.bottom());
|
|
|
|
painter->restore();
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTree::keyPressEvent(QKeyEvent *event)
|
|
|
|
{
|
|
|
|
switch (event->key())
|
|
|
|
{
|
|
|
|
case Qt::Key_Return:
|
|
|
|
case Qt::Key_Enter:
|
|
|
|
case Qt::Key_Space: // Trigger Edit
|
2023-08-27 20:17:07 +02:00
|
|
|
if (!mDelegate->editedItem())
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
|
|
|
if (const QTreeWidgetItem *item = currentItem())
|
|
|
|
{
|
|
|
|
if (item->columnCount() >= 2 && ((item->flags() & (Qt::ItemIsEditable | Qt::ItemIsEnabled)) == (Qt::ItemIsEditable | Qt::ItemIsEnabled)))
|
|
|
|
{
|
|
|
|
event->accept();
|
|
|
|
// If the current position is at column 0, move to 1.
|
|
|
|
QModelIndex index = currentIndex();
|
|
|
|
if (index.column() == 0)
|
|
|
|
{
|
|
|
|
index = index.sibling(index.row(), 1);
|
|
|
|
setCurrentIndex(index);
|
|
|
|
}
|
|
|
|
edit(index);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTreeWidget::keyPressEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTree::mousePressEvent(QMouseEvent *event)
|
|
|
|
{
|
|
|
|
QTreeWidget::mousePressEvent(event);
|
|
|
|
QTreeWidgetItem *item = itemAt(event->pos());
|
|
|
|
|
|
|
|
if (item)
|
|
|
|
{
|
2023-08-27 20:17:07 +02:00
|
|
|
if ((item != mDelegate->editedItem()) && (event->button() == Qt::LeftButton) && (header()->logicalIndexAt(event->pos().x()) == 1) &&
|
2023-08-13 15:15:52 +02:00
|
|
|
((item->flags() & (Qt::ItemIsEditable | Qt::ItemIsEnabled)) == (Qt::ItemIsEditable | Qt::ItemIsEnabled)))
|
2013-08-09 06:57:18 +02:00
|
|
|
editItem(item, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
void lcQPropertiesTree::Update(const lcArray<lcObject*>& Selection, lcObject* Focus)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
lcPropertyWidgetMode Mode = LC_PROPERTY_WIDGET_EMPTY;
|
|
|
|
|
|
|
|
if (Focus)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
switch (Focus->GetType())
|
|
|
|
{
|
2020-04-19 04:45:21 +02:00
|
|
|
case lcObjectType::Piece:
|
2015-12-22 23:44:46 +01:00
|
|
|
Mode = LC_PROPERTY_WIDGET_PIECE;
|
|
|
|
break;
|
|
|
|
|
2020-04-19 04:45:21 +02:00
|
|
|
case lcObjectType::Camera:
|
2015-12-22 23:44:46 +01:00
|
|
|
Mode = LC_PROPERTY_WIDGET_CAMERA;
|
|
|
|
break;
|
|
|
|
|
2020-04-19 04:45:21 +02:00
|
|
|
case lcObjectType::Light:
|
2015-12-22 23:44:46 +01:00
|
|
|
Mode = LC_PROPERTY_WIDGET_LIGHT;
|
|
|
|
break;
|
|
|
|
}
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
2015-12-22 23:44:46 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int ObjectIdx = 0; ObjectIdx < Selection.GetSize(); ObjectIdx++)
|
|
|
|
{
|
|
|
|
switch (Selection[ObjectIdx]->GetType())
|
|
|
|
{
|
2020-04-19 04:45:21 +02:00
|
|
|
case lcObjectType::Piece:
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Mode == LC_PROPERTY_WIDGET_EMPTY)
|
|
|
|
Mode = LC_PROPERTY_WIDGET_PIECE;
|
|
|
|
else if (Mode != LC_PROPERTY_WIDGET_PIECE)
|
|
|
|
{
|
|
|
|
Mode = LC_PROPERTY_WIDGET_MULTIPLE;
|
|
|
|
ObjectIdx = Selection.GetSize();
|
|
|
|
}
|
|
|
|
break;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-04-19 04:45:21 +02:00
|
|
|
case lcObjectType::Camera:
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Mode != LC_PROPERTY_WIDGET_EMPTY)
|
|
|
|
{
|
|
|
|
Mode = LC_PROPERTY_WIDGET_MULTIPLE;
|
|
|
|
ObjectIdx = Selection.GetSize();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Mode = LC_PROPERTY_WIDGET_CAMERA;
|
|
|
|
Focus = Selection[ObjectIdx];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-04-19 04:45:21 +02:00
|
|
|
case lcObjectType::Light:
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Mode != LC_PROPERTY_WIDGET_EMPTY)
|
|
|
|
{
|
|
|
|
Mode = LC_PROPERTY_WIDGET_MULTIPLE;
|
|
|
|
ObjectIdx = Selection.GetSize();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Mode = LC_PROPERTY_WIDGET_LIGHT;
|
|
|
|
Focus = Selection[ObjectIdx];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (Mode)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
case LC_PROPERTY_WIDGET_EMPTY:
|
|
|
|
SetEmpty();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LC_PROPERTY_WIDGET_PIECE:
|
2016-02-09 20:40:59 +01:00
|
|
|
SetPiece(Selection, Focus);
|
2013-08-09 06:57:18 +02:00
|
|
|
break;
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
case LC_PROPERTY_WIDGET_CAMERA:
|
|
|
|
SetCamera(Focus);
|
2013-08-09 06:57:18 +02:00
|
|
|
break;
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
case LC_PROPERTY_WIDGET_LIGHT:
|
|
|
|
SetLight(Focus);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LC_PROPERTY_WIDGET_MULTIPLE:
|
|
|
|
SetMultiple();
|
2013-08-09 06:57:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
class lcStepValidator : public QIntValidator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcStepValidator(lcStep Min, lcStep Max, bool AllowEmpty)
|
2020-01-27 21:01:52 +01:00
|
|
|
: QIntValidator(1, INT_MAX), mMin(Min), mMax(Max), mAllowEmpty(AllowEmpty)
|
2020-01-26 03:07:33 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-03-22 23:44:41 +01:00
|
|
|
QValidator::State validate(QString& Input, int& Pos) const override
|
2020-01-26 03:07:33 +01:00
|
|
|
{
|
|
|
|
if (mAllowEmpty && Input.isEmpty())
|
|
|
|
return Acceptable;
|
|
|
|
|
|
|
|
bool Ok;
|
|
|
|
lcStep Step = Input.toUInt(&Ok);
|
|
|
|
|
|
|
|
if (Ok)
|
|
|
|
return (Step >= mMin && Step <= mMax) ? Acceptable : Invalid;
|
|
|
|
|
|
|
|
return QIntValidator::validate(Input, Pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
lcStep mMin;
|
|
|
|
lcStep mMax;
|
|
|
|
bool mAllowEmpty;
|
|
|
|
};
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item) const
|
|
|
|
{
|
|
|
|
PropertyType propertyType = (PropertyType)item->data(0, lcQPropertiesTree::PropertyTypeRole).toInt();
|
|
|
|
|
|
|
|
switch (propertyType)
|
|
|
|
{
|
|
|
|
case PropertyGroup:
|
2014-05-03 03:22:24 +02:00
|
|
|
case PropertyBool:
|
2023-09-02 19:21:25 +02:00
|
|
|
return nullptr;
|
2014-05-03 03:22:24 +02:00
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
case PropertyFloat:
|
|
|
|
{
|
|
|
|
QLineEdit *editor = new QLineEdit(parent);
|
|
|
|
float value = item->data(0, PropertyValueRole).toFloat();
|
|
|
|
|
2016-09-22 17:04:51 +02:00
|
|
|
editor->setValidator(new QDoubleValidator(editor));
|
2016-06-13 03:46:50 +02:00
|
|
|
editor->setText(lcFormatValueLocalized(value));
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
connect(editor, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
case PropertyFloatLightSpotSize:
|
|
|
|
{
|
|
|
|
QLineEdit *editor = new QLineEdit(parent);
|
|
|
|
float value = item->data(0, PropertyValueRole).toFloat();
|
|
|
|
|
|
|
|
editor->setValidator(new QDoubleValidator(1.0, 180.0,1, editor));
|
|
|
|
editor->setText(lcFormatValueLocalized(value));
|
|
|
|
editor->setToolTip(tr("Angle of the spotlight beam."));
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
case PropertyFloatLightSpotFalloff:
|
|
|
|
{
|
|
|
|
QLineEdit *editor = new QLineEdit(parent);
|
|
|
|
float value = item->data(0, PropertyValueRole).toFloat();
|
|
|
|
|
|
|
|
editor->setValidator(new QDoubleValidator(1.0, 90.0,1, editor));
|
|
|
|
editor->setText(lcFormatValueLocalized(value));
|
|
|
|
editor->setToolTip(tr("Angle of the spotlight beam beteeen the cone edge and center line."));
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
case PropertyFloatReadOnly:
|
2023-08-13 15:15:52 +02:00
|
|
|
return nullptr;
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
case PropertyStep:
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2020-01-26 03:07:33 +01:00
|
|
|
QLineEdit* Editor = new QLineEdit(parent);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
lcStep Value = item->data(0, PropertyValueRole).toUInt();
|
|
|
|
lcStep Show = partShow->data(0, PropertyValueRole).toUInt();
|
|
|
|
lcStep Hide = partHide->data(0, PropertyValueRole).toUInt();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
if (Show && Hide)
|
|
|
|
{
|
|
|
|
if (item == partShow)
|
|
|
|
Editor->setValidator(new lcStepValidator(1, Hide - 1, false));
|
|
|
|
else
|
|
|
|
Editor->setValidator(new lcStepValidator(Show + 1, LC_STEP_MAX, true));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Editor->setValidator(new lcStepValidator(1, LC_STEP_MAX, item == partHide));
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
if (item != partHide || Value != LC_STEP_MAX)
|
|
|
|
Editor->setText(QString::number(Value));
|
|
|
|
|
|
|
|
connect(Editor, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
|
|
|
|
|
|
|
|
return Editor;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case PropertyString:
|
|
|
|
{
|
|
|
|
QLineEdit *editor = new QLineEdit(parent);
|
2020-12-14 01:27:21 +01:00
|
|
|
QString value = item->data(0, PropertyValueRole).toString();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
editor->setText(value);
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
2023-09-02 05:46:29 +02:00
|
|
|
case PropertyStringList:
|
|
|
|
{
|
|
|
|
QComboBox* editor = new QComboBox(parent);
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
if (item == mCameraProjectionItem)
|
|
|
|
{
|
|
|
|
editor->addItems( { tr("Perspective"), tr("Orthographic") } );
|
|
|
|
}
|
|
|
|
else if (item == mLightTypeItem)
|
|
|
|
{
|
2023-09-02 05:46:29 +02:00
|
|
|
for (int LightTypeIndex = 0; LightTypeIndex < static_cast<int>(lcLightType::Count); LightTypeIndex++)
|
|
|
|
editor->addItem(lcLight::GetLightTypeString(static_cast<lcLightType>(LightTypeIndex)));
|
2023-09-02 19:21:25 +02:00
|
|
|
}
|
2023-09-02 05:46:29 +02:00
|
|
|
|
|
|
|
int value = item->data(0, PropertyValueRole).toInt();
|
|
|
|
editor->setCurrentIndex(value);
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
case PropertyLightFormat:
|
|
|
|
{
|
|
|
|
QComboBox *editor = new QComboBox(parent);
|
|
|
|
|
|
|
|
editor->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
|
|
|
editor->setMinimumContentsLength(1);
|
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
QStringList formats = { QLatin1String("Blender"), QLatin1String("POVRay") };
|
2023-08-07 13:08:13 +02:00
|
|
|
for (int i = 0; i < formats.size(); i++)
|
|
|
|
editor->addItem(formats.at(i), QVariant::fromValue(i));
|
|
|
|
|
|
|
|
int value = item->data(0, PropertyValueRole).toInt();
|
|
|
|
editor->setCurrentIndex(value);
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
case PropertyLightShape:
|
|
|
|
{
|
|
|
|
QComboBox *editor = new QComboBox(parent);
|
|
|
|
|
|
|
|
editor->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
|
|
|
editor->setMinimumContentsLength(1);
|
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
QStringList shapes = { tr("Square"), tr("Disk"), tr("Rectangle"), tr("Ellipse") };
|
2023-08-04 22:26:29 +02:00
|
|
|
for (int i = 0; i < shapes.size(); i++)
|
|
|
|
editor->addItem(shapes.at(i), QVariant::fromValue(i));
|
|
|
|
|
|
|
|
int value = item->data(0, PropertyValueRole).toInt();
|
|
|
|
editor->setCurrentIndex(value);
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
case PropertyColor:
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-08-27 20:17:07 +02:00
|
|
|
QPushButton *Editor = new QPushButton(parent);
|
|
|
|
QColor Value = item->data(0, PropertyValueRole).value<QColor>();
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
UpdateLightColorEditor(Editor, Value);
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
connect(Editor, &QPushButton::clicked, this, &lcQPropertiesTree::LightColorButtonClicked);
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
return Editor;
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
case PropertyPieceColor:
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
|
|
|
QPushButton *editor = new QPushButton(parent);
|
|
|
|
int value = item->data(0, PropertyValueRole).toInt();
|
|
|
|
|
|
|
|
updateColorEditor(editor, value);
|
|
|
|
|
|
|
|
connect(editor, SIGNAL(clicked()), this, SLOT(slotColorButtonClicked()));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PropertyPart:
|
|
|
|
{
|
|
|
|
QComboBox *editor = new QComboBox(parent);
|
|
|
|
|
|
|
|
editor->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
|
|
|
editor->setMinimumContentsLength(1);
|
|
|
|
|
2017-07-24 04:35:18 +02:00
|
|
|
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
2017-08-25 23:27:24 +02:00
|
|
|
std::vector<PieceInfo*> SortedPieces;
|
|
|
|
SortedPieces.reserve(Library->mPieces.size());
|
2022-04-21 17:33:50 +02:00
|
|
|
const lcModel* ActiveModel = gMainWindow->GetActiveModel();
|
2017-08-25 23:27:24 +02:00
|
|
|
|
2018-02-22 02:27:24 +01:00
|
|
|
for (const auto& PartIt : Library->mPieces)
|
2022-04-21 17:33:50 +02:00
|
|
|
{
|
|
|
|
PieceInfo* Info = PartIt.second;
|
|
|
|
|
|
|
|
if (!Info->IsModel() || !Info->GetModel()->IncludesModel(ActiveModel))
|
|
|
|
SortedPieces.push_back(PartIt.second);
|
|
|
|
}
|
2017-08-25 23:27:24 +02:00
|
|
|
|
|
|
|
auto PieceCompare = [](PieceInfo* Info1, PieceInfo* Info2)
|
|
|
|
{
|
|
|
|
return strcmp(Info1->m_strDescription, Info2->m_strDescription) < 0;
|
|
|
|
};
|
|
|
|
|
2017-09-02 02:09:27 +02:00
|
|
|
std::sort(SortedPieces.begin(), SortedPieces.end(), PieceCompare);
|
2017-08-25 23:27:24 +02:00
|
|
|
|
|
|
|
for (PieceInfo* Info : SortedPieces)
|
2020-02-24 23:31:08 +01:00
|
|
|
editor->addItem(Info->m_strDescription, QVariant::fromValue((void*)Info));
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
PieceInfo *info = (PieceInfo*)item->data(0, PropertyValueRole).value<void*>();
|
2020-02-24 23:31:08 +01:00
|
|
|
editor->setCurrentIndex(editor->findData(QVariant::fromValue((void*)info)));
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
|
|
|
|
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
return nullptr;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcQPropertiesTree::updateColorEditor(QPushButton *editor, int value) const
|
|
|
|
{
|
|
|
|
QImage img(12, 12, QImage::Format_ARGB32);
|
|
|
|
img.fill(0);
|
|
|
|
|
|
|
|
lcColor* color = &gColorList[value];
|
|
|
|
QPainter painter(&img);
|
|
|
|
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
2017-03-04 23:59:42 +01:00
|
|
|
painter.setPen(Qt::darkGray);
|
|
|
|
painter.setBrush(QColor::fromRgbF(color->Value[0], color->Value[1], color->Value[2]));
|
|
|
|
painter.drawRect(0, 0, img.width() - 1, img.height() - 1);
|
2013-08-09 06:57:18 +02:00
|
|
|
painter.end();
|
|
|
|
|
|
|
|
editor->setStyleSheet("Text-align:left");
|
|
|
|
editor->setIcon(QPixmap::fromImage(img));
|
|
|
|
editor->setText(color->Name);
|
|
|
|
}
|
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
void lcQPropertiesTree::UpdateLightColorEditor(QPushButton* Editor, QColor Color) const
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-08-27 20:17:07 +02:00
|
|
|
QImage Image(12, 12, QImage::Format_ARGB32);
|
|
|
|
Image.fill(0);
|
|
|
|
|
|
|
|
QPainter Painter(&Image);
|
|
|
|
Painter.setCompositionMode(QPainter::CompositionMode_Source);
|
|
|
|
Painter.setPen(Qt::darkGray);
|
|
|
|
Painter.setBrush(Color);
|
|
|
|
Painter.drawRect(0, 0, Image.width() - 1, Image.height() - 1);
|
|
|
|
Painter.end();
|
|
|
|
|
|
|
|
Editor->setStyleSheet("Text-align:left");
|
|
|
|
Editor->setIcon(QPixmap::fromImage(Image));
|
|
|
|
Editor->setText(Color.name().toUpper());
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
void lcQPropertiesTree::slotToggled(bool Value)
|
2014-05-03 03:22:24 +02:00
|
|
|
{
|
2023-08-27 20:17:07 +02:00
|
|
|
QTreeWidgetItem* Item = mDelegate->editedItem();
|
2018-05-12 01:23:43 +02:00
|
|
|
lcModel* Model = gMainWindow->GetActiveModel();
|
2023-08-04 22:26:29 +02:00
|
|
|
lcObject* Focus = Model->GetFocusObject();
|
2014-05-03 03:22:24 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
|
|
|
|
|
|
|
if (Light)
|
|
|
|
{
|
|
|
|
if (Item == lightEnableCutoff)
|
|
|
|
{
|
2023-09-02 19:40:52 +02:00
|
|
|
lcLightProperties Props = Light->GetLightProperties();
|
2023-08-04 22:26:29 +02:00
|
|
|
Props.mEnableCutoff = Value;
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_USE_CUTOFF);
|
|
|
|
}
|
2023-09-02 19:40:52 +02:00
|
|
|
else if (Item == mLightCastShadowItem)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-09-02 19:40:52 +02:00
|
|
|
Model->SetLightCastShadow(Light, Value);
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-03 03:22:24 +02:00
|
|
|
}
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
void lcQPropertiesTree::slotReturnPressed()
|
|
|
|
{
|
2014-12-08 08:32:39 +01:00
|
|
|
QLineEdit* Editor = (QLineEdit*)sender();
|
2023-08-27 20:17:07 +02:00
|
|
|
QTreeWidgetItem* Item = mDelegate->editedItem();
|
2018-05-12 01:23:43 +02:00
|
|
|
lcModel* Model = gMainWindow->GetActiveModel();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (mWidgetMode == LC_PROPERTY_WIDGET_PIECE)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2017-04-14 02:26:40 +02:00
|
|
|
lcPiece* Piece = (mFocus && mFocus->IsPiece()) ? (lcPiece*)mFocus : nullptr;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
if (Item == partPositionX || Item == partPositionY || Item == partPositionZ)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2016-03-13 21:07:28 +01:00
|
|
|
lcVector3 Center;
|
|
|
|
lcMatrix33 RelativeRotation;
|
|
|
|
Model->GetMoveRotateTransform(Center, RelativeRotation);
|
2015-12-22 23:44:46 +01:00
|
|
|
lcVector3 Position = Center;
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
if (Item == partPositionX)
|
|
|
|
Position[0] = Value;
|
|
|
|
else if (Item == partPositionY)
|
|
|
|
Position[1] = Value;
|
|
|
|
else if (Item == partPositionZ)
|
|
|
|
Position[2] = Value;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
lcVector3 Distance = Position - Center;
|
|
|
|
|
2016-06-14 02:16:53 +02:00
|
|
|
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
2014-12-08 08:32:39 +01:00
|
|
|
else if (Item == partRotationX || Item == partRotationY || Item == partRotationZ)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
lcVector3 InitialRotation;
|
|
|
|
if (Piece)
|
|
|
|
InitialRotation = lcMatrix44ToEulerAngles(Piece->mModelWorld) * LC_RTOD;
|
|
|
|
else
|
|
|
|
InitialRotation = lcVector3(0.0f, 0.0f, 0.0f);
|
|
|
|
lcVector3 Rotation = InitialRotation;
|
|
|
|
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2014-12-08 08:32:39 +01:00
|
|
|
|
|
|
|
if (Item == partRotationX)
|
|
|
|
Rotation[0] = Value;
|
|
|
|
else if (Item == partRotationY)
|
|
|
|
Rotation[1] = Value;
|
|
|
|
else if (Item == partRotationZ)
|
|
|
|
Rotation[2] = Value;
|
|
|
|
|
2023-09-04 19:59:16 +02:00
|
|
|
Model->RotateSelectedObjects(Rotation - InitialRotation, true, false, true, true);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
2014-12-08 08:32:39 +01:00
|
|
|
else if (Item == partShow)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2020-01-26 03:07:33 +01:00
|
|
|
bool Ok = false;
|
|
|
|
lcStep Step = Editor->text().toUInt(&Ok);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
if (Ok)
|
|
|
|
Model->SetSelectedPiecesStepShow(Step);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
2014-12-08 08:32:39 +01:00
|
|
|
else if (Item == partHide)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2020-01-26 03:07:33 +01:00
|
|
|
QString Text = Editor->text();
|
|
|
|
|
|
|
|
if (Text.isEmpty())
|
|
|
|
Model->SetSelectedPiecesStepHide(LC_STEP_MAX);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool Ok = false;
|
|
|
|
lcStep Step = Text.toUInt(&Ok);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-01-26 03:07:33 +01:00
|
|
|
if (Ok)
|
|
|
|
Model->SetSelectedPiecesStepHide(Step);
|
|
|
|
}
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
}
|
2015-12-22 23:44:46 +01:00
|
|
|
else if (mWidgetMode == LC_PROPERTY_WIDGET_CAMERA)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2017-04-14 02:26:40 +02:00
|
|
|
lcCamera* Camera = (mFocus && mFocus->IsCamera()) ? (lcCamera*)mFocus : nullptr;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Camera)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Item == cameraPositionX || Item == cameraPositionY || Item == cameraPositionZ)
|
|
|
|
{
|
|
|
|
lcVector3 Center = Camera->mPosition;
|
|
|
|
lcVector3 Position = Center;
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Item == cameraPositionX)
|
|
|
|
Position[0] = Value;
|
|
|
|
else if (Item == cameraPositionY)
|
|
|
|
Position[1] = Value;
|
|
|
|
else if (Item == cameraPositionZ)
|
|
|
|
Position[2] = Value;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
lcVector3 Distance = Position - Center;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2016-06-14 02:16:53 +02:00
|
|
|
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
2015-12-22 23:44:46 +01:00
|
|
|
}
|
|
|
|
else if (Item == cameraTargetX || Item == cameraTargetY || Item == cameraTargetZ)
|
|
|
|
{
|
|
|
|
lcVector3 Center = Camera->mTargetPosition;
|
|
|
|
lcVector3 Position = Center;
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Item == cameraTargetX)
|
|
|
|
Position[0] = Value;
|
|
|
|
else if (Item == cameraTargetY)
|
|
|
|
Position[1] = Value;
|
|
|
|
else if (Item == cameraTargetZ)
|
|
|
|
Position[2] = Value;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
lcVector3 Distance = Position - Center;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2016-06-14 02:16:53 +02:00
|
|
|
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
2015-12-22 23:44:46 +01:00
|
|
|
}
|
|
|
|
else if (Item == cameraUpX || Item == cameraUpY || Item == cameraUpZ)
|
|
|
|
{
|
|
|
|
lcVector3 Center = Camera->mUpVector;
|
|
|
|
lcVector3 Position = Center;
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Item == cameraUpX)
|
|
|
|
Position[0] = Value;
|
|
|
|
else if (Item == cameraUpY)
|
|
|
|
Position[1] = Value;
|
|
|
|
else if (Item == cameraUpZ)
|
|
|
|
Position[2] = Value;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
lcVector3 Distance = Position - Center;
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2016-06-14 02:16:53 +02:00
|
|
|
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
2015-12-22 23:44:46 +01:00
|
|
|
}
|
|
|
|
else if (Item == cameraFOV)
|
|
|
|
{
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
Model->SetCameraFOV(Camera, Value);
|
|
|
|
}
|
|
|
|
else if (Item == cameraNear)
|
|
|
|
{
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2015-12-22 23:44:46 +01:00
|
|
|
|
|
|
|
Model->SetCameraZNear(Camera, Value);
|
|
|
|
}
|
|
|
|
else if (Item == cameraFar)
|
|
|
|
{
|
2016-06-14 01:57:31 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2015-12-22 23:44:46 +01:00
|
|
|
|
|
|
|
Model->SetCameraZFar(Camera, Value);
|
|
|
|
}
|
2023-09-02 19:21:25 +02:00
|
|
|
else if (Item == mCameraNameItem)
|
2015-12-22 23:44:46 +01:00
|
|
|
{
|
|
|
|
QString Value = Editor->text();
|
|
|
|
|
2020-12-14 01:27:21 +01:00
|
|
|
Model->SetCameraName(Camera, Value);
|
2015-12-22 23:44:46 +01:00
|
|
|
}
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
else if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
|
|
|
{
|
|
|
|
lcLight* Light = (mFocus && mFocus->IsLight()) ? (lcLight*)mFocus : nullptr;
|
|
|
|
|
|
|
|
if (Light)
|
|
|
|
{
|
|
|
|
lcLightProperties Props = Light->GetLightProperties();
|
|
|
|
|
|
|
|
QString Name = Light->GetName();
|
|
|
|
|
|
|
|
if (Item == lightPositionX || Item == lightPositionY || Item == lightPositionZ)
|
|
|
|
{
|
2023-09-05 05:53:34 +02:00
|
|
|
lcVector3 Center = Light->GetPosition();
|
2023-08-04 22:26:29 +02:00
|
|
|
lcVector3 Position = Center;
|
2023-09-05 05:53:34 +02:00
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
2023-09-05 05:53:34 +02:00
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
if (Item == lightPositionX)
|
|
|
|
Position[0] = Value;
|
|
|
|
else if (Item == lightPositionY)
|
|
|
|
Position[1] = Value;
|
|
|
|
else if (Item == lightPositionZ)
|
|
|
|
Position[2] = Value;
|
|
|
|
|
|
|
|
lcVector3 Distance = Position - Center;
|
|
|
|
|
|
|
|
Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
|
|
|
}
|
|
|
|
else if (Item == lightTargetX || Item == lightTargetY || Item == lightTargetZ)
|
|
|
|
{
|
2023-09-05 05:53:34 +02:00
|
|
|
// lcVector3 Center = Light->mTargetPosition;
|
|
|
|
// lcVector3 Position = Center;
|
|
|
|
// float Value = lcParseValueLocalized(Editor->text());
|
|
|
|
// if (Item == lightTargetX)
|
|
|
|
// Position[0] = Value;
|
|
|
|
// else if (Item == lightTargetY)
|
|
|
|
// Position[1] = Value;
|
|
|
|
// else if (Item == lightTargetZ)
|
|
|
|
// Position[2] = Value;
|
|
|
|
//
|
|
|
|
// lcVector3 Distance = Position - Center;
|
|
|
|
//
|
|
|
|
// Model->MoveSelectedObjects(Distance, Distance, false, false, true, true);
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
else if (Item == lightFactorA || Item == lightFactorB)
|
|
|
|
{
|
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
|
|
|
if (Item == lightFactorA)
|
|
|
|
Props.mLightFactor[0] = Value;
|
|
|
|
else if (Item == lightFactorB)
|
|
|
|
Props.mLightFactor[1] = Value;
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_FACTOR);
|
|
|
|
}
|
2023-08-07 13:08:13 +02:00
|
|
|
else if (Item == lightDiffuse)
|
|
|
|
{
|
|
|
|
Props.mLightDiffuse = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_DIFFUSE);
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
else if (Item == lightSpecular)
|
|
|
|
{
|
|
|
|
Props.mLightSpecular = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_SPECULAR);
|
|
|
|
}
|
|
|
|
else if (Item == lightExponent)
|
|
|
|
{
|
|
|
|
Props.mSpotExponent = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_EXPONENT);
|
|
|
|
}
|
|
|
|
else if (Item == lightCutoff)
|
|
|
|
{
|
|
|
|
Props.mSpotCutoff = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_CUTOFF);
|
|
|
|
}
|
|
|
|
else if (Item == lightSpotSize)
|
|
|
|
{
|
|
|
|
Props.mSpotSize = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_SPOT_SIZE);
|
|
|
|
}
|
2023-08-07 13:08:13 +02:00
|
|
|
|
|
|
|
else if (Item == lightSpotFalloff)
|
|
|
|
{
|
|
|
|
Props.mSpotFalloff = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_SPOT_FALLOFF);
|
|
|
|
}
|
|
|
|
else if (Item == lightSpotTightness)
|
|
|
|
{
|
|
|
|
Props.mSpotTightness = lcParseValueLocalized(Editor->text());
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_SPOT_TIGHTNESS);
|
|
|
|
}
|
|
|
|
else if (Item == lightAreaGridRows || Item == lightAreaGridColumns)
|
|
|
|
{
|
|
|
|
float Value = lcParseValueLocalized(Editor->text());
|
|
|
|
if (Item == lightAreaGridRows)
|
|
|
|
Props.mAreaGrid[0] = Value;
|
|
|
|
else if (Item == lightAreaGridColumns)
|
|
|
|
Props.mAreaGrid[1] = Value;
|
|
|
|
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_AREA_GRID);
|
|
|
|
}
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
else if (Item == mLightNameItem)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
QString Value = Editor->text();
|
|
|
|
|
2023-08-26 21:41:16 +02:00
|
|
|
Model->SetLightName(Light, Value);
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2014-12-08 08:32:39 +01:00
|
|
|
void lcQPropertiesTree::slotSetValue(int Value)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2023-08-27 20:17:07 +02:00
|
|
|
QTreeWidgetItem* Item = mDelegate->editedItem();
|
2018-05-12 01:23:43 +02:00
|
|
|
lcModel* Model = gMainWindow->GetActiveModel();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (mWidgetMode == LC_PROPERTY_WIDGET_PIECE)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
if (Item == mPieceColorItem)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
Model->SetSelectedPiecesColorIndex(Value);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
QPushButton *editor = (QPushButton*)mDelegate->editor();
|
2014-12-08 08:32:39 +01:00
|
|
|
updateColorEditor(editor, Value);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
2023-09-02 19:21:25 +02:00
|
|
|
else if (Item == mPieceIdItem)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
|
|
|
QComboBox *editor = (QComboBox*)sender();
|
|
|
|
|
2020-10-07 12:07:32 +02:00
|
|
|
PieceInfo* Info = (PieceInfo*)editor->itemData(Value).value<void*>();
|
|
|
|
Model->SetSelectedPiecesPieceInfo(Info);
|
|
|
|
|
2020-12-30 19:39:04 +01:00
|
|
|
int ColorIndex = gDefaultColor;
|
|
|
|
lcObject* Focus = gMainWindow->GetActiveModel()->GetFocusObject();
|
|
|
|
if (Focus && Focus->IsPiece())
|
2021-01-17 03:27:39 +01:00
|
|
|
ColorIndex = ((lcPiece*)Focus)->GetColorIndex();
|
2020-12-30 19:39:04 +01:00
|
|
|
quint32 ColorCode = lcGetColorCode(ColorIndex);
|
2021-01-05 21:32:03 +01:00
|
|
|
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
}
|
2023-09-02 19:21:25 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
else if (mWidgetMode == LC_PROPERTY_WIDGET_LIGHT)
|
|
|
|
{
|
|
|
|
lcObject* Focus = Model->GetFocusObject();
|
|
|
|
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (Light)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
lcLightProperties Props = Light->GetLightProperties();
|
2023-09-02 05:46:29 +02:00
|
|
|
|
|
|
|
if (Item == mLightTypeItem)
|
|
|
|
{
|
|
|
|
Model->SetLightType(Light, static_cast<lcLightType>(Value));
|
|
|
|
}
|
|
|
|
else if (Item == lightShape)
|
2023-08-07 13:08:13 +02:00
|
|
|
{
|
|
|
|
Props.mLightShape = static_cast<lcLightShape>(Value);
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_SHAPE);
|
|
|
|
}
|
|
|
|
else if (Item == lightFormat)
|
|
|
|
{
|
|
|
|
Props.mPOVRayLight = Value;
|
|
|
|
Model->UpdateLight(Light, Props, LC_LIGHT_POVRAY);
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
void lcQPropertiesTree::slotColorButtonClicked()
|
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
int ColorIndex = gDefaultColor;
|
2018-05-12 01:23:43 +02:00
|
|
|
lcObject* Focus = gMainWindow->GetActiveModel()->GetFocusObject();
|
2020-12-13 00:40:53 +01:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
if (Focus && Focus->IsPiece())
|
2021-01-17 03:27:39 +01:00
|
|
|
ColorIndex = ((lcPiece*)Focus)->GetColorIndex();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-12-13 00:40:53 +01:00
|
|
|
QWidget* Button = (QWidget*)sender();
|
|
|
|
|
|
|
|
if (!Button)
|
|
|
|
return;
|
|
|
|
|
2023-05-16 06:02:17 +02:00
|
|
|
lcColorPickerPopup* Popup = new lcColorPickerPopup(Button, ColorIndex);
|
|
|
|
connect(Popup, &lcColorPickerPopup::Selected, this, &lcQPropertiesTree::slotSetValue);
|
2020-12-30 19:43:46 +01:00
|
|
|
Popup->setMinimumSize(qMax(300, width()), qMax(200, static_cast<int>(width() * 2 / 3)));
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2021-07-06 02:00:41 +02:00
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
|
|
QScreen* Screen = Button->screen();
|
|
|
|
const QRect ScreenRect = Screen ? Screen->geometry() : QRect();
|
|
|
|
#elif (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
2020-12-13 00:40:53 +01:00
|
|
|
QScreen* Screen = QGuiApplication::screenAt(Button->mapToGlobal(Button->rect().bottomLeft()));
|
|
|
|
const QRect ScreenRect = Screen ? Screen->geometry() : QApplication::desktop()->geometry();
|
2020-12-13 01:07:56 +01:00
|
|
|
#else
|
|
|
|
const QRect ScreenRect = QApplication::desktop()->geometry();
|
|
|
|
#endif
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-12-30 00:20:21 +01:00
|
|
|
int x = mapToGlobal(QPoint(0, 0)).x();
|
|
|
|
int y = Button->mapToGlobal(Button->rect().bottomLeft()).y();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-12-30 00:20:21 +01:00
|
|
|
if (x < ScreenRect.left())
|
|
|
|
x = ScreenRect.left();
|
|
|
|
if (y < ScreenRect.top())
|
|
|
|
y = ScreenRect.top();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2020-12-30 00:20:21 +01:00
|
|
|
if (x + Popup->width() > ScreenRect.right())
|
|
|
|
x = ScreenRect.right() - Popup->width();
|
|
|
|
if (y + Popup->height() > ScreenRect.bottom())
|
|
|
|
y = ScreenRect.bottom() - Popup->height();
|
|
|
|
|
|
|
|
Popup->move(QPoint(x, y));
|
2020-12-13 00:40:53 +01:00
|
|
|
Popup->setFocus();
|
|
|
|
Popup->show();
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
void lcQPropertiesTree::LightColorButtonClicked()
|
|
|
|
{
|
|
|
|
lcModel* Model = gMainWindow->GetActiveModel();
|
|
|
|
lcObject* Focus = Model->GetFocusObject();
|
|
|
|
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
|
|
|
|
|
|
|
if (!Light)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QColor Color = QColorDialog::getColor(lcQColorFromVector3(Light->GetColor()), this, tr("Select Light Color"));
|
|
|
|
|
|
|
|
if (!Color.isValid())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Model->SetLightColor(Light, lcVector3FromQColor(Color));
|
|
|
|
|
|
|
|
QPushButton* Editor = qobject_cast<QPushButton*>(mDelegate->editor());
|
|
|
|
|
|
|
|
if (Editor)
|
|
|
|
UpdateLightColorEditor(Editor, Color);
|
|
|
|
}
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
QTreeWidgetItem *lcQPropertiesTree::addProperty(QTreeWidgetItem *parent, const QString& label, PropertyType propertyType)
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *newItem;
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
newItem = new QTreeWidgetItem(parent, QStringList(label));
|
|
|
|
else
|
|
|
|
newItem = new QTreeWidgetItem(this, QStringList(label));
|
|
|
|
|
|
|
|
newItem->setData(0, PropertyTypeRole, QVariant(propertyType));
|
2023-09-02 19:21:25 +02:00
|
|
|
|
|
|
|
if (propertyType != PropertyFloatReadOnly)
|
|
|
|
newItem->setFlags(newItem->flags() | Qt::ItemIsEditable);
|
|
|
|
|
2020-02-24 23:31:08 +01:00
|
|
|
newItem->setExpanded(true);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
if (propertyType == PropertyGroup)
|
|
|
|
{
|
|
|
|
newItem->setFirstColumnSpanned(true);
|
|
|
|
newItem->setIcon(0, m_expandIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
return newItem;
|
|
|
|
}
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
void lcQPropertiesTree::SetEmpty()
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
|
|
|
clear();
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
mPieceAttributesItem = nullptr;
|
2017-04-14 02:26:40 +02:00
|
|
|
partPosition = nullptr;
|
|
|
|
partPositionX = nullptr;
|
|
|
|
partPositionY = nullptr;
|
|
|
|
partPositionZ = nullptr;
|
|
|
|
partRotation = nullptr;
|
|
|
|
partRotationX = nullptr;
|
|
|
|
partRotationY = nullptr;
|
|
|
|
partRotationZ = nullptr;
|
|
|
|
partVisibility = nullptr;
|
|
|
|
partShow = nullptr;
|
|
|
|
partHide = nullptr;
|
|
|
|
partAppearance = nullptr;
|
2023-09-02 19:21:25 +02:00
|
|
|
mPieceColorItem = nullptr;
|
|
|
|
mPieceIdItem = nullptr;
|
2017-04-14 02:26:40 +02:00
|
|
|
|
|
|
|
cameraPosition = nullptr;
|
|
|
|
cameraPositionX = nullptr;
|
|
|
|
cameraPositionY = nullptr;
|
|
|
|
cameraPositionZ = nullptr;
|
|
|
|
cameraTarget = nullptr;
|
|
|
|
cameraTargetX = nullptr;
|
|
|
|
cameraTargetY = nullptr;
|
|
|
|
cameraTargetZ = nullptr;
|
|
|
|
cameraUp = nullptr;
|
|
|
|
cameraUpX = nullptr;
|
|
|
|
cameraUpY = nullptr;
|
|
|
|
cameraUpZ = nullptr;
|
2023-09-02 19:21:25 +02:00
|
|
|
mCameraAttributesItem = nullptr;
|
|
|
|
mCameraProjectionItem = nullptr;
|
2017-04-14 02:26:40 +02:00
|
|
|
cameraFOV = nullptr;
|
|
|
|
cameraNear = nullptr;
|
|
|
|
cameraFar = nullptr;
|
2023-09-02 19:21:25 +02:00
|
|
|
mCameraNameItem = nullptr;
|
2015-12-22 23:44:46 +01:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
lightConfiguration = nullptr;
|
2023-08-04 22:26:29 +02:00
|
|
|
lightPosition = nullptr;
|
|
|
|
lightPositionX = nullptr;
|
|
|
|
lightPositionY = nullptr;
|
|
|
|
lightPositionZ = nullptr;
|
|
|
|
lightTarget = nullptr;
|
|
|
|
lightTargetX = nullptr;
|
|
|
|
lightTargetY = nullptr;
|
|
|
|
lightTargetZ = nullptr;
|
2023-09-02 19:21:25 +02:00
|
|
|
mLightColorItem = nullptr;
|
|
|
|
mLightAttributesItem = nullptr;
|
2023-08-07 13:08:13 +02:00
|
|
|
lightDiffuse = nullptr;
|
2023-08-04 22:26:29 +02:00
|
|
|
lightSpecular = nullptr;
|
|
|
|
lightCutoff = nullptr;
|
|
|
|
lightEnableCutoff = nullptr;
|
|
|
|
lightExponent = nullptr;
|
2023-09-02 05:46:29 +02:00
|
|
|
mLightTypeItem = nullptr;
|
2023-08-04 22:26:29 +02:00
|
|
|
lightFactorA = nullptr;
|
|
|
|
lightFactorB = nullptr;
|
2023-09-02 19:21:25 +02:00
|
|
|
mLightNameItem = nullptr;
|
2023-08-04 22:26:29 +02:00
|
|
|
lightSpotSize = nullptr;
|
|
|
|
lightShape = nullptr;
|
2023-08-07 13:08:13 +02:00
|
|
|
lightFormat = nullptr;
|
2023-09-02 19:40:52 +02:00
|
|
|
mLightCastShadowItem = nullptr;
|
2023-08-07 13:08:13 +02:00
|
|
|
lightAreaGridRows = nullptr;
|
|
|
|
lightAreaGridColumns = nullptr;
|
|
|
|
lightSpotFalloff = nullptr;
|
|
|
|
lightSpotTightness = nullptr;
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
mWidgetMode = LC_PROPERTY_WIDGET_EMPTY;
|
2017-04-14 02:26:40 +02:00
|
|
|
mFocus = nullptr;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2016-02-09 20:40:59 +01:00
|
|
|
void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject* Focus)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
if (mWidgetMode != LC_PROPERTY_WIDGET_PIECE)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
SetEmpty();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
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);
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
partPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
2013-08-09 06:57:18 +02:00
|
|
|
partPositionX = addProperty(partPosition, tr("X"), PropertyFloat);
|
|
|
|
partPositionY = addProperty(partPosition, tr("Y"), PropertyFloat);
|
|
|
|
partPositionZ = addProperty(partPosition, tr("Z"), PropertyFloat);
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
partRotation = addProperty(nullptr, tr("Rotation"), PropertyGroup);
|
2013-08-09 06:57:18 +02:00
|
|
|
partRotationX = addProperty(partRotation, tr("X"), PropertyFloat);
|
|
|
|
partRotationY = addProperty(partRotation, tr("Y"), PropertyFloat);
|
|
|
|
partRotationZ = addProperty(partRotation, tr("Z"), PropertyFloat);
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
mWidgetMode = LC_PROPERTY_WIDGET_PIECE;
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2018-05-12 01:23:43 +02:00
|
|
|
lcModel* Model = gMainWindow->GetActiveModel();
|
2017-04-14 02:26:40 +02:00
|
|
|
lcPiece* Piece = (Focus && Focus->IsPiece()) ? (lcPiece*)Focus : nullptr;
|
2015-12-22 23:44:46 +01:00
|
|
|
mFocus = Piece;
|
|
|
|
|
2016-03-13 21:07:28 +01:00
|
|
|
lcVector3 Position;
|
|
|
|
lcMatrix33 RelativeRotation;
|
|
|
|
Model->GetMoveRotateTransform(Position, RelativeRotation);
|
2016-06-13 03:46:50 +02:00
|
|
|
partPositionX->setText(1, lcFormatValueLocalized(Position[0]));
|
2015-12-22 23:44:46 +01:00
|
|
|
partPositionX->setData(0, PropertyValueRole, Position[0]);
|
2016-06-13 03:46:50 +02:00
|
|
|
partPositionY->setText(1, lcFormatValueLocalized(Position[1]));
|
2015-12-22 23:44:46 +01:00
|
|
|
partPositionY->setData(0, PropertyValueRole, Position[1]);
|
2016-06-13 03:46:50 +02:00
|
|
|
partPositionZ->setText(1, lcFormatValueLocalized(Position[2]));
|
2015-12-22 23:44:46 +01:00
|
|
|
partPositionZ->setData(0, PropertyValueRole, Position[2]);
|
|
|
|
|
|
|
|
lcVector3 Rotation;
|
|
|
|
if (Piece)
|
|
|
|
Rotation = lcMatrix44ToEulerAngles(Piece->mModelWorld) * LC_RTOD;
|
|
|
|
else
|
|
|
|
Rotation = lcVector3(0.0f, 0.0f, 0.0f);
|
2016-06-13 03:46:50 +02:00
|
|
|
partRotationX->setText(1, lcFormatValueLocalized(Rotation[0]));
|
2015-12-22 23:44:46 +01:00
|
|
|
partRotationX->setData(0, PropertyValueRole, Rotation[0]);
|
2016-06-13 03:46:50 +02:00
|
|
|
partRotationY->setText(1, lcFormatValueLocalized(Rotation[1]));
|
2015-12-22 23:44:46 +01:00
|
|
|
partRotationY->setData(0, PropertyValueRole, Rotation[1]);
|
2016-06-13 03:46:50 +02:00
|
|
|
partRotationZ->setText(1, lcFormatValueLocalized(Rotation[2]));
|
2015-12-22 23:44:46 +01:00
|
|
|
partRotationZ->setData(0, PropertyValueRole, Rotation[2]);
|
|
|
|
|
|
|
|
lcStep Show = 0;
|
|
|
|
lcStep Hide = 0;
|
|
|
|
int ColorIndex = gDefaultColor;
|
2017-04-14 02:26:40 +02:00
|
|
|
PieceInfo* Info = nullptr;
|
2015-12-22 23:44:46 +01:00
|
|
|
|
|
|
|
if (Piece)
|
|
|
|
{
|
|
|
|
Show = Piece->GetStepShow();
|
|
|
|
Hide = Piece->GetStepHide();
|
2021-01-17 03:27:39 +01:00
|
|
|
ColorIndex = Piece->GetColorIndex();
|
2015-12-22 23:44:46 +01:00
|
|
|
Info = Piece->mPieceInfo;
|
2020-12-30 19:39:04 +01:00
|
|
|
quint32 ColorCode = lcGetColorCode(ColorIndex);
|
2021-01-05 21:32:03 +01:00
|
|
|
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
|
2015-12-22 23:44:46 +01:00
|
|
|
}
|
2016-02-09 20:40:59 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
bool FirstPiece = true;
|
|
|
|
|
|
|
|
for (int ObjectIdx = 0; ObjectIdx < Selection.GetSize(); ObjectIdx++)
|
|
|
|
{
|
|
|
|
lcObject* Object = Selection[ObjectIdx];
|
|
|
|
|
2020-04-19 04:45:21 +02:00
|
|
|
if (!Object->IsPiece())
|
2016-02-09 20:40:59 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
lcPiece* SelectedPiece = (lcPiece*)Object;
|
|
|
|
|
|
|
|
if (FirstPiece)
|
|
|
|
{
|
|
|
|
Show = SelectedPiece->GetStepShow();
|
|
|
|
Hide = SelectedPiece->GetStepHide();
|
2021-01-17 03:27:39 +01:00
|
|
|
ColorIndex = SelectedPiece->GetColorIndex();
|
2016-02-09 20:40:59 +01:00
|
|
|
Info = SelectedPiece->mPieceInfo;
|
|
|
|
|
|
|
|
FirstPiece = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (SelectedPiece->GetStepShow() != Show)
|
|
|
|
Show = 0;
|
|
|
|
|
|
|
|
if (SelectedPiece->GetStepHide() != Hide)
|
|
|
|
Hide = 0;
|
|
|
|
|
2021-01-17 03:27:39 +01:00
|
|
|
if (SelectedPiece->GetColorIndex() != ColorIndex)
|
2016-02-09 20:40:59 +01:00
|
|
|
ColorIndex = gDefaultColor;
|
|
|
|
|
|
|
|
if (SelectedPiece->mPieceInfo != Info)
|
2017-04-14 02:26:40 +02:00
|
|
|
Info = nullptr;
|
2016-02-09 20:40:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-12-22 23:44:46 +01:00
|
|
|
|
|
|
|
partShow->setText(1, QString::number(Show));
|
|
|
|
partShow->setData(0, PropertyValueRole, Show);
|
2020-01-26 03:07:33 +01:00
|
|
|
partHide->setText(1, Hide == LC_STEP_MAX ? QString() : QString::number(Hide));
|
2015-12-22 23:44:46 +01:00
|
|
|
partHide->setData(0, PropertyValueRole, Hide);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
|
|
|
QImage img(16, 16, QImage::Format_ARGB32);
|
|
|
|
img.fill(0);
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
lcColor* color = &gColorList[ColorIndex];
|
2013-08-09 06:57:18 +02:00
|
|
|
QPainter painter(&img);
|
|
|
|
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
2017-03-04 23:59:42 +01:00
|
|
|
painter.setPen(Qt::darkGray);
|
|
|
|
painter.setBrush(QColor::fromRgbF(color->Value[0], color->Value[1], color->Value[2]));
|
|
|
|
painter.drawRect(0, 0, img.width() - 1, img.height() - 1);
|
2013-08-09 06:57:18 +02:00
|
|
|
painter.end();
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
mPieceColorItem->setIcon(1, QIcon(QPixmap::fromImage(img)));
|
|
|
|
mPieceColorItem->setText(1, color->Name);
|
|
|
|
mPieceColorItem->setData(0, PropertyValueRole, ColorIndex);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2019-03-06 17:42:10 +01:00
|
|
|
QString text = Info ? Info->m_strDescription : QString();
|
2023-09-02 19:21:25 +02:00
|
|
|
mPieceIdItem->setText(1, text);
|
|
|
|
mPieceIdItem->setToolTip(1, text);
|
|
|
|
mPieceIdItem->setData(0, PropertyValueRole, QVariant::fromValue((void*)Info));
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
void lcQPropertiesTree::SetCamera(lcObject* Focus)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
if (mWidgetMode != LC_PROPERTY_WIDGET_CAMERA)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2015-12-22 23:44:46 +01:00
|
|
|
SetEmpty();
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
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);
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
cameraPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
2013-08-09 06:57:18 +02:00
|
|
|
cameraPositionX = addProperty(cameraPosition, tr("X"), PropertyFloat);
|
|
|
|
cameraPositionY = addProperty(cameraPosition, tr("Y"), PropertyFloat);
|
|
|
|
cameraPositionZ = addProperty(cameraPosition, tr("Z"), PropertyFloat);
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
cameraTarget = addProperty(nullptr, tr("Target"), PropertyGroup);
|
2013-08-09 06:57:18 +02:00
|
|
|
cameraTargetX = addProperty(cameraTarget, tr("X"), PropertyFloat);
|
|
|
|
cameraTargetY = addProperty(cameraTarget, tr("Y"), PropertyFloat);
|
|
|
|
cameraTargetZ = addProperty(cameraTarget, tr("Z"), PropertyFloat);
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
cameraUp = addProperty(nullptr, tr("Up"), PropertyGroup);
|
2013-08-09 06:57:18 +02:00
|
|
|
cameraUpX = addProperty(cameraUp, tr("X"), PropertyFloat);
|
|
|
|
cameraUpY = addProperty(cameraUp, tr("Y"), PropertyFloat);
|
|
|
|
cameraUpZ = addProperty(cameraUp, tr("Z"), PropertyFloat);
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
mWidgetMode = LC_PROPERTY_WIDGET_CAMERA;
|
|
|
|
}
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
lcCamera* Camera = (Focus && Focus->IsCamera()) ? (lcCamera*)Focus : nullptr;
|
2015-12-22 23:44:46 +01:00
|
|
|
mFocus = Camera;
|
|
|
|
|
|
|
|
lcVector3 Position(0.0f, 0.0f, 0.0f);
|
|
|
|
lcVector3 Target(0.0f, 0.0f, 0.0f);
|
|
|
|
lcVector3 UpVector(0.0f, 0.0f, 0.0f);
|
|
|
|
bool Ortho = false;
|
|
|
|
float FoV = 60.0f;
|
|
|
|
float ZNear = 1.0f;
|
|
|
|
float ZFar = 100.0f;
|
2020-12-14 01:27:21 +01:00
|
|
|
QString Name;
|
2015-12-22 23:44:46 +01:00
|
|
|
|
2017-07-03 05:12:17 +02:00
|
|
|
if (Camera)
|
2015-12-22 23:44:46 +01:00
|
|
|
{
|
|
|
|
Position = Camera->mPosition;
|
|
|
|
Target = Camera->mTargetPosition;
|
|
|
|
UpVector = Camera->mUpVector;
|
|
|
|
|
|
|
|
Ortho = Camera->IsOrtho();
|
|
|
|
FoV = Camera->m_fovy;
|
|
|
|
ZNear = Camera->m_zNear;
|
|
|
|
ZFar = Camera->m_zFar;
|
|
|
|
Name = Camera->GetName();
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraPositionX->setText(1, lcFormatValueLocalized(Position[0]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraPositionX->setData(0, PropertyValueRole, Position[0]);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraPositionY->setText(1, lcFormatValueLocalized(Position[1]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraPositionY->setData(0, PropertyValueRole, Position[1]);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraPositionZ->setText(1, lcFormatValueLocalized(Position[2]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraPositionZ->setData(0, PropertyValueRole, Position[2]);
|
|
|
|
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraTargetX->setText(1, lcFormatValueLocalized(Target[0]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraTargetX->setData(0, PropertyValueRole, Target[0]);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraTargetY->setText(1, lcFormatValueLocalized(Target[1]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraTargetY->setData(0, PropertyValueRole, Target[1]);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraTargetZ->setText(1, lcFormatValueLocalized(Target[2]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraTargetZ->setData(0, PropertyValueRole, Target[2]);
|
|
|
|
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraUpX->setText(1, lcFormatValueLocalized(UpVector[0]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraUpX->setData(0, PropertyValueRole, UpVector[0]);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraUpY->setText(1, lcFormatValueLocalized(UpVector[1]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraUpY->setData(0, PropertyValueRole, UpVector[1]);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraUpZ->setText(1, lcFormatValueLocalized(UpVector[2]));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraUpZ->setData(0, PropertyValueRole, UpVector[2]);
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
mCameraProjectionItem->setText(1, Ortho ? tr("Orthographic") : tr("Perspective"));
|
|
|
|
mCameraProjectionItem->setData(0, PropertyValueRole, Ortho);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraFOV->setText(1, lcFormatValueLocalized(FoV));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraFOV->setData(0, PropertyValueRole, FoV);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraNear->setText(1, lcFormatValueLocalized(ZNear));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraNear->setData(0, PropertyValueRole, ZNear);
|
2016-06-13 03:46:50 +02:00
|
|
|
cameraFar->setText(1, lcFormatValueLocalized(ZFar));
|
2015-12-22 23:44:46 +01:00
|
|
|
cameraFar->setData(0, PropertyValueRole, ZFar);
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
mCameraNameItem->setText(1, Name);
|
|
|
|
mCameraNameItem->setData(0, PropertyValueRole, Name);
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
void lcQPropertiesTree::SetLight(lcObject* Focus)
|
2013-08-09 06:57:18 +02:00
|
|
|
{
|
2023-08-04 22:26:29 +02:00
|
|
|
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
|
|
|
|
|
|
|
QString Name = tr("Light");
|
|
|
|
QString ExponentLabel = tr("Exponent");
|
2023-08-07 13:08:13 +02:00
|
|
|
QString FactorALabel = QLatin1String("FactorA");
|
|
|
|
QString Format, Shape, SpotSizeToolTip, ExponentToolTip, FactorAToolTip, FactorBToolTip;
|
2023-08-13 15:15:52 +02:00
|
|
|
lcLightType LightType = lcLightType::Point;
|
2023-08-04 22:26:29 +02:00
|
|
|
lcLightShape ShapeIndex = LC_LIGHT_SHAPE_UNDEFINED;
|
2023-08-07 13:08:13 +02:00
|
|
|
int FormatIndex = 0;
|
2023-08-04 22:26:29 +02:00
|
|
|
float SpotSize = 0.0f;
|
2023-08-07 13:08:13 +02:00
|
|
|
float SpotFalloff = 0.0f;
|
|
|
|
float SpotTightness = 0.0f;
|
|
|
|
float Diffuse = 0.0f;
|
2023-08-04 22:26:29 +02:00
|
|
|
float Specular = 0.0f;
|
|
|
|
float Cutoff = 0.0f;
|
|
|
|
float Exponent = 0.0f;
|
|
|
|
bool EnableCutoff = false;
|
2023-08-07 13:08:13 +02:00
|
|
|
bool POVRayLight = false;
|
2023-09-02 19:40:52 +02:00
|
|
|
bool CastShadow = true;
|
2023-08-04 22:26:29 +02:00
|
|
|
PropertyType TargetProperty = PropertyFloat;
|
2023-08-07 13:08:13 +02:00
|
|
|
PropertyType SpotSizeProperty = PropertyFloatLightSpotSize;
|
2023-08-04 22:26:29 +02:00
|
|
|
lcVector3 Position(0.0f, 0.0f, 0.0f);
|
|
|
|
lcVector3 Target(0.0f, 0.0f, 0.0f);
|
2023-08-27 20:17:07 +02:00
|
|
|
QColor Color(Qt::white);
|
2023-08-04 22:26:29 +02:00
|
|
|
lcVector2 Factor(0.0f, 0.0f);
|
2023-08-07 13:08:13 +02:00
|
|
|
lcVector2 AreaGrid(0.0f, 0.0f);
|
2016-02-17 00:11:52 +01:00
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
if (Light)
|
|
|
|
{
|
|
|
|
Name = Light->GetName();
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
POVRayLight = Light->mPOVRayLight;
|
|
|
|
FormatIndex = static_cast<int>(POVRayLight);
|
|
|
|
Format = POVRayLight ? QLatin1String("POVRay") : QLatin1String("Blender");
|
|
|
|
|
2023-09-02 19:40:52 +02:00
|
|
|
CastShadow = Light->GetCastShadow();
|
2023-09-05 05:53:34 +02:00
|
|
|
Position = Light->GetPosition();
|
|
|
|
// Target = Light->mTargetPosition;
|
2023-08-27 20:17:07 +02:00
|
|
|
Color = lcQColorFromVector3(Light->GetColor());
|
2023-08-04 22:26:29 +02:00
|
|
|
Factor = Light->mLightFactor;
|
2023-08-13 15:15:52 +02:00
|
|
|
LightType = Light->GetLightType();
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
switch(LightType)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-08-13 15:15:52 +02:00
|
|
|
case lcLightType::Point:
|
2023-08-04 22:26:29 +02:00
|
|
|
FactorALabel = tr("Radius (m)");
|
2023-08-07 13:08:13 +02:00
|
|
|
FactorAToolTip = tr("The light size for shadow sampling in metres.");
|
2023-08-13 15:15:52 +02:00
|
|
|
ExponentLabel = tr("Exponent");
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
2023-08-13 15:15:52 +02:00
|
|
|
case lcLightType::Spot:
|
|
|
|
FactorBToolTip = tr("The softness of the spotlight edge.");
|
|
|
|
ExponentLabel = tr("Power");
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (POVRayLight)
|
|
|
|
{
|
2023-08-13 15:15:52 +02:00
|
|
|
FactorALabel = tr("Radius (°)");
|
2023-08-13 21:30:24 +02:00
|
|
|
FactorAToolTip = tr("The angle between the \"hot-spot\" edge at the beam center and the center line.");
|
2023-08-13 15:15:52 +02:00
|
|
|
SpotSizeToolTip = tr("Angle of the spotlight beam - Read only.");
|
|
|
|
Factor[0] = Light->mSpotSize - Light->mSpotFalloff;
|
|
|
|
SpotSizeProperty = PropertyFloatReadOnly;
|
2023-08-07 13:08:13 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-08-13 15:15:52 +02:00
|
|
|
FactorALabel = tr("Radius (m)");
|
|
|
|
FactorAToolTip = tr("Shadow soft size - Light size in metres for shadow sampling.");
|
|
|
|
SpotSizeToolTip = tr("Angle of the spotlight beam.");
|
2023-08-07 13:08:13 +02:00
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
2023-08-13 15:15:52 +02:00
|
|
|
case lcLightType::Directional:
|
2023-08-04 22:26:29 +02:00
|
|
|
FactorALabel = tr("Angle (°)");
|
2023-08-07 13:08:13 +02:00
|
|
|
FactorAToolTip = tr("Angular diamater of the sun as seen from the Earth.");
|
2023-08-13 15:15:52 +02:00
|
|
|
ExponentLabel = tr("Strength");
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
2023-08-13 15:15:52 +02:00
|
|
|
case lcLightType::Area:
|
|
|
|
ExponentLabel = tr("Power");
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (POVRayLight)
|
|
|
|
{
|
2023-08-13 15:15:52 +02:00
|
|
|
Factor = Light->mAreaSize;
|
|
|
|
FactorALabel = tr("Width");
|
2023-08-26 21:41:16 +02:00
|
|
|
FactorAToolTip = tr("The width (X direction) of the area light.");
|
|
|
|
FactorBToolTip = tr("The height (Y direction) of the area light.");
|
2023-08-07 13:08:13 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-08-26 21:41:16 +02:00
|
|
|
FactorALabel = tr("Width");
|
|
|
|
FactorAToolTip = tr("The width (X direction) of the area light.");
|
|
|
|
FactorBToolTip = tr("The height (Y direction) of the area light.");
|
2023-08-07 13:08:13 +02:00
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
ShapeIndex = static_cast<lcLightShape>(Light->GetLightType());
|
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
switch(ShapeIndex)
|
|
|
|
{
|
|
|
|
case LC_LIGHT_SHAPE_SQUARE:
|
2023-08-07 13:08:13 +02:00
|
|
|
Shape = tr("Square");
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
|
|
|
case LC_LIGHT_SHAPE_DISK:
|
2023-08-07 13:08:13 +02:00
|
|
|
Shape = POVRayLight ? tr("Circle") : tr("Disk");
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
|
|
|
case LC_LIGHT_SHAPE_RECTANGLE:
|
2023-08-07 13:08:13 +02:00
|
|
|
Shape = tr("Rectangle");
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
|
|
|
case LC_LIGHT_SHAPE_ELLIPSE:
|
2023-08-07 13:08:13 +02:00
|
|
|
Shape = tr("Ellipse");
|
2023-08-04 22:26:29 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
Diffuse = Light->mLightDiffuse;
|
2023-08-04 22:26:29 +02:00
|
|
|
Specular = Light->mLightSpecular;
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (POVRayLight)
|
|
|
|
{
|
|
|
|
Exponent = Light->mPOVRayExponent;
|
|
|
|
ExponentToolTip = tr("Intensity of the light with typical range of 0 to 1.0.");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Exponent = Light->mSpotExponent;
|
|
|
|
ExponentToolTip = tr("Intensity of the light in watts.");
|
|
|
|
}
|
2023-08-13 15:15:52 +02:00
|
|
|
|
|
|
|
ExponentLabel = LightType == lcLightType::Directional ? tr("Strength") : tr("Power");
|
2023-08-04 22:26:29 +02:00
|
|
|
Cutoff = Light->mSpotCutoff;
|
|
|
|
EnableCutoff = Light->mEnableCutoff;
|
2023-08-13 15:15:52 +02:00
|
|
|
TargetProperty = LightType != lcLightType::Point ? PropertyFloat : PropertyFloatReadOnly;
|
2023-08-04 22:26:29 +02:00
|
|
|
SpotSize = Light->mSpotSize;
|
2023-08-07 13:08:13 +02:00
|
|
|
SpotFalloff = Light->mSpotFalloff;
|
|
|
|
SpotTightness = Light->mSpotTightness;
|
|
|
|
AreaGrid = Light->mAreaGrid;
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
if (mWidgetMode != LC_PROPERTY_WIDGET_LIGHT || mLightType != LightType || mLightShape != ShapeIndex || mPOVRayLight != POVRayLight)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
SetEmpty();
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
// 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);
|
2023-09-02 19:40:52 +02:00
|
|
|
mLightCastShadowItem = addProperty(mLightAttributesItem, tr("Cast Shadows"), PropertyBool);
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
lightExponent = addProperty(mLightAttributesItem, ExponentLabel, PropertyFloat);
|
2023-08-13 15:15:52 +02:00
|
|
|
|
|
|
|
if ((LightType == lcLightType::Point || LightType == lcLightType::Directional) && !POVRayLight)
|
2023-09-02 19:21:25 +02:00
|
|
|
lightFactorA = addProperty(mLightAttributesItem, FactorALabel, PropertyFloat);
|
2023-08-13 15:15:52 +02:00
|
|
|
|
|
|
|
if (LightType == lcLightType::Spot)
|
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
lightSpotSize = addProperty(mLightAttributesItem, tr("Spot Size (°)"), SpotSizeProperty);
|
|
|
|
lightFactorA = addProperty(mLightAttributesItem, FactorALabel, PropertyFloatLightSpotSize);
|
2023-08-13 15:15:52 +02:00
|
|
|
|
|
|
|
if (!POVRayLight)
|
2023-09-02 19:21:25 +02:00
|
|
|
lightFactorB = addProperty(mLightAttributesItem, tr("Spot Blend"), PropertyFloat);
|
2023-08-13 15:15:52 +02:00
|
|
|
else
|
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
lightSpotFalloff = addProperty(mLightAttributesItem, tr("Spot Falloff (°)"), PropertyFloatLightSpotFalloff);
|
|
|
|
lightSpotTightness = addProperty(mLightAttributesItem, tr("Spot Tightness"), PropertyFloat);
|
2023-08-13 15:15:52 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-26 21:41:16 +02:00
|
|
|
else if (LightType == lcLightType::Area)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
lightShape = addProperty(mLightAttributesItem, tr("Shape"), PropertyLightShape);
|
|
|
|
lightFactorA = addProperty(mLightAttributesItem, FactorALabel, PropertyFloat);
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (ShapeIndex == LC_LIGHT_SHAPE_RECTANGLE || ShapeIndex == LC_LIGHT_SHAPE_ELLIPSE || POVRayLight)
|
2023-09-02 19:21:25 +02:00
|
|
|
lightFactorB = addProperty(mLightAttributesItem, tr("Height"), PropertyFloat);
|
2023-08-07 13:08:13 +02:00
|
|
|
else
|
2023-08-26 21:41:16 +02:00
|
|
|
FactorAToolTip = tr("The size of the area light grid.");
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (POVRayLight)
|
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
lightAreaGridRows = addProperty(mLightAttributesItem, tr("Grid Rows"), PropertyFloat);
|
|
|
|
lightAreaGridColumns = addProperty(mLightAttributesItem, tr("Grid Columns"), PropertyFloat);
|
2023-08-07 13:08:13 +02:00
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (!POVRayLight)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-08-13 15:15:52 +02:00
|
|
|
if (LightType != lcLightType::Directional)
|
2023-08-07 13:08:13 +02:00
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
lightEnableCutoff = addProperty(mLightAttributesItem, tr("Cutoff"), PropertyBool);
|
|
|
|
lightCutoff = addProperty(mLightAttributesItem, tr("Cutoff Distance"), PropertyFloat);
|
2023-08-07 13:08:13 +02:00
|
|
|
}
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
lightDiffuse = addProperty(mLightAttributesItem, tr("Diffuse"), PropertyFloat);
|
|
|
|
lightSpecular = addProperty(mLightAttributesItem, tr("Specular"), PropertyFloat);
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
2023-08-13 15:15:52 +02:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
// Configuration
|
|
|
|
lightConfiguration = addProperty(nullptr, tr("Configuration"), PropertyGroup);
|
|
|
|
lightFormat = addProperty(lightConfiguration, tr("Format"), PropertyLightFormat);
|
|
|
|
|
|
|
|
// Position
|
|
|
|
lightPosition = addProperty(nullptr, tr("Position"), PropertyGroup);
|
|
|
|
lightPositionX = addProperty(lightPosition, tr("X"), PropertyFloat);
|
|
|
|
lightPositionY = addProperty(lightPosition, tr("Y"), PropertyFloat);
|
|
|
|
lightPositionZ = addProperty(lightPosition, tr("Z"), PropertyFloat);
|
|
|
|
|
|
|
|
// Target Position
|
|
|
|
if (LightType != lcLightType::Point && !(LightType == lcLightType::Area && POVRayLight))
|
|
|
|
{
|
|
|
|
lightTarget = addProperty(nullptr, tr("Target"), PropertyGroup);
|
|
|
|
lightTargetX = addProperty(lightTarget, tr("X"), TargetProperty);
|
|
|
|
lightTargetY = addProperty(lightTarget, tr("Y"), TargetProperty);
|
|
|
|
lightTargetZ = addProperty(lightTarget, tr("Z"), TargetProperty);
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
|
|
|
|
mWidgetMode = LC_PROPERTY_WIDGET_LIGHT;
|
2023-08-13 15:15:52 +02:00
|
|
|
mLightType = LightType;
|
2023-08-04 22:26:29 +02:00
|
|
|
mLightShape = ShapeIndex;
|
2023-08-07 13:08:13 +02:00
|
|
|
mPOVRayLight = POVRayLight;
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mFocus = Light;
|
|
|
|
|
|
|
|
lightPositionX->setText(1, lcFormatValueLocalized(Position[0]));
|
|
|
|
lightPositionX->setData(0, PropertyValueRole, Position[0]);
|
|
|
|
lightPositionY->setText(1, lcFormatValueLocalized(Position[1]));
|
|
|
|
lightPositionY->setData(0, PropertyValueRole, Position[1]);
|
|
|
|
lightPositionZ->setText(1, lcFormatValueLocalized(Position[2]));
|
|
|
|
lightPositionZ->setData(0, PropertyValueRole, Position[2]);
|
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
if (LightType != lcLightType::Point && !(LightType == lcLightType::Area && POVRayLight))
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
lightTargetX->setText(1, lcFormatValueLocalized(Target[0]));
|
|
|
|
lightTargetX->setData(0, PropertyValueRole, Target[0]);
|
|
|
|
lightTargetY->setText(1, lcFormatValueLocalized(Target[1]));
|
|
|
|
lightTargetY->setData(0, PropertyValueRole, Target[1]);
|
|
|
|
lightTargetZ->setText(1, lcFormatValueLocalized(Target[2]));
|
|
|
|
lightTargetZ->setData(0, PropertyValueRole, Target[2]);
|
|
|
|
}
|
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
QImage ColorImage(16, 16, QImage::Format_ARGB32);
|
|
|
|
ColorImage.fill(0);
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-27 20:17:07 +02:00
|
|
|
QPainter painter(&ColorImage);
|
2023-08-04 22:26:29 +02:00
|
|
|
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
|
|
|
painter.setPen(Qt::darkGray);
|
2023-08-27 20:17:07 +02:00
|
|
|
painter.setBrush(Color);
|
|
|
|
painter.drawRect(0, 0, ColorImage.width() - 1, ColorImage.height() - 1);
|
2023-08-04 22:26:29 +02:00
|
|
|
painter.end();
|
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
mLightColorItem->setIcon(1, QIcon(QPixmap::fromImage(ColorImage)));
|
|
|
|
mLightColorItem->setText(1, Color.name().toUpper());
|
|
|
|
mLightColorItem->setData(0, PropertyValueRole, Color);
|
2023-08-07 13:08:13 +02:00
|
|
|
|
|
|
|
lightFormat->setText(1, Format);
|
|
|
|
lightFormat->setData(0, PropertyValueRole, FormatIndex);
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-09-02 05:46:29 +02:00
|
|
|
mLightTypeItem->setText(1, lcLight::GetLightTypeString(LightType));
|
|
|
|
mLightTypeItem->setData(0, PropertyValueRole, static_cast<int>(LightType));
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-09-02 19:40:52 +02:00
|
|
|
mLightCastShadowItem->setCheckState(1, CastShadow ? Qt::Checked : Qt::Unchecked);
|
|
|
|
mLightCastShadowItem->setData(0, PropertyValueRole, CastShadow);
|
2023-08-07 13:08:13 +02:00
|
|
|
|
2023-08-04 22:26:29 +02:00
|
|
|
lightExponent->setText(1, lcFormatValueLocalized(Exponent));
|
|
|
|
lightExponent->setData(0, PropertyValueRole, Exponent);
|
2023-08-07 13:08:13 +02:00
|
|
|
lightExponent->setToolTip(1, ExponentToolTip);
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-13 15:15:52 +02:00
|
|
|
if ((LightType == lcLightType::Point || LightType == lcLightType::Directional) && !POVRayLight)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-08-07 13:08:13 +02:00
|
|
|
lightFactorA->setText(1, lcFormatValueLocalized(Factor[0]));
|
|
|
|
lightFactorA->setData(0, PropertyValueRole, Factor[0]);
|
|
|
|
lightFactorA->setToolTip(1, FactorAToolTip);
|
|
|
|
}
|
2023-08-13 15:15:52 +02:00
|
|
|
else if (LightType == lcLightType::Area)
|
2023-08-07 13:08:13 +02:00
|
|
|
{
|
|
|
|
lightShape->setText(1, Shape);
|
|
|
|
lightShape->setData(0, PropertyValueRole, ShapeIndex);
|
|
|
|
lightShape->setToolTip(1, tr("Suggested shape of the arealight."));
|
|
|
|
|
|
|
|
lightFactorA->setText(1, lcFormatValueLocalized(Factor[0]));
|
|
|
|
lightFactorA->setData(0, PropertyValueRole, Factor[0]);
|
|
|
|
lightFactorA->setToolTip(1, FactorAToolTip);
|
|
|
|
|
|
|
|
if (ShapeIndex == LC_LIGHT_SHAPE_RECTANGLE || ShapeIndex == LC_LIGHT_SHAPE_ELLIPSE || POVRayLight)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
lightFactorB->setText(1, lcFormatValueLocalized(Factor[1]));
|
|
|
|
lightFactorB->setData(0, PropertyValueRole, Factor[1]);
|
|
|
|
lightFactorB->setToolTip(1, FactorBToolTip);
|
|
|
|
}
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (POVRayLight)
|
|
|
|
{
|
|
|
|
lightAreaGridRows->setText(1, lcFormatValueLocalized(AreaGrid[0]));
|
|
|
|
lightAreaGridRows->setData(0, PropertyValueRole, AreaGrid[0]);
|
|
|
|
lightAreaGridRows->setToolTip(1, tr("The number of sample rows in the area light."));
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
lightAreaGridColumns->setText(1, lcFormatValueLocalized(AreaGrid[1]));
|
|
|
|
lightAreaGridColumns->setData(0, PropertyValueRole, AreaGrid[1]);
|
|
|
|
lightAreaGridColumns->setToolTip(1, tr("The number of sample columns in the area light."));
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
2023-08-13 15:15:52 +02:00
|
|
|
else if (LightType == lcLightType::Spot)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
|
|
|
lightSpotSize->setText(1, lcFormatValueLocalized(SpotSize));
|
|
|
|
lightSpotSize->setData(0, PropertyValueRole, SpotSize);
|
2023-08-07 13:08:13 +02:00
|
|
|
lightSpotSize->setToolTip(1, SpotSizeToolTip);
|
|
|
|
|
|
|
|
lightFactorA->setText(1, lcFormatValueLocalized(Factor[0]));
|
|
|
|
lightFactorA->setData(0, PropertyValueRole, Factor[0]);
|
|
|
|
lightFactorA->setToolTip(1, FactorAToolTip);
|
|
|
|
|
|
|
|
if (!POVRayLight)
|
|
|
|
{
|
|
|
|
lightFactorB->setText(1, lcFormatValueLocalized(Factor[1]));
|
|
|
|
lightFactorB->setData(0, PropertyValueRole, Factor[1]);
|
|
|
|
lightFactorB->setToolTip(1, FactorBToolTip);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lightSpotFalloff->setText(1, lcFormatValueLocalized(SpotFalloff));
|
|
|
|
lightSpotFalloff->setData(0, PropertyValueRole, SpotFalloff);
|
|
|
|
lightSpotFalloff->setToolTip(1, tr("The angle between the spot beam edge and center line."));
|
|
|
|
|
|
|
|
lightSpotTightness->setText(1, lcFormatValueLocalized(SpotTightness));
|
|
|
|
lightSpotTightness->setData(0, PropertyValueRole, SpotTightness);
|
|
|
|
lightSpotTightness->setToolTip(1, tr("Additional exponential spotlight edge softening."));
|
|
|
|
}
|
2023-08-04 22:26:29 +02:00
|
|
|
}
|
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
if (!POVRayLight)
|
2023-08-04 22:26:29 +02:00
|
|
|
{
|
2023-08-13 15:15:52 +02:00
|
|
|
if (LightType != lcLightType::Directional)
|
2023-08-07 13:08:13 +02:00
|
|
|
{
|
2023-09-02 19:21:25 +02:00
|
|
|
lightEnableCutoff->setCheckState(1, EnableCutoff ? Qt::Checked : Qt::Unchecked);
|
2023-08-07 13:08:13 +02:00
|
|
|
lightEnableCutoff->setData(0, PropertyValueRole, EnableCutoff);
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
lightCutoff->setText(1, lcFormatValueLocalized(Cutoff));
|
|
|
|
lightCutoff->setData(0, PropertyValueRole, Cutoff);
|
|
|
|
lightCutoff->setToolTip(1, tr("Distance at which the light influence will be set to 0."));
|
|
|
|
}
|
|
|
|
|
|
|
|
lightDiffuse->setText(1, lcFormatValueLocalized(Diffuse));
|
|
|
|
lightDiffuse->setData(0, PropertyValueRole, Diffuse);
|
|
|
|
lightDiffuse->setToolTip(1, tr("Diffuse reflection multiplier factor."));
|
2023-08-04 22:26:29 +02:00
|
|
|
|
2023-08-07 13:08:13 +02:00
|
|
|
lightSpecular->setText(1, lcFormatValueLocalized(Specular));
|
|
|
|
lightSpecular->setData(0, PropertyValueRole, Specular);
|
|
|
|
lightSpecular->setToolTip(1, tr("Specular reflection multiplier factor."));
|
|
|
|
}
|
2015-12-22 23:44:46 +01:00
|
|
|
|
2023-09-02 19:21:25 +02:00
|
|
|
mLightNameItem->setText(1, Name);
|
|
|
|
mLightNameItem->setData(0, PropertyValueRole, QVariant::fromValue(Name));
|
2013-08-09 06:57:18 +02:00
|
|
|
}
|
|
|
|
|
2015-12-22 23:44:46 +01:00
|
|
|
void lcQPropertiesTree::SetMultiple()
|
|
|
|
{
|
|
|
|
if (mWidgetMode != LC_PROPERTY_WIDGET_MULTIPLE)
|
|
|
|
{
|
|
|
|
SetEmpty();
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
addProperty(nullptr, tr("Multiple Objects Selected"), PropertyGroup);
|
2015-12-22 23:44:46 +01:00
|
|
|
|
|
|
|
mWidgetMode = LC_PROPERTY_WIDGET_MULTIPLE;
|
|
|
|
}
|
|
|
|
|
2017-04-14 02:26:40 +02:00
|
|
|
mFocus = nullptr;
|
2015-12-22 23:44:46 +01:00
|
|
|
}
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
bool lcQPropertiesTree::lastColumn(int column) const
|
|
|
|
{
|
|
|
|
return header()->visualIndex(column) == columnCount() - 1;
|
|
|
|
}
|