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

Method setImage

Engine/source/T3D/shapeImage.cpp:2260–2434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2258//----------------------------------------------------------------------------
2259
2260void ShapeBase::setImage( U32 imageSlot,
2261 ShapeBaseImageData* imageData,
2262 NetStringHandle& skinNameHandle,
2263 bool loaded,
2264 bool ammo,
2265 bool triggerDown,
2266 bool altTriggerDown,
2267 bool motion,
2268 bool genericTrigger0,
2269 bool genericTrigger1,
2270 bool genericTrigger2,
2271 bool genericTrigger3,
2272 bool target)
2273{
2274 AssertFatal(imageSlot<MaxMountedImages,"Out of range image slot");
2275
2276 MountedImage& image = mMountedImageList[imageSlot];
2277
2278 // If we already have this datablock...
2279 if (image.dataBlock == imageData) {
2280 // Mark that there is not a datablock change pending.
2281 image.nextImage = InvalidImagePtr;
2282 // Change the skin handle if necessary.
2283 if (image.skinNameHandle != skinNameHandle) {
2284 if (!isGhost()) {
2285 // Serverside, note the skin handle and tell the client.
2286 image.skinNameHandle = skinNameHandle;
2287 setMaskBits(ImageMaskN << imageSlot);
2288 }
2289 else {
2290 // Clientside, do the reskin.
2291 image.skinNameHandle = skinNameHandle;
2292 for( U32 i=0; i<ShapeBaseImageData::MaxShapes; ++i)
2293 {
2294 if (image.shapeInstance[i])
2295 {
2296 String newSkin = skinNameHandle.getString();
2297 image.shapeInstance[i]->reSkin(newSkin, image.appliedSkinName);
2298 image.appliedSkinName = newSkin;
2299 }
2300 }
2301 }
2302 }
2303 return;
2304 }
2305
2306 // Check to see if we need to delay image changes until state change.
2307 if (!isGhost()) {
2308 if (imageData && image.dataBlock && !image.state->allowImageChange) {
2309 image.nextImage = imageData;
2310 image.nextSkinNameHandle = skinNameHandle;
2311 image.nextLoaded = loaded;
2312 return;
2313 }
2314 }
2315
2316 // Mark that updates are happenin'.
2317 setMaskBits(ImageMaskN << imageSlot);

Callers

nothing calls this directly

Calls 8

cloneMaterialListMethod · 0.80
getCurrentTimeFunction · 0.50
getStringMethod · 0.45
reSkinMethod · 0.45
addThreadMethod · 0.45
setTimeScaleMethod · 0.45
setSequenceMethod · 0.45

Tested by

no test coverage detected