Jump to content

Set texture of multiple child prims?


CadenzaInVivace
 Share

You are about to reply to a thread that has been inactive for 3850 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I've searched everywhere for this and I'm really shocked to find no results... How do I set the texture of MULTIPLE child prims at once? For example, set the texture of link #1,3,5,7,9 inside an object to "UUID". To my knowledge "llSetLinkTexture" only works for 1 prim. Only results I found on LSL wiki and google were changing textures for one prim, or changing texture of multiple faces on one prim...
Link to comment
Share on other sites

make a list of the numbers to change-

get the list length-

for each member of the list, do a texture change-

-----------------------------------------------------------

list myPrims = [1,3,5,7,9];

integer n;

integer length = llGetListLength(myPrims);

for(;n < length;++n)

{ llSetLinkPrimitiveParamsFast( llList2Integer(myPrims,n)  [PRIM_TEXTURE, ALL_SIDES,
 "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0]);

}

?

Link to comment
Share on other sites

Yep, there's no way to set the textures on multiple prims unless you do everything in the linkset, or all the children in the linkset or all other prims in the linkset, using LINK_SET, LINK_ALL_CHILDREN, or LINK_ALL_OTHERS.

If you are concerned about the time it takes to change textures one prim at a time, use llSetLinkTextureFast() or llSetLinkPrimitiveParamsFast().

Link to comment
Share on other sites

It's terribly wordy, but this is how you can do that all in one operation.

 

        llSetLinkPrimitiveParamsFast(1, [PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,            PRIM_LINK_TARGET, 3, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,            PRIM_LINK_TARGET, 5, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,            PRIM_LINK_TARGET, 7, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,             PRIM_LINK_TARGET, 9, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0]
        );

(forgot to paste in a bit of puncutation) 

 

Link to comment
Share on other sites


Cerise Sorbet wrote:

It's terribly wordy, but this is how you can do that all in one operation.

 
        llSetLinkPrimitiveParamsFast(1, [PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,            PRIM_LINK_TARGET, 3, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,            PRIM_LINK_TARGET, 5, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,            PRIM_LINK_TARGET, 7, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0,             PRIM_LINK_TARGET, 9, PRIM_TEXTURE, ALL_SIDES, "some texture", <1,1,0>, <0,0,0>, 0]

        );

(forgot to paste in a bit of puncutation) 

 

Oooh, I wonder if I ever knew you could just keep building a list for mulitple prims in that call. I know now!

Thanks, Cerise!

Link to comment
Share on other sites


Cerise Sorbet wrote:

It's relatively new. PRIM_LINK_TARGET was added just over 2 years ago, mostly to encourage people to get away from things like a resize script in every prim. 

Yes if I recall, the issue was that moving to llSetLinkPrimitiveParamsFast  and iterative in a loop seemed a good idea when it first came out but not everything would necessarily complete in one frame and so depending on the complexity of the linkset, that serial resizing didn't work that well after all.

Using PRIM_LINK_TARGET inside one llSetLinkPrimitiveParamsFast function ensures that it all executes in one frame.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3850 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...