Пример #1
0
// Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a
bool rlvCanDeleteOrReturn()
{
	if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) )
	{
		struct RlvCanDeleteOrReturn : public LLSelectedObjectFunctor
		{
			/*virtual*/ bool apply(LLViewerObject* pObj) { return pObj->isReturnable(); }
		} f;
		LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection();
		return (hSel.notNull()) && (0 != hSel->getRootObjectCount()) && (hSel->applyToRootObjects(&f, false));
	}
	return true;
}
// Checked: 2010-04-11 (RLVa-1.2.0b) | Modified: RLVa-0.2.0g
bool rlvCanDeleteOrReturn()
{
	bool fIsAllowed = true;

	if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ))
	{
		// We'll allow if none of the prims are owned by the avie or group owned
		LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection();
		RlvSelectIsOwnedByOrGroupOwned f(gAgent.getID());
		if ( (handleSel.notNull()) && ((0 == handleSel->getRootObjectCount()) || (NULL != handleSel->getFirstRootNode(&f, FALSE))) )
			fIsAllowed = false;
	}
	
	if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) )
	{
		// We'll allow if the avie isn't sitting on any of the selected objects
		LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection();
		RlvSelectIsSittingOn f(gAgent.getAvatarObject()->getRoot());
		if ( (handleSel.notNull()) && (handleSel->getFirstRootNode(&f, TRUE)) )
			fIsAllowed = false;
	}

	return fIsAllowed;
}
void LLFloaterPathfindingObjects::showFloaterWithSelectionObjects()
{
	mObjectsToBeSelected.clear();

	LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection();
	if (selectedObjectsHandle.notNull())
	{
		LLObjectSelection *selectedObjects = selectedObjectsHandle.get();
		if (!selectedObjects->isEmpty())
		{
			for (LLObjectSelection::valid_iterator objectIter = selectedObjects->valid_begin();
				objectIter != selectedObjects->valid_end(); ++objectIter)
			{
				LLSelectNode *object = *objectIter;
				LLViewerObject *viewerObject = object->getObject();
				mObjectsToBeSelected.push_back(viewerObject->getID());
			}
		}
	}
	mHasObjectsToBeSelected = true;

	if (!getVisible())
	{
		open();
		setVisibleAndFrontmost();
	}
	else
	{
		rebuildObjectsScrollList();
		if (isMinimized())
		{
			setMinimized(FALSE);
		}
		setVisibleAndFrontmost();
	}
	setFocus(TRUE);
}
Пример #4
0
void LLToolMgr::toggleBuildMode()
{
    if (inBuildMode())
    {
        if (gSavedSettings.getBOOL("EditCameraMovement"))
        {
            // just reset the view, will pull us out of edit mode
            handle_reset_view();
        }
        else
        {
            // manually disable edit mode, but do not affect the camera
            gAgentCamera.resetView(false);
            gFloaterTools->close();
            gViewerWindow->showCursor();
        }
        // avoid spurious avatar movements pulling out of edit mode
        LLViewerJoystick::getInstance()->setNeedsReset();
    }
    else
    {
        ECameraMode camMode = gAgentCamera.getCameraMode();
        if (CAMERA_MODE_MOUSELOOK == camMode ||	CAMERA_MODE_CUSTOMIZE_AVATAR == camMode)
        {
            // pull the user out of mouselook or appearance mode when entering build mode
            handle_reset_view();
        }

        if (gSavedSettings.getBOOL("EditCameraMovement"))
        {
            // camera should be set
            if (LLViewerJoystick::getInstance()->getOverrideCamera())
            {
                handle_toggle_flycam();
            }

            if (gAgentCamera.getFocusOnAvatar())
            {
                // zoom in if we're looking at the avatar
                gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
                gAgentCamera.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis()));
                gAgentCamera.cameraZoomIn(0.666f);
                gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
            }
        }

// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b)
        bool fRlvCanEdit = (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ));
        if (!fRlvCanEdit)
        {
            LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection();
            RlvSelectIsEditable f;
            if ((hSel.notNull()) && ((hSel->getFirstRootNode(&f, TRUE)) != NULL))
                LLSelectMgr::getInstance()->deselectAll();
        }
// [/RLVa:KB]

        setCurrentToolset(gBasicToolset);
        getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );

        // Could be first use
        LLFirstUse::useBuild();

        gAgentCamera.resetView(false);

        // avoid spurious avatar movements
        LLViewerJoystick::getInstance()->setNeedsReset();

    }
}