diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloateravatartextures.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloateravatartextures.cpp | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloateravatartextures.cpp b/linden/indra/newview/llfloateravatartextures.cpp new file mode 100644 index 0000000..8ff65ab --- /dev/null +++ b/linden/indra/newview/llfloateravatartextures.cpp | |||
@@ -0,0 +1,199 @@ | |||
1 | /** | ||
2 | * @file llfloateravatartextures.cpp | ||
3 | * @brief Debugging view showing underlying avatar textures and baked textures. | ||
4 | * | ||
5 | * Copyright (c) 2006-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llfloateravatartextures.h" | ||
31 | |||
32 | #include "lltexturectrl.h" | ||
33 | |||
34 | #include "llvieweruictrlfactory.h" | ||
35 | #include "llviewerobjectlist.h" | ||
36 | #include "llvoavatar.h" | ||
37 | |||
38 | LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) : | ||
39 | LLFloater("avatar_texture_debug"), | ||
40 | mID(id) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | LLFloaterAvatarTextures::~LLFloaterAvatarTextures() | ||
45 | { | ||
46 | } | ||
47 | |||
48 | LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id) | ||
49 | { | ||
50 | |||
51 | LLFloaterAvatarTextures* floaterp = new LLFloaterAvatarTextures(id); | ||
52 | |||
53 | // Builds and adds to gFloaterView | ||
54 | gUICtrlFactory->buildFloater(floaterp, "floater_avatar_textures.xml"); | ||
55 | |||
56 | gFloaterView->addChild(floaterp); | ||
57 | floaterp->open(); | ||
58 | |||
59 | gFloaterView->adjustToFitScreen(floaterp, FALSE); | ||
60 | |||
61 | return floaterp; | ||
62 | } | ||
63 | |||
64 | BOOL LLFloaterAvatarTextures::postBuild() | ||
65 | { | ||
66 | mBakedHead = (LLTextureCtrl*)getChildByName("baked_head"); | ||
67 | mBakedEyes = (LLTextureCtrl*)getChildByName("baked_eyes"); | ||
68 | mBakedUpper = (LLTextureCtrl*)getChildByName("baked_upper_body"); | ||
69 | mBakedLower = (LLTextureCtrl*)getChildByName("baked_lower_body"); | ||
70 | mBakedSkirt = (LLTextureCtrl*)getChildByName("baked_skirt"); | ||
71 | mHair = (LLTextureCtrl*)getChildByName("hair"); | ||
72 | mMakeup = (LLTextureCtrl*)getChildByName("head_bodypaint"); | ||
73 | mEye = (LLTextureCtrl*)getChildByName("eye_texture"); | ||
74 | mShirt = (LLTextureCtrl*)getChildByName("shirt"); | ||
75 | mUpperTattoo = (LLTextureCtrl*)getChildByName("upper_bodypaint"); | ||
76 | mUpperJacket = (LLTextureCtrl*)getChildByName("upper_jacket"); | ||
77 | mGloves = (LLTextureCtrl*)getChildByName("gloves"); | ||
78 | mUndershirt = (LLTextureCtrl*)getChildByName("undershirt"); | ||
79 | mPants = (LLTextureCtrl*)getChildByName("pants"); | ||
80 | mLowerTattoo = (LLTextureCtrl*)getChildByName("lower_bodypaint"); | ||
81 | mShoes = (LLTextureCtrl*)getChildByName("shoes"); | ||
82 | mSocks = (LLTextureCtrl*)getChildByName("socks"); | ||
83 | mJacket = (LLTextureCtrl*)getChildByName("jacket"); | ||
84 | mUnderpants = (LLTextureCtrl*)getChildByName("underpants"); | ||
85 | mSkirt = (LLTextureCtrl*)getChildByName("skirt_texture"); | ||
86 | mTitle = getTitle(); | ||
87 | |||
88 | childSetAction("Dump", onClickDump, this); | ||
89 | |||
90 | refresh(); | ||
91 | return TRUE; | ||
92 | } | ||
93 | |||
94 | void LLFloaterAvatarTextures::draw() | ||
95 | { | ||
96 | refresh(); | ||
97 | LLFloater::draw(); | ||
98 | } | ||
99 | |||
100 | static void update_texture_ctrl(LLVOAvatar* avatarp, | ||
101 | LLTextureCtrl* ctrl, | ||
102 | LLVOAvatar::ETextureIndex te) | ||
103 | { | ||
104 | LLUUID id = avatarp->getTE(te)->getID(); | ||
105 | if (id == IMG_DEFAULT_AVATAR) | ||
106 | { | ||
107 | ctrl->setImageAssetID(LLUUID::null); | ||
108 | ctrl->setToolTip("IMG_DEFAULT_AVATAR"); | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | ctrl->setImageAssetID(id); | ||
113 | ctrl->setToolTip(id.getString()); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | static LLVOAvatar* find_avatar(const LLUUID& id) | ||
118 | { | ||
119 | LLViewerObject *obj = gObjectList.findObject(id); | ||
120 | while (obj && obj->isAttachment()) | ||
121 | { | ||
122 | obj = (LLViewerObject *)obj->getParent(); | ||
123 | } | ||
124 | |||
125 | if (obj && obj->isAvatar()) | ||
126 | { | ||
127 | return (LLVOAvatar*)obj; | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | return NULL; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | void LLFloaterAvatarTextures::refresh() | ||
136 | { | ||
137 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
138 | LLVOAvatar *avatarp = find_avatar(mID); | ||
139 | if (avatarp) | ||
140 | { | ||
141 | char firstname[DB_FIRST_NAME_BUF_SIZE]; | ||
142 | char lastname[DB_LAST_NAME_BUF_SIZE]; | ||
143 | if (gCacheName->getName(avatarp->getID(), firstname, lastname)) | ||
144 | { | ||
145 | LLString name; | ||
146 | name.assign( firstname ); | ||
147 | name.append( " " ); | ||
148 | name.append( lastname ); | ||
149 | |||
150 | setTitle(mTitle + ": " + name); | ||
151 | } | ||
152 | update_texture_ctrl(avatarp, mBakedHead, LLVOAvatar::TEX_HEAD_BAKED); | ||
153 | update_texture_ctrl(avatarp, mBakedEyes, LLVOAvatar::TEX_EYES_BAKED); | ||
154 | update_texture_ctrl(avatarp, mBakedUpper, LLVOAvatar::TEX_UPPER_BAKED); | ||
155 | update_texture_ctrl(avatarp, mBakedLower, LLVOAvatar::TEX_LOWER_BAKED); | ||
156 | update_texture_ctrl(avatarp, mBakedSkirt, LLVOAvatar::TEX_SKIRT_BAKED); | ||
157 | |||
158 | update_texture_ctrl(avatarp, mMakeup, LLVOAvatar::TEX_HEAD_BODYPAINT); | ||
159 | update_texture_ctrl(avatarp, mHair, LLVOAvatar::TEX_HAIR); | ||
160 | update_texture_ctrl(avatarp, mEye, LLVOAvatar::TEX_EYES_IRIS); | ||
161 | |||
162 | update_texture_ctrl(avatarp, mShirt, LLVOAvatar::TEX_UPPER_SHIRT); | ||
163 | update_texture_ctrl(avatarp, mUpperTattoo, LLVOAvatar::TEX_UPPER_BODYPAINT); | ||
164 | update_texture_ctrl(avatarp, mUpperJacket, LLVOAvatar::TEX_UPPER_JACKET); | ||
165 | update_texture_ctrl(avatarp, mGloves, LLVOAvatar::TEX_UPPER_GLOVES); | ||
166 | update_texture_ctrl(avatarp, mUndershirt, LLVOAvatar::TEX_UPPER_UNDERSHIRT); | ||
167 | |||
168 | update_texture_ctrl(avatarp, mPants, LLVOAvatar::TEX_LOWER_PANTS); | ||
169 | update_texture_ctrl(avatarp, mLowerTattoo, LLVOAvatar::TEX_LOWER_BODYPAINT); | ||
170 | update_texture_ctrl(avatarp, mShoes, LLVOAvatar::TEX_LOWER_SHOES); | ||
171 | update_texture_ctrl(avatarp, mSocks, LLVOAvatar::TEX_LOWER_SOCKS); | ||
172 | update_texture_ctrl(avatarp, mJacket, LLVOAvatar::TEX_LOWER_JACKET); | ||
173 | update_texture_ctrl(avatarp, mUnderpants, LLVOAvatar::TEX_LOWER_UNDERPANTS); | ||
174 | update_texture_ctrl(avatarp, mSkirt, LLVOAvatar::TEX_SKIRT); | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | setTitle(mTitle + ": INVALID AVATAR (" + mID.getString() + ")"); | ||
179 | } | ||
180 | #endif | ||
181 | } | ||
182 | |||
183 | // static | ||
184 | void LLFloaterAvatarTextures::onClickDump(void* data) | ||
185 | { | ||
186 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
187 | LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data; | ||
188 | LLVOAvatar* avatarp = find_avatar(self->mID); | ||
189 | if (!avatarp) return; | ||
190 | |||
191 | for (S32 i = 0; i < avatarp->getNumTEs(); i++) | ||
192 | { | ||
193 | const LLTextureEntry* te = avatarp->getTE(i); | ||
194 | if (!te) continue; | ||
195 | |||
196 | llinfos << "Avatar TE " << i << " id " << te->getID() << llendl; | ||
197 | } | ||
198 | #endif | ||
199 | } | ||