Skip to content

Commit

Permalink
Fix bug in Edit skeleton dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
myurtoglu committed Dec 11, 2014
1 parent bf4e1e7 commit fd272e0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
42 changes: 39 additions & 3 deletions editskeletondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ EditSkeletonDialog::EditSkeletonDialog(QWidget *parent): QDialog(parent),
connect(ui->pushButton_removeBone, &QPushButton::clicked, this,
&EditSkeletonDialog::removeBone);

ui->verticalSlider_x->setRange(0, 120);
ui->verticalSlider_y->setRange(0, 120);
ui->verticalSlider_z->setRange(0, 120);
ui->verticalSlider_x->setRange(-60, 60);
ui->verticalSlider_y->setRange(-60, 60);
ui->verticalSlider_z->setRange(-60, 60);
ui->verticalSlider_x->setSingleStep(1);
ui->verticalSlider_y->setSingleStep(1);
ui->verticalSlider_z->setSingleStep(1);
Expand Down Expand Up @@ -377,3 +377,39 @@ void EditSkeletonDialog::stickBonesStateChanged(int state)
emit stickBonesStateChangedSignal(state);
}


void EditSkeletonDialog::updateJoints()
{
mJoints.clear();

for (const auto &el : *mpBones) {
int idx0 = el[0];
int idx1 = el[1];

bool idx0alreadyAdded = false;
bool idx1alreadyAdded = false;

for (const auto &el : mJoints) {
if (el == idx0) {
idx0alreadyAdded = true;
}

if (el == idx1) {
idx1alreadyAdded = true;
}
}

if (!idx0alreadyAdded) {
mJoints.push_back(idx0);
}

if (!idx1alreadyAdded) {
mJoints.push_back(idx1);
}
}

ui->comboBox_joint->clear();
for (const auto &el : mJoints) {
ui->comboBox_joint->addItem(QString::number(el));
}
}
1 change: 1 addition & 0 deletions editskeletondialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class EditSkeletonDialog : public QDialog {
explicit EditSkeletonDialog(QWidget *parent = 0);
~EditSkeletonDialog();
void updateLists();
void updateJoints();

std::vector<Vec3f> *mpVertices;
std::vector<std::vector<int>> *mpBones;
Expand Down

0 comments on commit fd272e0

Please sign in to comment.