本文整理汇总了C++中LL_DEBUGS函数的典型用法代码示例。如果您正苦于以下问题:C++ LL_DEBUGS函数的具体用法?C++ LL_DEBUGS怎么用?C++ LL_DEBUGS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LL_DEBUGS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRect
BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
{
// Note: we don't bother sending the event to the children (the arrow buttons)
// because they'll capture the mouse whenever they need hover events.
BOOL handled = FALSE;
if( hasMouseCapture() )
{
S32 height = getRect().getHeight();
S32 width = getRect().getWidth();
if( VERTICAL == mOrientation )
{
// S32 old_pos = mThumbRect.mTop;
S32 delta_pixels = y - mDragStartY;
if( mOrigRect.mBottom + delta_pixels < mThickness )
{
delta_pixels = mThickness - mOrigRect.mBottom - 1;
}
else
if( mOrigRect.mTop + delta_pixels > height - mThickness )
{
delta_pixels = height - mThickness - mOrigRect.mTop + 1;
}
mThumbRect.mTop = mOrigRect.mTop + delta_pixels;
mThumbRect.mBottom = mOrigRect.mBottom + delta_pixels;
S32 thumb_length = mThumbRect.getHeight();
S32 thumb_track_length = height - 2 * mThickness;
if( delta_pixels != mLastDelta || mDocChanged)
{
// Note: delta_pixels increases as you go up. mDocPos increases down (line 0 is at the top of the page).
S32 usable_track_length = thumb_track_length - thumb_length;
if( 0 < usable_track_length )
{
S32 variable_lines = getDocPosMax();
S32 pos = mThumbRect.mTop;
F32 ratio = F32(pos - mThickness - thumb_length) / usable_track_length;
S32 new_pos = llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines );
// Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly
// out of sync (less than a line's worth) to make the thumb feel responsive.
changeLine( new_pos - mDocPos, FALSE );
}
}
mLastDelta = delta_pixels;
}
else
{
// Horizontal
// S32 old_pos = mThumbRect.mLeft;
S32 delta_pixels = x - mDragStartX;
if( mOrigRect.mLeft + delta_pixels < mThickness )
{
delta_pixels = mThickness - mOrigRect.mLeft - 1;
}
else
if( mOrigRect.mRight + delta_pixels > width - mThickness )
{
delta_pixels = width - mThickness - mOrigRect.mRight + 1;
}
mThumbRect.mLeft = mOrigRect.mLeft + delta_pixels;
mThumbRect.mRight = mOrigRect.mRight + delta_pixels;
S32 thumb_length = mThumbRect.getWidth();
S32 thumb_track_length = width - 2 * mThickness;
if( delta_pixels != mLastDelta || mDocChanged)
{
// Note: delta_pixels increases as you go up. mDocPos increases down (line 0 is at the top of the page).
S32 usable_track_length = thumb_track_length - thumb_length;
if( 0 < usable_track_length )
{
S32 variable_lines = getDocPosMax();
S32 pos = mThumbRect.mLeft;
F32 ratio = F32(pos - mThickness) / usable_track_length;
S32 new_pos = llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines);
// Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly
// out of sync (less than a line's worth) to make the thumb feel responsive.
changeLine( new_pos - mDocPos, FALSE );
}
}
mLastDelta = delta_pixels;
}
getWindow()->setCursor(UI_CURSOR_ARROW);
LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL;
handled = TRUE;
//.........这里部分代码省略.........
示例2: lock
void LLPluginProcessParent::updatePollset()
{
if(!sInstancesMutex)
{
// No instances have been created yet. There's no work to do.
return;
}
LLMutexLock lock(sInstancesMutex);
if(sPollSet)
{
LL_DEBUGS("PluginPoll") << "destroying pollset " << sPollSet << LL_ENDL;
// delete the existing pollset.
apr_pollset_destroy(sPollSet);
sPollSet = NULL;
}
std::list<LLPluginProcessParent*>::iterator iter;
int count = 0;
// Count the number of instances that want to be in the pollset
for(iter = sInstances.begin(); iter != sInstances.end(); iter++)
{
(*iter)->mPolledInput = false;
if((*iter)->mPollFD.client_data)
{
// This instance has a socket that needs to be polled.
++count;
}
}
if(sUseReadThread && sReadThread && !sReadThread->isQuitting())
{
if(!sPollSet && (count > 0))
{
#ifdef APR_POLLSET_NOCOPY
// The pollset doesn't exist yet. Create it now.
apr_status_t status = apr_pollset_create(&sPollSet, count, gAPRPoolp, APR_POLLSET_NOCOPY);
if(status != APR_SUCCESS)
{
#endif // APR_POLLSET_NOCOPY
LL_WARNS("PluginPoll") << "Couldn't create pollset. Falling back to non-pollset mode." << LL_ENDL;
sPollSet = NULL;
#ifdef APR_POLLSET_NOCOPY
}
else
{
LL_DEBUGS("PluginPoll") << "created pollset " << sPollSet << LL_ENDL;
// Pollset was created, add all instances to it.
for(iter = sInstances.begin(); iter != sInstances.end(); iter++)
{
if((*iter)->mPollFD.client_data)
{
status = apr_pollset_add(sPollSet, &((*iter)->mPollFD));
if(status == APR_SUCCESS)
{
(*iter)->mPolledInput = true;
}
else
{
LL_WARNS("PluginPoll") << "apr_pollset_add failed with status " << status << LL_ENDL;
}
}
}
}
#endif // APR_POLLSET_NOCOPY
}
}
}
示例3: setState
void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
{
// internal messages should be handled here
std::string message_name = message.getName();
if(message_name == "hello")
{
if(mState == STATE_CONNECTED)
{
// Plugin host has launched. Tell it which plugin to load.
setState(STATE_HELLO);
}
else
{
LL_WARNS("Plugin") << "received hello message in wrong state -- bailing out" << LL_ENDL;
errorState();
}
}
else if(message_name == "load_plugin_response")
{
if(mState == STATE_LOADING)
{
// Plugin has been loaded.
mPluginVersionString = message.getValue("plugin_version");
LL_INFOS("Plugin") << "plugin version string: " << mPluginVersionString << LL_ENDL;
// Check which message classes/versions the plugin supports.
// TODO: check against current versions
// TODO: kill plugin on major mismatches?
mMessageClassVersions = message.getValueLLSD("versions");
LLSD::map_iterator iter;
for(iter = mMessageClassVersions.beginMap(); iter != mMessageClassVersions.endMap(); iter++)
{
LL_INFOS("Plugin") << "message class: " << iter->first << " -> version: " << iter->second.asString() << LL_ENDL;
}
// Send initial sleep time
llassert_always(mSleepTime != 0.f);
setSleepTime(mSleepTime, true);
setState(STATE_RUNNING);
}
else
{
LL_WARNS("Plugin") << "received load_plugin_response message in wrong state -- bailing out" << LL_ENDL;
errorState();
}
}
else if(message_name == "heartbeat")
{
// this resets our timer.
mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
mCPUUsage = message.getValueReal("cpu_usage");
LL_DEBUGS("Plugin") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
}
else if(message_name == "shm_add_response")
{
// Nothing to do here.
}
else if(message_name == "shm_remove_response")
{
std::string name = message.getValue("name");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// destroy the shared memory region
iter->second->destroy();
delete iter->second;
iter->second = NULL;
// and remove it from our map
mSharedMemoryRegions.erase(iter);
}
}
else
{
LL_WARNS("Plugin") << "Unknown internal message from child: " << message_name << LL_ENDL;
}
}
else
{
if(mOwner != NULL)
{
mOwner->receivePluginMessage(message);
}
}
}
示例4: handleDoubleClick
BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (gDebugClicks)
{
llinfos << "LLToolPie handleDoubleClick (becoming mouseDown)" << llendl;
}
LLViewerObject *object = mPick.getObject();
if(object)
{
//Zwagoth: No more teleport to HUD attachments. >:o
if (object->isHUDAttachment())
{
LL_DEBUGS("DoubleClicks") << "Double clicked HUD" << LL_ENDL;
return FALSE;
}
//Armin: No more teleport to other attachments or Avatars including self ...
if (object->isAttachment())
{
LL_DEBUGS("DoubleClicks") << "Double clicked attachment (not HUD)" << LL_ENDL;
return FALSE;
}
if (object->isAvatar()&& object == gAgent.getAvatarObject() )
{
LL_DEBUGS("DoubleClicks") << "Double clicked self" << LL_ENDL;
return FALSE;
}
if (object->isAvatar())
{
LL_DEBUGS("DoubleClicks") << "Double clicked other Avatar" << LL_ENDL;
return FALSE;// or what about open profile or IM session or ...
}
if (final_click_action(object))
{
LL_DEBUGS("DoubleClicks") << "Double clicked an object with a click action" << LL_ENDL;
return FALSE;
}
LLViewerObject* parent = object->getRootEdit();
if (object->flagHandleTouch() || (parent && parent->flagHandleTouch()))
{
LL_DEBUGS("DoubleClicks") << "Double clicked a touch-scripted object" << LL_ENDL;
return FALSE;
}
const LLTextureEntry* tep = object->getTE(mPick.mObjectFace);
viewer_media_t media_impl = tep ? LLViewerMedia::getMediaImplFromTextureID(tep->getID()) : NULL;
if (media_impl.notNull() && media_impl->hasMedia())
{
LL_DEBUGS("DoubleClicks") << "Double clicked running parcel media" << LL_ENDL;
return FALSE;
}
}
std::string action = gSavedSettings.getString("DoubleClickAction");
LLStringUtil::toLower(action);
if (action == "none")
{
return FALSE;
}
else if (action == "go")
{
if (mPick.mPickType == LLPickInfo::PICK_LAND
&& !mPick.mPosGlobal.isExactlyZero())
{
handle_go_to_confirm();
return TRUE;
}
else if (mPick.mObjectID.notNull()
&& !mPick.mPosGlobal.isExactlyZero())
{
handle_go_to_confirm();
return TRUE;
}
}
else
{
llwarns << "Unhandled DoubleClickAction setting: " << action << llendl;
}
return FALSE;
}
示例5: LL_DEBUGS
void LLPluginProcessParent::setState(EState state)
{
LL_DEBUGS("Plugin") << "setting state to " << state << LL_ENDL;
mState = state;
};
示例6: while
void LLMaterialMgr::processPutQueue()
{
typedef std::map<LLViewerRegion*, LLSD> regionput_request_map;
regionput_request_map requests;
put_queue_t::iterator loopQueue = mPutQueue.begin();
while (mPutQueue.end() != loopQueue)
{
put_queue_t::iterator itQueue = loopQueue++;
const LLUUID& object_id = itQueue->first;
const LLViewerObject* objectp = gObjectList.findObject(object_id);
if ( !objectp )
{
LL_WARNS("Materials") << "Object is NULL" << LL_ENDL;
mPutQueue.erase(itQueue);
}
else
{
LLViewerRegion* regionp = objectp->getRegion();
if ( !regionp )
{
LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL;
mPutQueue.erase(itQueue);
}
else if ( regionp->capabilitiesReceived() && !regionp->materialsCapThrottled())
{
LLSD& facesData = requests[regionp];
facematerial_map_t& face_map = itQueue->second;
U32 max_entries = regionp->getMaxMaterialsPerTransaction();
facematerial_map_t::iterator itFace = face_map.begin();
while ( (face_map.end() != itFace) && (facesData.size() < (int)max_entries) )
{
LLSD faceData = LLSD::emptyMap();
faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
if (!itFace->second.isNull())
{
faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
}
facesData.append(faceData);
face_map.erase(itFace++);
}
if (face_map.empty())
{
mPutQueue.erase(itQueue);
}
}
}
}
for (regionput_request_map::const_iterator itRequest = requests.begin(); itRequest != requests.end(); ++itRequest)
{
LLViewerRegion* regionp = itRequest->first;
std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);
if (capURL.empty())
{
LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME
<< "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL;
continue;
}
LLSD materialsData = LLSD::emptyMap();
materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = itRequest->second;
std::string materialString = zip_llsd(materialsData);
S32 materialSize = materialString.size();
if (materialSize > 0)
{
LLSD::Binary materialBinary;
materialBinary.resize(materialSize);
memcpy(materialBinary.data(), materialString.data(), materialSize);
LLSD putData = LLSD::emptyMap();
putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces to region " << itRequest->first->getName() << LL_ENDL;
LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2));
LLHTTPClient::put(capURL, putData, materialsResponder);
regionp->resetMaterialsCapThrottle();
}
else
{
LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL;
}
}
}
示例7: LL_DEBUGS
// virtual static
void LLWaterParamManager::initSingleton()
{
LL_DEBUGS("Windlight") << "Initializing water" << LL_ENDL;
loadAllPresets();
LLEnvManagerNew::instance().usePrefs();
}
示例8: sEnableButtonFlashing
//.........这里部分代码省略.........
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw button image, if available.
// Otherwise draw basic rectangular button.
if (imagep != NULL)
{
// apply automatic 50% alpha fade to disabled image
LLColor4 disabled_color = mFadeWhenDisabled ? mDisabledImageColor.get() % 0.5f : mDisabledImageColor.get();
if ( mScaleImage)
{
imagep->draw(getLocalRect(), (enabled ? mImageColor.get() : disabled_color) % alpha );
if (mCurGlowStrength > 0.01f)
{
gGL.setSceneBlendType(glow_type);
imagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % (mCurGlowStrength * alpha));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
else
{
imagep->draw(0, 0, (enabled ? mImageColor.get() : disabled_color) % alpha );
if (mCurGlowStrength > 0.01f)
{
gGL.setSceneBlendType(glow_type);
imagep->drawSolid(0, 0, glow_color % (mCurGlowStrength * alpha));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
}
else
{
// no image
LL_DEBUGS() << "No image for button " << getName() << LL_ENDL;
// draw it in pink so we can find it
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1 % alpha, FALSE);
}
// let overlay image and text play well together
S32 text_left = mLeftHPad;
S32 text_right = getRect().getWidth() - mRightHPad;
S32 text_width = getRect().getWidth() - mLeftHPad - mRightHPad;
// draw overlay image
if (mImageOverlay.notNull())
{
// get max width and height (discard level 0)
S32 overlay_width;
S32 overlay_height;
getOverlayImageSize(overlay_width, overlay_height);
S32 center_x = getLocalRect().getCenterX();
S32 center_y = getLocalRect().getCenterY();
//FUGLY HACK FOR "DEPRESSED" BUTTONS
if (pressed && mDisplayPressedState)
{
center_y--;
center_x++;
}
center_y += (mImageOverlayBottomPad - mImageOverlayTopPad);
// fade out overlay images on disabled buttons
LLColor4 overlay_color = mImageOverlayColor.get();
if (!enabled)
示例9: uploadComplete
//virtual
virtual void uploadComplete(const LLSD& content)
{
LL_DEBUGS("ObjectBackup") << "LLNewAgentInventoryResponder::result from capabilities" << LL_ENDL;
LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString());
LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString());
// Update L$ and ownership credit information
// since it probably changed on the server
if (asset_type == LLAssetType::AT_TEXTURE ||
asset_type == LLAssetType::AT_SOUND ||
asset_type == LLAssetType::AT_ANIMATION)
{
gMessageSystem->newMessageFast(_PREHASH_MoneyBalanceRequest);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_MoneyData);
gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
gAgent.sendReliableMessage();
// LLStringUtil::format_map_t args;
// args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
// LLNotifyBox::showXml("UploadPayment", args);
}
// Actually add the upload to viewer inventory
LL_INFOS("ObjectBackup") << "Adding " << content["new_inventory_item"].asUUID() << " "
<< content["new_asset"].asUUID() << " to inventory." << LL_ENDL;
if (mPostData["folder_id"].asUUID().notNull())
{
LLPermissions perm;
U32 next_owner_perm;
perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
if (mPostData["inventory_type"].asString() == "snapshot")
{
next_owner_perm = PERM_ALL;
}
else
{
next_owner_perm = PERM_MOVE | PERM_TRANSFER;
}
perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, next_owner_perm);
S32 creation_date_now = time_corrected();
LLPointer<LLViewerInventoryItem> item
= new LLViewerInventoryItem(content["new_inventory_item"].asUUID(),
mPostData["folder_id"].asUUID(),
perm,
content["new_asset"].asUUID(),
asset_type,
inventory_type,
mPostData["name"].asString(),
mPostData["description"].asString(),
LLSaleInfo::DEFAULT,
LLInventoryItemFlags::II_FLAGS_NONE,
creation_date_now);
gInventory.updateItem(item);
gInventory.notifyObservers();
}
else
{
LL_WARNS("ObjectBackup") << "Can't find a folder to put it into" << LL_ENDL;
}
// remove the "Uploading..." message
LLUploadDialog::modalUploadFinished();
LLObjectBackup::getInstance()->updateMap(content["new_asset"].asUUID());
LLObjectBackup::getInstance()->uploadNextAsset();
}
示例10: LL_WARNS
bool FSFloaterObjectExport::exportTexture(const LLUUID& texture_id)
{
if(texture_id.isNull())
{
LL_WARNS("export") << "Attempted to export NULL texture." << LL_ENDL;
return false;
}
if (mTextureChecked.count(texture_id) != 0)
{
return mTextureChecked[texture_id];
}
if (gAssetStorage->mStaticVFS->getExists(texture_id, LLAssetType::AT_TEXTURE))
{
LL_DEBUGS("export") << "Texture " << texture_id.asString() << " is local static." << LL_ENDL;
// no need to save the texture data as the viewer already has it in a local file.
mTextureChecked[texture_id] = true;
return true;
}
//TODO: check for local file static texture. The above will only get the static texture in the static db, not individual textures.
LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(texture_id);
bool texture_export = false;
std::string name;
std::string description;
if (LLGridManager::getInstance()->isInSecondLife())
{
if (imagep->mComment.find("a") != imagep->mComment.end())
{
if (LLUUID(imagep->mComment["a"]) == gAgentID)
{
texture_export = true;
LL_DEBUGS("export") << texture_id << " pass texture export comment check." << LL_ENDL;
}
}
}
if (texture_export)
{
FSExportPermsCheck::canExportAsset(texture_id, &name, &description);
}
else
{
texture_export = FSExportPermsCheck::canExportAsset(texture_id, &name, &description);
}
mTextureChecked[texture_id] = texture_export;
if (!texture_export)
{
LL_DEBUGS("export") << "Texture " << texture_id << " failed export check." << LL_ENDL;
return false;
}
LL_DEBUGS("export") << "Loading image texture " << texture_id << LL_ENDL;
mRequestedTexture[texture_id].name = name;
mRequestedTexture[texture_id].description = description;
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_id, FTT_DEFAULT, MIPMAP_TRUE);
image->setBoostLevel(LLViewerTexture::BOOST_MAX_LEVEL);
image->forceToSaveRawImage(0);
image->setLoadedCallback(FSFloaterObjectExport::onImageLoaded, 0, TRUE, FALSE, this, &mCallbackTextureList);
return true;
}
示例11: switch
void FSFloaterObjectExport::onIdle()
{
switch(mExportState)
{
case IDLE:
break;
case INVENTORY_DOWNLOAD:
if (gDisconnected)
{
return;
}
if (mInventoryRequests.empty())
{
mLastRequest = mAssetRequests.size();
mWaitTimer.start();
mExportState = ASSET_DOWNLOAD;
}
else if (mLastRequest != mInventoryRequests.size())
{
mWaitTimer.start();
mLastRequest = mInventoryRequests.size();
updateTitleProgress(INVENTORY_DOWNLOAD);
}
else if (mWaitTimer.getElapsedTimeF32() > MAX_INVENTORY_WAIT_TIME)
{
mWaitTimer.start();
for (uuid_vec_t::const_iterator iter = mInventoryRequests.begin(); iter != mInventoryRequests.end(); ++iter)
{
LLViewerObject* object = gObjectList.findObject((*iter));
object->dirtyInventory();
object->requestInventory();
LL_DEBUGS("export") << "re-requested inventory of " << (*iter).asString() << LL_ENDL;
}
}
break;
case ASSET_DOWNLOAD:
if (gDisconnected)
{
return;
}
if (mAssetRequests.empty())
{
mLastRequest = mRequestedTexture.size();
mWaitTimer.start();
mExportState = TEXTURE_DOWNLOAD;
}
else if (mLastRequest != mAssetRequests.size())
{
mWaitTimer.start();
mLastRequest = mAssetRequests.size();
updateTitleProgress(ASSET_DOWNLOAD);
}
else if (mWaitTimer.getElapsedTimeF32() > MAX_ASSET_WAIT_TIME)
{
//abort for now
LL_DEBUGS("export") << "Asset timeout with " << (S32)mAssetRequests.size() << " requests left." << LL_ENDL;
for (uuid_vec_t::iterator iter = mAssetRequests.begin(); iter != mAssetRequests.end(); ++iter)
{
LL_DEBUGS("export") << "Asset: " << (*iter).asString() << LL_ENDL;
}
mAssetRequests.clear();
}
break;
case TEXTURE_DOWNLOAD:
if (gDisconnected)
{
return;
}
if(mRequestedTexture.empty())
{
mExportState = IDLE;
if (!gIdleCallbacks.deleteFunction(onIdle, this))
{
LL_WARNS("export") << "Failed to delete idle callback" << LL_ENDL;
}
mWaitTimer.stop();
llofstream file;
file.open(mFilename.c_str(), std::ios_base::out | std::ios_base::binary);
std::string zip_data = zip_llsd(mManifest);
file.write(zip_data.data(), zip_data.size());
file.close();
LL_DEBUGS("export") << "Export finished and written to " << mFilename << LL_ENDL;
LLSD args;
args["FILENAME"] = mFilename;
LLNotificationsUtil::add("ExportFinished", args);
closeFloater();
}
else if (mLastRequest != mRequestedTexture.size())
{
mWaitTimer.start();
mLastRequest = mRequestedTexture.size();
updateTitleProgress(TEXTURE_DOWNLOAD);
}
else if (mWaitTimer.getElapsedTimeF32() > MAX_TEXTURE_WAIT_TIME)
//.........这里部分代码省略.........
示例12: f
void FSFloaterObjectExport::addPrim(LLViewerObject* object, bool root)
{
LLSD prim;
LLUUID object_id = object->getID();
bool default_prim = true;
struct f : public LLSelectedNodeFunctor
{
LLUUID mID;
f(const LLUUID& id) : mID(id) {}
virtual bool apply(LLSelectNode* node)
{
return (node->getObject() && node->getObject()->mID == mID);
}
} func(object_id);
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
default_prim = (!FSExportPermsCheck::canExportNode(node, false));
if (root)
{
if (object->isAttachment())
{
prim["attachment_point"] = ATTACHMENT_ID_FROM_STATE(object->getState());
}
}
else
{
LLViewerObject* parent_object = (LLViewerObject*)object->getParent();
prim["parent"] = parent_object->getID();
}
prim["position"] = object->getPosition().getValue();
prim["scale"] = object->getScale().getValue();
prim["rotation"] = ll_sd_from_quaternion(object->getRotation());
if (default_prim)
{
LL_DEBUGS("export") << object_id.asString() << " failed export check. Using default prim" << LL_ENDL;
prim["flags"] = ll_sd_from_U32((U32)0);
prim["volume"]["path"] = LLPathParams().asLLSD();
prim["volume"]["profile"] = LLProfileParams().asLLSD();
prim["material"] = (S32)LL_MCODE_WOOD;
}
else
{
mExported = true;
prim["flags"] = ll_sd_from_U32(object->getFlags());
prim["volume"]["path"] = object->getVolume()->getParams().getPathParams().asLLSD();
prim["volume"]["profile"] = object->getVolume()->getParams().getProfileParams().asLLSD();
prim["material"] = (S32)object->getMaterial();
if (object->getClickAction() != 0)
{
prim["clickaction"] = (S32)object->getClickAction();
}
LLVOVolume *volobjp = NULL;
if (object->getPCode() == LL_PCODE_VOLUME)
{
volobjp = (LLVOVolume *)object;
}
if(volobjp)
{
if(volobjp->isSculpted())
{
const LLSculptParams *sculpt_params = (const LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
if (sculpt_params)
{
if(volobjp->isMesh())
{
if (!mAborted)
{
mAborted = true;
}
return;
}
else
{
if (exportTexture(sculpt_params->getSculptTexture()))
{
prim["sculpt"] = sculpt_params->asLLSD();
}
else
{
LLSculptParams default_sculpt;
prim["sculpt"] = default_sculpt.asLLSD();
}
}
}
}
if(volobjp->isFlexible())
{
const LLFlexibleObjectData *flexible_param_block = (const LLFlexibleObjectData *)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
if (flexible_param_block)
{
prim["flexible"] = flexible_param_block->asLLSD();
}
}
if (volobjp->getIsLight())
//.........这里部分代码省略.........
示例13: LLCertException
// validate the certificate chain against a store.
// There are many aspects of cert validatioin policy involved in
// trust validation. The policies in this validation algorithm include
// * Hostname matching for SSL certs
// * Expiration time matching
// * Signature validation
// * Chain trust (is the cert chain trusted against the store)
// * Basic constraints
// * key usage and extended key usage
// TODO: We should add 'authority key identifier' for chaining.
// This algorithm doesn't simply validate the chain by itself
// and verify the last cert is in the certificate store, or points
// to a cert in the store. It validates whether any cert in the chain
// is trusted in the store, even if it's not the last one.
void LLBasicCertificateStore::validate(int validation_policy,
LLPointer<LLCertificateChain> cert_chain,
const LLSD& validation_params)
{
// If --no-verify-ssl-cert was passed on the command line, stop right now.
if (gSavedSettings.getBOOL("NoVerifySSLCert")) return;
if(cert_chain->size() < 1)
{
throw LLCertException(NULL, "No certs in chain");
}
iterator current_cert = cert_chain->begin();
LLSD current_cert_info;
LLSD validation_date;
if (validation_params.has(CERT_VALIDATION_DATE))
{
validation_date = validation_params[CERT_VALIDATION_DATE];
}
if (validation_policy & VALIDATION_POLICY_HOSTNAME)
{
(*current_cert)->getLLSD(current_cert_info);
if(!validation_params.has(CERT_HOSTNAME))
{
throw LLCertException((*current_cert), "No hostname passed in for validation");
}
if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
{
throw LLInvalidCertificate((*current_cert));
}
LL_DEBUGS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() <<
"against the cert CN " << current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString() << LL_ENDL;
if(!_cert_hostname_wildcard_match(validation_params[CERT_HOSTNAME].asString(),
current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString()))
{
throw LLCertValidationHostnameException(validation_params[CERT_HOSTNAME].asString(),
(*current_cert));
}
}
// check the cache of already validated certs
X509* cert_x509 = (*current_cert)->getOpenSSLX509();
if(!cert_x509)
{
throw LLInvalidCertificate((*current_cert));
}
std::string sha1_hash((const char *)cert_x509->sha1_hash, SHA_DIGEST_LENGTH);
t_cert_cache::iterator cache_entry = mTrustedCertCache.find(sha1_hash);
if(cache_entry != mTrustedCertCache.end())
{
LL_DEBUGS("SECAPI") << "Found cert in cache" << LL_ENDL;
// this cert is in the cache, so validate the time.
if (validation_policy & VALIDATION_POLICY_TIME)
{
LLDate validation_date(time(NULL));
if(validation_params.has(CERT_VALIDATION_DATE))
{
validation_date = validation_params[CERT_VALIDATION_DATE];
}
if((validation_date < cache_entry->second.first) ||
(validation_date > cache_entry->second.second))
{
throw LLCertValidationExpirationException((*current_cert), validation_date);
}
}
// successfully found in cache
return;
}
if(current_cert_info.isUndefined())
{
(*current_cert)->getLLSD(current_cert_info);
}
LLDate from_time = current_cert_info[CERT_VALID_FROM].asDate();
LLDate to_time = current_cert_info[CERT_VALID_TO].asDate();
int depth = 0;
LLPointer<LLCertificate> previous_cert;
// loop through the cert chain, validating the current cert against the next one.
while(current_cert != cert_chain->end())
{
int local_validation_policy = validation_policy;
if(current_cert == cert_chain->begin())
{
// for the child cert, we don't validate CA stuff
//.........这里部分代码省略.........
示例14: LL_ERRS
//--------------------------------------------------------------------
// LLPolyMeshSharedData::loadMesh()
//--------------------------------------------------------------------
BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
{
//-------------------------------------------------------------------------
// Open the file
//-------------------------------------------------------------------------
if(fileName.empty())
{
LL_ERRS() << "Filename is Empty!" << LL_ENDL;
return FALSE;
}
LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/
if (!fp)
{
LL_ERRS() << "can't open: " << fileName << LL_ENDL;
return FALSE;
}
//-------------------------------------------------------------------------
// Read a chunk
//-------------------------------------------------------------------------
char header[128]; /*Flawfinder: ignore*/
if (fread(header, sizeof(char), 128, fp) != 128)
{
LL_WARNS() << "Short read" << LL_ENDL;
}
//-------------------------------------------------------------------------
// Check for proper binary header
//-------------------------------------------------------------------------
BOOL status = FALSE;
if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 ) /*Flawfinder: ignore*/
{
LL_DEBUGS() << "Loading " << fileName << LL_ENDL;
//----------------------------------------------------------------
// File Header (seek past it)
//----------------------------------------------------------------
fseek(fp, 24, SEEK_SET);
//----------------------------------------------------------------
// HasWeights
//----------------------------------------------------------------
U8 hasWeights;
size_t numRead = fread(&hasWeights, sizeof(U8), 1, fp);
if (numRead != 1)
{
LL_ERRS() << "can't read HasWeights flag from " << fileName << LL_ENDL;
return FALSE;
}
if (!isLOD())
{
mHasWeights = (hasWeights==0) ? FALSE : TRUE;
}
//----------------------------------------------------------------
// HasDetailTexCoords
//----------------------------------------------------------------
U8 hasDetailTexCoords;
numRead = fread(&hasDetailTexCoords, sizeof(U8), 1, fp);
if (numRead != 1)
{
LL_ERRS() << "can't read HasDetailTexCoords flag from " << fileName << LL_ENDL;
return FALSE;
}
//----------------------------------------------------------------
// Position
//----------------------------------------------------------------
LLVector3 position;
numRead = fread(position.mV, sizeof(float), 3, fp);
llendianswizzle(position.mV, sizeof(float), 3);
if (numRead != 3)
{
LL_ERRS() << "can't read Position from " << fileName << LL_ENDL;
return FALSE;
}
setPosition( position );
//----------------------------------------------------------------
// Rotation
//----------------------------------------------------------------
LLVector3 rotationAngles;
numRead = fread(rotationAngles.mV, sizeof(float), 3, fp);
llendianswizzle(rotationAngles.mV, sizeof(float), 3);
if (numRead != 3)
{
LL_ERRS() << "can't read RotationAngles from " << fileName << LL_ENDL;
return FALSE;
}
U8 rotationOrder;
numRead = fread(&rotationOrder, sizeof(U8), 1, fp);
if (numRead != 1)
{
LL_ERRS() << "can't read RotationOrder from " << fileName << LL_ENDL;
return FALSE;
//.........这里部分代码省略.........
示例15: LL_WARNS
void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LLUUID& region_id)
{
if (!success)
{
// *TODO: is there any kind of error handling we can do here?
LL_WARNS("Materials")<< "failed"<<LL_ENDL;
return;
}
llassert(content.isMap());
llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());
LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
std::string content_string(reinterpret_cast<const char*>(content_binary.data()), content_binary.size());
std::istringstream content_stream(content_string);
LLSD response_data;
if (!unzip_llsd(response_data, content_stream, content_binary.size()))
{
LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
return;
}
get_queue_t::iterator itQueue = mGetQueue.find(region_id);
material_map_t materials;
llassert(response_data.isArray());
LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial)
{
const LLSD& material_data = *itMaterial;
llassert(material_data.isMap());
llassert(material_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
llassert(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].isBinary());
LLMaterialID material_id(material_data[MATERIALS_CAP_OBJECT_ID_FIELD].asBinary());
if (mGetQueue.end() != itQueue)
{
itQueue->second.erase(material_id);
}
llassert(material_data.has(MATERIALS_CAP_MATERIAL_FIELD));
llassert(material_data[MATERIALS_CAP_MATERIAL_FIELD].isMap());
LLMaterialPtr material = setMaterial(region_id, material_id, material_data[MATERIALS_CAP_MATERIAL_FIELD]);
materials[material_id] = material;
}
getall_callback_map_t::iterator itCallback = mGetAllCallbacks.find(region_id);
if (itCallback != mGetAllCallbacks.end())
{
(*itCallback->second)(region_id, materials);
delete itCallback->second;
mGetAllCallbacks.erase(itCallback);
}
if ( (mGetQueue.end() != itQueue) && (itQueue->second.empty()) )
{
mGetQueue.erase(itQueue);
}
LL_DEBUGS("Materials")<< "recording that getAll has been done for region id " << region_id << LL_ENDL;
mGetAllRequested.insert(region_id); // prevents subsequent getAll requests for this region
mGetAllPending.erase(region_id); // Invalidates region_id
}