Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Giving textures to other (linked?) objects...

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
07-09-2006 11:00
Hi all... in wayyy over my head :-)

Object 1 has textures in it. I want object 1 to "give" or "loan" or otherwise cause one of the textures in its inventory, to appear as a texture on another, object, linked to it.

Is this possible?

thanks so much
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-09-2006 11:29
Yes, the simple method is to communicate the texture UUID/key to the other prim using a linked message and the llGetInventoryKey() function. Then, have the other prim call llSetTexture() with the UUID received, to place the texture on a face.
Frosty Fox
Registered User
Join date: 28 Feb 2005
Posts: 18
07-09-2006 11:30
yes this is possibal

Textures
http://secondlife.com/badgeo/wakka.php?wakka=texture

LinkedMessages
http://secondlife.com/badgeo/wakka.php?wakka=ExampleLinkMessage
CODE

integer side = ALL_SIDES;
default
{
touch_start(integer total_number)
{
key texture = llGetTexture(ALL_SIDES); // select the side
llMessageLinked(LINK_THIS, 0, "Touched.", NULL_KEY);
}

link_message(integer sender_num, integer num, string str, key id)
{
llSetTexture(side,id);
}
}
Vlad Bjornson
Virtual Gardener
Join date: 11 Nov 2005
Posts: 650
07-09-2006 11:50
Also, I think that the texture you send must have full permissions.
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
07-10-2006 01:49
From: Vlad Bjornson
Also, I think that the texture you send must have full permissions.


Not quite - to _use_ a texture by using its key, you do not need any permissions on it - in fact, you don't even need to have the texture, just the id.


to _find_ the key of a texture, you need to have full permissions on it, or to have the key told to you by someone who does have those perms.
Norman Desmoulins
Grand Poohba
Join date: 10 Nov 2005
Posts: 194
07-10-2006 02:41
Same is true for any asset... sound, anim, object, not just textures.
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
07-10-2006 04:33
Some assets can only be used by name, and _have_ to physically be in the inventory of the prim with the script (animations?)

Others you can use by key, and for those, yeah, all the above applies
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
07-10-2006 08:47
Yup, animations have to be there and used by name - it proved to be too easy to steal them if you could use the keys. Sounds and textures you can certainly do by key and keep the original in your inventory, or someone else's if they'll share the key with you.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
OK then.....
07-13-2006 01:27
What if the asset is in another prim that is linked to the one that uses the texture?
Can it be used that way? By either key or name?

From: Bitzer Balderdash
Some assets can only be used by name, and _have_ to physically be in the inventory of the prim with the script (animations?)

Others you can use by key, and for those, yeah, all the above applies
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
07-13-2006 02:09
If a script is using an asset by key then it can be anywhere or nowhere - you don't even EVER have had to have a copy.

If a script is using an asset by name then the asset with that name must be in the same prim as the script period. No exceptions (that I am aware of).

Linked objects are NOT the same prim.

Consider the case where, say, a texture called "wood" exists in two out of three linked prims, but it is a different texture in each case.

Which one should a script in the third prim use?

What happens if someone unlinks the prims?

It would be impossible for the scripting engine to sensible sort out the mess that resulted, quite apart from the several orders of magnitude of delay that would be introduced into every single inventory lookup.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
07-13-2006 02:29
That makes total sense..... thanks.

Now, what would be the cause of an error like :

"Object: Couldn't find texture 00000000-0000-0000-0000-000000000000"

This would be the key of a texture contained in a prim... and then passed on by linked message to a child that tries to load the texture... would this be an example of a texture that does not have permissions needed to get the key in the first place?
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
07-13-2006 07:07
Probably as it's returning NULL_KEY. Either you do not have permissions or you do not give it the correct spelling of the name.
_____________________