コード例 #1
0
LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
{
	lldebugs << "LLWearableList::createNewWearable()" << llendl;

	LLWearable *wearable = generateNewWearable();
	wearable->setType( type );
	
	std::string name = LLWearableType::getTypeDefaultNewName(wearable->getType());
	wearable->setName( name );

	LLPermissions perm;
	perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
	perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER);
	wearable->setPermissions(perm);

	// Description and sale info have default values.
	wearable->setParamsToDefaults();
	wearable->setTexturesToDefaults();

	//mark all values (params & images) as saved
	wearable->saveValues();

	// Send to the dataserver
	wearable->saveNewAsset();


	return wearable;
}
コード例 #2
0
LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std::string& new_name)
{
	lldebugs << "LLWearableList::createCopy()" << llendl;

	LLWearable *wearable = generateNewWearable();
	wearable->copyDataFrom(old_wearable);

	LLPermissions perm(old_wearable->getPermissions());
	perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true);
	wearable->setPermissions(perm);

	if (!new_name.empty()) wearable->setName(new_name);

	// Send to the dataserver
	wearable->saveNewAsset();

	return wearable;
}