void CMtbRobotDialog::refresh() { inRefreshRoutine=true; // Get handle of last selected object: int lastSel=simGetObjectLastSelection(); updateObjectsInList(); // Now initialized other dialog elements: CMtbRobot* taggedObj=NULL; ui->qqRobotProgram->setPlainText(""); ui->qqAutomatic->setChecked(false); if (lastSel!=-1) { taggedObj=CAccess::mtbRobotContainer->getFromAssociatedObject(lastSel); if (taggedObj==NULL) selectObjectInList(-1); else { // The last selected object is the base object of a MTB model! selectObjectInList(taggedObj->getID()); std::string prg(taggedObj->getProgram()); ui->qqRobotProgram->setPlainText(prg.c_str()); ui->qqAutomatic->setChecked((taggedObj->getOptions()&1)!=0); } } else selectObjectInList(-1); ui->qqRobotProgram->setEnabled((taggedObj!=NULL)&&(simGetSimulationState()==sim_simulation_stopped)); ui->qqAutomatic->setEnabled((taggedObj!=NULL)&&(simGetSimulationState()==sim_simulation_stopped)); inRefreshRoutine=false; }
void CBubbleRobDialog::refresh() { // This refreshed the dialog's items: int lastSel=simGetObjectLastSelection(); m_bubbleRobList.ResetContent(); for (int i=0;i<CAccess::bubbleRobContainer->getCount();i++) { CBubbleRob* bubbleRob=CAccess::bubbleRobContainer->getFromIndex(i); int sceneObjectHandle=bubbleRob->getAssociatedObject(); std::string txt="Object: "; char* name=NULL; if (sceneObjectHandle!=-1) name=simGetObjectName(sceneObjectHandle); if (name==NULL) txt+="Unassociated"; else { txt+="Associated with "; txt+=name; simReleaseBuffer(name); } int index=m_bubbleRobList.AddString(txt.c_str()); m_bubbleRobList.SetItemData(index,(DWORD)bubbleRob->getID()); } CBubbleRob* taggedObj=NULL; if (lastSel!=-1) { taggedObj=CAccess::bubbleRobContainer->getFromAssociatedObject(lastSel); if (taggedObj==NULL) selectObjectInList(-1); else selectObjectInList(taggedObj->getID()); } else selectObjectInList(-1); taggedObj=CAccess::bubbleRobContainer->getFromID(getSelectedObjectInList()); m_maxVelocity.EnableWindow(taggedObj!=NULL); if (taggedObj!=NULL) { CString tmp; tmp.Format("%0.2f",120.0f*taggedObj->getMaxVelocity()/3.1415f); // display it in RPM m_maxVelocity.SetWindowText(tmp); } else m_maxVelocity.SetWindowText(""); }
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; }