RlvCommandOptionGetPathCallback(const LLUUID& idAttachObj, RlvCommandOptionGetPath::getpath_callback_t cb) : mObjectId(idAttachObj), mCallback(cb) { if (isAgentAvatarValid()) mAttachmentConnection = gAgentAvatarp->setAttachmentCallback(boost::bind(&RlvCommandOptionGetPathCallback::onAttachment, this, _1, _3)); gIdleCallbacks.addFunction(&onIdle, this); }
void LLMorphView::updateCamera() { if (!mCameraTargetJoint) { setCameraTargetJoint(gAgentAvatarp->getJoint("mHead")); } if (!isAgentAvatarValid()) return; LLJoint* root_joint = gAgentAvatarp->getRootJoint(); if( !root_joint ) { return; } const LLQuaternion& avatar_rot = root_joint->getWorldRotation(); LLVector3d joint_pos = gAgent.getPosGlobalFromAgent(mCameraTargetJoint->getWorldPosition()); LLVector3d target_pos = joint_pos + mCameraTargetOffset * avatar_rot; LLQuaternion camera_rot_yaw(mCameraYaw, LLVector3::z_axis); LLQuaternion camera_rot_pitch(mCameraPitch, LLVector3::y_axis); LLVector3d camera_pos = joint_pos + mCameraOffset * camera_rot_pitch * camera_rot_yaw * avatar_rot; gAgentCamera.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() ); }
void LLLocalBitmapBrowser::performTimedActions(void) { // perform checking if updates are needed && update if so. local_list_iter iter; for (iter = sLoadedBitmaps.begin(); iter != sLoadedBitmaps.end(); iter++) { (*iter)->updateSelf(); } // one or more sculpts have been updated, refreshing them. if ( sSculptUpdated ) { LLLocalBitmapBrowser::local_list_iter iter; for(iter = sLoadedBitmaps.begin(); iter != sLoadedBitmaps.end(); iter++) { if ( (*iter)->mSculptDirty ) { performSculptUpdates( (*iter)->getThis() ); (*iter)->mSculptDirty = false; } } sSculptUpdated = false; } // one of the layer bitmaps has been updated, we need to rebake. if ( sLayerUpdated ) { if ( !isAgentAvatarValid() ) { return; } gAgentAvatarp->forceBakeAllTextures( SLAM_FOR_DEBUG ); sLayerUpdated = false; } }
// static bool LLGiveInventory::isInventoryGroupGiveAcceptable(const LLInventoryItem* item) { if (!item) return false; if (!isAgentAvatarValid()) return false; // These permissions are double checked in the simulator in // LLGroupNoticeInventoryItemFetch::result(). if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID)) { return false; } if (!item->getPermissions().allowCopyBy(gAgent.getID())) { return false; } bool acceptable = true; switch(item->getType()) { case LLAssetType::AT_OBJECT: if (gAgentAvatarp->isWearingAttachment(item->getUUID())) { acceptable = false; } break; default: break; } return acceptable; }
void LLStatusBar::setHealth(S32 health) { //llinfos << "Setting health to: " << buffer << llendl; if( mHealth > health ) { if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) { if (isAgentAvatarValid()) { if (gAgentAvatarp->getSex() == SEX_FEMALE) { make_ui_sound("UISndHealthReductionF"); } else { make_ui_sound("UISndHealthReductionM"); } } } mHealthTimer->reset(); mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY ); } mHealth = health; }
void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake) { if (mIsAnimating || mTexLayer == NULL) { return; } F32 min_weight = getMinWeight(); F32 max_weight = getMaxWeight(); F32 new_weight = llclamp(weight, min_weight, max_weight); U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight); U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight); if (cur_u8 != new_u8) { mCurWeight = new_weight; if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param. { if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) { upload_bake = FALSE; } mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake); mTexLayer->invalidateMorphMasks(); } } }
BOOL get_is_item_worn(const LLInventoryItem *item) { if (!item) return FALSE; // Consider the item as worn if it has links in COF. /* if (LLCOFMgr::instance().isLinkInCOF(item->getUUID())) { REMOVED due to advice from Kitty Barnett, looks like it WILL cause trouble on some grids -SG return TRUE; } */ switch(item->getType()) { case LLAssetType::AT_OBJECT: { if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) return TRUE; break; } case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: if(gAgentWearables.isWearingItem(item->getLinkedUUID())) return TRUE; break; case LLAssetType::AT_GESTURE: if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID())) return TRUE; break; default: break; } return FALSE; }
void LLStatusBar::setHealth(S32 health) { //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL; mTextHealth->setText(llformat("%d%%", health)); if( mHealth > health ) { if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) { if (isAgentAvatarValid()) { if (gAgentAvatarp->getSex() == SEX_FEMALE) { make_ui_sound("UISndHealthReductionF"); } else { make_ui_sound("UISndHealthReductionM"); } } } mHealthTimer->reset(ICON_TIMER_EXPIRY); } mHealth = health; }
void FSPose::stopPose() { if (isAgentAvatarValid() && mCurrentPose != LLUUID::null) { gAgent.sendAnimationRequest(mCurrentPose, ANIM_REQUEST_STOP); mCurrentPose.setNull(); } }
// static void LLPanelContents::onClickNewScript(void *userdata) { const BOOL children_ok = TRUE; LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { // [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c) | Modified: RLVa-1.0.5a if (rlv_handler_t::isEnabled()) // Fallback code [see LLPanelContents::getState()] { if (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) { return; // Disallow creating new scripts in a locked attachment } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { if ( (isAgentAvatarValid()) && (gAgentAvatarp->isSitting()) && (gAgentAvatarp->getRoot() == object->getRootEdit()) ) return; // .. or in a linkset the avie is sitting on under @unsit=n/@sittp=n } } // [/RLVa:KB] LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); // Parameters are base, owner, everyone, group, next perm.initMasks( PERM_ALL, PERM_ALL, LLFloaterPerms::getEveryonePerms("Scripts"), LLFloaterPerms::getGroupPerms("Scripts"), PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts")); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem( LLUUID::null, LLUUID::null, perm, LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, "New Script", desc, LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, time_corrected()); object->saveScript(new_item, TRUE, true); std::string name = new_item->getName(); // *NOTE: In order to resolve SL-22177, we needed to create // the script first, and then you have to click it in // inventory to edit it. // *TODO: The script creation should round-trip back to the // viewer so the viewer can auto-open the script and start // editing ASAP. } }
void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) { if (mRequestedItem != -1) // teleport within the history in progress? { mCurrentItem = mRequestedItem; mRequestedItem = -1; } else { //EXT-7034 //skip initial update if agent avatar is no valid yet //this may happen when updateCurrentLocation called while login process //sometimes isAgentAvatarValid return false and in this case new_pos //(which actually is gAgent.getPositionGlobal() ) is invalid //if this position will be saved then teleport back will teleport user to wrong position if ( !mGotInitialUpdate && !isAgentAvatarValid() ) { return ; } // If we're getting the initial location update // while we already have a (loaded) non-empty history, // there's no need to purge forward items or add a new item. if (mGotInitialUpdate || mItems.size() == 0) { // Purge forward items (if any). if(mItems.size()) mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end()); // Append an empty item to the history and make it current. mItems.push_back(LLTeleportHistoryItem("", LLVector3d())); mCurrentItem++; } // Update current history item. if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check { llwarns << "Invalid current item. (this should not happen)" << llendl; llassert(!"Invalid current teleport histiry item"); return; } LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos); mItems[mCurrentItem].mFullTitle = getCurrentLocationTitle(true, new_pos_local); mItems[mCurrentItem].mTitle = getCurrentLocationTitle(false, new_pos_local); mItems[mCurrentItem].mGlobalPos = new_pos; mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID(); } dump(); if (!mGotInitialUpdate) mGotInitialUpdate = true; // Signal the interesting party that we've changed. onHistoryChanged(); }
void LLPanelContents::getState(LLViewerObject *objectp ) { if( !objectp ) { getChildView("button new script")->setEnabled(FALSE); getChildView("button reset scripts")->setEnabled(FALSE); return; } LLUUID group_id; // used for SL-23488 LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488 // BUG? Check for all objects being editable? bool editable = gAgent.isGodlike() || (objectp->permModify() && !objectp->isPermanentEnforced() && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488 BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); // [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-1.0.5a if ( (rlv_handler_t::isEnabled()) && (editable) ) { // Don't allow creation of new scripts if it's non-detachable if (objectp->isAttachment()) editable = !gRlvAttachmentLocks.isLockedAttachment(objectp->getRootEdit()); // Don't allow creation of new scripts if we're @unsit=n or @sittp=n restricted and we're sitting on the selection if ( (editable) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) { // Only check the first (non-)root object because nothing else would result in enabling the button (see below) LLViewerObject* pObj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(TRUE); editable = (pObj) && (isAgentAvatarValid()) && ((!gAgentAvatarp->isSitting()) || (gAgentAvatarp->getRoot() != pObj->getRootEdit())); } } // [/RLVa:KB] // Edit/reset script buttons - ok if object is editable and there's an unambiguous destination for the object. // <FS:PP> FIRE-3219: Reset Scripts button in Build floater // getChildView("button new script")->setEnabled( // editable && // all_volume && // ((LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1) // || (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1))); bool objectIsOK = FALSE; if( editable && all_volume && ( (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1) || (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) ) ) { objectIsOK = TRUE; } getChildView("button new script")->setEnabled(objectIsOK); getChildView("button reset scripts")->setEnabled(objectIsOK); // </FS:PP> getChildView("button permissions")->setEnabled(!objectp->isPermanentEnforced()); mPanelInventoryObject->setEnabled(!objectp->isPermanentEnforced()); }
void LLFloaterMove::setMovementMode(const EMovementMode mode) { mCurrentMode = mode; gAgent.setFlying(MM_FLY == mode); // attempts to set avatar flying can not set it real flying in some cases. // For ex. when avatar fell down & is standing up. // So, no need to continue processing FLY mode. See EXT-1079 if (MM_FLY == mode && !gAgent.getFlying()) { return; } switch (mode) { case MM_RUN: gAgent.setAlwaysRun(); gAgent.setRunning(); //MK if (gRRenabled) { if (gAgent.mRRInterface.mContainsRun || gAgent.mRRInterface.mContainsAlwaysRun) { gAgent.clearRunning(); gAgent.clearAlwaysRun(); } } //mk break; case MM_WALK: gAgent.clearAlwaysRun(); gAgent.clearRunning(); break; default: //do nothing for other modes (MM_FLY) break; } // tell the simulator. gAgent.sendWalkRun(gAgent.getAlwaysRun()); updateButtonsWithMovementMode(mode); //MK if (gRRenabled && mode == MM_RUN) { if (gAgent.mRRInterface.mContainsRun || gAgent.mRRInterface.mContainsAlwaysRun) { updateButtonsWithMovementMode(MM_WALK); } } //mk bool bHideModeButtons = MM_FLY == mode || (isAgentAvatarValid() && gAgentAvatarp->isSitting()); showModeButtons(!bHideModeButtons); }
LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : LLInventoryFetchDescendentsObserver(cof_id) { if (isAgentAvatarValid()) { gAgentAvatarp->startPhase("initial_wearables_fetch"); gAgentAvatarp->outputRezTiming("Initial wearables fetch started"); } }
//----------------------------------------------------------------------------- // shutdown() //----------------------------------------------------------------------------- void LLMorphView::shutdown() { if (isAgentAvatarValid()) { gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE ); //gAgentAvatarp->mSpecialRenderMode = 0; // reset camera LLViewerCamera::getInstance()->setNear(mOldCameraNearClip); } }
// Per-frame updates of visibility void LLToolBar::refresh() { if(!isAgentAvatarValid()) return; static LLCachedControl<bool> show("ShowToolBar", true); static LLCachedControl<bool> ascent_fly_always_enabled("AscentFlyAlwaysEnabled", true); static LLCachedControl<bool> ascent_build_always_enabled("AscentBuildAlwaysEnabled", true); BOOL mouselook = gAgentCamera.cameraMouselook(); setVisible(show && !mouselook); BOOL sitting = FALSE; static LLCachedControl<bool> continue_flying_on_unsit("LiruContinueFlyingOnUnsit"); if (continue_flying_on_unsit) { sitting = false; } else if (gAgentAvatarp) { sitting = gAgentAvatarp->isSitting(); } mFlyBtn->setEnabled((gAgent.canFly() || gAgent.getFlying() || ascent_fly_always_enabled) && !sitting ); mBuildBtn->setEnabled((LLViewerParcelMgr::getInstance()->allowAgentBuild() || ascent_build_always_enabled)); // Check to see if we're in build mode BOOL build_mode = LLToolMgr::getInstance()->inEdit(); // And not just clicking on a scripted object if (LLToolGrab::getInstance()->getHideBuildHighlight()) { build_mode = FALSE; } static LLCachedControl<bool> build_btn_state("BuildBtnState",false); if(build_btn_state!=(bool)build_mode) build_btn_state = build_mode; // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-10 (RLVa-1.0.0g) // Called per-frame so this really can't be slow if (rlv_handler_t::isEnabled()) { // If we're rez-restricted, we can still edit => allow build floater // If we're edit-restricted, we can still rez => allow build floater mBuildBtn->setEnabled(!(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT))); mMapBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP)); mRadarBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP)); mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV)); } // [/RLVa:KB] if (isInVisibleChain()) { updateCommunicateList(); } }
void LLAgentListener::requestSit(LLSD const & event_data) const { //mAgent.getAvatarObject()->sitOnObject(); // shamelessly ripped from llviewermenu.cpp:handle_sit_or_stand() // *TODO - find a permanent place to share this code properly. LLViewerObject *object = NULL; if (event_data.has("obj_uuid")) { object = gObjectList.findObject(event_data["obj_uuid"]); } else if (event_data.has("position")) { LLVector3 target_position = ll_vector3_from_sd(event_data["position"]); object = findObjectClosestTo(target_position); } // [RLVa:KB] - Checked: 2010-03-06 (RLVa-1.2.0c) | Modified: RLVa-1.1.0j // TODO-RLVa: [RLVa-1.2.1] Figure out how to call this? if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canSit(object)) ) { return; } // [/RLVa:KB] if (object && object->getPCode() == LL_PCODE_VOLUME) { // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) ) { if (gAgentAvatarp->isSitting()) { gAgent.standUp(); return; } gRlvHandler.setSitSource(gAgent.getPositionGlobal()); } // [/RLVa:KB] gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, mAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, mAgent.getSessionID()); gMessageSystem->nextBlockFast(_PREHASH_TargetObject); gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID); gMessageSystem->addVector3Fast(_PREHASH_Offset, LLVector3(0,0,0)); object->getRegion()->sendReliableMessage(); } else { llwarns << "LLAgent requestSit could not find the sit target: " << event_data << llendl; } }
void render_ui_2d() { LLGLSUIDefault gls_ui; ///////////////////////////////////////////////////////////// // // Render 2D UI elements that overlay the world (no z compare) // Disable wireframe mode below here, as this is HUD/menus glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Menu overlays, HUD, etc gViewerWindow->setup2DRender(); F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); if (zoom_factor > 1.f) { //decompose subregion number to x and y values int pos_y = sub_region / llceil(zoom_factor); int pos_x = sub_region - (pos_y*llceil(zoom_factor)); // offset for this tile LLFontGL::sCurOrigin.mX -= ll_round((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor); LLFontGL::sCurOrigin.mY -= ll_round((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor); } stop_glerror(); //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); // render outline for HUD if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f) { gGL.pushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f); gGL.translatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgentCamera.mHUDCurZoom; gGL.scalef(zoom,zoom,1.f); gGL.color4fv(LLColor4::white.mV); gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE); gGL.popMatrix(); stop_glerror(); } if(gDebugGL)check_blend_funcs(); gViewerWindow->draw(); if(gDebugGL)check_blend_funcs(); // reset current origin for font rendering, in case of tiling render LLFontGL::sCurOrigin.set(0, 0); }
void FSPose::setPose(std::string new_pose, bool save_state) { if (isAgentAvatarValid()) { if (mCurrentPose.notNull()) { gAgent.sendAnimationRequest(mCurrentPose, ANIM_REQUEST_STOP); } if (save_state) mCurrentPose.set(new_pose); gAgent.sendAnimationRequest(LLUUID(new_pose), ANIM_REQUEST_START); } }
// Hover junk void syncFromPreferenceSetting(LLSliderCtrl* sldrCtrl) { F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ"); sldrCtrl->setValue(value,FALSE); if (isAgentAvatarValid()) { LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL; gAgentAvatarp->setHoverOffset(offset); } }
// Fetch currently worn items and only enable the New Look button after everything's been // fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. void LLSidepanelAppearance::fetchInventory() { mNewOutfitBtn->setEnabled(false); uuid_vec_t ids; LLUUID item_id; for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) { for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) { item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); if(item_id.notNull()) { ids.push_back(item_id); } } } if (isAgentAvatarValid()) { for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) { LLViewerJointAttachment* attachment = iter->second; if (!attachment) continue; for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { LLViewerObject* attached_object = (*attachment_iter); if (!attached_object) continue; const LLUUID& item_id = attached_object->getAttachmentItemID(); if (item_id.isNull()) continue; ids.push_back(item_id); } } } LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); fetch_worn->startFetch(); // If no items to be fetched, done will never be triggered. // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. if (fetch_worn->isFinished()) { fetch_worn->done(); } else { gInventory.addObserver(fetch_worn); } }
void LLPanelOutfitEdit::onShopButtonClicked() { static LLShopURLDispatcher url_resolver; // will contain the resultant URL std::string url; if (isAgentAvatarValid()) { // try to get wearable type from 'Add More' panel first (EXT-7639) selection_info_t selection_info = getAddMorePanelSelectionType(); LLWearableType::EType type = selection_info.first; if (selection_info.second > 1) { // the second argument is not important in this case: generic market place will be opened url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE); } else { if (type == LLWearableType::WT_NONE) { type = getCOFWearablesSelectionType(); } ESex sex = gAgentAvatarp->getSex(); // WT_INVALID comes for attachments if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE) { url = url_resolver.resolveURL(type, sex); } if (url.empty()) { url = url_resolver.resolveURL( mCOFWearables->getExpandedAccordionAssetType(), sex); } } } else { llwarns << "Agent avatar is invalid" << llendl; // the second argument is not important in this case: generic market place will be opened url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE); } LLWeb::loadURLExternal(url); }
BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) { // NOTE: This function doesn't check the folder's children. // See LLFolderBridge::isItemRemovable for a function that does // consider the children. if (!model) { return FALSE; } if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID())) { return FALSE; } // [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g if ( ((rlv_handler_t::isEnabled()) && (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) && (!RlvFolderLocks::instance().canRemoveFolder(id))) ) { return FALSE; } // [/RLVa:KB] if (!isAgentAvatarValid()) return FALSE; const LLInventoryCategory* category = model->getCategory(id); if (!category) { return FALSE; } const LLFolderType::EType folder_type = category->getPreferredType(); if (LLFolderType::lookupIsProtectedType(folder_type)) { return FALSE; } // Can't delete the outfit that is currently being worn. if (folder_type == LLFolderType::FT_OUTFIT) { const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); if (base_outfit_link && (category == base_outfit_link->getLinkedCategory())) { return FALSE; } } return TRUE; }
void LLPanelAttachmentListItem::updateItem(const std::string& name, EItemState item_state) { std::string title_joint = name; LLViewerInventoryItem* inv_item = getItem(); if (inv_item && isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(inv_item->getLinkedUUID())) { std::string joint = LLTrans::getString(gAgentAvatarp->getAttachedPointName(inv_item->getLinkedUUID())); title_joint = title_joint + " (" + joint + ")"; } LLPanelInventoryListItemBase::updateItem(title_joint, item_state); }
// Checked: 2012-07-14 (RLVa-1.4.7) std::string rlvGetItemName(const LLViewerInventoryItem* pItem) { if ( (pItem) && ((LLAssetType::AT_BODYPART == pItem->getType()) || (LLAssetType::AT_CLOTHING == pItem->getType())) ) { return llformat("%s (%s)", pItem->getName().c_str(), LLWearableType::getTypeName(pItem->getWearableType()).c_str()); } else if ( (pItem) && (LLAssetType::AT_OBJECT == pItem->getType()) && (isAgentAvatarValid()) ) { std::string strAttachPtName; gAgentAvatarp->getAttachedPointName(pItem->getUUID(), strAttachPtName); return llformat("%s (%s)", pItem->getName().c_str(), strAttachPtName.c_str()); } return (pItem) ? pItem->getName() : LLStringUtil::null; }
void LLFloaterMove::initMovementMode() { EMovementMode initMovementMode = gAgent.getAlwaysRun() ? MM_RUN : MM_WALK; if (gAgent.getFlying()) { initMovementMode = MM_FLY; } setMovementMode(initMovementMode); if (isAgentAvatarValid()) { showModeButtons(!gAgentAvatarp->isSitting()); } }
// Checked: 2010-03-11 (RLVa-1.2.0a) | Modified: RLVa-1.2.0g std::string rlvGetItemNameFromObjID(const LLUUID& idObj, bool fIncludeAttachPt = true) { const LLViewerObject* pObj = gObjectList.findObject(idObj); const LLViewerObject* pObjRoot = (pObj) ? pObj->getRootEdit() : NULL; const LLViewerInventoryItem* pItem = ((pObjRoot) && (pObjRoot->isAttachment())) ? gInventory.getItem(pObjRoot->getAttachmentItemID()) : NULL; std::string strItemName = (pItem) ? pItem->getName() : idObj.asString(); if ( (!fIncludeAttachPt) || (!pObj) || (!pObj->isAttachment()) || (!isAgentAvatarValid()) ) return strItemName; const LLViewerJointAttachment* pAttachPt = get_if_there(gAgentAvatarp->mAttachmentPoints, RlvAttachPtLookup::getAttachPointIndex(pObjRoot), static_cast<LLViewerJointAttachment*>(NULL)); std::string strAttachPtName = (pAttachPt) ? pAttachPt->getName() : std::string("Unknown"); return llformat("%s (%s%s)", strItemName.c_str(), strAttachPtName.c_str(), (pObj == pObjRoot) ? "" : ", child"); }
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake) { if(isAgentAvatarValid() && mWearablep && driven->mParam->getCrossWearable() && mWearablep->isOnTop()) { // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); } else { driven->mParam->setWeight( driven_weight, upload_bake ); } }
// static void LLViewerAttachMenu::populateMenus(const std::string& attach_to_menu_name, const std::string& attach_to_hud_menu_name) { // *TODO: share this code with other similar menus // (inventory panel context menu, in-world object menu). if (attach_to_menu_name.empty() || attach_to_hud_menu_name.empty() || !isAgentAvatarValid()) return; LLContextMenu* attach_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_menu_name); LLContextMenu* attach_hud_menu = gMenuHolder->getChild<LLContextMenu>(attach_to_hud_menu_name); if (!attach_menu || attach_menu->getChildCount() != 0 || !attach_hud_menu || attach_hud_menu->getChildCount() != 0) { return; } // Populate "Attach to..." / "Attach to HUD..." submenus. for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; LLMenuItemCallGL::Params p; std::string submenu_name = attachment->getName(); std::string translated_submenu_name; if (LLTrans::findString(translated_submenu_name, submenu_name)) { p.name = (" ") + translated_submenu_name + " "; } else { p.name = submenu_name; } LLSD cbparams; cbparams["index"] = curiter->first; cbparams["label"] = p.name; p.on_click.function_name = "Object.Attach"; p.on_click.parameter = LLSD(attachment->getName()); p.on_enable.function_name = "Attachment.Label"; p.on_enable.parameter = cbparams; LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(p); LLView* parent_menu = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu; parent_menu->addChild(item); } }
ECursorType cursor_from_object(LLViewerObject* object) { LLViewerObject* parent = NULL; if (object) { parent = object->getRootEdit(); } U8 click_action = final_click_action(object); ECursorType cursor = UI_CURSOR_ARROW; switch(click_action) { case CLICK_ACTION_SIT: { if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting? { cursor = UI_CURSOR_TOOLSIT; } } break; case CLICK_ACTION_BUY: cursor = UI_CURSOR_TOOLBUY; break; case CLICK_ACTION_OPEN: // Open always opens the parent. if (parent && parent->allowOpen()) { cursor = UI_CURSOR_TOOLOPEN; } break; case CLICK_ACTION_PAY: if ((object && object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) { cursor = UI_CURSOR_TOOLBUY; } break; case CLICK_ACTION_ZOOM: cursor = UI_CURSOR_TOOLZOOMIN; break; case CLICK_ACTION_PLAY: case CLICK_ACTION_OPEN_MEDIA: cursor = cursor_from_parcel_media(click_action); break; default: break; } return cursor; }