void LLInspectObject::update() { // Performance optimization, because we listen to updates from select mgr // but we're never destroyed. if (!getVisible()) return; LLObjectSelection* selection = LLSelectMgr::getInstance()->getSelection(); if (!selection) return; LLSelectNode* nodep = selection->getFirstRootNode(); if (!nodep) return; updateButtons(nodep); updateName(nodep); updateDescription(nodep); updateCreator(nodep); updatePrice(nodep); LLViewerObject* obj = nodep->getObject(); if(!obj) return; if ( mObjectFace < 0 || mObjectFace >= obj->getNumTEs() ) { return; } // Does this face have media? const LLTextureEntry* tep = obj->getTE(mObjectFace); if (!tep) return; mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL; if(!mMediaEntry) return; mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mMediaEntry->getMediaID()); updateMediaCurrentURL(); updateSecureBrowsing(); }
LLSD JCExportTracker::subserialize(LLViewerObject* linkset) { //Chalice - Changed to support exporting linkset groups. LLViewerObject* object = linkset; //if(!linkset)return LLSD(); // Create an LLSD object that will hold the entire tree structure that can be serialized to a file LLSD llsd; //if (!node) // return llsd; //object = root_object = node->getObject(); if (!object) return llsd; if(!(!object->isAvatar() && object->permYouOwner() && object->permModify() && object->permCopy() && object->permTransfer() && !gAgent.getGodLevel())) return llsd; // Build a list of everything that we'll actually be exporting LLDynamicArray<LLViewerObject*> export_objects; // Add the root object to the export list export_objects.put(object); // Iterate over all of this objects children LLViewerObject::child_list_t child_list = object->getChildren(); for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { LLViewerObject* child = *i; if(!child->isAvatar()) { // Put the child objects on the export list export_objects.put(child); } } S32 object_index = 0; while ((object_index < export_objects.count())) { object = export_objects.get(object_index++); LLUUID id = object->getID(); llinfos << "Exporting prim " << object->getID().asString() << llendl; // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD // tree structure LLSD prim_llsd; if (object_index == 1) { LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) { LLViewerJointAttachment* attachment = avatar->getTargetAttachmentPoint(object); U8 attachment_id = 0; if (attachment) { for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); iter != avatar->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) { attachment_id = iter->first; break; } } } else { // interpret 0 as "default location" attachment_id = 0; } prim_llsd["Attachment"] = attachment_id; prim_llsd["attachpos"] = object->getPosition().getValue(); prim_llsd["attachrot"] = ll_sd_from_quaternion(object->getRotation()); } prim_llsd["position"] = LLVector3(0, 0, 0).getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } else { prim_llsd["position"] = object->getPosition().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } //prim_llsd["name"] = "";//node->mName; //prim_llsd["description"] = "";//node->mDescription; // Transforms prim_llsd["scale"] = object->getScale().getValue(); // Flags prim_llsd["shadows"] = object->flagCastShadows(); prim_llsd["phantom"] = object->flagPhantom(); prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS); LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); if (object->isFlexible()) { LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); } // Textures LLSD te_llsd; U8 te_count = object->getNumTEs(); for (U8 i = 0; i < te_count; i++) { te_llsd.append(object->getTE(i)->asLLSD()); } if(export_textures) { std::string path = asset_dir + gDirUtilp->getDirDelimiter(); for (U8 i = 0; i < te_count; i++) { LLUUID asset_id = object->getTE(i)->getID(); JCAssetInfo* info = new JCAssetInfo; info->path = path + asset_id.asString() + ".j2c"; info->name = "Prim Texture"; //gAssetStorage->getAssetData(asset_id, LLAssetType::AT_TEXTURE, JCAssetExportCallback, info,1); if(requested_textures.count(asset_id) == 0) { requested_textures.insert(asset_id); LLViewerImage* img = gImageList.getImage(asset_id, MIPMAP_TRUE, FALSE); img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAX_LEVEL); img->setLoadedCallback( JCExportTracker::onFileLoadedForSave, 0, TRUE, FALSE, info ); llinfos << "Requesting texture " << asset_id.asString() << llendl; } } } //JCExportTracker::mirror(asset, obj, asset_dir, asset->getUUID().asString()); prim_llsd["textures"] = te_llsd; prim_llsd["id"] = object->getID().asString(); if(export_properties) { ////cmdline_printchat(llformat("yes %d",export_properties)); propertyqueries += 1; gMessageSystem->newMessageFast(_PREHASH_ObjectSelect); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); gMessageSystem->sendReliable(gAgent.getRegionHost()); if(export_inventory) { object->registerInventoryListener(sInstance,NULL); object->dirtyInventory(); object->requestInventory(); invqueries += 1; } }//else //cmdline_printchat(llformat("no %d",export_properties)); totalprims += 1; // Changed to use link numbers zero-indexed. llsd[object_index - 1] = prim_llsd; } return llsd; }
LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment) { LLViewerObject* object; LLSD llsd; char localid[16]; for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { object = (*i); LLUUID id = object->getID(); LL_INFOS("ObjectBackup") << "Exporting prim " << object->getID().asString() << LL_ENDL; // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD // tree structure LLSD prim_llsd; if (!object->isRoot()) { // Parent id snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); prim_llsd["parent"] = localid; } // Name and description LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->findNode(object); if (node) { prim_llsd["name"] = node->mName; prim_llsd["description"] = node->mDescription; } // Transforms if (is_attachment) { prim_llsd["position"] = object->getPositionEdit().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotationEdit()); } else { prim_llsd["position"] = object->getPosition().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } prim_llsd["scale"] = object->getScale().getValue(); // Flags prim_llsd["shadows"] = FALSE; prim_llsd["phantom"] = object->flagPhantom(); prim_llsd["physical"] = object->flagUsePhysics(); // Volume params LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); // Extra paramsb6fab961-af18-77f8-cf08-f021377a7244 if (object->isFlexible()) { // Flexible LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { // Light LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { // Sculpt LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); LLUUID sculpt_texture = sculpt->getSculptTexture(); if (sculpt_texture == validateTextureID(sculpt_texture)) { bool alreadyseen = false; std::list<LLUUID>::iterator iter; for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) { if ((*iter) == sculpt_texture) alreadyseen = true; } if (alreadyseen == false) { LL_INFOS("ObjectBackup") << "Found a sculpt texture, adding to list " << sculpt_texture << LL_ENDL; mTexturesList.push_back(sculpt_texture); } } else { LL_WARNS("ObjectBackup") << "Incorrect permission to export a sculpt texture." << LL_ENDL; LLObjectBackup::getInstance()->mExportState = EXPORT_FAILED; } } // Textures LLSD te_llsd; LLSD this_te_llsd; LLUUID t_id; U8 te_count = object->getNumTEs(); for (U8 i = 0; i < te_count; i++) { bool alreadyseen = false; t_id = validateTextureID(object->getTE(i)->getID()); this_te_llsd = object->getTE(i)->asLLSD(); this_te_llsd["imageid"] = t_id; te_llsd.append(this_te_llsd); // Do not export Linden textures even though they don't taint creation. if (t_id != LL_TEXTURE_PLYWOOD && t_id != LL_TEXTURE_BLANK && t_id != LL_TEXTURE_TRANSPARENT && t_id != LL_TEXTURE_INVISIBLE && t_id != LL_TEXTURE_MEDIA) { std::list<LLUUID>::iterator iter; for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) { if ((*iter) == t_id) alreadyseen = true; } if (alreadyseen == false) mTexturesList.push_back(t_id); } } prim_llsd["textures"] = te_llsd; // The keys in the primitive maps do not have to be localids, they can be any // string. We simply use localids because they are a unique identifier snprintf(localid, sizeof(localid), "%u", object->getLocalID()); llsd[(const char*)localid] = prim_llsd; } updateExportNumbers(); return llsd; }
void LLPanelPermissions::refresh() { LLStringUtil::format_map_t argsCurrency; argsCurrency["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); if(BtnDeedToGroup) { std::string deedText; if (gSavedSettings.getWarning("DeedObject")) { deedText = getString("text deed continued"); } else { deedText = getString("text deed"); } BtnDeedToGroup->setLabelSelected(deedText); BtnDeedToGroup->setLabelUnselected(deedText); } BOOL root_selected = TRUE; LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); if(!nodep || 0 == object_count) { nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); root_selected = FALSE; } //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); //attachment_selected = false; LLViewerObject* objectp = NULL; if(nodep) objectp = nodep->getObject(); if(!nodep || !objectp)// || attachment_selected) { // ...nothing selected disableAll(); return; } // figure out a few variables const BOOL is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = { getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), getString("text modify info 4"), getString("text modify info 5"), getString("text modify info 6") }; if(!is_perm_modify) { string_index += 2; } else if (!is_nonpermanent_enforced) { string_index += 4; } if(!is_one_object) { ++string_index; } getChildView("perm_modify")->setEnabled(TRUE); getChild<LLUICtrl>("perm_modify")->setValue(MODIFY_INFO_STRINGS[string_index]); std::string pfAttrName; if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding()) || LLSelectMgr::getInstance()->selectGetNonPathfinding()) { pfAttrName = "Pathfinding_Object_Attr_None"; } else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsPermanent()) || LLSelectMgr::getInstance()->selectGetPermanent()) { pfAttrName = "Pathfinding_Object_Attr_Permanent"; } else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsCharacter()) || LLSelectMgr::getInstance()->selectGetCharacter()) { pfAttrName = "Pathfinding_Object_Attr_Character"; } else { pfAttrName = "Pathfinding_Object_Attr_MultiSelect"; } getChildView("pathfinding_attributes_value")->setEnabled(TRUE); getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); getChildView("Permissions:")->setEnabled(TRUE); // Update creator text field getChildView("Creator:")->setEnabled(TRUE); // [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a BOOL creators_identical = FALSE; // [/RLVa:KB] std::string creator_name; // [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); // [/RLVa:KB] // LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); // getChild<LLUICtrl>("Creator Name")->setValue(creator_name); // getChildView("Creator Name")->setEnabled(TRUE); // [RLVa:KB] - Moved further down to avoid an annoying flicker when the text is set twice in a row // Update owner text field getChildView("Owner:")->setEnabled(TRUE); // Update last owner text field getChildView("Last Owner:")->setEnabled(TRUE); std::string owner_name; const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); if (mOwnerID.isNull()) { if(LLSelectMgr::getInstance()->selectIsGroupOwned()) { // Group owned already displayed by selectGetOwner } else { // Display last owner if public std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC if (!mLastOwnerID.isNull() && !last_owner_name.empty()) { owner_name.append(", last "); owner_name.append( last_owner_name ); } } } // getChild<LLUICtrl>("Owner Name")->setValue(owner_name); // getChildView("Owner Name")->setEnabled(TRUE); // [RLVa:KB] - Moved further down to avoid an annoying flicker when the text is set twice in a row // [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a bool fRlvEnableOwner = true; bool fRlvEnableCreator = true; bool fRlvEnableLastOwner = true; if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { // Only anonymize the creator if all of the selection was created by the same avie who's also the owner or they're a nearby avie if ( (creators_identical) && (mCreatorID != gAgent.getID()) && ((mCreatorID == mOwnerID) || (RlvUtil::isNearbyAgent(mCreatorID))) ) { creator_name = RlvStrings::getAnonym(creator_name); fRlvEnableCreator = false; } // Only anonymize the owner name if all of the selection is owned by the same avie and isn't group owned if ( (owners_identical) && (!LLSelectMgr::getInstance()->selectIsGroupOwned()) && (mOwnerID != gAgent.getID()) ) { owner_name = RlvStrings::getAnonym(owner_name); fRlvEnableOwner = false; } if (RlvUtil::isNearbyAgent(mLastOwnerID)) { last_owner_name = RlvStrings::getAnonym(last_owner_name); fRlvEnableLastOwner = false; } } else if ((objectp->isAttachment() || objectp->isAvatar()) && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS) && mOwnerID != gAgentID) { owner_name = RlvStrings::getAnonym(owner_name); fRlvEnableOwner = false; if (mOwnerID == mCreatorID) { creator_name = RlvStrings::getAnonym(creator_name); fRlvEnableCreator = false; } if (mOwnerID == mLastOwnerID) { last_owner_name = RlvStrings::getAnonym(last_owner_name); fRlvEnableLastOwner = false; } } // [/RLVa:KB] getChild<LLUICtrl>("Creator Name")->setValue(creator_name); getChildView("Creator Name")->setEnabled(TRUE); getChild<LLUICtrl>("Owner Name")->setValue(owner_name); getChildView("Owner Name")->setEnabled(TRUE); // childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // getChildView("button last owner profile")->setEnabled(owners_identical && mLastOwnerID.notNull()); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) getChildView("button owner profile")->setEnabled(fRlvEnableOwner && owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); getChildView("button creator profile")->setEnabled(fRlvEnableCreator && creators_identical && mCreatorID.notNull()); getChildView("button last owner profile")->setEnabled(fRlvEnableLastOwner && owners_identical && mLastOwnerID.notNull()); // [/RLVa:KB] getChild<LLUICtrl>("Last Owner Name")->setValue(last_owner_name); getChildView("Last Owner Name")->setEnabled(TRUE); // update group text field getChildView("Group:")->setEnabled(TRUE); //getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if(mLabelGroupName) { mLabelGroupName->setNameID(group_id, TRUE); mLabelGroupName->setEnabled(TRUE); } } else { if(mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); mLabelGroupName->refresh(LLUUID::null, std::string(), true); mLabelGroupName->setEnabled(FALSE); } } getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); getChildView("button open group")->setEnabled(group_id.notNull()); getChildView("Name:")->setEnabled(TRUE); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); getChildView("Description:")->setEnabled(TRUE); LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if(is_one_object) { if(keyboard_focus_view != LineEditorObjectName) { LineEditorObjectName->setValue(nodep->mName); } if(LineEditorObjectDesc) { if(keyboard_focus_view != LineEditorObjectDesc) { LineEditorObjectDesc->setText(nodep->mDescription); } } } else { LineEditorObjectName->setText(LLStringUtil::null); LineEditorObjectDesc->setText(LLStringUtil::null); } // figure out the contents of the name, description, & category // Singu Note: It was requested that the user be able to bulk change description { const std::string& str(object_count > 1 ? getString("multiple_objects_selected") : LLStringUtil::null); LineEditorObjectName->setLabel(str); LineEditorObjectDesc->setLabel(str); } if (/*is_one_object &&*/ objectp->permModify() && !objectp->isPermanentEnforced()) { LineEditorObjectName->setEnabled(TRUE); LineEditorObjectDesc->setEnabled(TRUE); } else { LineEditorObjectName->setEnabled(FALSE); LineEditorObjectDesc->setEnabled(FALSE); } S32 total_sale_price = 0; S32 individual_sale_price = 0; BOOL is_for_sale_mixed = FALSE; BOOL is_sale_price_mixed = FALSE; U32 num_for_sale = FALSE; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, is_for_sale_mixed, is_sale_price_mixed, total_sale_price, individual_sale_price); const BOOL self_owned = (gAgent.getID() == mOwnerID); const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if (!owners_identical) { getChildView("Cost")->setEnabled(FALSE); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); getChildView("Edit Cost")->setEnabled(FALSE); } // You own these objects. else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) { // If there are multiple items for sale then set text to PRICE PER UNIT. if (num_for_sale > 1) { getChild<LLUICtrl>("Cost")->setValue(getString("Cost Per Unit")); } else { getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default")); } LLLineEditor *edit_price = getChild<LLLineEditor>("Edit Cost"); if(keyboard_focus_view != edit_price) { // If the sale price is mixed then set the cost to MIXED, otherwise // set to the actual cost. if (num_for_sale > 0 && is_for_sale_mixed) { edit_price->setValue(getString("Sale Mixed")); } else if (num_for_sale > 0 && is_sale_price_mixed) { edit_price->setValue(getString("Cost Mixed")); } else { edit_price->setValue(individual_sale_price); } } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE; getChildView("Cost")->setEnabled(enable_edit); getChildView("Edit Cost")->setEnabled(enable_edit); } // Someone, not you, owns these objects. else if(!public_owned) { getChildView("Cost")->setEnabled(FALSE); getChildView("Edit Cost")->setEnabled(FALSE); // Don't show a price if none of the items are for sale. if (num_for_sale) getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",total_sale_price)); else getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) getChild<LLUICtrl>("Cost")->setValue(getString("Cost Total", argsCurrency)); else getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default", argsCurrency)); } // This is a public object. else { getChildView("Cost")->setEnabled(FALSE); getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default", argsCurrency)); getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); getChildView("Edit Cost")->setEnabled(FALSE); } // Enable and disable the permissions checkboxes // based on who owns the object. // TODO: Creator permissions U32 base_mask_on = 0; U32 base_mask_off = 0; U32 owner_mask_off = 0; U32 owner_mask_on = 0; U32 group_mask_on = 0; U32 group_mask_off = 0; U32 everyone_mask_on = 0; U32 everyone_mask_off = 0; U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); //BOOL valid_owner_perms =// LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); bool supports_export = LFSimFeatureHandler::instance().simSupportsExport(); if( gSavedSettings.getBOOL("DebugPermissions") ) { childSetVisible("perm_modify", false); if (valid_base_perms) { std::string perm_string = mask_to_string(base_mask_on); if (!supports_export && base_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); if (U32 diff_mask = base_mask_on ^ owner_mask_on) // When different, show the user's potential permissions lowercase. { if (diff_mask & PERM_MOVE) LLStringUtil::replaceChar(perm_string, 'V', 'v'); if (diff_mask & PERM_MODIFY) LLStringUtil::replaceChar(perm_string, 'M', 'm'); if (diff_mask & PERM_COPY) LLStringUtil::replaceChar(perm_string, 'C', 'c'); if (diff_mask & PERM_TRANSFER) LLStringUtil::replaceChar(perm_string, 'T', 't'); if (diff_mask & PERM_EXPORT) LLStringUtil::replaceChar(perm_string, 'E', 'e'); } getChild<LLUICtrl>("B:")->setValue("B: " + perm_string); getChildView("B:")->setVisible( TRUE); /* perm_string = mask_to_string(owner_mask_on); if (!supports_export && owner_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); getChild<LLUICtrl>("O:")->setValue("O: " + perm_string); getChildView("O:")->setVisible( TRUE); */ getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on)); getChildView("G:")->setVisible( TRUE); perm_string = mask_to_string(everyone_mask_on); if (!supports_export && everyone_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); getChild<LLUICtrl>("E:")->setValue("E: " + perm_string); getChildView("E:")->setVisible( TRUE); getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on)); getChildView("N:")->setVisible( TRUE); } U32 flag_mask = 0x0; if (objectp->permMove()) flag_mask |= PERM_MOVE; if (objectp->permModify()) flag_mask |= PERM_MODIFY; if (objectp->permCopy()) flag_mask |= PERM_COPY; if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask)); getChildView("F:")->setVisible( TRUE); } else { childSetVisible("perm_modify", true); getChildView("B:")->setVisible( FALSE); //getChildView("O:")->setVisible( FALSE); getChildView("G:")->setVisible( FALSE); getChildView("E:")->setVisible( FALSE); getChildView("N:")->setVisible( FALSE); getChildView("F:")->setVisible( FALSE); } BOOL has_change_perm_ability = FALSE; BOOL has_change_sale_ability = FALSE; if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = TRUE; } if (valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = TRUE; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions getChild<LLUICtrl>("perm_modify")->setValue(getString("text modify warning")); } if (has_change_perm_ability) { getChildView("checkbox share with group")->setEnabled(TRUE); getChildView("text anyone can")->setEnabled(true); getChildView("checkbox allow everyone move")->setEnabled(owner_mask_on & PERM_MOVE); getChildView("checkbox allow everyone copy")->setEnabled(owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { getChildView("checkbox share with group")->setEnabled(FALSE); getChildView("text anyone can")->setEnabled(false); getChildView("checkbox allow everyone move")->setEnabled(FALSE); getChildView("checkbox allow everyone copy")->setEnabled(FALSE); } // Is this user allowed to toggle export on this object? if (supports_export && self_owned && mCreatorID == mOwnerID && can_set_export(base_mask_on, owner_mask_on, next_owner_mask_on)) { bool can_export = true; LLInventoryObject::object_list_t objects; objectp->getInventoryContents(objects); for (LLInventoryObject::object_list_t::iterator i = objects.begin(); can_export && i != objects.end() ; ++i) //The object's inventory must have EXPORT. { LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(i->get()); //getInventoryContents() filters out categories, static_cast. can_export = perms_allow_export(item->getPermissions()); } for (U8 i = 0; can_export && i < objectp->getNumTEs(); ++i) // Can the textures be exported? if (LLTextureEntry* texture = objectp->getTE(i)) can_export = is_asset_exportable(texture->getID()); getChildView("checkbox allow export")->setEnabled(can_export); } else { getChildView("checkbox allow export")->setEnabled(false); if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) getChildView("checkbox allow everyone copy")->setVisible(true); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale)); // Set the checkbox to tentative if the prices of each object selected // are not the same. getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed); getChildView("sale type")->setEnabled(num_for_sale && can_transfer && !is_sale_price_mixed); bool no_export = everyone_mask_off & PERM_EXPORT; // Next owner perms can't be changed if set getChildView("Next owner can:")->setEnabled(no_export); getChildView("checkbox next owner can modify")->setEnabled(no_export && base_mask_on & PERM_MODIFY); getChildView("checkbox next owner can copy")->setEnabled(no_export && base_mask_on & PERM_COPY); getChildView("checkbox next owner can transfer")->setEnabled(no_export && next_owner_mask_on & PERM_COPY); } else { getChildView("checkbox for sale")->setEnabled(FALSE); getChildView("sale type")->setEnabled(FALSE); getChildView("Next owner can:")->setEnabled(FALSE); getChildView("checkbox next owner can modify")->setEnabled(FALSE); getChildView("checkbox next owner can copy")->setEnabled(FALSE); getChildView("checkbox next owner can transfer")->setEnabled(FALSE); } if (valid_group_perms) { if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE); getChild<LLUICtrl>("checkbox share with group")->setTentative( FALSE); getChildView("button deed")->setEnabled(FALSE); } else { getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); getChild<LLUICtrl>("checkbox share with group")->setTentative( TRUE); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } if (valid_everyone_perms) { // Move if (everyone_mask_on & PERM_MOVE) { getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE); getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE); } else if (everyone_mask_off & PERM_MOVE) { getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE); getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( FALSE); } else { getChild<LLUICtrl>("checkbox allow everyone move")->setValue(TRUE); getChild<LLUICtrl>("checkbox allow everyone move")->setTentative( TRUE); } // Copy == everyone can't copy if (everyone_mask_on & PERM_COPY) { getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE); getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( !can_copy || !can_transfer); } else if (everyone_mask_off & PERM_COPY) { getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE); getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( FALSE); } else { getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(TRUE); getChild<LLUICtrl>("checkbox allow everyone copy")->setTentative( TRUE); } // Export if (supports_export) { if(everyone_mask_on & PERM_EXPORT) { getChild<LLUICtrl>("checkbox allow export")->setValue(TRUE); getChild<LLUICtrl>("checkbox allow export")->setTentative( FALSE); } else if(everyone_mask_off & PERM_EXPORT) { getChild<LLUICtrl>("checkbox allow export")->setValue(FALSE); getChild<LLUICtrl>("checkbox allow export")->setTentative( FALSE); } else { getChild<LLUICtrl>("checkbox allow export")->setValue(TRUE); getChild<LLUICtrl>("checkbox allow export")->setValue( TRUE); } } else { childSetValue("checkbox allow export", false); childSetTentative("checkbox allow export", false); } } if (valid_next_perms) { // Modify == next owner canot modify if (next_owner_mask_on & PERM_MODIFY) { getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE); getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE); } else if (next_owner_mask_off & PERM_MODIFY) { getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE); getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( FALSE); } else { getChild<LLUICtrl>("checkbox next owner can modify")->setValue(TRUE); getChild<LLUICtrl>("checkbox next owner can modify")->setTentative( TRUE); } // Copy == next owner cannot copy if (next_owner_mask_on & PERM_COPY) { getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE); getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( !can_copy); } else if (next_owner_mask_off & PERM_COPY) { getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE); getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( FALSE); } else { getChild<LLUICtrl>("checkbox next owner can copy")->setValue(TRUE); getChild<LLUICtrl>("checkbox next owner can copy")->setTentative( TRUE); } // Transfer == next owner cannot transfer if (next_owner_mask_on & PERM_TRANSFER) { getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE); getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( !can_transfer); } else if (next_owner_mask_off & PERM_TRANSFER) { getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE); getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( FALSE); } else { getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(TRUE); getChild<LLUICtrl>("checkbox next owner can transfer")->setTentative( TRUE); } } // reflect sale information LLSaleInfo sale_info; BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { if (valid_sale_info) { RadioSaleType->setSelectedIndex((S32)sale_type - 1); RadioSaleType->setTentative(FALSE); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest RadioSaleType->setSelectedIndex((S32)LLSaleInfo::FS_COPY - 1); RadioSaleType->setTentative(TRUE); // unfortunately this doesn't do anything at the moment. } } getChild<LLUICtrl>("checkbox for sale")->setValue((num_for_sale != 0)); // HACK: There are some old objects in world that are set for sale, // but are no-transfer. We need to let users turn for-sale off, but only // if for-sale is set. bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); if (cannot_actually_sell) { if (num_for_sale && has_change_sale_ability) { getChildView("checkbox for sale")->setEnabled(true); } } // Check search status of objects const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); getChildView("search_check")->setEnabled(has_change_sale_ability && all_volume); getChild<LLUICtrl>("search_check")->setValue(include_in_search); getChild<LLUICtrl>("search_check")->setTentative( !all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction"); if(combo_click_action) { combo_click_action->setCurrentByIndex((S32)click_action); } } getChildView("label click action")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); }
void LLTextureView::draw() { if (!mFreezeView) { // LLViewerObject *objectp; // S32 te; for_each(mTextureBars.begin(), mTextureBars.end(), DeletePointer()); mTextureBars.clear(); delete mGLTexMemBar; mGLTexMemBar = 0; typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t; display_list_t display_image_list; if (mPrintList) { llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl; } for (LLViewerImageList::image_priority_list_t::iterator iter = gImageList.mImageList.begin(); iter != gImageList.mImageList.end(); ) { LLPointer<LLViewerImage> imagep = *iter++; S32 cur_discard = imagep->getDiscardLevel(); S32 desired_discard = imagep->mDesiredDiscardLevel; if (mPrintList) { llinfos << imagep->getID() << "\t" << imagep->mTextureMemory << "\t" << imagep->getBoostLevel() << "\t" << imagep->getDecodePriority() << "\t" << imagep->getWidth() << "\t" << imagep->getHeight() << "\t" << cur_discard << llendl; } #if 0 if (imagep->getDontDiscard()) { continue; } if (imagep->isMissingAsset()) { continue; } #endif #define HIGH_PRIORITY 100000000.f F32 pri; if (mOrderFetch) { pri = ((F32)imagep->mFetchPriority)/256.f; } else { pri = imagep->getDecodePriority(); } if (sDebugImages.find(imagep) != sDebugImages.end()) { pri += 4*HIGH_PRIORITY; } if (!mOrderFetch) { #if 1 if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) { struct f : public LLSelectedTEFunctor { LLViewerImage* mImage; f(LLViewerImage* image) : mImage(image) {} virtual bool apply(LLViewerObject* object, S32 te) { return (mImage == object->getTEImage(te)); } } func(imagep); const bool firstonly = true; bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); if (match) { pri += 3*HIGH_PRIORITY; } } #endif #if 1 if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) { LLViewerObject *objectp = gHoverView->getLastHoverObject(); if (objectp) { S32 tex_count = objectp->getNumTEs(); for (S32 i = 0; i < tex_count; i++) { if (imagep == objectp->getTEImage(i)) { pri += 2*HIGH_PRIORITY; break; } } } } #endif #if 1 if (pri > 0.f && pri < HIGH_PRIORITY) { if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f || imagep->mFetchDeltaTime < 0.25f) { pri += 1*HIGH_PRIORITY; } } #endif } if (pri > 0.0f) { display_image_list.insert(std::make_pair(pri, imagep)); } } if (mPrintList) { mPrintList = FALSE; } static S32 max_count = 50; S32 count = 0; for (display_list_t::iterator iter = display_image_list.begin(); iter != display_image_list.end(); iter++) { LLViewerImage* imagep = iter->second; S32 hilite = 0; F32 pri = iter->first; if (pri >= 1 * HIGH_PRIORITY) { hilite = (S32)((pri+1) / HIGH_PRIORITY) - 1; } if ((hilite || count < max_count-10) && (count < max_count)) { if (addBar(imagep, hilite)) { count++; } } } if (mOrderFetch) sortChildren(LLTextureBar::sort_fetch()); else sortChildren(LLTextureBar::sort()); mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this); addChild(mGLTexMemBar); reshape(getRect().getWidth(), getRect().getHeight(), TRUE); /* count = gImageList.getNumImages(); std::string info_string; info_string = llformat("Global Info:\nTexture Count: %d", count); mInfoTextp->setText(info_string); */ for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *viewp = *child_iter; if (viewp->getRect().mBottom < 0) { viewp->setVisible(FALSE); } } } LLContainerView::draw(); }
LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment) { LLViewerObject* object; LLSD llsd; char localid[16]; LLUUID t_id; for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { object = (*i); LLUUID id = object->getID(); LL_INFOS() << "Exporting prim " << object->getID().asString() << LL_ENDL; // Create an LLSD object that represents this prim. It will be injected // in to the overall LLSD tree structure LLSD prim_llsd; if (!object->isRoot()) { // Parent id snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); prim_llsd["parent"] = localid; } // Name and description LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->findNode(object); if (node) { prim_llsd["name"] = node->mName; prim_llsd["description"] = node->mDescription; } // Transforms if (is_attachment) { prim_llsd["position"] = object->getPositionEdit().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotationEdit()); } else { prim_llsd["position"] = object->getPosition().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); } prim_llsd["scale"] = object->getScale().getValue(); // Flags prim_llsd["phantom"] = object->flagPhantom(); // legacy prim_llsd["physical"] = object->flagUsePhysics(); // legacy prim_llsd["flags"] = (S32)object->getFlags(); // new way // Extra physics flags if (mGotExtraPhysics) { LLSD& physics = prim_llsd["ExtraPhysics"]; physics["PhysicsShapeType"] = object->getPhysicsShapeType(); physics["Gravity"] = object->getPhysicsGravity(); physics["Friction"] = object->getPhysicsFriction(); physics["Density"] = object->getPhysicsDensity(); physics["Restitution"] = object->getPhysicsRestitution(); } // Click action if (S32 action = object->getClickAction()) // Non-zero prim_llsd["clickaction"] = action; // Prim material prim_llsd["material"] = object->getMaterial(); // Volume params LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); // Extra paramsb6fab961-af18-77f8-cf08-f021377a7244 if (object->isFlexible()) { // Flexible LLFlexibleObjectData* flex; flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { // Light LLLightParams* light; light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) { // Light image LLLightImageParams* light_param; light_param = (LLLightImageParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); t_id = validateTextureID(light_param->getLightTexture()); if (mTexturesList.count(t_id) == 0) { LL_INFOS() << "Found a light texture, adding to list " << t_id << LL_ENDL; mTexturesList.insert(t_id); } prim_llsd["light_texture"] = light_param->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { // Sculpt LLSculptParams* sculpt; sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); if ((sculpt->getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH) { LLUUID sculpt_texture = sculpt->getSculptTexture(); if (sculpt_texture == validateTextureID(sculpt_texture)) { if (mTexturesList.count(sculpt_texture) == 0) { LL_INFOS() << "Found a sculpt texture, adding to list " << sculpt_texture << LL_ENDL; mTexturesList.insert(sculpt_texture); } } else { LL_WARNS() << "Incorrect permission to export a sculpt texture." << LL_ENDL; mExportState = EXPORT_FAILED; } } } // Textures and materials LLSD te_llsd; LLSD this_te_llsd; LLSD te_mat_llsd; LLSD this_te_mat_llsd; bool has_materials = false; for (U8 i = 0, count = object->getNumTEs(); i < count; ++i) { LLTextureEntry* te = object->getTE(i); if (!te) continue; // Paranoia // Normal texture/diffuse map t_id = validateTextureID(te->getID()); this_te_llsd = te->asLLSD(); this_te_llsd["imageid"] = t_id; te_llsd.append(this_te_llsd); // Do not export non-existent default textures if (t_id != LL_TEXTURE_BLANK && t_id != LL_TEXTURE_INVISIBLE) { if (mTexturesList.count(t_id) == 0) { mTexturesList.insert(t_id); } } // Materials LLMaterial* mat = te->getMaterialParams().get(); if (mat) { has_materials = true; this_te_mat_llsd = mat->asLLSD(); t_id = validateTextureID(mat->getNormalID()); this_te_mat_llsd["NormMap"] = t_id; if (mTexturesList.count(t_id) == 0) { mTexturesList.insert(t_id); } t_id = validateTextureID(mat->getSpecularID()); this_te_mat_llsd["SpecMap"] = t_id; if (mTexturesList.count(t_id) == 0) { mTexturesList.insert(t_id); } te_mat_llsd.append(this_te_mat_llsd); } } prim_llsd["textures"] = te_llsd; if (has_materials) { prim_llsd["materials"] = te_mat_llsd; } // The keys in the primitive maps do not have to be localids, they can // be any string. We simply use localids because they are a unique // identifier snprintf(localid, sizeof(localid), "%u", object->getLocalID()); llsd[(const char*)localid] = prim_llsd; } updateExportNumbers(); return llsd; }
// static LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root) { LLViewerObject* object = pick.getObject(); if (select_root) { object = object->getRootEdit(); } BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); // *NOTE: These settings must be cleaned up at bottom of function. if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar) { gSavedSettings.setBOOL("SelectOwnedOnly", FALSE); gSavedSettings.setBOOL("SelectMovableOnly", FALSE); LLSelectMgr::getInstance()->setForceSelection(TRUE); } BOOL extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL); // If no object, check for icon, then just deselect if (!object) { LLHUDIcon* last_hit_hud_icon = pick.mHUDIcon; if (last_hit_hud_icon && last_hit_hud_icon->getSourceObject()) { LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID()); } else if (!extend_select) { LLSelectMgr::getInstance()->deselectAll(); } } else { BOOL already_selected = object->isSelected(); if (already_selected && object->getNumTEs() > 0 && !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES)) { const LLTextureEntry* tep = object->getTE(pick.mObjectFace); if (tep && !tep->isSelected() && !LLViewerMediaFocus::getInstance()->getFocusedObjectID().isNull()) { // we were interacting with media and clicked on non selected face, drop media focus LLViewerMediaFocus::getInstance()->clearFocus(); // selection was removed and zoom preserved by clearFocus(), continue with regular selection already_selected = false; extend_select = true; } } if ( extend_select ) { if ( already_selected ) { if ( ignore_group ) { LLSelectMgr::getInstance()->deselectObjectOnly(object); } else { LLSelectMgr::getInstance()->deselectObjectAndFamily(object, TRUE, TRUE); } } else { if ( ignore_group ) { LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES); } else { LLSelectMgr::getInstance()->selectObjectAndFamily(object); } } } else { // Save the current zoom values because deselect resets them. F32 target_zoom; F32 current_zoom; LLSelectMgr::getInstance()->getAgentHUDZoom(target_zoom, current_zoom); // JC - Change behavior to make it easier to select children // of linked sets. 9/3/2002 if( !already_selected || ignore_group) { // ...lose current selection in favor of just this object LLSelectMgr::getInstance()->deselectAll(); } if ( ignore_group ) { LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES); } else { LLSelectMgr::getInstance()->selectObjectAndFamily(object); } // restore the zoom to the previously stored values. LLSelectMgr::getInstance()->setAgentHUDZoom(target_zoom, current_zoom); } if (!gAgentCamera.getFocusOnAvatar() && // if camera not glued to avatar LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatarp && // and it's not one of your attachments object != gAgentAvatarp) // and it's not you { // have avatar turn to face the selected object(s) LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal(); selection_center = selection_center - gAgent.getPositionGlobal(); LLVector3 selection_dir; selection_dir.setVec(selection_center); selection_dir.mV[VZ] = 0.f; selection_dir.normVec(); if (!object->isAvatar() && gAgent.getAtAxis() * selection_dir < 0.6f) { LLQuaternion target_rot; target_rot.shortestArc(LLVector3::x_axis, selection_dir); gAgent.startAutoPilotGlobal(gAgent.getPositionGlobal(), "", &target_rot, NULL, NULL, 1.f, SELECTION_ROTATION_TRESHOLD); } } if (temp_select) { if (!already_selected) { LLViewerObject* root_object = (LLViewerObject*)object->getRootEdit(); LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); // this is just a temporary selection LLSelectNode* select_node = selection->findNode(root_object); if (select_node) { select_node->setTransient(TRUE); } LLViewerObject::const_child_list_t& child_list = root_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); iter++) { LLViewerObject* child = *iter; select_node = selection->findNode(child); if (select_node) { select_node->setTransient(TRUE); } } } } //if(temp_select) } //if(!object) // Cleanup temp select settings above. if (temp_select ||LLSelectMgr::getInstance()->mAllowSelectAvatar) { gSavedSettings.setBOOL("SelectOwnedOnly", select_owned); gSavedSettings.setBOOL("SelectMovableOnly", select_movable); LLSelectMgr::getInstance()->setForceSelection(FALSE); } return LLSelectMgr::getInstance()->getSelection(); }
void LLTextureView::draw() { if (!mFreezeView) { // LLViewerObject *objectp; // S32 te; for_each(mTextureBars.begin(), mTextureBars.end(), KillView()); mTextureBars.clear(); if (mGLTexMemBar) { removeChild(mGLTexMemBar); mGLTexMemBar->die(); mGLTexMemBar = 0; } if (mAvatarTexBar) { removeChild(mAvatarTexBar); mAvatarTexBar->die(); mAvatarTexBar = 0; } typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t; display_list_t display_image_list; if (mPrintList) { llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl; } for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin(); iter != gTextureList.mImageList.end(); ) { LLPointer<LLViewerFetchedTexture> imagep = *iter++; if(!imagep->hasFetcher()) { continue ; } S32 cur_discard = imagep->getDiscardLevel(); S32 desired_discard = imagep->mDesiredDiscardLevel; if (mPrintList) { S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ; llinfos << imagep->getID() << "\t" << tex_mem << "\t" << imagep->getBoostLevel() << "\t" << imagep->getDecodePriority() << "\t" << imagep->getWidth() << "\t" << imagep->getHeight() << "\t" << cur_discard << llendl; } if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID) { static S32 debug_count = 0; ++debug_count; // for breakpoints } F32 pri; if (mOrderFetch) { pri = ((F32)imagep->mFetchPriority)/256.f; } else { pri = imagep->getDecodePriority(); } pri = llclamp(pri, 0.0f, HIGH_PRIORITY-1.f); if (sDebugImages.find(imagep) != sDebugImages.end()) { pri += 4*HIGH_PRIORITY; } if (!mOrderFetch) { if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) { struct f : public LLSelectedTEFunctor { LLViewerFetchedTexture* mImage; f(LLViewerFetchedTexture* image) : mImage(image) {} virtual bool apply(LLViewerObject* object, S32 te) { return (mImage == object->getTEImage(te)); } } func(imagep); const bool firstonly = true; bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); if (match) { pri += 3*HIGH_PRIORITY; } } if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) { LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode(); if (hover_node) { LLViewerObject *objectp = hover_node->getObject(); if (objectp) { S32 tex_count = objectp->getNumTEs(); for (S32 i = 0; i < tex_count; i++) { if (imagep == objectp->getTEImage(i)) { pri += 2*HIGH_PRIORITY; break; } } } } } if (pri > 0.f && pri < HIGH_PRIORITY) { if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f || imagep->mFetchDeltaTime < 0.25f) { pri += 1*HIGH_PRIORITY; } } } if (pri > 0.0f) { display_image_list.insert(std::make_pair(pri, imagep)); } } if (mPrintList) { mPrintList = FALSE; } static S32 max_count = 50; S32 count = 0; mNumTextureBars = 0 ; for (display_list_t::iterator iter = display_image_list.begin(); iter != display_image_list.end(); iter++) { LLViewerFetchedTexture* imagep = iter->second; S32 hilite = 0; F32 pri = iter->first; if (pri >= 1 * HIGH_PRIORITY) { hilite = (S32)((pri+1) / HIGH_PRIORITY) - 1; } if ((hilite || count < max_count-10) && (count < max_count)) { if (addBar(imagep, hilite)) { count++; } } } if (mOrderFetch) sortChildren(LLTextureBar::sort_fetch()); else sortChildren(LLTextureBar::sort()); LLGLTexMemBar::Params tmbp; LLRect tmbr; tmbp.name("gl texmem bar"); tmbp.rect(tmbr); tmbp.follows.flags = FOLLOWS_LEFT|FOLLOWS_TOP; tmbp.texture_view(this); mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp); addChild(mGLTexMemBar); sendChildToFront(mGLTexMemBar); LLAvatarTexBar::Params atbp; LLRect atbr; atbp.name("gl avatartex bar"); atbp.texture_view(this); atbp.rect(atbr); mAvatarTexBar = LLUICtrlFactory::create<LLAvatarTexBar>(atbp); addChild(mAvatarTexBar); sendChildToFront(mAvatarTexBar); reshape(getRect().getWidth(), getRect().getHeight(), TRUE); LLUI::popMatrix(); LLUI::pushMatrix(); LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom); for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *viewp = *child_iter; if (viewp->getRect().mBottom < 0) { viewp->setVisible(FALSE); } } } LLContainerView::draw(); }
// True if you selected an object. BOOL LLToolPie::pickAndShowMenu(BOOL always_show) { S32 x = mPick.mMousePt.mX; S32 y = mPick.mMousePt.mY; MASK mask = mPick.mKeyMask; if (!always_show && mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel(); if (parcel) { LLViewerParcelMgr::getInstance()->selectCollisionParcel(); if (parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned()) { // if selling passes, just buy one void* deselect_when_done = (void*)TRUE; LLPanelLandGeneral::onClickBuyPass(deselect_when_done); } else { // not selling passes, get info LLFloaterLand::showInstance(); } } gFocusMgr.setKeyboardFocus(NULL); return LLTool::handleMouseDown(x, y, mask); } // didn't click in any UI object, so must have clicked in the world LLViewerObject *object = mPick.getObject(); LLViewerObject *parent = NULL; // Shift Right Click Open Texture if(mPick.mKeyMask == MASK_SHIFT) { if(object) { U8 face = mPick.mObjectFace & 0xff; if(face < object->getNumTEs()) { LLViewerImage* img = object->getTEImage(face); if(img) { LLUUID image_id = img->getID(); LLLocalInventory::addItem(image_id.asString(), (int)LLAssetType::AT_TEXTURE, image_id, true); } } } return TRUE; } // Shift Right Click Open Texture if (mPick.mPickType != LLPickInfo::PICK_LAND) { LLViewerParcelMgr::getInstance()->deselectLand(); } if (object) { parent = object->getRootEdit(); } BOOL touchable = (object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch()); // If it's a left-click, and we have a special action, do it. if (useClickAction(always_show, mask, object, parent)) { // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Block left-click special actions when fartouch restricted if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (!gRlvHandler.canTouch(object, mPick.mObjectOffset)) ) { return TRUE; } // [/RLVa:KB] mClickAction = 0; if (object && object->getClickAction()) { mClickAction = object->getClickAction(); } else if (parent && parent->getClickAction()) { mClickAction = parent->getClickAction(); } switch(mClickAction) { case CLICK_ACTION_TOUCH: // touch behavior down below... break; case CLICK_ACTION_SIT: if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting) && (!gSavedSettings.getBOOL("DisableClickSit"))) // agent not already sitting { handle_sit_or_stand(); // put focus in world when sitting on an object gFocusMgr.setKeyboardFocus(NULL); return TRUE; } // else nothing (fall through to touch) case CLICK_ACTION_PAY: if ((object && object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) { // pay event goes to object actually clicked on mClickActionObject = object; mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } return TRUE; } break; case CLICK_ACTION_BUY: mClickActionObject = parent; mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } return TRUE; case CLICK_ACTION_OPEN: if (parent && parent->allowOpen()) { mClickActionObject = parent; mLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE); if (LLSelectMgr::getInstance()->selectGetAllValid()) { // call this right away, since we have all the info we need to continue the action selectionPropertiesReceived(); } } return TRUE; case CLICK_ACTION_PLAY: handle_click_action_play(); return TRUE; case CLICK_ACTION_OPEN_MEDIA: // mClickActionObject = object; handle_click_action_open_media(object); return TRUE; default: // nothing break; } } if (!always_show && handle_media_click(mPick)) { return FALSE; } // put focus back "in world" gFocusMgr.setKeyboardFocus(NULL); // Switch to grab tool if physical or triggerable if (object && !object->isAvatar() && ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) && !always_show) { // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Triggered by left-clicking on a touchable object if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canTouch(object, mPick.mObjectOffset)) ) { return LLTool::handleMouseDown(x, y, mask); } // [/RLVa:KB] gGrabTransientTool = this; LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); return LLToolGrab::getInstance()->handleObjectHit( mPick ); } LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon; if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject()) { LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID()); } // If left-click never selects or spawns a menu // Eat the event. if (!gSavedSettings.getBOOL("LeftClickShowMenu") && !always_show) { // mouse already released if (!mGrabMouseButtonDown) { return TRUE; } while( object && object->isAttachment() && !object->flagHandleTouch()) { // don't pick avatar through hud attachment if (object->isHUDAttachment()) { break; } object = (LLViewerObject*)object->getParent(); } if (object && object == gAgent.getAvatarObject()) { // we left clicked on avatar, switch to focus mode LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); gViewerWindow->hideCursor(); LLToolCamera::getInstance()->setMouseCapture(TRUE); LLToolCamera::getInstance()->pickCallback(mPick); if(gSavedSettings.getBOOL("ResetFocusOnSelfClick")) { gAgent.setFocusOnAvatar(TRUE, TRUE); } return TRUE; } // Could be first left-click on nothing LLFirstUse::useLeftClickNoHit(); // Eat the event return LLTool::handleMouseDown(x, y, mask); } if (!always_show && gAgent.leftButtonGrabbed()) { // if the left button is grabbed, don't put up the pie menu return LLTool::handleMouseDown(x, y, mask); } // Can't ignore children here. LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); // Spawn pie menu if (mPick.mPickType == LLPickInfo::PICK_LAND) { LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal ); gMenuHolder->setParcelSelection(selection); gPieLand->show(x, y, mPieMouseButtonDown); // <edit> if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) { // </edit> // VEFFECT: ShowPie LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(mPick.mPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); // <edit> } // </edit> } else if (mPick.mObjectID == gAgent.getID() ) { if(!gPieSelf) { //either at very early startup stage or at late quitting stage, //this event is ignored. return TRUE ; } gPieSelf->show(x, y, mPieMouseButtonDown); } else if (object) { gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); if (object->isAvatar() || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) { // Find the attachment's avatar while( object && object->isAttachment()) { object = (LLViewerObject*)object->getParent(); } // Object is an avatar, so check for mute by id. LLVOAvatar* avatar = (LLVOAvatar*)object; std::string name = avatar->getFullname(); if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) { gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate //gMutePieMenu->setLabel("Unmute"); } else { gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate //gMutePieMenu->setLabel("Mute"); } //gPieAvatar->show(x, y, mPieMouseButtonDown); // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Don't show the pie menu on empty selection when fartouch/interaction restricted [see LLToolSelect::handleObjectSelection()] if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) { gPieAvatar->show(x, y, mPieMouseButtonDown); } else { make_ui_sound("UISndInvalidOp"); } // [/RLVa:KB] } else if (object->isAttachment()) { //gPieAttachment->show(x, y, mPieMouseButtonDown); // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Don't show the pie menu on empty selection when fartouch/interaction restricted [see LLToolSelect::handleObjectSelection()] if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) { gPieAttachment->show(x, y, mPieMouseButtonDown); } else { make_ui_sound("UISndInvalidOp"); } // [/RLVa:KB] } else { // BUG: What about chatting child objects? std::string name; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node) { name = node->mName; } if (LLMuteList::getInstance()->isMuted(object->getID(), name)) { gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Unmute"); } else { gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Mute"); } // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l // Don't show the pie menu on empty selection when fartouch/interaction restricted // (not entirely accurate in case of Tools / Select Only XXX [see LLToolSelect::handleObjectSelection()] if ( (!rlv_handler_t::isEnabled()) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) || (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) ) { // [/RLVa:KB] gPieObject->show(x, y, mPieMouseButtonDown); // <edit> if(!gSavedSettings.getBOOL("DisablePointAtAndBeam")) { // </edit> // VEFFECT: ShowPie object // Don't show when you click on someone else, it freaks them // out. LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(mPick.mPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); // <edit> } // </edit> // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f } else { make_ui_sound("UISndInvalidOp"); } // [/RLVa:KB] } } if (always_show) { // ignore return value LLTool::handleRightMouseDown(x, y, mask); } else { // ignore return value LLTool::handleMouseDown(x, y, mask); } // We handled the event. return TRUE; }
LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list) { LLViewerObject* object; LLSD llsd; char localid[16]; for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) { object=(*i); LLUUID id = object->getID(); llinfos << "Exporting prim " << object->getID().asString() << llendl; // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD // tree structure LLSD prim_llsd; if (!object->isRoot()) { // Parent id snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); prim_llsd["parent"] = localid; } // Transforms prim_llsd["position"] = object->getPosition().getValue(); prim_llsd["scale"] = object->getScale().getValue(); prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); // Flags prim_llsd["shadows"] = object->flagCastShadows(); prim_llsd["phantom"] = object->flagPhantom(); prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS); // Volume params LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); // Extra paramsb6fab961-af18-77f8-cf08-f021377a7244 if (object->isFlexible()) { // Flexible LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { // Light LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); prim_llsd["light"] = light->asLLSD(); } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { // Sculpt LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); LLUUID sculpt_texture=sculpt->getSculptTexture(); bool alreadyseen=false; std::list<LLUUID>::iterator iter; for(iter = textures.begin(); iter != textures.end() ; iter++) { if( (*iter)==sculpt_texture) alreadyseen=true; } if(alreadyseen==false) { llinfos << "Found a sculpt texture, adding to list "<<sculpt_texture<<llendl; textures.push_back(sculpt_texture); } } // Textures LLSD te_llsd; U8 te_count = object->getNumTEs(); for (U8 i = 0; i < te_count; i++) { bool alreadyseen=false; te_llsd.append(object->getTE(i)->asLLSD()); std::list<LLUUID>::iterator iter; for(iter = textures.begin(); iter != textures.end() ; iter++) { if( (*iter)==object->getTE(i)->getID()) alreadyseen=true; } if(alreadyseen==false) textures.push_back(object->getTE(i)->getID()); } prim_llsd["textures"] = te_llsd; // The keys in the primitive maps do not have to be localids, they can be any // string. We simply use localids because they are a unique identifier snprintf(localid, sizeof(localid), "%u", object->getLocalID()); llsd[(const char*)localid] = prim_llsd; } updateexportnumbers(); return llsd; }