当前位置: 首页>>代码示例>>C++>>正文


C++ LLViewerInventoryItem::fetchFromServer方法代码示例

本文整理汇总了C++中LLViewerInventoryItem::fetchFromServer方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerInventoryItem::fetchFromServer方法的具体用法?C++ LLViewerInventoryItem::fetchFromServer怎么用?C++ LLViewerInventoryItem::fetchFromServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLViewerInventoryItem的用法示例。


在下文中一共展示了LLViewerInventoryItem::fetchFromServer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: show

// static
LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus)
{
	LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id);
	if (previewp)
	{
		previewp->open();   /*Flawfinder: ignore*/
		if (take_focus)
		{
			previewp->setFocus(TRUE);
		}
		return previewp;
	}

	LLPreviewGesture* self = new LLPreviewGesture();

	// Finish internal construction
	self->init(item_id, object_id);

	// Builds and adds to gFloaterView
	gUICtrlFactory->buildFloater(self, "floater_preview_gesture.xml");
	self->setTitle(title);

	// Move window to top-left of screen
	LLMultiFloater* hostp = self->getHost();
	if (hostp == NULL)
	{
		LLRect r = self->getRect();
		LLRect screen = gFloaterView->getRect();
		r.setLeftTopAndSize(0, screen.getHeight(), r.getWidth(), r.getHeight());
		self->setRect(r);
	}
	else
	{
		// re-add to host to update title
		hostp->addFloater(self, TRUE);
	}

	// this will call refresh when we have everything.
	LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
	if(item && !item->isComplete())
	{
		LLInventoryGestureAvailable* observer;
		observer = new LLInventoryGestureAvailable();
		observer->watchItem(item_id);
		gInventory.addObserver(observer);
		item->fetchFromServer();
	}
	else
	{
		// not sure this is necessary.
		self->refresh();
	}

	if (take_focus)
	{
		self->setFocus(TRUE);
	}

	return self;
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:61,代码来源:llpreviewgesture.cpp

示例2: onClickUpdate

// static
void LLFloaterProperties::onClickUpdate(void* user_data)
{
	LLFloaterProperties* floaterp = (LLFloaterProperties*)user_data;
	if(floaterp)
	{
		LLViewerInventoryItem* item = (LLViewerInventoryItem*)floaterp->findItem();
		if(item)
		{
			std::string str(floaterp->childGetValue("item_text").asString());
			std::string::size_type pos;
			while((pos = str.find("    ")) != std::string::npos)
			{
				str.replace(pos, 4, "\t");
			}
			
			std::istringstream strm(str);
			item->importLegacyStream(strm);

			if(floaterp->mObjectID.isNull())
			{
				// This is in the agent's inventory.
				item->updateServer(FALSE);
				gInventory.updateItem(item);
				gInventory.notifyObservers();

				item->setComplete(FALSE);
				item->fetchFromServer();
			}
			else
			{
				// This is in an object's contents.
				LLViewerObject* object = gObjectList.findObject(floaterp->mObjectID);
				if(object)
				{
					object->updateInventory(
						item,
						TASK_INVENTORY_ITEM_KEY,
						false);
					object->fetchInventoryFromServer();
				}
			}
		}
	}
}
开发者ID:DcLumen,项目名称:Inertia,代码行数:45,代码来源:llfloaterproperties.cpp

示例3: show

// static
LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus)
{
	LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id);
	if (previewp)
	{
		previewp->open();   /*Flawfinder: ignore*/
		if (take_focus)
		{
			previewp->setFocus(TRUE);
		}
		return previewp;
	}

	LLPreviewGesture* self = new LLPreviewGesture();

	// Finish internal construction
	self->init(item_id, object_id);

	// Builds and adds to gFloaterView
	LLUICtrlFactory::getInstance()->buildFloater(self, "floater_preview_gesture.xml");
	self->setTitle(title);

	// Move window to top-left of screen
	LLMultiFloater* hostp = self->getHost();
	if (hostp == NULL)
	{
		LLRect r = self->getRect();
		LLRect screen = gFloaterView->getRect();
		r.setLeftTopAndSize(0, screen.getHeight(), r.getWidth(), r.getHeight());
		self->setRect(r);
	}
	else
	{
		// re-add to host to update title
		hostp->addFloater(self, TRUE);
	}

	// Start speculative download of sounds and animations
	const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION);
	LLInventoryModelBackgroundFetch::instance().start(animation_folder_id);

	const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND);
	LLInventoryModelBackgroundFetch::instance().start(sound_folder_id);

	// this will call refresh when we have everything.
	LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
	if(item && !item->isFinished())
	{
		LLInventoryGestureAvailable* observer;
		observer = new LLInventoryGestureAvailable();
		observer->watchItem(item_id);
		gInventory.addObserver(observer);
		item->fetchFromServer();
	}
	else
	{
		// not sure this is necessary.
		self->refresh();
	}

	if (take_focus)
	{
		self->setFocus(TRUE);
	}

	return self;
}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:68,代码来源:llpreviewgesture.cpp

