Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

SVC-2266: llGetTextureResolution please!

Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
06-09-2008 10:31
Since I've been pimping some of my favorite JIRA issues lately, I'll bring this one up, too. I don't know that it's technically possible but it's still a good idea. :)

Please vote for: http://jira.secondlife.com/browse/SVC-2266

From: SVC-2266
llGetTextureResolution please!

It would be nice to have a way for scripts to get the dimensions of a texture. This would enable things like picture frames that automatically resize to the correct aspect ratio without having to include the resolution in the texture file name.

Something like "vector llGetTextureResolution (key textureId)" that returns the resolution in x and y. Maybe even stuff the aspect ratio in .z so scripts can save a few computrons by not having to calculate it themselves.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-09-2008 10:47
The problem with this is that this could be a VERY costly script call, as it would require the simulator to download the asset in order to calculate its size. Even if the information were stored separately as meta-data or whatever, then it would still require extra requests/caching. I'm not sure it's really worth the huge amount of effort required unfortunately.

What are your use-cases anyway? Why do you need to know the size? Most textures are forced to power of two dimensions meaning the dimensions may not accurately reflect the actual ratio of the image.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
06-09-2008 10:57
That's sorta exactly why I said it may not be technically possible - "practical" might have been better word. I'd be happy if it only worked on texures that the sim had and/or that were in the objects inventory - maybe have it return zero_vector the sim doesn't have the info handy. (edit: I can't really think of a use case that doesn't involve the sim already having the texture)

The use case is any object that changes textures and cares about keeping things lined up correctly. A picture frame would be one example. Another might be something like builders tools that automatically line textures up - being able to script a texture change from, say, 512x256 to 512x512 without having it look squashed/stretched would be nice.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left