diff options
| author | Anchor Linden <anchor@lindenlab.com> | 2018-02-28 22:14:38 -0800 | 
|---|---|---|
| committer | Anchor Linden <anchor@lindenlab.com> | 2018-02-28 22:14:38 -0800 | 
| commit | bfbcd6d16931819c43eea8e83963c9f86c6892dd (patch) | |
| tree | 618356592c438411504c3789f32608ee40e56c79 /indra | |
| parent | d4ce47b09122d1f76601ba402c2b9ad6bb504950 (diff) | |
[MAINT-8081] - bakes on mesh. 1st pass. changed texture panel to select bakes on objects. handle magic bake ids in LLViewerObject.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llappearance/llavatarappearancedefines.cpp | 74 | ||||
| -rw-r--r-- | indra/llappearance/llavatarappearancedefines.h | 4 | ||||
| -rw-r--r-- | indra/llappearance/lltexlayer.cpp | 4 | ||||
| -rw-r--r-- | indra/llcommon/indra_constants.cpp | 7 | ||||
| -rw-r--r-- | indra/llcommon/indra_constants.h | 7 | ||||
| -rw-r--r-- | indra/newview/character/avatar_lad.xml | 20 | ||||
| -rw-r--r-- | indra/newview/lldynamictexture.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/lltexturectrl.cpp | 82 | ||||
| -rw-r--r-- | indra/newview/lltexturectrl.h | 3 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 130 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.h | 4 | ||||
| -rw-r--r-- | indra/newview/llviewertexture.h | 5 | ||||
| -rw-r--r-- | indra/newview/llviewertexturelist.cpp | 7 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.cpp | 44 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.h | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_texture_ctrl.xml | 72 | 
16 files changed, 425 insertions, 43 deletions
| diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp index 17da19a710..9e95b6c154 100644 --- a/indra/llappearance/llavatarappearancedefines.cpp +++ b/indra/llappearance/llavatarappearancedefines.cpp @@ -26,6 +26,7 @@  #include "linden_common.h"  #include "llavatarappearancedefines.h" +#include "indra_constants.h"  const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024;  const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024; @@ -266,3 +267,76 @@ LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIn  	return getInstance()->getTexture(index)->mWearableType;  } +// static +BOOL LLAvatarAppearanceDictionary::isBakedImageId(const LLUUID& id) +{ +	if ((id == IMG_USE_BAKED_EYES) || (id == IMG_USE_BAKED_HAIR) || (id == IMG_USE_BAKED_HEAD) || (id == IMG_USE_BAKED_LOWER) || (id == IMG_USE_BAKED_SKIRT) || (id == IMG_USE_BAKED_UPPER)) +	{ +		return TRUE; +	} + +	return FALSE; +} + +// static  +EBakedTextureIndex LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(const LLUUID& id) +{ +	if (id == IMG_USE_BAKED_EYES) +	{ +		return BAKED_EYES; +	} +	else if (id == IMG_USE_BAKED_HAIR) +	{ +		return BAKED_HAIR; +	} +	else if (id == IMG_USE_BAKED_HEAD) +	{ +		return BAKED_HEAD; +	} +	else if (id == IMG_USE_BAKED_LOWER) +	{ +		return BAKED_LOWER; +	} +	else if (id == IMG_USE_BAKED_SKIRT) +	{ +		return BAKED_SKIRT; +	} +	else if (id == IMG_USE_BAKED_UPPER) +	{ +		return BAKED_UPPER; +	} + +	return BAKED_NUM_INDICES; +} + +//static +LLUUID LLAvatarAppearanceDictionary::localTextureIndexToMagicId(ETextureIndex t) +{ +	LLUUID id = LLUUID::null; + +	switch (t) +	{ +	case LLAvatarAppearanceDefines::TEX_HEAD_BAKED:
 +		id = IMG_USE_BAKED_HEAD;
 +		break;
 +	case LLAvatarAppearanceDefines::TEX_UPPER_BAKED:
 +		id = IMG_USE_BAKED_UPPER;
 +		break;
 +	case LLAvatarAppearanceDefines::TEX_LOWER_BAKED:
 +		id = IMG_USE_BAKED_LOWER;
 +		break;
 +	case LLAvatarAppearanceDefines::TEX_EYES_BAKED:
 +		id = IMG_USE_BAKED_EYES;
 +		break;
 +	case LLAvatarAppearanceDefines::TEX_SKIRT_BAKED:
 +		id = IMG_USE_BAKED_SKIRT;
 +		break;
 +	case LLAvatarAppearanceDefines::TEX_HAIR_BAKED:
 +		id = IMG_USE_BAKED_HAIR;
 +		break;
 +	default:
 +		break; +	} + +	return id; +} diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h index d6223bb4d2..af94ea94f2 100644 --- a/indra/llappearance/llavatarappearancedefines.h +++ b/indra/llappearance/llavatarappearancedefines.h @@ -223,6 +223,10 @@ public:  	// Given a texture entry, determine which wearable type owns it.  	static LLWearableType::EType 		getTEWearableType(ETextureIndex index); +	static BOOL							isBakedImageId(const LLUUID& id); +	static EBakedTextureIndex			assetIdToBakedTextureIndex(const LLUUID& id); +	static LLUUID						localTextureIndexToMagicId(ETextureIndex t); +  }; // End LLAvatarAppearanceDictionary  } // End namespace LLAvatarAppearanceDefines diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index cc7fc73e85..2cf86bb4fe 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -187,8 +187,8 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet()  LLTexLayerSetInfo::LLTexLayerSetInfo() :  	mBodyRegion( "" ), -	mWidth( 1024 ), -	mHeight( 1024 ), +	mWidth( 512 ), +	mHeight( 512 ),  	mClearAlpha( TRUE )  {  } diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp index 7ea42a3fc0..1e85e1c605 100644 --- a/indra/llcommon/indra_constants.cpp +++ b/indra/llcommon/indra_constants.cpp @@ -72,3 +72,10 @@ const LLUUID TERRAIN_ROCK_DETAIL		("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // V  const LLUUID DEFAULT_WATER_NORMAL		("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER +const LLUUID IMG_USE_BAKED_HEAD  ("af238700-22df-5a1f-0818-f9877b30e027"); +const LLUUID IMG_USE_BAKED_UPPER ("b45fc8cc-7ab7-9bf7-bddb-d1053d89fc55"); +const LLUUID IMG_USE_BAKED_LOWER ("040973c3-5e2d-5f0e-6c7a-377bca151f82"); +const LLUUID IMG_USE_BAKED_EYES  ("3769e766-88b6-df79-4c1e-46a588c5adb6"); +const LLUUID IMG_USE_BAKED_SKIRT ("96c3b3d8-9909-ab07-e858-626525a0a345"); +const LLUUID IMG_USE_BAKED_HAIR  ("42f76a58-f1ab-7385-3f4f-da762d69192c"); + diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index fda84aa5a8..28e55b2091 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -207,6 +207,13 @@ LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL;  LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL;  LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL; +LL_COMMON_API extern const LLUUID IMG_USE_BAKED_HEAD; +LL_COMMON_API extern const LLUUID IMG_USE_BAKED_UPPER; +LL_COMMON_API extern const LLUUID IMG_USE_BAKED_LOWER; +LL_COMMON_API extern const LLUUID IMG_USE_BAKED_EYES; +LL_COMMON_API extern const LLUUID IMG_USE_BAKED_SKIRT; +LL_COMMON_API extern const LLUUID IMG_USE_BAKED_HAIR; +  LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL; diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index ee620b39b8..90f06746c9 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -8923,8 +8923,8 @@    <!-- =========================================================== -->    <layer_set      body_region="hair" -    width="1024" -    height="1024" +    width="512" +    height="512"      clear_alpha="false">      <layer        name="base" @@ -8953,8 +8953,8 @@    <layer_set      body_region="head" -    width="1024" -    height="1024"> +    width="512" +    height="512">      <layer         name="head bump base"         fixed_color = "128,128,128,255" @@ -10031,8 +10031,8 @@ render_pass="bump">    <!-- =========================================================== -->    <layer_set     body_region="upper_body" -   width="1024" -   height="1024"> +   width="512" +   height="512">      <layer       name="base_upperbody bump"       render_pass="bump" @@ -11282,8 +11282,8 @@ render_pass="bump">    <!-- =========================================================== -->    <layer_set     body_region="lower_body" -   width="1024" -   height="1024"> +   width="512" +   height="512">      <layer         name="lower body bump base"         fixed_color = "128,128,128,255" @@ -12241,8 +12241,8 @@ render_pass="bump">    <!-- =========================================================== -->    <layer_set     body_region="skirt" -   width="1024" -   height="1024" +   width="512" +   height="512"     clear_alpha="false">      <layer       name="skirt_fabric" diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 87b56f33af..8ef0dd2865 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -126,8 +126,8 @@ BOOL LLViewerDynamicTexture::render()  void LLViewerDynamicTexture::preRender(BOOL clear_depth)  {  	//only images up to 1024*1024 are supported -	llassert(mFullHeight <= 1024); -	llassert(mFullWidth <= 1024); +	llassert(mFullHeight <= 512); +	llassert(mFullWidth <= 512);  	if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI)  	{ //using offscreen render target, just use the bottom left corner diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index c7adaa908f..854d328c71 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -404,6 +404,10 @@ BOOL LLFloaterTexturePicker::postBuild()  	LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); +	getChild<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this); +	getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setCommitCallback(onHideBaseMeshRegionCheck, this); +	 +  	return TRUE;  } @@ -760,22 +764,25 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem  void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)  {  	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; -	bool mode = (self->mModeSelector->getSelectedIndex() == 0); +	int mode = self->mModeSelector->getSelectedIndex(); -	self->getChild<LLButton>("Default")->setVisible(mode); -	self->getChild<LLButton>("Blank")->setVisible(mode); -	self->getChild<LLButton>("None")->setVisible(mode); -	self->getChild<LLButton>("Pipette")->setVisible(mode); -	self->getChild<LLFilterEditor>("inventory search editor")->setVisible(mode); -	self->getChild<LLInventoryPanel>("inventory panel")->setVisible(mode); +	self->getChild<LLButton>("Default")->setVisible(mode == 0); +	self->getChild<LLButton>("Blank")->setVisible(mode == 0); +	self->getChild<LLButton>("None")->setVisible(mode == 0); +	self->getChild<LLButton>("Pipette")->setVisible(mode == 0); +	self->getChild<LLFilterEditor>("inventory search editor")->setVisible(mode == 0); +	self->getChild<LLInventoryPanel>("inventory panel")->setVisible(mode == 0);  	/*self->getChild<LLCheckBox>("show_folders_check")->setVisible(mode);  	  no idea under which conditions the above is even shown, needs testing. */ -	self->getChild<LLButton>("l_add_btn")->setVisible(!mode); -	self->getChild<LLButton>("l_rem_btn")->setVisible(!mode); -	self->getChild<LLButton>("l_upl_btn")->setVisible(!mode); -	self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(!mode); +	self->getChild<LLButton>("l_add_btn")->setVisible(mode == 1); +	self->getChild<LLButton>("l_rem_btn")->setVisible(mode == 1); +	self->getChild<LLButton>("l_upl_btn")->setVisible(mode == 1); +	self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(mode == 1); + +	self->getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(mode == 2); +	self->getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(false);// mode == 2);  }  // static @@ -896,6 +903,59 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da  	picker->commitIfImmediateSet();  } +//static +void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data) +{ +	LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)user_data; +	LLComboBox* combo_box = (LLComboBox*)ctrl; + +	S8 type = combo_box->getValue().asInteger(); +	 +	LLUUID imageID = LLUUID::null; +	if (type == 0) +	{ +		imageID = IMG_USE_BAKED_HEAD; +	} +	else if (type == 1) +	{ +		imageID = IMG_USE_BAKED_UPPER; +	} +	else if (type == 2) +	{ +		imageID = IMG_USE_BAKED_LOWER; +	} +	else if (type == 3) +	{ +		imageID = IMG_USE_BAKED_EYES; +	} +	else if (type == 4) +	{ +		imageID = IMG_USE_BAKED_SKIRT; +	} +	else if (type == 5) +	{ +		imageID = IMG_USE_BAKED_HAIR; +	} + +	if (imageID.notNull()) +	{ +		self->setCanApply(true, true); +		self->setImageID(imageID); +		self->commitIfImmediateSet(); +	} +	else +	{ +		onBtnCancel(self); +	} +} + +//static +void LLFloaterTexturePicker::onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *user_data) +{ +	//LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; +	//LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; +} +  void LLFloaterTexturePicker::updateFilterPermMask()  {  	//mInventoryPanel->setFilterPermMask( getFilterPermMask() );  Commented out due to no-copy texture loss. diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 840feddfaf..e70849e5c9 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -322,6 +322,9 @@ public:  	static void		onBtnUpload(void* userdata);  	static void		onLocalScrollCommit(LLUICtrl* ctrl, void* userdata); +	static void		onBakeTextureSelect(LLUICtrl* ctrl, void *userdata); +	static void		onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata); +  	void 			setLocalTextureEnabled(BOOL enabled);  protected: diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 5de4029542..1bc3b3c726 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4358,31 +4358,119 @@ void LLViewerObject::sendTEUpdate() const  	// TODO send media type + +	const U32 MAX_TES = 32; + +	LLUUID texture_id[MAX_TES]; +	S32 last_face_index = llmin((U32)getNumTEs(), MAX_TES) - 1; + +	if (last_face_index > -1) +	{ +		S8 face_index; +		for (face_index = 0; face_index <= last_face_index; face_index++) +		{ +			LLTextureEntry* entry = getTE((U8)face_index); +			texture_id[face_index] = entry->getID(); + +			LLViewerFetchedTexture* fetched_texture = gTextureList.findImage(entry->getID(), TEX_LIST_STANDARD); +			if (fetched_texture && fetched_texture->getFTType() == FTT_SERVER_BAKE) +			{ +				const LLUUID new_id = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::localTextureIndexToMagicId((LLAvatarAppearanceDefines::ETextureIndex)fetched_texture->getBakedTextureIndex()); +				entry->setID(new_id.notNull() ? new_id : IMG_DEFAULT_AVATAR); +			} +		} +	} +  	packTEMessage(msg); +	if (last_face_index > -1) +	{ +		S8 face_index; +		for (face_index = 0; face_index <= last_face_index; face_index++) +		{ +			LLTextureEntry* entry = getTE((U8)face_index); +			entry->setID(texture_id[face_index]); +		} +	} +  	LLViewerRegion *regionp = getRegion();  	msg->sendReliable( regionp->getHost() );  } +LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) +{ +	if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) +	{ +		return NULL; +	} + +	LLVOAvatar* avatar = getAvatar(); +	if (avatar) +	{ +		LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); +		return avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); +	} + +	return NULL; +} + +LLTextureEntry* LLViewerObject::getBakedTextureEntryForMagicId(const LLUUID& id) +{ +	if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) +	{ +		return NULL; +	} + +	LLVOAvatar* avatar = getAvatar(); +	if (avatar) +	{ +		LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); +		return avatar->getTE(texIndex); +	} + +	return NULL; +} +  void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry)  { -	LLPrimitive::setTE(te, texture_entry); +	const LLTextureEntry* baked_entry = getBakedTextureEntryForMagicId(texture_entry.getID()); +	if (baked_entry) +	{ +		LLPrimitive::setTE(te, *baked_entry); + +		const LLUUID& image_id = baked_entry->getID(); +		mTEImages[te] = getBakedTextureForMagicId(image_id); +	} +	else +	{ +		LLPrimitive::setTE(te, texture_entry);  		const LLUUID& image_id = getTE(te)->getID();  		mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); -	 -	if (getTE(te)->getMaterialParams().notNull()) -	{ -		const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); -		mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); -		 -		const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); -		mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + +		if (getTE(te)->getMaterialParams().notNull()) +		{ +			const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); +			mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + +			const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); +			mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); +		}  	} +	  }  void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep)  { +	if (imagep) +	{ +		LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); +		if (baked_texture) +		{ +			imagep = baked_texture; +		} +	} +  	if (mTEImages[te] != imagep)  	{  		mTEImages[te] = imagep; @@ -4397,6 +4485,15 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep)  S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image)  { +	if (image) +	{ +		LLViewerTexture* baked_texture = getBakedTextureForMagicId(image->getID()); +		if (baked_texture) +		{ +			image = baked_texture; +		} +	} +  	const LLUUID& uuid = image->getID();  	S32 retval = 0;  	if (uuid != getTE(te)->getID() || @@ -4492,9 +4589,18 @@ void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image)  S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid)  {  	// Invalid host == get from the agent's sim -	LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( -		uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); -	return setTETextureCore(te,image); + +	LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); +	if (baked_texture) +	{ +		return setTETextureCore(te, baked_texture); +	} +	else +	{ +		LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( +			uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); +		return setTETextureCore(te, image); +	}  }  S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 7a490f6957..bac96991fa 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -566,6 +566,10 @@ public:  	friend class LLViewerObjectList;  	friend class LLViewerMediaList; +private: +	LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id); +	LLTextureEntry*  getBakedTextureEntryForMagicId(const LLUUID& id); +  public:  	static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name);  	static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name); diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index c9dea17f63..2bd2f83e93 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -417,6 +417,9 @@ public:  	void        setInFastCacheList(bool in_list) { mInFastCacheList = in_list; }  	bool        isInFastCacheList() { return mInFastCacheList; } +	U8			getBakedTextureIndex() { return mBakedTextureIndex; } +	void		setBakedTextureIndex(U8 index) { mBakedTextureIndex = index; } +  	/*virtual*/bool  isActiveFetching(); //is actively in fetching by the fetching pipeline.  protected: @@ -519,6 +522,8 @@ protected:  	BOOL   mForSculpt ; //a flag if the texture is used as sculpt data.  	BOOL   mIsFetched ; //is loaded from remote or from cache, not generated locally. +	U8		mBakedTextureIndex; //for FTT_SERVER_BAKE fetched textures +  public:  	static LLPointer<LLViewerFetchedTexture> sMissingAssetImagep;	// Texture to show for an image asset that is not in the database  	static LLPointer<LLViewerFetchedTexture> sWhiteImagep;	// Texture to show NOTHING (whiteness) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index d7080051da..ce32bb186f 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -61,6 +61,8 @@  #include "llviewerdisplay.h"  #include "llviewerwindow.h"  #include "llprogressview.h" + +#include "llvoavatarself.h"  ////////////////////////////////////////////////////////////////////////////  void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL; @@ -503,12 +505,15 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id,  	// If the image is not found, creates new image and  	// enqueues a request for transmission +	LLPointer<LLViewerFetchedTexture> imagep = NULL; +  	if (image_id.isNull())  	{  		return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI));  	} -	LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority)); +	imagep = imagep.isNull() ? findImage(image_id, get_element_type(boost_priority)) : imagep; +	  	if (!imagep.isNull())  	{  		LLViewerFetchedTexture *texture = imagep.get(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index eae8f2cc56..af98f78d0d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2224,6 +2224,8 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU  		{  			result->setIsMissingAsset(false);  		} +		 +		result->setBakedTextureIndex(te);  	}  	return result;  } @@ -7413,6 +7415,9 @@ void LLVOAvatar::updateMeshTextures()  		removeMissingBakedTextures();	// May call back into this function if anything is removed  		call_remove_missing = true;  	} + +	 +  }  // virtual @@ -8189,6 +8194,45 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte  	}  	updateMeshTextures(); + +	//refresh bakes on any attached objects +	for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); +		iter != mAttachmentPoints.end(); +		++iter) +	{ +		LLViewerJointAttachment* attachment = iter->second; + +		for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); +			attachment_iter != attachment->mAttachedObjects.end(); +			++attachment_iter) +		{ +			LLViewerObject* attached_object = (*attachment_iter); + +			const U32 MAX_TES = 32; + +			S32 last_face_index = llmin((U32)attached_object->getNumTEs(), MAX_TES) - 1; + +			if (last_face_index > -1) +			{ +				S8 face_index; +				for (face_index = 0; face_index <= last_face_index; face_index++) +				{ +					LLViewerTexture* viewer_texture = attached_object->getTEImage((U8)face_index); + +					if (viewer_texture && ( (viewer_texture->getType() == LLViewerTexture::FETCHED_TEXTURE) || (viewer_texture->getType() == LLViewerTexture::LOD_TEXTURE) )) +					{ +						LLViewerFetchedTexture* fetched_texture = dynamic_cast<LLViewerFetchedTexture*>(viewer_texture); +						if (fetched_texture->getFTType() == FTT_SERVER_BAKE) +						{ +							const LLUUID new_id = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::localTextureIndexToMagicId((LLAvatarAppearanceDefines::ETextureIndex)fetched_texture->getBakedTextureIndex()); +							attached_object->setTETexture(face_index, new_id); +						} + +					} +				} +			} +		} +	}  }  // static diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bd89d4ef23..4f876533ee 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -569,6 +569,7 @@ public:  public:  	/*virtual*/ LLTexLayerSet*	createTexLayerSet(); // Return LLViewerTexLayerSet  	void			releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY ! +  protected:  	static void		onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);  	static void		onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 53618b684b..9bce037cba 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -52,7 +52,7 @@       control_name="mode_selection"       height="20"       layout="topleft" -     left="18" +     left="0"       top_pad="80"       name="mode_selection"       follows="left|top"> @@ -64,7 +64,7 @@           height="16"            left="0"            value="0" -         width="80" /> +         width="70" />          <radio_item           label="Local"           left_pad="0" @@ -73,7 +73,16 @@           height="16"            name="local"           value="1" -         width="75" /> +         width="50" /> +       <radio_item +         label="Bake" +         left_pad="0" +         layout="topleft" +         top_delta="0" +         height="16" +         name="bake" +         value="2" +         width="50" />      </radio_group>  	<!-- --> @@ -83,7 +92,7 @@       follows="left|top"       height="14"       layout="topleft" -     left_delta="-12" +     left_delta="12"       name="unknown"       top_pad="4">          Size: [DIMENSIONS] @@ -225,7 +234,60 @@          <column name="unit_name" label="Name" dynamicwidth="true" />          <column name="unit_id_HIDDEN" label="ID" width="0" />      </scroll_list> -      + +<!-- middle: bake mode --> +  <combo_box +         left="180" +         top="30" +			   height="19" +			   top_delta="15" +			   layout="topleft" +			   follows="left|top" +			   name="l_bake_use_texture_combo_box" +			   tool_tip="Choose the bake texture" +			   width="108" +         visible="false"> +        <combo_box.item +         label="None" +         name="None" +         value="-1" /> +        <combo_box.item +         label="BAKED_HEAD" +         name="BAKED_HEAD" +         value="0" /> +        <combo_box.item +         label="BAKED_UPPER" +         name="BAKED_UPPER" +         value="1" /> +        <combo_box.item +         label="BAKED_LOWER" +         name="BAKED_LOWER" +         value="2" /> +        <combo_box.item +         label="BAKED_EYES" +         name="BAKED_EYES" +         value="3" /> +        <combo_box.item +         label="BAKED_SKIRT" +         name="BAKED_SKIRT" +         value="4" /> +        <combo_box.item +         label="BAKED_HAIR" +         name="BAKED_HAIR" +         value="5" /> +  </combo_box> +  <check_box +     follows="left|top" +     height="20" +     initial_value="false" +     label="Hide Base Mesh Region" +     layout="topleft" +     name="hide_base_mesh_region" +     left_delta="0" +     top_pad="10" +     top_delta="0" +     width="120"  +     visible="false"/>  <!-- bottom static -->      <button       follows="bottom" | 
