EngineGetModelTextures: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Add note that the return value structure is differente than stated (according to the source code)) |
||
Line 12: | Line 12: | ||
===Returns=== | ===Returns=== | ||
Returns a table of texture elements [textureName, texture], '''false''' otherwise. | Returns a table of texture elements [textureName, texture], '''false''' otherwise. </br> | ||
'''Note: According to the [https://github.com/multitheftauto/mtasa-blue/blob/bafbae00cdcca392f10ffc9f450ed45e019253c4/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp#L1192 source code] the actual structure is: t[texture] = textureName''' | |||
==Example== | ==Example== |
Revision as of 19:39, 12 November 2020
This function allows you to get the textures of any model.
Syntax
table engineGetModelTextures( string/int modelName/modelID [, string/table textureNames ] )
Required Arguments
- model: either the model ID or model name.
Optional Arguments
- textureNames: Only return textures with specified name(s). You can provide a single string or a table of strings. Wildcard matching e.g. "ro?ds*" can be used.
Returns
Returns a table of texture elements [textureName, texture], false otherwise.
Note: According to the source code the actual structure is: t[texture] = textureName
Example
Click to collapse [-]
ClientGet the textures for model ID 3722 and draw them with dxDrawImage.
function init() textures = engineGetModelTextures(3722) addEventHandler("onClientRender", root, render) end addEventHandler("onClientResourceStart", resourceRoot, init) function render() local offset = 0 for name,texture in pairs(textures) do local size = dxGetPixelsSize(dxGetTexturePixels(texture)) dxDrawImage(0+offset, 0, size, size, texture) offset = offset + size end end
Requirements
This template will be deleted.
See Also
- engineAddImage
- engineApplyShaderToWorldTexture
- engineFreeModel
- engineGetModelFlags
- engineGetModelIDFromName
- engineGetModelLODDistance
- engineGetModelNameFromID
- engineGetModelPhysicalPropertiesGroup
- engineGetModelTextureNames
- engineGetModelTextures
- engineGetModelTXDID
- engineGetModelVisibleTime
- engineGetObjectGroupPhysicalProperty
- engineGetSurfaceProperties
- engineGetVisibleTextureNames
- engineImageGetFilesCount
- engineImageGetFiles
- engineImageGetFile
- engineImageLinkDFF
- engineImageLinkTXD
- engineImportTXD
- engineLoadCOL
- engineLoadDFF
- engineLoadIMG
- engineLoadIFP
- engineLoadTXD
- engineRemoveImage
- engineRemoveShaderFromWorldTexture
- engineReplaceAnimation
- engineReplaceCOL
- engineReplaceModel
- engineRequestModel
- engineResetModelFlags
- engineResetModelLODDistance
- engineResetSurfaceProperties
- engineRestoreAnimation
- engineRestoreCOL
- engineRestoreDFFImage
- engineRestoreModel
- engineRestoreModelPhysicalPropertiesGroup
- engineRestoreObjectGroupPhysicalProperties
- engineRestoreTXDImage
- engineRestreamWorld
- engineSetAsynchronousLoading
- engineSetModelFlag
- engineSetModelFlags
- engineSetModelLODDistance
- engineSetModelPhysicalPropertiesGroup
- engineSetModelVisibleTime
- engineSetObjectGroupPhysicalProperty
- engineSetSurfaceProperties
- engineStreamingFreeUpMemory
- engineStreamingGetUsedMemory