LLXMLNode *LLInventoryItem::exportFileXML(BOOL include_asset_key) const { LLMemType m1(LLMemType::MTYPE_INVENTORY); LLXMLNode *ret = new LLXMLNode("item", FALSE); ret->createChild("uuid", TRUE)->setUUIDValue(1, &mUUID); ret->createChild("parent_uuid", TRUE)->setUUIDValue(1, &mParentUUID); mPermissions.exportFileXML()->setParent(ret); // Check for permissions to see the asset id, and if so write it // out as an asset id. Otherwise, apply our cheesy encryption. if(include_asset_key) { U32 mask = mPermissions.getMaskBase(); if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) || (mAssetUUID.isNull())) { ret->createChild("asset_id", FALSE)->setUUIDValue(1, &mAssetUUID); } else { LLUUID shadow_id(mAssetUUID); LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.encrypt(shadow_id.mData, UUID_BYTES); ret->createChild("shadow_id", FALSE)->setUUIDValue(1, &shadow_id); } } LLString type_str = LLAssetType::lookup(mType); LLString inv_type_str = LLInventoryType::lookup(mInventoryType); ret->createChild("asset_type", FALSE)->setStringValue(1, &type_str); ret->createChild("inventory_type", FALSE)->setStringValue(1, &inv_type_str); S32 tmp_flags = (S32) mFlags; ret->createChild("flags", FALSE)->setByteValue(4, (U8*)(&tmp_flags), LLXMLNode::ENCODING_HEX); mSaleInfo.exportFileXML()->setParent(ret); LLString temp; temp.assign(mName); ret->createChild("name", FALSE)->setStringValue(1, &temp); temp.assign(mDescription); ret->createChild("description", FALSE)->setStringValue(1, &temp); ret->createChild("creation_date", FALSE)->setIntValue(1, &mCreationDate); return ret; }
LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { LLString name("spinner"); node->getAttributeString("name", name); LLString label; node->getAttributeString("label", label); LLRect rect; createRect(node, rect, parent, LLRect()); LLFontGL* font = LLView::selectFont(node); F32 initial_value = 0.f; node->getAttributeF32("initial_val", initial_value); F32 min_value = 0.f; node->getAttributeF32("min_val", min_value); F32 max_value = 1.f; node->getAttributeF32("max_val", max_value); F32 increment = 0.1f; node->getAttributeF32("increment", increment); U32 precision = 3; node->getAttributeU32("decimal_digits", precision); S32 label_width = llmin(40, rect.getWidth() - 40); node->getAttributeS32("label_width", label_width); LLUICtrlCallback callback = NULL; if(label.empty()) { label.assign( node->getValue() ); } LLSpinCtrl* spinner = new LLSpinCtrl(name, rect, label, font, callback, NULL, initial_value, min_value, max_value, increment, "", label_width); spinner->setPrecision(precision); spinner->initFromXML(node, parent); return spinner; }
void LLFloaterAvatarTextures::refresh() { LLVOAvatar *avatarp = find_avatar(mID); if (avatarp) { char firstname[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ char lastname[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ if (gCacheName->getName(avatarp->getID(), firstname, lastname)) { LLString name; name.assign( firstname ); name.append( " " ); name.append( lastname ); setTitle(mTitle + ": " + name); } update_texture_ctrl(avatarp, mBakedHead, LLVOAvatar::TEX_HEAD_BAKED); update_texture_ctrl(avatarp, mBakedEyes, LLVOAvatar::TEX_EYES_BAKED); update_texture_ctrl(avatarp, mBakedUpper, LLVOAvatar::TEX_UPPER_BAKED); update_texture_ctrl(avatarp, mBakedLower, LLVOAvatar::TEX_LOWER_BAKED); update_texture_ctrl(avatarp, mBakedSkirt, LLVOAvatar::TEX_SKIRT_BAKED); update_texture_ctrl(avatarp, mMakeup, LLVOAvatar::TEX_HEAD_BODYPAINT); update_texture_ctrl(avatarp, mHair, LLVOAvatar::TEX_HAIR); update_texture_ctrl(avatarp, mEye, LLVOAvatar::TEX_EYES_IRIS); update_texture_ctrl(avatarp, mShirt, LLVOAvatar::TEX_UPPER_SHIRT); update_texture_ctrl(avatarp, mUpperTattoo, LLVOAvatar::TEX_UPPER_BODYPAINT); update_texture_ctrl(avatarp, mUpperJacket, LLVOAvatar::TEX_UPPER_JACKET); update_texture_ctrl(avatarp, mGloves, LLVOAvatar::TEX_UPPER_GLOVES); update_texture_ctrl(avatarp, mUndershirt, LLVOAvatar::TEX_UPPER_UNDERSHIRT); update_texture_ctrl(avatarp, mPants, LLVOAvatar::TEX_LOWER_PANTS); update_texture_ctrl(avatarp, mLowerTattoo, LLVOAvatar::TEX_LOWER_BODYPAINT); update_texture_ctrl(avatarp, mShoes, LLVOAvatar::TEX_LOWER_SHOES); update_texture_ctrl(avatarp, mSocks, LLVOAvatar::TEX_LOWER_SOCKS); update_texture_ctrl(avatarp, mJacket, LLVOAvatar::TEX_LOWER_JACKET); update_texture_ctrl(avatarp, mUnderpants, LLVOAvatar::TEX_LOWER_UNDERPANTS); update_texture_ctrl(avatarp, mSkirt, LLVOAvatar::TEX_SKIRT); } else { setTitle(mTitle + ": INVALID AVATAR (" + mID.asString() + ")"); } }
// virtual BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, LLString& tooltip_msg) { BOOL handled = TRUE; switch(cargo_type) { case DAD_ANIMATION: case DAD_SOUND: { // TODO: Don't allow this if you can't transfer the sound/animation // make a script step LLInventoryItem* item = (LLInventoryItem*)cargo_data; if (item && gInventory.getItem(item->getUUID())) { LLPermissions perm = item->getPermissions(); if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)) { *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only animations and sounds\n" "with unrestricted permissions\n" "can be added to a gesture."); } break; } else if (drop) { LLScrollListItem* line = NULL; if (cargo_type == DAD_ANIMATION) { line = addStep("Animation"); LLGestureStepAnimation* anim = (LLGestureStepAnimation*)line->getUserdata(); anim->mAnimAssetID = item->getAssetUUID(); anim->mAnimName = item->getName(); } else if (cargo_type == DAD_SOUND) { line = addStep("Sound"); LLGestureStepSound* sound = (LLGestureStepSound*)line->getUserdata(); sound->mSoundAssetID = item->getAssetUUID(); sound->mSoundName = item->getName(); } updateLabel(line); mDirty = TRUE; refresh(); } *accept = ACCEPT_YES_COPY_MULTI; } else { // Not in user's inventory means it was in object inventory *accept = ACCEPT_NO; } break; } default: *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only animations and sounds\n" "can be added to a gesture."); } break; } return handled; }