Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetPrimitiveParams & Slice(s) values?

HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 14:51
Can we not access the slice parameters (i.e. for boxes and cylinders) with LSL? (And likewise for llSetPrimitiveParams). I cannot seem to.

Thanks for any help!
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
03-04-2009 14:55
Check out the second table on this page:

http://lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams

It lists the allowed parameters for each prim type in scripting, including hollow, cut, and so on.
_____________________
Tutorials for Sculpties using Blender!
Http://www.youtube.com/user/BlenderSL
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 15:06
From: Keira Wells
Check out the second table on this page:

http://lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams

It lists the allowed parameters for each prim type in scripting, including hollow, cut, and so on.


Thanks for your speedy reply! I have been through this documentation, however there are slice values available (B and E) in the Edit UI that do not seem to have a corresponding LSL equivalent. Are these accessible only through the UI and not LSL?

Thanks!
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-04-2009 15:11
vector cut, profilecut; // <begin,end,0>
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 15:25
From: Argent Stonecutter
vector cut, profilecut; // <begin,end,0>


Thank you kindly for your response. I see in the documetation that profilecut is valid for certain type shapes but do not see it listed for box and cylinder (which is of course what I am looking for).

I have tested this with the following code which generates a list of primitive params for the primitive.

list GetPrimitiveParams(list input)
{
list output;
integer c = (output != input);//same as -llGetListLength(input);
if(c)
{
list t = output;
list special = [PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN];
do
{
integer flag = llList2Integer(input, c); //peak the stack
if(~llListFindList(special, [flag]))
{
if(++c)//adjust stack position, make sure it's valid.
{
integer side = llList2Integer(input, c); //peak the stack
if(side == ALL_SIDES)
{
side = llGetNumberOfSides();
do
output += t + llGetPrimitiveParams(t = [flag, --side]);
while(side); //we return the sides in reverse order, easier to code; runs faster.
}
else
output += t + llGetPrimitiveParams(t = [flag, side]);
jump test;//by using a jump here we speed the code up a bit.
}
llOwnerSay("malformed input";);
jump end;
}//else //not needed because of jumps.
output += flag + llGetPrimitiveParams([flag]);
@test;
}while(++c);//adjust stack position, make sure it's valid.
}
@end;
return output;
}//Writen by Strife Onizuka

My code will get a list value from this function and store it in a strided list so that prims can go back to stored parameter settings. I do not further manipulate the primitive parameters as generated in the above function.

If I change the Slice value on the Edit UI, there is no corresponding value in the returning list of params from llGetPrimitiveParams.

Slice is such a dramatic change to a primitive's appearance, I would be surprised if it was not accessible via LSL but maybe there is some ancient JIRA open for it.

Many thanks!
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-04-2009 15:28
From: HatHead Rickenbacker
Thank you kindly for your response. I see in the documetation that profilecut is valid for certain type shapes but do not see it listed for box and cylinder (which is of course what I am looking for).
The "cut" parameter is what you want for a box or cylinder. It's the "vector cut" parameter in PRIM_TYPE.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 15:35
From: Argent Stonecutter
The "cut" parameter is what you want for a box or cylinder. It's the "vector cut" parameter in PRIM_TYPE.


Hello - thank you for your reply and support and patience!

The "cut" parameter corresponds to "Path Cut" on the Edit UI; not Slice - at least from my testing. My primitive will change to the desired path cut but not slice values (always reset to ZERO_VECTOR).

One can both have a path cut and a slice on box or cylinder, but there is only one "cut" parameter returned/settable by LSL, at least according to the documentation and my afternoon of testing. I would LOVE to be wrong on this!

Many thanks!

EDIT: also, I am using the Kirstens viewer so it might some more extended UI elements than I know about! Will check SL proper.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-04-2009 15:41
From: HatHead Rickenbacker
Hello - thank you for your reply and support and patience!

The "cut" parameter corresponds to "Path Cut" on the Edit UI; not Slice - at least from my testing. My primitive will change to the desired path cut but not slice values (always reset to ZERO_VECTOR).
There is no "path cut" for cylinders and blocks. The cut parameter modifies the profile, not the path. You can change the type to a sphere, in which case the "dimple" parameter (which is actually a profile cut on a sphere) will be applied to the path of the cube or cylinder when you change it back to the cube or cylinder... shortening it, in effect... but this option is not directly available in the edit box for these primitives.

Yes, this means that the "cut" parameter is used to refer to the "path cut" on the sphere or torus and the "profile cut" on the cylinder. I'm sure there's a fascinating historical reason for this.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 15:54
From: Argent Stonecutter
There is no "path cut" for cylinders and blocks. The cut parameter modifies the profile, not the path. You can change the type to a sphere, in which case the "dimple" parameter (which is actually a profile cut on a sphere) will be applied to the path of the cube or cylinder when you change it back to the cube or cylinder... shortening it, in effect... but this option is not directly available in the edit box for these primitives.

