MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setBitmap

Method setBitmap

Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp:267–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265//-----------------------------------------------------------------------------
266
267void 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;

Callers

nothing calls this directly

Calls 15

_setBitmapFunction · 0.85
dStricmpFunction · 0.85
avarFunction · 0.85
setExtentFunction · 0.85
notNullMethod · 0.80
replaceMethod · 0.80
getImagePathMethod · 0.80
isDeclaredAssetMethod · 0.80
isAwakeFunction · 0.50
GFXTexHandleClass · 0.50
StringClass · 0.50
warnfFunction · 0.50

Tested by

no test coverage detected