Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetLinkPrimitiveParams -- No Results?

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
05-06-2007 06:43
heyas;

okay, so to make life for the end-user easy (and to give myself a headache), i have devised a script to propagate one panel of a cape into all the panels. that is, the user changes one panel to whatever colour/texture/shininess/bump/blahblah they want, then click, and --like magic-- all the other panels change to match it.
ain't i nice? anyway, here's the code, it looks all aboveboard, and it SAYS its changing different panels... but nothing happens.

is llSetLinkPrimitiveParams live in this latest release??

also, i understand there might/can/will be problems with propagating the texture, if it isn't full permissions or something? i tried propagating no texture (blank), but that still didn't work.



CODE

//----------------------------------------------
//-- Cape (or dress) Panel Propagator
//-- by bloodsong termagant
//----------------------------------------------
// touch to read texture/colour/etc properties
// then propagate them through every 'panel'
// in the object
//-----------------------------------------------

integer parts; //--#prims in object
integer BUSY;


//--unexplained wiki script, how fun
//--supposed to format get params for use in set params
//--by strife onizuka
list GetPrimitiveParams(list input)
{
list output;
integer c = -llGetListLength(input);
integer flag;
integer side;
while(c<0)
{
flag = llList2Integer(input, c++); //pop the stack
if(llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT], [flag]) + 1)
{
side = llList2Integer(input, c++); //pop the stack
if(side == ALL_SIDES)
{
side = llGetNumberOfSides();
while(side--) //we return the sides in reverse order, easier to code; runs faster.
output += [flag, side] + llGetPrimitiveParams([flag, side ]);
}
else
output += [flag, side] + llGetPrimitiveParams([flag, side ]);
}
else
output += [flag] + llGetPrimitiveParams([flag]);
}
return output;
}



default
{
state_entry()
{
parts = llGetNumberOfPrims();
BUSY = FALSE;
}

touch_start(integer total_number)
{
if(BUSY) return;

BUSY = TRUE; //--prevents multi clicks while working.

//--step one: read the current parameters...? and set to use

list pParms = GetPrimitiveParams([
PRIM_BUMP_SHINY, ALL_SIDES,
PRIM_COLOR, ALL_SIDES,
PRIM_FULLBRIGHT, ALL_SIDES,
PRIM_TEXTURE, ALL_SIDES
]);

//--step two: go through and find panels and apply these.
integer n;
for(n=1;n<=parts;n++)
{
if("panel" == llGetLinkName(n) && n != llGetLinkNumber())
{//--find all panels but ourself
llSetLinkPrimitiveParams(n, pParms);
}
}

BUSY = FALSE;
}
}
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
05-06-2007 10:01
I haven't toyed with your script in-world yet, but my brief experience with setting textures through the llSetLinkPrimitiveParams needed the texture that's being applied to be both full perms, and in the object's inventory.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
05-07-2007 07:42
heyas senuka;

in the object's inventory as in, in the root prim of the object, or in each child prim i want to change? :)


which isn't half so bad. however, it doesn't explain why i can't even change the colour/shininess, when i use a blank texture for testing. i read somewhere that 'blank' is an actual texture. do i have to somehow put that in things? that'd be stupid :/
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
05-07-2007 11:00
So long as you know the UUID key for a texture, you can apply it to a prim using llSetTexture or llSet(Link)PrimitiveParams, regardless of ownership, permissions, or presence of the texture in the prim's inventory.
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
05-07-2007 11:59
Deanna is correct -- but applying a texture to an object doesn't give the script the UUID. If the texture is in the object's inventory and is copy/xfer then a script can get its UUID (or it could just apply the texture by name).

I don't know whether there's a way for a script to get an object's texture's UUID. However, if there is, it won't work unless the owner of the object has copy/xfer privileges for the texture.

If you get a texture's UUID, you essentially have copy/xfer capabilities on that texture, which is why you can't get its UUID unless you have those privileges.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-07-2007 13:35
That isn't the newest version of GetPrimitiveParams but that doesn't matter (newer version don't add functionality).

I pounded this together for ya, enjoy. Tell me if the list_replace function is working, just wrote it :D.

CODE

//----------------------------------------------
//-- Cape (or dress) Panel Propagator
//-- by bloodsong termagant
//----------------------------------------------
// touch to read texture/colour/etc properties
// then propagate them through every 'panel'
// in the object
//-----------------------------------------------
//Strife was here

integer parts; //--#prims in object
integer BUSY;


//--unexplained wiki script, how fun
//--supposed to format get params for use in set params
//--by strife onizuka
list GetPrimitiveParams(list input)
{
list output;
integer c = -llGetListLength(input);
integer flag;
integer side;
while(c<0)
{
flag = llList2Integer(input, c++); //pop the stack
if(llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT], [flag]) + 1)
{
side = llList2Integer(input, c++); //pop the stack
if(side == ALL_SIDES)
{
side = llGetNumberOfSides();
while(side--) //we return the sides in reverse order, easier to code; runs faster.
output += [flag, side] + llGetPrimitiveParams([flag, side ]);
}
else
output += [flag, side] + llGetPrimitiveParams([flag, side ]);
}
else
output += [flag] + llGetPrimitiveParams([flag]);
}
return output;
}