Yes, this means that the "cut" parameter is used to refer to the "path cut" on the sphere or torus and the "profile cut" on the cylinder. I'm sure there's a fascinating historical reason for this.



Many thanks again Argent for your support and patience!

I am not sure if I am being clear enough or understand you properly, I am a musician after all. My overall goal is to store a strided list of primitive params within a prim and be able to swtich around between them. My script works great except for what corresponds to "Slice Begin and End" on the edit UI - these values are available on the UI and not in LSL (at least to me so far).

Here is some very simple code that demonstrates what I mean - it gets all of the primitive's parameters then directly reapplies these same parameter values again when you touch it. If all the parameters are captured, then nothing on the primitive will change however it appears not the case here.

Drop this in a box and adjust the Slice Begin and End, then touch the box:

list GetPrimitiveParams(list input)
{
list output;
integer c = (output != input);//same as -llGetListLength(input);
if(c)
{
list t = output;
list special = [PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW];
do
{
integer flag = llList2Integer(input, c); //peak the stack
if(~llListFindList(special, [flag]))
{
if(++c)//adjust stack position, make sure it's valid.
{
integer side = llList2Integer(input, c); //peak the stack
if(side == ALL_SIDES)
{
side = llGetNumberOfSides();
do
output += t + llGetPrimitiveParams(t = [flag, --side]);
while(side); //we return the sides in reverse order, easier to code; runs faster.
}
else
output += t + llGetPrimitiveParams(t = [flag, side]);
jump test;//by using a jump here we speed the code up a bit.
}
jump end;
}//else //not needed because of jumps.
output += flag + llGetPrimitiveParams([flag]);
@test;
}while(++c);//adjust stack position, make sure it's valid.
}
@end;
return output;
}


default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
list current_params = GetPrimitiveParams([PRIM_TYPE]);
llSetPrimitiveParams(current_params);
}
}

EDIT: also, I am using the Kirstens viewer so it might some more extended UI elements than I know about! Will check SL proper.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-04-2009 16:08
From: HatHead Rickenbacker
My script works great except for what corresponds to "Slice Begin and End" on the edit UI - these values are available on the UI and not in LSL (at least to me so far).
Add "PRIM_TYPE" to the list.

From: someone
Here is some very simple code that demonstrates what I mean - it gets all of the primitive's parameters
It doesn't. Several of the parameters are encoded in PRIM_TYPE itself. I don't know what the rest of your code is trying to do, it seems to be excessively complex for what should be a simple operation.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 16:21
From: Argent Stonecutter
Add "PRIM_TYPE" to the list.

It doesn't. Several of the parameters are encoded in PRIM_TYPE itself. I don't know what the rest of your code is trying to do, it seems to be excessively complex for what should be a simple operation.


Hello again Argent - thanks for your help. Alas I don't think we understand each other here.

My code does use PRIM_TYPE as you can see from the default event handler in the code.

I explained my overall goal earlier - in essence, a chat command will store the name and all of the primitive's params in a strided list. A listen will process a recall from the strided list and set the primitive's parameters with the appropriate, previous values. If there is an easier way to dynamically store multiple primitive parameter settings and recall them from within the prim itself, I would LOVE to know this technique!

I have included a debug message in the following code to display the generated parameter value being generated - you will note all of the PRIM_TYPE variables are there - you would need to actually put it into a box in SL to see it work I would think.

list GetPrimitiveParams(list input)
{
list output;
integer c = (output != input);//same as -llGetListLength(input);
if(c)
{
list t = output;
list special = [PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW];
do
{
integer flag = llList2Integer(input, c); //peak the stack
if(~llListFindList(special, [flag]))
{
if(++c)//adjust stack position, make sure it's valid.
{
integer side = llList2Integer(input, c); //peak the stack
if(side == ALL_SIDES)
{
side = llGetNumberOfSides();
do
output += t + llGetPrimitiveParams(t = [flag, --side]);
while(side); //we return the sides in reverse order, easier to code; runs faster.
}
else
output += t + llGetPrimitiveParams(t = [flag, side]);
jump test;//by using a jump here we speed the code up a bit.
}
jump end;
}//else //not needed because of jumps.
output += flag + llGetPrimitiveParams([flag]);
@test;
}while(++c);//adjust stack position, make sure it's valid.
}
@end;
return output;
}


default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
list current_params = GetPrimitiveParams([PRIM_TYPE]);
llSay(DEBUG_CHANNEL, llDumpList2String(current_params, "|";));
llSetPrimitiveParams(current_params);
}
}


