The idea behind the script is pretty simple: drop it in a prim or the root of a linkset and it'll texture every face with a number to show the face number. Nothing clever. Nothing you'd want to do to an item where you didn't want to destroy the existing textures. Nothing you can't really do in a reasonable viewer (most of the time -- this does help solve the problem of getting at mesh faces that are almost impossible to touch). On the other hand, sometimes, when you're coding, having a nice big visual reminder on the screen in front of you isn't such a bad thing.
The script itself doesn't self-delete, but it does refresh the textures if the prim changes or more items are linked to it.
Here's the script:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////// | |
// Z&A Show Face Numbers | |
// By Antony Fairport | |
// | |
// Z&A Show Face Numbers - Quickly show face numbers on an object. | |
// | |
// Revision history: | |
// ------------------------------------------------------------ | |
// | |
// 2015-02-19 | |
// Initial revision. | |
////////////////////////////////////////////////////////////////////// | |
// Number textures. | |
list NUMBERS = [ | |
"de4264f4-a3bb-d173-8db4-db469d19d844", | |
"d7820e37-87f5-c967-4708-17e5bbd3e4dd", | |
"a66c055c-a50e-5757-a0a7-f8e149cb39d6", | |
"4c3c9511-04f6-793f-17b8-c920a51dc98c", | |
"25589b6a-2281-01ae-7926-3fe406e4277d", | |
"f8250b58-85bd-5889-1589-fcc08607952f", | |
"a451b6c7-2e18-9935-df8d-f0bdabdacd06", | |
"b66c6b13-3948-e003-f61a-81e5624a71dd", | |
"644e1a49-e3fe-1293-c397-29fc920e6bb5", | |
"2918ac2f-e8a3-c73d-0926-8d14ef8eef9f" | |
]; | |
////////////////////////////////////////////////////////////////////// | |
// Texture all faces on all objects in the linkset. | |
TextureFaces() | |
{ | |
// Build up the texture rules. | |
integer iMax = llGetListLength( NUMBERS ); | |
list lRules; | |
integer i; | |
for ( i = 0; i < iMax; i++ ) | |
{ | |
lRules += [ | |
PRIM_TEXTURE, i, llList2String( NUMBERS, i ), < 1.0, 1.0, 0.0 >, ZERO_VECTOR, 0.0 | |
]; | |
} | |
// Set the textures. | |
llSetLinkPrimitiveParamsFast( LINK_SET, lRules ); | |
} | |
////////////////////////////////////////////////////////////////////// | |
// Default state. | |
default | |
{ | |
////////////////////////////////////////////////////////////////// | |
// Do things when we enter this state. | |
state_entry() | |
{ | |
// Get straight to the work of texturing the faces. | |
TextureFaces(); | |
} | |
////////////////////////////////////////////////////////////////// | |
// React to any changes we might be interested in. | |
changed( integer change ) | |
{ | |
// A change of shape, or linking, really needs... | |
if ( ( change & CHANGED_SHAPE ) || ( change & CHANGED_LINK ) ) | |
{ | |
// ...a refresh of the textures. | |
TextureFaces(); | |
} | |
} | |
} |
No comments:
Post a Comment