示例4: writeToAvatar

// Updates the user's avatar's appearance
void LLWearable::writeToAvatar( BOOL set_by_user )
{
	LLVOAvatar* avatar = gAgent.getAvatarObject();
	llassert( avatar );
	if( !avatar )
	{
		return;
	}

	ESex old_sex = avatar->getSex();

	// Pull params
	for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
	{
		if (((LLViewerVisualParam*)param)->getWearableType() == mType && param->isTweakable())
		{
			S32 param_id = param->getID();
			F32 weight = get_if_there(mVisualParamMap, param_id, param->getDefaultWeight());
			// only animate with user-originated changes
			if (set_by_user)
			{
				param->setAnimationTarget(weight, set_by_user);
			}
			else
			{
				avatar->setVisualParamWeight( param_id, weight, set_by_user );
			}
		}
	}

	// only interpolate with user-originated changes
	if (set_by_user)
	{
		avatar->startAppearanceAnimation(TRUE, TRUE);
	}

	// Pull texture entries
	for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
	{
		if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
		{
			const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) );
			LLViewerImage* image = gImageList.getImage( image_id );
			avatar->setLocTexTE( te, image, set_by_user );
		}
	}

	avatar->updateVisualParams();

	if( gFloaterCustomize )
	{
		LLViewerInventoryItem* item;
		item = (LLViewerInventoryItem*)gInventory.getItem(gAgent.getWearableItem(mType));
		U32 perm_mask = PERM_NONE;
		BOOL is_complete = FALSE;
		if(item)
		{
			perm_mask = item->getPermissions().getMaskOwner();
			is_complete = item->isComplete();
			if(!is_complete)
			{
				item->fetchFromServer();
			}
		}
		gFloaterCustomize->setWearable(mType, this, perm_mask, is_complete);
		LLFloaterCustomize::setCurrentWearableType( mType );
	}

	ESex new_sex = avatar->getSex();
	if( old_sex != new_sex )
	{
		avatar->updateSexDependentLayerSets( set_by_user );
	}	
	
	avatar->updateMeshTextures();

//	if( set_by_user )
//	{
//		gAgent.sendAgentSetAppearance();
//	}
}
开发者ID:Avian-IW,项目名称:InWorldz-Viewer,代码行数:82,代码来源:llwearable.cpp

示例5: backgroundFetch


//.........这里部分代码省略.........
                {
                    // Category exists but has no children yet, fetch the descendants
                    // for now, just request every time and rely on retry timer to throttle.
                    if (cat->fetch())
                    {
                        mFetchTimer.reset();
                        mTimelyFetchPending = TRUE;
                    }
                    else
                    {
                        //  The catagory also tracks if it has expired and here it says it hasn't
                        //  yet.  Get out of here because nothing is going to happen until we
                        //  update the timers.
                        break;
                    }
                }
                // Do I have all my children?
                else if (gInventory.isCategoryComplete(info.mUUID))
                {
                    // Finished with this category, remove from queue.
                    mFetchQueue.pop_front();

                    // Add all children to queue.
                    LLInventoryModel::cat_array_t* categories;
                    gInventory.getDirectDescendentsOf(cat->getUUID(), categories);
                    for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
                            it != categories->end();
                            ++it)
                    {
                        mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
                    }

                    // We received a response in less than the fast time.
                    if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
                    {
                        // Shrink timeouts based on success.
                        mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
                        mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
                        lldebugs << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
                    }

                    mTimelyFetchPending = FALSE;
                    continue;
                }
                else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
                {
                    // Received first packet, but our num descendants does not match db's num descendants
                    // so try again later.
                    mFetchQueue.pop_front();

                    if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
                    {
                        // push on back of queue
                        mFetchQueue.push_back(info);
                    }
                    mTimelyFetchPending = FALSE;
                    mFetchTimer.reset();
                    break;
                }

                // Not enough time has elapsed to do a new fetch
                break;
            }
            else
            {
                LLViewerInventoryItem* itemp = gInventory.getItem(info.mUUID);

                mFetchQueue.pop_front();
                if (!itemp)
                {
                    continue;
                }

                if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches)
                {
                    itemp->fetchFromServer();
                    mFetchTimer.reset();
                    mTimelyFetchPending = TRUE;
                }
                else if (itemp->mIsComplete)
                {
                    mTimelyFetchPending = FALSE;
                }
                else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
                {
                    mFetchQueue.push_back(info);
                    mFetchTimer.reset();
                    mTimelyFetchPending = FALSE;
                }
                // Not enough time has elapsed to do a new fetch
                break;
            }
        }

        //
        // DEPRECATED OLD CODE
        //--------------------------------------------------------------------------------
#endif
    }
}
开发者ID:nathanmarck,项目名称:VoodooNxg,代码行数:101,代码来源:llinventorymodelbackgroundfetch.cpp


注:本文中的LLViewerInventoryItem::fetchFromServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。