2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_PART_TREE_WIDGET_H
|
|
|
|
#define DUST3D_PART_TREE_WIDGET_H
|
2018-08-27 08:50:40 +00:00
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <QUuid>
|
|
|
|
#include <QMouseEvent>
|
2018-10-25 00:19:38 +00:00
|
|
|
#include "document.h"
|
2018-08-27 08:50:40 +00:00
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
class PartTreeWidget : public QTreeWidget
|
2018-08-27 08:50:40 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void currentComponentChanged(QUuid componentId);
|
|
|
|
void moveComponentUp(QUuid componentId);
|
|
|
|
void moveComponentDown(QUuid componentId);
|
|
|
|
void moveComponentToTop(QUuid componentId);
|
|
|
|
void moveComponentToBottom(QUuid componentId);
|
|
|
|
void checkPart(QUuid partId);
|
|
|
|
void createNewComponentAndMoveThisIn(QUuid componentId);
|
2018-09-07 10:13:55 +00:00
|
|
|
void createNewChildComponent(QUuid parentComponentId);
|
2018-08-27 08:50:40 +00:00
|
|
|
void renameComponent(QUuid componentId, QString name);
|
|
|
|
void setComponentExpandState(QUuid componentId, bool expanded);
|
2018-09-06 15:04:59 +00:00
|
|
|
void setComponentSmoothAll(QUuid componentId, float toSmoothAll);
|
|
|
|
void setComponentSmoothSeam(QUuid componentId, float toSmoothSeam);
|
2018-08-27 08:50:40 +00:00
|
|
|
void moveComponent(QUuid componentId, QUuid toParentId);
|
|
|
|
void removeComponent(QUuid componentId);
|
|
|
|
void hideOtherComponents(QUuid componentId);
|
|
|
|
void lockOtherComponents(QUuid componentId);
|
|
|
|
void hideAllComponents();
|
|
|
|
void showAllComponents();
|
|
|
|
void collapseAllComponents();
|
|
|
|
void expandAllComponents();
|
|
|
|
void lockAllComponents();
|
|
|
|
void unlockAllComponents();
|
|
|
|
void setPartLockState(QUuid partId, bool locked);
|
|
|
|
void setPartVisibleState(QUuid partId, bool visible);
|
2018-11-14 13:21:45 +00:00
|
|
|
void setComponentCombineMode(QUuid componentId, CombineMode combineMode);
|
2018-08-27 08:50:40 +00:00
|
|
|
void hideDescendantComponents(QUuid componentId);
|
|
|
|
void showDescendantComponents(QUuid componentId);
|
|
|
|
void lockDescendantComponents(QUuid componentId);
|
|
|
|
void unlockDescendantComponents(QUuid componentId);
|
2018-09-01 02:17:26 +00:00
|
|
|
void addPartToSelection(QUuid partId);
|
2018-09-06 15:04:59 +00:00
|
|
|
void groupOperationAdded();
|
2018-08-27 08:50:40 +00:00
|
|
|
public:
|
2018-10-25 00:19:38 +00:00
|
|
|
PartTreeWidget(const Document *document, QWidget *parent);
|
2018-08-27 08:50:40 +00:00
|
|
|
QTreeWidgetItem *findComponentItem(QUuid componentId);
|
|
|
|
public slots:
|
|
|
|
void componentNameChanged(QUuid componentId);
|
|
|
|
void componentChildrenChanged(QUuid componentId);
|
|
|
|
void componentRemoved(QUuid componentId);
|
|
|
|
void componentAdded(QUuid componentId);
|
|
|
|
void componentExpandStateChanged(QUuid componentId);
|
2018-11-14 13:21:45 +00:00
|
|
|
void componentCombineModeChanged(QUuid componentId);
|
2018-08-27 08:50:40 +00:00
|
|
|
void partRemoved(QUuid partId);
|
|
|
|
void partPreviewChanged(QUuid partid);
|
|
|
|
void partLockStateChanged(QUuid partId);
|
|
|
|
void partVisibleStateChanged(QUuid partId);
|
|
|
|
void partSubdivStateChanged(QUuid partId);
|
|
|
|
void partDisableStateChanged(QUuid partId);
|
|
|
|
void partXmirrorStateChanged(QUuid partId);
|
|
|
|
void partDeformChanged(QUuid partId);
|
|
|
|
void partRoundStateChanged(QUuid partId);
|
2018-08-31 04:54:32 +00:00
|
|
|
void partWrapStateChanged(QUuid partId);
|
2018-08-27 08:50:40 +00:00
|
|
|
void partColorStateChanged(QUuid partId);
|
2018-10-09 02:19:12 +00:00
|
|
|
void partMaterialIdChanged(QUuid partId);
|
2018-08-27 08:50:40 +00:00
|
|
|
void partChecked(QUuid partId);
|
|
|
|
void partUnchecked(QUuid partId);
|
|
|
|
void groupChanged(QTreeWidgetItem *item, int column);
|
|
|
|
void groupExpanded(QTreeWidgetItem *item);
|
|
|
|
void groupCollapsed(QTreeWidgetItem *item);
|
|
|
|
void removeAllContent();
|
|
|
|
void showContextMenu(const QPoint &pos);
|
|
|
|
protected:
|
2018-10-24 08:54:18 +00:00
|
|
|
QSize sizeHint() const override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
2018-08-27 08:50:40 +00:00
|
|
|
private:
|
|
|
|
void addComponentChildrenToItem(QUuid componentId, QTreeWidgetItem *parentItem);
|
2018-08-31 01:40:53 +00:00
|
|
|
void deleteItemChildren(QTreeWidgetItem *item);
|
2018-09-07 10:13:55 +00:00
|
|
|
void selectComponent(QUuid componentId, bool multiple=false);
|
2018-09-06 15:04:59 +00:00
|
|
|
QWidget *createSmoothMenuWidget(QUuid componentId);
|
2018-09-07 10:13:55 +00:00
|
|
|
void updateComponentSelectState(QUuid componentId, bool selected);
|
2018-11-14 03:11:31 +00:00
|
|
|
void updateComponentAppearance(QUuid componentId);
|
2018-09-07 10:13:55 +00:00
|
|
|
bool isComponentSelected(QUuid componentId);
|
2018-08-27 08:50:40 +00:00
|
|
|
private:
|
2018-10-25 00:19:38 +00:00
|
|
|
const Document *m_document = nullptr;
|
2018-08-27 08:50:40 +00:00
|
|
|
std::map<QUuid, QTreeWidgetItem *> m_partItemMap;
|
|
|
|
std::map<QUuid, QTreeWidgetItem *> m_componentItemMap;
|
2018-09-06 15:04:59 +00:00
|
|
|
QFont m_normalFont;
|
|
|
|
QFont m_selectedFont;
|
2018-09-07 10:13:55 +00:00
|
|
|
QUuid m_currentSelectedComponentId;
|
|
|
|
QBrush m_hightlightedPartBackground;
|
|
|
|
QUuid m_shiftStartComponentId;
|
|
|
|
std::set<QUuid> m_selectedComponentIds;
|
2018-08-27 08:50:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|