Many thanks!
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
03-04-2009 16:26
From: HatHead Rickenbacker
EDIT: also, I am using the Kirstens viewer so it might some more extended UI elements than I know about! Will check SL proper.
From: Argent Stonecutter
There is no "path cut" for cylinders and blocks. The cut parameter modifies the profile, not the path. You can change the type to a sphere, in which case the "dimple" parameter (which is actually a profile cut on a sphere) will be applied to the path of the cube or cylinder when you change it back to the cube or cylinder... shortening it, in effect... but this option is not directly available in the edit box for these primitives.
I have a feeling "slice" may be "dimple" in other viewers, as suggested in http://jira.secondlife.com/browse/VWR-7827; I don't know of a way to get that back from a box or cylinder using llGetPrimitiveParams(). If there really isn't, this probably needs a jira.
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 16:29
Seeing that this is not available in the standard SL UI and only available as a work-around for vis-a-vis dimples, I would conclude that I am S.O.L. for the moment. Couldn't find a JIRA on it although I can't even find my account profile on that system. Hopefully LL will open this up in the future.

Many thanks for your support and patience with me - peace!

Just getting Qie's post now too corroborating the same.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-04-2009 16:29
It's only a historical accident that allows you to set the path cut for a block or cylinder through prim torture. It's not supported, and there is no user interface element for it in the standard viewer, and there isn't an LSL interface for it.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-04-2009 16:32
From: Argent Stonecutter
It's only a historical accident that allows you to set the path cut for a block or cylinder through prim torture. It's not supported, and there is no user interface element for it in the standard viewer, and there isn't an LSL interface for it.


But it's so fraking cool! (and useful too)

Thanks for your help Argent.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-04-2009 16:35
From: HatHead Rickenbacker
But it's so fraking cool! (and useful too)
How do you figure? All it does is reduce the length of the object just as if you'd changed the length directly.

And I still don't understand how you intend to store the parameters in a strided list when the length of the arguments to the parameter vary.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-05-2009 05:14
From: Argent Stonecutter
How do you figure? All it does is reduce the length of the object just as if you'd changed the length directly.


But you can't do it through code, which is what I am trying to accomplish. When using curved shapes, such as a tapered cylinder, the shape is only available through defeating the SL UI; that is, there are some shapes that exist only with this method - especially when using mega-prims. There are currently more possible shapes for a primitive than are officially available and it would be great to access these through LSL.[/QUOTE]


From: someone

And I still don't understand how you intend to store the parameters in a strided list when the length of the arguments to the parameter vary.


I already store parameters in a strided list and, with the exception of the parameter values described in this thread, the code works perfectly. The snippet of code I provided generates a strided list of param values which can be fed back directly into llSetPrimitiveParam. I then prefix a user-defined name list element acting as an identifier between strides as this name is the only string type in the list. Parsing the list for string data types brings me to the beginning of each new set of primitive params with the next string list element acting as EOR.

An example use case would be you are designing a new building and expect lots of changes during the design process. This code allows you save the whole build as a name and continue on editing it, enabling you to recall the previous after making further changes.

But this thread was about the Case of the 2 Missing Primitive Params; not the general philosophy of my script. :)

Cheers!
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-05-2009 05:22
Here is JIRA for it:

http://jira.secondlife.com/browse/SVC-1834
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-05-2009 05:26
From: HatHead Rickenbacker
But you can't do it through code, which is what I am trying to accomplish. When using curved shapes, such as a tapered cylinder, the shape is only available through defeating the SL UI;
Um, you just reduce the taper amount and use llSetScale() to make the cylinder shorter.

As for megaprims, I think a better solution would be to allow us to make megaprims directly.
From: someone
I then prefix a user-defined name list element acting as an identifier between strides
Ah, so it's not a strided list. It's a tagged list. That's where you were confusing me.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-05-2009 05:34
From: Argent Stonecutter
Um, you just reduce the taper amount and use llSetScale() to make the cylinder shorter.
Ah, so it's not a strided list. It's a tagged list. That's where you were confusing me.


Your solution will not work in my case unfortunately as the diameter of the cylinder must remain the same and changing the scale will decrease it. I am sorry I am not as precise with my coding semantics as you, I am musician after all.

Nice talking with you Argent - thank you for your help and catch you around!
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-05-2009 05:35
From: Argent Stonecutter
As for megaprims, I think a better solution would be to allow us to make megaprims directly.


Amen to that I say!
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-05-2009 07:02
From: HatHead Rickenbacker
Your solution will not work in my case unfortunately as the diameter of the cylinder must remain the same and changing the scale will decrease it.
llSetScale can be used to change X, Y, and Z independently.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-05-2009 09:58
From: Argent Stonecutter
llSetScale can be used to change X, Y, and Z independently.


On mega-prims?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-05-2009 10:13
From: HatHead Rickenbacker
On mega-prims?
You can't change scale on megaprims at all.

I would rather they fixed that than institutionalizing prim torture.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
03-05-2009 10:16
From: Argent Stonecutter
You can't change scale on megaprims at all.

I would rather they fixed that than institutionalizing prim torture.


"institutionalizing prim torture" - LOL! It sounds so politically incorrect.