std::string CUIComboObjListTile::getSelectedTileMaterial() { CTerrain::MAP_TILES& tiles =((CTerrain*)(m_pScene->getTerrainData()))->GetTiles(); if (tiles.find(getSelectedObjectID())!=tiles.end()) { return tiles[getSelectedObjectID()]; } return ""; }
void CQDlgCollisions::refresh() { ui->qqEnableAll->setChecked(App::ct->mainSettings->collisionDetectionEnabled); if (!inSelectionRoutine) { int selectedObjectID=getSelectedObjectID(); updateObjectsInList(); selectObjectInList(selectedObjectID); } CRegColl* it=App::ct->collisions->getObject(getSelectedObjectID()); ui->qqComputeContour->setEnabled(it!=NULL); ui->qqColliderColorChanges->setEnabled(it!=NULL); ui->qqCollideeColorChanges->setEnabled(it!=NULL); ui->qqExplicitHandling->setEnabled(it!=NULL); ui->qqContourWidth->setEnabled((it!=NULL)&&it->getExhaustiveDetection()); ui->qqAdjustContourColor->setEnabled((it!=NULL)&&it->getExhaustiveDetection()); if (it!=NULL) { ui->qqComputeContour->setChecked(it->getExhaustiveDetection()); ui->qqColliderColorChanges->setChecked(it->getColliderChangesColor()); ui->qqCollideeColorChanges->setChecked(it->getCollideeChangesColor()); ui->qqExplicitHandling->setChecked(it->getExplicitHandling()); ui->qqContourWidth->setText(tt::FNb(it->getContourWidth()).c_str()); } else { ui->qqComputeContour->setChecked(false); ui->qqColliderColorChanges->setChecked(false); ui->qqCollideeColorChanges->setChecked(false); ui->qqExplicitHandling->setChecked(false); ui->qqContourWidth->setText(""); } }
void CQDlgMotionPlanning::refresh() { inMainRefreshRoutine=true; bool simStopped=App::ct->simulation->isSimulationStopped(); bool noEditMode=(App::ct->objCont->getEditModeType()==NO_EDIT_MODE); int taskID=getSelectedObjectID(); CMotionPlanningTask* task=App::ct->motionPlanning->getObject(taskID); if (!inListSelectionRoutine) { updateObjectsInList(); selectObjectInList(taskID); } ui->qqAddNew->setEnabled(simStopped&&noEditMode); ui->qqIkGroupCombo->setEnabled(simStopped&&noEditMode&&(task!=NULL)); ui->qqEntity1Combo->setEnabled(simStopped&&noEditMode&&(task!=NULL)); ui->qqEntity2Combo->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getRobotSelfCollEntity1()!=-1)); ui->qqSelfColl->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getRobotSelfCollEntity1()!=-1)); ui->qqSelfDist->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getRobotSelfCollEntity1()!=-1)); ui->qqSelfDistDist->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getSelfCollDistanceThreshold()!=0.0f)&&(task->getRobotSelfCollEntity1()!=-1)); ui->qqRobotCombo->setEnabled(simStopped&&noEditMode&&(task!=NULL)); ui->qqObstacleCombo->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getRobotEntity()!=-1)); ui->qqColl->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getRobotEntity()!=-1)); ui->qqDist->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getRobotEntity()!=-1)); ui->qqDistDist->setEnabled(simStopped&&noEditMode&&(task!=NULL)&&(task->getDistanceThreshold()!=0.0f)&&(task->getRobotEntity()!=-1)); ui->qqIkGroupCombo->clear(); ui->qqEntity1Combo->clear(); ui->qqEntity2Combo->clear(); ui->qqRobotCombo->clear(); ui->qqObstacleCombo->clear(); ui->qqEditJointProp->setEnabled(simStopped&&noEditMode&&(task!=NULL)); ui->qqEditWorkspaceMetric->setEnabled(simStopped&&noEditMode&&(task!=NULL)); ui->qqComputeNodes->setEnabled(simStopped&&noEditMode&&(task!=NULL)); ui->showPhase1Nodes->setEnabled(noEditMode&&(task!=NULL)); if (task!=NULL) { // IK group: fillComboWithIkGroups(ui->qqIkGroupCombo); if (!selectItemInCombo(ui->qqIkGroupCombo,task->getIkGroup())) { // should not happen task->setIkGroup(-1); // none ui->qqIkGroupCombo->setCurrentIndex(0); } if (task->getIkGroup()!=-1) { C3DObject* obj=task->getBaseObject(); if (obj==NULL) ui->qqBase->setText("world (error)"); else ui->qqBase->setText(obj->getName().c_str()); obj=task->getTipObject(); if (obj==NULL) ui->qqTip->setText("tip is not defined! (error)"); else ui->qqTip->setText(obj->getName().c_str()); obj=task->getTargetObject(); if (obj==NULL) ui->qqTarget->setText("target is not defined! (error)"); else ui->qqTarget->setText(obj->getName().c_str()); } else { ui->qqBase->setText("-"); ui->qqTip->setText("-"); ui->qqTarget->setText("-"); } // self-collision entity1: fillComboWithCollisionOrDistanceEntities(ui->qqEntity1Combo,task->getSelfCollDistanceThreshold()==0.0f,false,true,-1); if (!selectItemInCombo(ui->qqEntity1Combo,task->getRobotSelfCollEntity1())) { // should not happen task->setRobotSelfCollEntity1(-1); // none ui->qqEntity1Combo->setCurrentIndex(0); } // self-collentity2: fillComboWithCollisionOrDistanceEntities(ui->qqEntity2Combo,task->getSelfCollDistanceThreshold()==0.0f,true,false,task->getRobotSelfCollEntity1()); if (!selectItemInCombo(ui->qqEntity2Combo,task->getRobotSelfCollEntity2())) { // should not happen task->setRobotSelfCollEntity2(-1); // all ui->qqEntity2Combo->setCurrentIndex(0); } ui->qqSelfColl->setChecked(task->getSelfCollDistanceThreshold()==0.0f); ui->qqSelfDist->setChecked(task->getSelfCollDistanceThreshold()!=0.0f); if (task->getSelfCollDistanceThreshold()!=0.0f) ui->qqSelfDistDist->setText(gv::getSizeStr(false,task->getSelfCollDistanceThreshold(),-1).c_str()); else ui->qqSelfDistDist->setText(""); // robot: fillComboWithCollisionOrDistanceEntities(ui->qqRobotCombo,task->getDistanceThreshold()==0.0f,false,true,-1); if (!selectItemInCombo(ui->qqRobotCombo,task->getRobotEntity())) { // should not happen task->setRobotEntity(-1); // none ui->qqRobotCombo->setCurrentIndex(0); } // obstacles: fillComboWithCollisionOrDistanceEntities(ui->qqObstacleCombo,task->getDistanceThreshold()==0.0f,true,false,task->getRobotEntity()); if (!selectItemInCombo(ui->qqObstacleCombo,task->getObstacleEntity())) { // should not happen task->setObstacleEntity(-1); // all ui->qqObstacleCombo->setCurrentIndex(0); } ui->qqColl->setChecked(task->getDistanceThreshold()==0.0f); ui->qqDist->setChecked(task->getDistanceThreshold()!=0.0f); if (task->getDistanceThreshold()!=0.0f) ui->qqDistDist->setText(gv::getSizeStr(false,task->getDistanceThreshold(),-1).c_str()); else ui->qqDistDist->setText(""); ui->showPhase1Nodes->setChecked(task->getPhase1NodeVisualization()); } else { ui->qqBase->setText("-"); ui->qqTip->setText("-"); ui->qqTarget->setText("-"); ui->qqSelfColl->setChecked(false); ui->qqSelfDist->setChecked(false); ui->qqSelfDistDist->setText(""); ui->qqColl->setChecked(false); ui->qqDist->setChecked(false); ui->qqDistDist->setText(""); ui->showPhase1Nodes->setChecked(false); } inMainRefreshRoutine=false; }