list list_replace(list src, list from, list to)
{//replaces all occurances of 'from' with 'to' in 'src'.
integer len = ~([] != from);
if(~len)
{
list buffer = src;
integer b_pos = -1;
integer to_len = ~([] != to);
@loop;//instead of a while loop, saves 5 bytes (and run faster).
integer to_pos = ~llListFindList(buffer, from);
if(to_pos)
{
// b_pos-=to_pos;
// src = llListReplaceList(src, to, b_pos, b_pos+len);
// b_pos += to_len;
// buffer = llList2List(src, -~b_pos, 0x4000);
buffer = llList2List(src = llListReplaceList(src, to, b_pos-=to_pos, b_pos+len), -~(b_pos += to_len), 0x4000);
jump loop;
}
}
return src;
}//By: Strife Onizuka

default
{
state_entry()
{
parts = llGetNumberOfPrims();
BUSY = FALSE;
}

touch_start(integer total_number)
{
if(BUSY) return;

BUSY = TRUE; //--prevents multi clicks while working.

//--step one: read the current parameters...? and set to use

list pParms = GetPrimitiveParams([
PRIM_BUMP_SHINY, ALL_SIDES,
PRIM_COLOR, ALL_SIDES,
PRIM_FULLBRIGHT, ALL_SIDES,
PRIM_TEXTURE, ALL_SIDES
]);

integer n = llGetInventoryNumber(INVENTORY_TEXTURE);
while(n)
{
string sTex = llGetInventoryName(INVENTORY_TEXTURE, --n);
key kTex = llGetInventoryKey(sTex);
if(kTex)
pParms = list_replace(pParms, (list)sTex, [(string)kTex]);
else if(~llListFindList(pParms, (list)sTex))
llOwnerSay("Cannot get the UUID of \""+sTex+"\"");
}

//--step two: go through and find panels and apply these.
for(n=1;n<=parts;n++)
{
if("panel" == llGetLinkName(n) && n != llGetLinkNumber())
{//--find all panels but ourself
llSetLinkPrimitiveParams(n, pParms);
}
}

BUSY = FALSE;
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
05-07-2007 13:40
Actually, it is very easy to get the UUID key of any texture your viewer has received (but not through script). I won't say how, though, since I know I'll get bombarded with accusations that I'm facilitating/encouraging texture theft.
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
05-08-2007 08:14
heyas;

wow, strife! it's working!

except....

okay, for some reason, the script is not changing the colour for the different sides. :/ or the shininess, bumpiness, or fullbrightness. this is not helping me make a silk-lined cape :(


okay, i tested the texture. i threw a texture on it without putting it in the object. and that worked. then again, it was a full perms texture. ::looks for one that isnt::

ooookay... no, didnt find one, but i found that it will put the different textures on different sides. i really gotta stop posting WHILE testing the script... :X


all right, as far as i can tell, strife's list parsing is spitting out a proper list, but it isn't applying the different values to the different faces. here's a sample of the output:

panel: Parm List =
19, 5, 0, 0, 19, 4, 0, 0, 19, 3, 0, 0, 19, 2, 0, 0, 19, 1, 3, 2, 19, 0, 0, 0, 18, 5, <0.749020, 0.749020, 0.749020>, 1.000000, 18, 4, <0.749020, 0.749020, 0.749020>, 1.000000, 18, 3, <0.749020, 0.749020, 0.749020>, 1.000000, 18, 2, <0.749020, 0.749020, 0.749020>, 1.000000, 18, 1, <0.749020, 0.749020, 0.749020>, 1.000000, 18, 0, <0.749020, 0.749020, 0.749020>, 1.000000, 20, 5, 0, 20, 4, 0, 20, 3, 0, 20, 2, 0, 20, 1, 1, 20, 0, 0, 17, 5, 941bea08-e4c9-97dd-8fc4-baedde105c08, <1.000000, 1.300000, 0.000000>, <0.100009, 0.000000, 0.000000>, 0.000000, 17, 4, 941bea08-e4c9-97dd-8fc4-baedde105c08, <1.000000, 1.300000, 0.000000>, <0.100009, 0.000000, 0.000000>, 0.000000, 17, 3, 941bea08-e4c9-97dd-8fc4-baedde105c08, <1.000000, 1.300000, 0.000000>, <0.100009, 0.000000, 0.000000>, 0.000000, 17, 2, 941bea08-e4c9-97dd-8fc4-baedde105c08, <1.000000, 1.300000, 0.000000>, <0.100009, 0.000000, 0.000000>, 0.000000, 17, 1, 8435736b-6c21-8dfc-5d72-788d69016cb8, <3.000000, 1.500000, 0.000000>, <0.100009, 0.000000, 0.000


you can see, face 1 has different settings. and, except for the texture, they're not getting applied to face 1 of the other panels. :/
erm... okay, the end looks truncated. im going to guess that's a limit to the llownersay output, because the parm function isn't throwing an error over it.




can anybody confirm/deny that llSetLinkPrimitiveParams is not applying individual side parameters?
thanks!