Improved interface

This commit is contained in:
Paolo Cignoni cignoni 2008-04-12 14:32:17 +00:00
parent b70732a496
commit e4a3cc3a28
7 changed files with 80 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/" >
<file>images/edit_texture.png</file>
<file>images/invertsel.png</file>
<file>images/rotate.png</file>
<file>images/scale.png</file>
<file>images/sel_move.png</file>

View File

@ -951,6 +951,34 @@ void RenderArea::ClearSelection()
selection = QRect();
}
void RenderArea::InvertSelection()
{
// Invert selected faces
if (selected)
{
for (unsigned i = 0; i < model->cm.face.size(); i++)
{
if (model->cm.face[i].WT(0).n() == textNum)
{
if (model->cm.face[i].IsUserBit(selBit)) model->cm.face[i].ClearUserBit(selBit);
else model->cm.face[i].SetUserBit(selBit);
}
}
RecalculateSelectionArea();
this->update();
}
else if (selectedV)
{
for (unsigned i = 0; i < model->cm.vert.size(); i++)
{
if (model->cm.vert[i].IsUserBit(selVertBit)) model->cm.vert[i].ClearUserBit(selVertBit);
else model->cm.vert[i].SetUserBit(selVertBit);
}
UpdateVertexSelection();
this->update();
}
}
void RenderArea::HandleScale(QPoint e)
{
// Move the rectangle of scaling and resize the selction area
@ -1133,7 +1161,7 @@ void RenderArea::DrawCircle(QPoint origin)
for (int i = 0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex3f(origin.x() + cos(degInRad)*r,origin.y() + sin(degInRad)*r,1.1f);
glVertex3f(origin.x() + cos(degInRad)*r,origin.y() + sin(degInRad)*r,2.0f);
}
glEnd();
}

View File

@ -40,6 +40,7 @@ public:
void RemapClamp();
void RemapMod();
void ClearSelection();
void InvertSelection();
protected:
void paintEvent(QPaintEvent *event);

View File

@ -133,6 +133,11 @@ void TextureEditor::on_modulusButton_clicked()
((RenderArea*)ui.tabWidget->currentWidget()->childAt(MARGIN,MARGIN))->RemapMod();
}
void TextureEditor::on_invertButton_clicked()
{
((RenderArea*)ui.tabWidget->currentWidget()->childAt(MARGIN,MARGIN))->InvertSelection();
}
void TextureEditor::on_cancelButton_clicked()
{
ResetLayout();

View File

@ -46,6 +46,7 @@ private slots:
void on_modulusButton_clicked();
void on_smoothButton_clicked();
void on_cancelButton_clicked();
void on_invertButton_clicked();
public slots:
void UpdateModel();

View File

@ -218,6 +218,49 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="invertButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Invert selected faces/vertexes</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="meshlab.qrc" >:/images/invertsel.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton" >
<property name="sizePolicy" >