Exemplo n.º 1
0
void EditableSceneBodyImpl::updateMarkersAndManipulators()
{
    bool show = (isEditMode && !self->body()->isStaticModel());
    
    Link* baseLink = bodyItem->currentBaseLink();
    PinDragIKptr pin = bodyItem->pinDragIK();

    const int n = self->numSceneLinks();
    for(int i=0; i < n; ++i){
        EditableSceneLink* sceneLink = editableSceneLink(i);
        sceneLink->hideMarker();
        sceneLink->removeChild(positionDragger);
        if(show){
            Link* link = sceneLink->link();
            if(link == baseLink){
                sceneLink->showMarker(Vector3f(1.0f, 0.1f, 0.1f), 0.4);
            } else {
                int pinAxes = pin->pinAxes(link);
                if(pinAxes & (InverseKinematics::TRANSFORM_6D)){
                    sceneLink->showMarker(Vector3f(1.0f, 1.0f, 0.1f), 0.4);
                }
            }
        }
    }

    if(show && targetLink && (kinematicsBar->mode() == KinematicsBar::IK_MODE) && kinematicsBar->isAttitudeMode()){
        attachPositionDragger(targetLink);
    }

    self->notifyUpdate(modified);
}
Exemplo n.º 2
0
void EditableSceneBodyImpl::updateMarkersAndManipulators()
{
    Link* baseLink = bodyItem->currentBaseLink();
    PinDragIKptr pin = bodyItem->pinDragIK();

    const int n = self->numSceneLinks();
    for(int i=0; i < n; ++i){
        EditableSceneLink* sceneLink = editableSceneLink(i);
        sceneLink->hideMarker();
        sceneLink->removeChild(positionDragger);
        markerGroup->removeChild(positionDragger);

        if(isEditMode && !activeSimulatorItem){
            Link* link = sceneLink->link();
            if(link == baseLink){
                sceneLink->showMarker(Vector3f(1.0f, 0.1f, 0.1f), 0.4);
            } else {
                int pinAxes = pin->pinAxes(link);
                if(pinAxes & (InverseKinematics::TRANSFORM_6D)){
                    sceneLink->showMarker(Vector3f(1.0f, 1.0f, 0.1f), 0.4);
                }
            }
        }
    }

    bool showDragger = isEditMode && targetLink && kinematicsBar->isPositionDraggerEnabled();
    if(showDragger){
        if(activeSimulatorItem){
            showDragger = forcedPositionMode != NO_FORCED_POSITION;
                } else {
            showDragger = (kinematicsBar->mode() == KinematicsBar::IK_MODE);
        }
    }
        
    if(showDragger){
        attachPositionDragger(targetLink);
    }

    self->notifyUpdate(modified);
}
Exemplo n.º 3
0
void EditableSceneBodyImpl::togglePin(EditableSceneLink* sceneLink, bool toggleTranslation, bool toggleRotation)
{
    PinDragIKptr pin = bodyItem->pinDragIK();

    InverseKinematics::AxisSet axes = pin->pinAxes(sceneLink->link());

    if(toggleTranslation && toggleRotation){
        if(axes == InverseKinematics::NO_AXES){
            axes = InverseKinematics::TRANSFORM_6D;
        } else {
            axes = InverseKinematics::NO_AXES;
        }
    } else {
        if(toggleTranslation){
            axes = (InverseKinematics::AxisSet)(axes ^ InverseKinematics::TRANSLATION_3D);
        }
        if(toggleRotation){
            axes = (InverseKinematics::AxisSet)(axes ^ InverseKinematics::ROTATION_3D);
        }
    }
        
    pin->setPin(sceneLink->link(), axes);
    bodyItem->notifyUpdate();
}