how to Remove Root Prim from Link_set
|
|
Arad Alter
The Wold is Yours !
Join date: 8 Apr 2008
Posts: 8
|
04-08-2008 07:20
Hi I have a rezzer object (that creates objects by llrezobject and then link child prims using llcreateLink) but i dont want to link Rezzer object (ROOT Prim) to child prims, in other word is there any way to link just child prims ?
object_rez( key child_id ) {
if (I need an expression to avoid linking Rezzer Object) llCreateLink( child_id, TRUE ); linkedObjectCounter++; if (linkedObjectCounter >= numObjects) { llSetLinkColor( LINK_ALL_CHILDREN, < 1, 0, 0 >, ALL_SIDES ); } }
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
04-08-2008 08:39
I'm not quite sure what you're asking.
Any link set has a root prim. You can pick which it is, but there is always a root prim.
Do you mean, you want to link the rezzed prims together but NOT link them into your rezzer object? I don't know of any LL call to link two other objects together; you can only link an object to your own object (the one the script is in).
A workaround might be to put a script in the prim you want as the root of the new object, and have your rezzer send it a chat message telling it of each child prim to link in (or something like that).
|
|
Arad Alter
The Wold is Yours !
Join date: 8 Apr 2008
Posts: 8
|
04-08-2008 08:45
Thanks for ur reply
is there any way to unlink the Root prim(the prim that is creating the child prims) with llBreakLink() ?!
|
|
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
|
04-08-2008 08:49
So you want it to rez something without it being attached tot he rezzer? Just trying to clear it up a bit.. with all the 'child' and 'root' talk your wording is overcomplicating it in my mind, sorry. And I believe, though not 100% sure that llBreakLink(1);
Would unlink the root or parent object. After a quick look at the wiki, it seems that link # 1 is the root or parent object.
_____________________
Tutorials for Sculpties using Blender! Http://www.youtube.com/user/BlenderSL
|
|
Arad Alter
The Wold is Yours !
Join date: 8 Apr 2008
Posts: 8
|
04-08-2008 12:29
Thank for ur attention
No, I tested llBreakLink(1) before,it cause will unlink all rez panels.
really there is not anyone to have a solution ?!!
|
|
Arad Alter
The Wold is Yours !
Join date: 8 Apr 2008
Posts: 8
|
04-08-2008 12:32
From: Lear Cale I'm not quite sure what you're asking.
Any link set has a root prim. You can pick which it is, but there is always a root prim.
Do you mean, you want to link the rezzed prims together but NOT link them into your rezzer object? I don't know of any LL call to link two other objects together; you can only link an object to your own object (the one the script is in).
A workaround might be to put a script in the prim you want as the root of the new object, and have your rezzer send it a chat message telling it of each child prim to link in (or something like that). Hi U said I can pick which is the root prim ? then how can i pick one of child prims as Root Prim (replace it)?
|
|
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
|
04-08-2008 12:55
Script the other pieces to note when unlinked and then relink?
_____________________
Tutorials for Sculpties using Blender! Http://www.youtube.com/user/BlenderSL
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
04-08-2008 13:58
I wonder what happens if you try to create a link to a prim already in this prim's link set. Hmm. Have you tried something like this? key newParent = llGetLinkKey(2); llCreateLink(newParent, FALSE); llBreakLink(llGetLinkNumber()); // Note: may need to be in a 'changed' event handler
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
04-08-2008 15:07
You could accomplish this with one script in the old root prim that continually links itself to a new prim (with that target as the parent) and then breaks itself off, but here is a somewhat less complex solution. Note the order in which the links are created, and that unlike linking a bunch of prims manually through editing, the script only tries to link them in one order, which could easily fail depending on the location and size of the prims. Enhancing this to work like the built-in multi-prim linking is left as an excercise for the reader.  Script for old root prim (not yet compiled; may need some minor fixes): default { changed(integer changes) { llResetScript(); }
touch_start(integer nDetected) { key owner = llGetOwner();
integer i; for (i = 0; i < nDetected; ++i) { if (llDetectedKey(i) == owner) { llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS); return; } } }
run_time_permissions(integer perms) { if (perms & PERMISSION_CHANGE_LINKS) { llBreakAllLinks(); } } }
script for prim you want to become the new root (not yet compiled; may need some minor fixes): list primKeys = [];
recordLinkKeys() { primKeys = [];
integer nPrims = llGetNumberOfPrims(); if (nPrims < 3) { return; }
integer thisLink = llGetLinkNumber(); integer i; for (i = 2; i <= nPrims; ++i) { if (i != thisLink) { key prim = llGetLinkKey(i); if (llGetAgentSize(prim) == ZERO_VECTOR) { primKeys = (primKeys=[])+primKeys+[ prim ]; } } } }
state default { state_entry() { recordLinkKeys(); }
on_rez(integer startParam) { recordLinkKeys(); }
changed(integer changes) { if (!(changed & CHANGED_LINK)) { return; }
if (llGetLinkNumber != 0) { recordLinkKeys(); } else { llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS); } }
run_time_permissions(integer perms) { if (perms & PERMISSION_CHANGE_LINKS) { integer i; for (i = llGetListLength(primKeys); i > 0; --i) { key prim = llList2Key(primKeys, i-1); llCreateLink(prim, TRUE); } } } }
|
|
Arad Alter
The Wold is Yours !
Join date: 8 Apr 2008
Posts: 8
|
04-09-2008 05:28
Ok, thanks i will check it right now, 
|