void Robot::calculateJointCheckboxes() { if (inChangedEnableAllLinks || !robot_loaded_) return; int links_with_geom_checked = 0; int links_with_geom_unchecked = 0; // check root link RobotLink *link = root_link_; if (link && link->hasGeometry()) { bool checked = link->getLinkProperty()->getValue().toBool(); links_with_geom_checked += checked ? 1 : 0; links_with_geom_unchecked += checked ? 0 : 1; } int links_with_geom = links_with_geom_checked + links_with_geom_unchecked; // check all child links and joints recursively std::vector<std::string>::const_iterator child_joint_it = link->getChildJointNames().begin(); std::vector<std::string>::const_iterator child_joint_end = link->getChildJointNames().end(); for ( ; child_joint_it != child_joint_end ; ++child_joint_it ) { RobotJoint* child_joint = getJoint( *child_joint_it ); if (child_joint) { int child_links_with_geom; int child_links_with_geom_checked; int child_links_with_geom_unchecked; child_joint->calculateJointCheckboxesRecursive(child_links_with_geom, child_links_with_geom_checked, child_links_with_geom_unchecked); links_with_geom_checked += child_links_with_geom_checked; links_with_geom_unchecked += child_links_with_geom_unchecked; } } links_with_geom = links_with_geom_checked + links_with_geom_unchecked; if (!links_with_geom) { setEnableAllLinksCheckbox(QVariant()); } else { setEnableAllLinksCheckbox(links_with_geom_unchecked == 0); } }