Exemplo n.º 1
0
void EditableSceneBodyImpl::onContextMenuRequest(const SceneWidgetEvent& event, MenuManager& menuManager)
{
    if(!bodyItem->isEditable()){
        return;
    }
    if(self->body()->isStaticModel()){
        return;
    }
    
    PointedType pointedType = findPointedObject(event.nodePath());

    if(bodyItem && pointedType == PT_SCENE_LINK){

        menuManager.addItem(_("Set Free"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::makeLinkFree, this, pointedSceneLink));
        menuManager.addItem(_("Set Base"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::setBaseLink, this, pointedSceneLink));
        menuManager.addItem(_("Set Translation Pin"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, false));
        menuManager.addItem(_("Set Rotation Pin"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, false, true));
        menuManager.addItem(_("Set Both Pins"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, true));

        menuManager.addSeparator();

        menuManager.addItem(_("Level Attitude"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::makeLinkAttitudeLevel, this));

        menuManager.addSeparator();
        
        menuManager.setPath(N_("/Markers"));
        
        Action* item = menuManager.addCheckItem(_("Center of Mass"));
        item->setChecked(isCmVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showCenterOfMass, this, _1));

        item = menuManager.addCheckItem(_("ZMP"));
        item->setChecked(isZmpVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showZmp, this, _1));

        menuManager.setPath("/");
        menuManager.addSeparator();
    }
}
Exemplo n.º 2
0
void EditableSceneBodyImpl::onContextMenuRequest(const SceneWidgetEvent& event, MenuManager& menuManager)
{
    if(!isEditable()){
        return;
    }
    
    PointedType pointedType = findPointedObject(event.nodePath());

    if(bodyItem && pointedType == PT_SCENE_LINK){

        activeSimulatorItem = SimulatorItem::findActiveSimulatorItemFor(bodyItem);
        if(activeSimulatorItem){
            if(pointedSceneLink->link()->isRoot()){
                Action* item1 = menuManager.addCheckItem(_("Move Position"));
                item1->setChecked(forcedPositionMode == MOVE_FORCED_POSITION);
                item1->sigToggled().connect(
                    boost::bind(&EditableSceneBodyImpl::setForcedPositionMode, this, MOVE_FORCED_POSITION, _1));

                Action* item2 = menuManager.addCheckItem(_("Keep Position"));
                item2->setChecked(forcedPositionMode == KEEP_FORCED_POSITION);
                item2->sigToggled().connect(
                    boost::bind(&EditableSceneBodyImpl::setForcedPositionMode, this, KEEP_FORCED_POSITION, _1));
                
                menuManager.addSeparator();
            }
        } else {
            menuManager.addItem(_("Set Free"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::makeLinkFree, this, pointedSceneLink));
            menuManager.addItem(_("Set Base"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::setBaseLink, this, pointedSceneLink));
            menuManager.addItem(_("Set Translation Pin"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, false));
            menuManager.addItem(_("Set Rotation Pin"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, false, true));
            menuManager.addItem(_("Set Both Pins"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, true));

            menuManager.addSeparator();

            menuManager.addItem(_("Level Attitude"))->sigTriggered().connect(
                boost::bind(&EditableSceneBodyImpl::makeLinkAttitudeLevel, this));

            menuManager.addSeparator();
        }
        
        menuManager.setPath(_("Markers"));
        
        Action* item = menuManager.addCheckItem(_("Center of Mass"));
        item->setChecked(isCmVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showCenterOfMass, this, _1));

        item = menuManager.addCheckItem(_("Projection Point of CoM"));
        item->setChecked(isPpcomVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showPpcom, this, _1));

        item = menuManager.addCheckItem(_("ZMP"));
        item->setChecked(isZmpVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showZmp, this, _1));

        menuManager.setPath("/");
        menuManager.addSeparator();
    }
}