| 265 | //----------------------------------------------------------------------------- |
| 266 | |
| 267 | void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name ) |
| 268 | { |
| 269 | PROFILE_SCOPE( GuiBitmapButtonCtrl_setBitmap ); |
| 270 | |
| 271 | _setBitmap(name); |
| 272 | if( !isAwake() ) |
| 273 | return; |
| 274 | |
| 275 | if( mBitmapAsset.notNull()) |
| 276 | { |
| 277 | if( dStricmp( getBitmap(), "texhandle" ) != 0 ) |
| 278 | { |
| 279 | const U32 count = mUseModifiers ? NumModifiers : 1; |
| 280 | for( U32 i = 0; i < count; ++ i ) |
| 281 | { |
| 282 | static String modifiers[] = |
| 283 | { |
| 284 | "", |
| 285 | "_ctrl", |
| 286 | "_alt", |
| 287 | "_shift" |
| 288 | }; |
| 289 | |
| 290 | static String s_n[2] = { "_n", "_n_image" }; |
| 291 | static String s_d[2] = { "_d", "_d_image" }; |
| 292 | static String s_h[2] = { "_h", "_h_image" }; |
| 293 | static String s_i[2] = { "_i", "_i_image" }; |
| 294 | |
| 295 | String baseName = mBitmapAssetId; |
| 296 | |
| 297 | //strip any pre-assigned suffix, just in case |
| 298 | baseName = baseName.replace("_n_image", ""); |
| 299 | baseName = baseName.replace("_n", ""); |
| 300 | |
| 301 | if( mUseModifiers ) |
| 302 | baseName += modifiers[ i ]; |
| 303 | |
| 304 | mTextures[ i ].mTextureNormal = GFXTexHandle( mBitmapAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); |
| 305 | |
| 306 | if( mUseStates ) |
| 307 | { |
| 308 | //normal lookup |
| 309 | StringTableEntry lookupName; |
| 310 | for (U32 s = 0; s < 2; s++) |
| 311 | { |
| 312 | if (!mTextures[i].mTextureNormal) |
| 313 | { |
| 314 | lookupName = StringTable->insert(String(baseName + s_n[s]).c_str()); |
| 315 | if (AssetDatabase.isDeclaredAsset(lookupName)) |
| 316 | { |
| 317 | mTextures[i].mTextureNormalAssetId = lookupName; |
| 318 | mTextures[i].mTextureNormalAsset = mTextures[i].mTextureNormalAssetId; |
| 319 | } |
| 320 | |
| 321 | if (mTextures[i].mTextureNormalAsset.notNull() && mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok) |
| 322 | { |
| 323 | mTextures[i].mTextureNormal = GFXTexHandle(mTextures[i].mTextureNormalAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); |
| 324 | break; |
nothing calls this directly
no test coverage detected