本文整理汇总了C++中LLPreviewAnim::getItem方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPreviewAnim::getItem方法的具体用法?C++ LLPreviewAnim::getItem怎么用?C++ LLPreviewAnim::getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPreviewAnim
的用法示例。
在下文中一共展示了LLPreviewAnim::getItem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gotAssetForSave
// static
void LLPreviewAnim::gotAssetForSave(LLVFS *vfs,
const LLUUID& asset_uuid,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status)
{
LLPreviewAnim* self = (LLPreviewAnim*) user_data;
//const LLInventoryItem *item = self->getItem();
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
S32 size = file.getSize();
char* buffer = new char[size];
if (buffer == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
file.read((U8*)buffer, size);
// Write it back out...
AIFilePicker* filepicker = AIFilePicker::create();
filepicker->open(LLDir::getScrubbedFileName(self->getItem()->getName()) + ".animatn", FFSAVE_ANIMATN);
filepicker->run(boost::bind(&LLPreviewAnim::gotAssetForSave_continued, buffer, size, filepicker));
}
示例2: auditionAnim
// static
void LLPreviewAnim::auditionAnim( void *userdata )
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
const LLInventoryItem *item = self->getItem();
if(item)
{
LLUUID itemID=item->getAssetUUID();
LLButton* btn = self->getChild<LLButton>("Anim audition btn");
if (btn)
{
btn->toggleState();
}
if (self->childGetValue("Anim audition btn").asBoolean() )
{
self->mPauseRequest = NULL;
gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(itemID);
if (motion)
{
motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
}
}
else
{
gAgent.getAvatarObject()->stopMotion(itemID);
gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
}
}
}
示例3: exportAnim
// static
void LLPreviewAnim::exportAnim( void *userdata )
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
const LLInventoryItem *item = self->getItem();
if(item)
{
if(self->mAnimBuffer == NULL) return;
LLUUID assetID=item->getAssetUUID();
std::string filename = item->getName() + ".bvh";
LLFilePicker& picker = LLFilePicker::instance();
if( !picker.getSaveFile( LLFilePicker::FFSAVE_ALL, filename.c_str() ) )
{
// User canceled save.
return;
}
TSBVHExporter exporter;
LLDataPackerBinaryBuffer dp(self->mAnimBuffer, self->mAnimBufferSize);
if(exporter.deserialize(dp)) {
exporter.exportBVHFile(picker.getFirstFile().c_str());
}
}
}
示例4: copyAnim
/*
void LLPreviewAnim::copyAnim(void *userdata)
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
const LLInventoryItem *item = self->getItem();
if(item)
{
// Some animations aren't hosted on the servers
// I guess they're in this static vfs thing
bool static_vfile = false;
LLVFile* anim_file = new LLVFile(gStaticVFS, item->getAssetUUID(), LLAssetType::AT_ANIMATION);
if (anim_file && anim_file->getSize())
{
//S32 anim_file_size = anim_file->getSize();
//U8* anim_data = new U8[anim_file_size];
//if(anim_file->read(anim_data, anim_file_size))
//{
// static_vfile = true;
//}
static_vfile = true; // for method 2
LLPreviewAnim::gotAssetForCopy(gStaticVFS, item->getAssetUUID(), LLAssetType::AT_ANIMATION, self, 0, 0);
}
delete anim_file;
anim_file = NULL;
if(!static_vfile)
{
// Get it from the servers
gAssetStorage->getAssetData(item->getAssetUUID(), LLAssetType::AT_ANIMATION, LLPreviewAnim::gotAssetForCopy, self, TRUE);
}
}
}
struct LLSaveInfo
{
LLSaveInfo(const LLUUID& item_id, const LLUUID& object_id, const std::string& desc,
const LLTransactionID tid)
: mItemUUID(item_id), mObjectUUID(object_id), mDesc(desc), mTransactionID(tid)
{
}
LLUUID mItemUUID;
LLUUID mObjectUUID;
std::string mDesc;
LLTransactionID mTransactionID;
};
// static
void LLPreviewAnim::gotAssetForCopy(LLVFS *vfs,
const LLUUID& asset_uuid,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status)
{
LLPreviewAnim* self = (LLPreviewAnim*) user_data;
//const LLInventoryItem *item = self->getItem();
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
S32 size = file.getSize();
char* buffer = new char[size];
if (buffer == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
file.read((U8*)buffer, size);
// Write it back out...
LLTransactionID tid;
LLAssetID asset_id;
tid.generate();
asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
LLVFile ofile(gVFS, asset_id, LLAssetType::AT_ANIMATION, LLVFile::APPEND);
ofile.setMaxSize(size);
ofile.write((U8*)buffer, size);
// Upload that asset to the database
LLSaveInfo* info = new LLSaveInfo(self->mItemUUID, self->mObjectUUID, "animation", tid);
gAssetStorage->storeAssetData(tid, LLAssetType::AT_ANIMATION, onSaveCopyComplete, info, FALSE);
delete[] buffer;
buffer = NULL;
}
// static
void LLPreviewAnim::onSaveCopyComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status)
{
LLSaveInfo* info = (LLSaveInfo*)user_data;
if (status == 0)
{
std::string item_name = "New Animation";
std::string item_desc = "";
// Saving into user inventory
LLViewerInventoryItem* item;
//.........这里部分代码省略.........
示例5: exportasdotAnim
void LLPreviewAnim::exportasdotAnim( void *userdata )
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
const LLInventoryItem *item = self->getItem();
//LLVOAvatar* avatar = gAgent.getAvatarObject();
//LLMotion* motion = avatar->findMotion(item->getAssetUUID());
//LLKeyframeMotion* motionp = (LLKeyframeMotion*)motion;
//if (motionp)
{
//U32 size = motionp->getFileSize();
//U8* buffer = new U8[size];
//LLDataPackerBinaryBuffer dp(buffer, size);
//if(motionp->serialize(dp))
{
std::string filename = item->getName() + ".animatn";
LLFilePicker& picker = LLFilePicker::instance();
if(!picker.getSaveFile( LLFilePicker::FFSAVE_ALL, filename.c_str() ) )
{
// User canceled save.
return;
}
std::string name = picker.getFirstFile();
std::string save_filename(name);
LLAPRFile infile ;
infile.open(save_filename.c_str(), LL_APR_WB, LLAPRFile::local);
apr_file_t *fp = infile.getFileHandle();
if(fp)infile.write(self->mAnimBuffer, self->mAnimBufferSize);
infile.close();
}
//delete[] buffer;
}
//whole file imported from onyx thomas shikami gets credit for the exporter
}
示例6: gotAssetForSave
// static
void LLPreviewAnim::gotAssetForSave(LLVFS *vfs,
const LLUUID& asset_uuid,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status)
{
LLPreviewAnim* self = (LLPreviewAnim*) user_data;
//const LLInventoryItem *item = self->getItem();
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
S32 size = file.getSize();
char* buffer = new char[size];
if (buffer == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
return;
}
file.read((U8*)buffer, size);
// Write it back out...
LLFilePicker& file_picker = LLFilePicker::instance();
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_ANIMATN, LLDir::getScrubbedFileName(self->getItem()->getName())) )
{
// User canceled or we failed to acquire save file.
return;
}
// remember the user-approved/edited file name.
std::string filename = file_picker.getFirstFile();
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
export_file.write(buffer, size);
export_file.close();
delete[] buffer;
buffer = NULL;
}
示例7: dupliAnim
void LLPreviewAnim::dupliAnim( void *userdata )
{
LLPreviewAnim* self = (LLPreviewAnim*) userdata;
//if(!self->childGetValue("Anim play btn").asBoolean())
//{
// printchat("anim must be playing to copy by this method; please try again");
// LLPreviewAnim::playAnim( userdata );
// return;
//}
const LLInventoryItem *item = self->getItem();
if(item)
{
if(self->mAnimBuffer == NULL)
{
return;
}
LLKeyframeMotion* motionp = NULL;
//LLBVHLoader* loaderp = NULL;
LLAssetID xMotionID;
LLTransactionID xTransactionID;
// generate unique id for this motion
xTransactionID.generate();
xMotionID = xTransactionID.makeAssetID(gAgent.getSecureSessionID());
motionp = (LLKeyframeMotion*)gAgent.getAvatarObject()->createMotion(xMotionID);
/*
// pass animation data through memory buffer
//loaderp->serialize(dp);
gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(item->getAssetUUID());
LLKeyframeMotion* tmp = (LLKeyframeMotion*)motion;
S32 file_size = tmp->getFileSize();
U8* buffer = new U8[file_size];
LLDataPackerBinaryBuffer dp(buffer, file_size);*/
LLDataPackerBinaryBuffer dp(self->mAnimBuffer, self->mAnimBufferSize);
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLMotion* motion = avatar->findMotion(item->getAssetUUID());
LLKeyframeMotion* tmp = (LLKeyframeMotion*)motion;
tmp->serialize(dp);
dp.reset();
BOOL success = motionp && motionp->deserialize(dp);
//delete []buffer;
if (success)
{
motionp->setName(item->getName());
gAgent.getAvatarObject()->startMotion(xMotionID);
////////////////////////////////////////////////////////////////////
/*LLKeyframeMotion* */motionp = (LLKeyframeMotion*)gAgent.getAvatarObject()->findMotion(xMotionID);
S32 file_size = motionp->getFileSize();
U8* buffer = new U8[file_size];
LLDataPackerBinaryBuffer dp(buffer, file_size);
if (motionp->serialize(dp))
{
LLVFile file(gVFS, motionp->getID(), LLAssetType::AT_ANIMATION, LLVFile::APPEND);
S32 size = dp.getCurrentSize();
file.setMaxSize(size);
if (file.write((U8*)buffer, size))
{
std::string name = item->getName();
std::string desc = item->getDescription();
upload_new_resource(xTransactionID, // tid
LLAssetType::AT_ANIMATION,
name,
desc,
0,
LLAssetType::AT_NONE,
LLInventoryType::IT_ANIMATION,
PERM_NONE,PERM_NONE,PERM_NONE,
name,0,10,0);
}
else
{
llwarns << "Failure writing animation data." << llendl;
LLNotifications::instance().add("WriteAnimationFail");
}
}
delete [] buffer;
// clear out cache for motion data
gAgent.getAvatarObject()->removeMotion(xMotionID);
LLKeyframeDataCache::removeKeyframeData(xMotionID);
////////////////////////////////////////////////////////////////////
//.........这里部分代码省略.........