| Anonymous | Login | Signup for a new account | 2013-05-25 03:53 UTC | ![]() |
| Main | My View | View Issues | Change Log | Roadmap | Summary | My Account |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||
| 0006121 | opensim | [REGION] Script Functions | public | 2012-08-01 12:22 | 2013-03-27 00:04 | |||||
| Reporter | SignpostMarv | |||||||||
| Assigned To | ||||||||||
| Priority | normal | Severity | major | Reproducibility | always | |||||
| Status | new | Resolution | open | |||||||
| Platform | OS | OS Version | ||||||||
| Product Version | ||||||||||
| Target Version | Fixed in Version | |||||||||
| Summary | 0006121: llSetLinkPrimitiveParams, llSetLinkPrimitiveParamsFast, llGetLinkPrimitiveParams do not work on avatars | |||||||||
| Description | I've noticed for a while that the link prim params family of functions don't work on avatars. I started to implement them, but ran into a wall trying to get ScenePresence objects to return from GetLinkNumPart() | |||||||||
| Additional Information | default { state_entry(){ llSitTarget(<0,0,0.00001>,ZERO_ROTATION); } touch_start(integer total_number) { llOwnerSay(llList2CSV(["PRIM_BUMP_SHINY"] + llGetLinkPrimitiveParams(2, [PRIM_BUMP_SHINY, 1]))); llOwnerSay(llList2CSV(["PRIM_CAST_SHADOWS"] + llGetLinkPrimitiveParams(2, [PRIM_CAST_SHADOWS]))); llOwnerSay(llList2CSV(["PRIM_COLOR"] + llGetLinkPrimitiveParams(2, [PRIM_COLOR, 1]))); llOwnerSay(llList2CSV(["PRIM_DESC"] + llGetLinkPrimitiveParams(2, [PRIM_DESC]))); llOwnerSay(llList2CSV(["PRIM_FLEXIBLE"] + llGetLinkPrimitiveParams(2, [PRIM_FLEXIBLE]))); llOwnerSay(llList2CSV(["PRIM_FULLBRIGHT"] + llGetLinkPrimitiveParams(2, [PRIM_FULLBRIGHT, 1]))); llOwnerSay(llList2CSV(["PRIM_GLOW"] + llGetLinkPrimitiveParams(2, [PRIM_GLOW, 1]))); llOwnerSay(llList2CSV(["PRIM_LINK_TARGET"] + llGetLinkPrimitiveParams(2, [PRIM_LINK_TARGET, 2, PRIM_NAME]))); llOwnerSay(llList2CSV(["PRIM_MATERIAL"] + llGetLinkPrimitiveParams(2, [PRIM_MATERIAL]))); llOwnerSay(llList2CSV(["PRIM_NAME"] + llGetLinkPrimitiveParams(2, [PRIM_NAME]))); llOwnerSay(llList2CSV(["PRIM_OMEGA"] + llGetLinkPrimitiveParams(2, [PRIM_OMEGA]))); llOwnerSay(llList2CSV(["PRIM_PHANTOM"] + llGetLinkPrimitiveParams(2, [PRIM_PHANTOM]))); llOwnerSay(llList2CSV(["PRIM_PHYSICS"] + llGetLinkPrimitiveParams(2, [PRIM_PHYSICS]))); llOwnerSay(llList2CSV(["PRIM_PHYSICS_SHAPE_TYPE"] + llGetLinkPrimitiveParams(2, [PRIM_PHYSICS_SHAPE_TYPE]))); llOwnerSay(llList2CSV(["PRIM_POINT_LIGHT"] + llGetLinkPrimitiveParams(2, [PRIM_POINT_LIGHT]))); llOwnerSay(llList2CSV(["PRIM_POS_LOCAL"] + llGetLinkPrimitiveParams(2, [PRIM_POS_LOCAL]))); llOwnerSay(llList2CSV(["PRIM_POSITION"] + llGetLinkPrimitiveParams(2, [PRIM_POSITION]))); llOwnerSay(llList2CSV(["PRIM_ROT_LOCAL"] + llGetLinkPrimitiveParams(2, [PRIM_ROT_LOCAL]))); llOwnerSay(llList2CSV(["PRIM_ROTATION"] + llGetLinkPrimitiveParams(2, [PRIM_ROTATION]))); llOwnerSay(llList2CSV(["PRIM_SIZE"] + llGetLinkPrimitiveParams(2, [PRIM_SIZE]))); llOwnerSay(llList2CSV(["PRIM_SLICE"] + llGetLinkPrimitiveParams(2, [PRIM_SLICE]))); llOwnerSay(llList2CSV(["PRIM_TEMP_ON_REZ"] + llGetLinkPrimitiveParams(2, [PRIM_TEMP_ON_REZ]))); llOwnerSay(llList2CSV(["PRIM_TEXGEN"] + llGetLinkPrimitiveParams(2, [PRIM_TEXGEN, 1]))); llOwnerSay(llList2CSV(["PRIM_TEXT"] + llGetLinkPrimitiveParams(2, [PRIM_TEXT]))); llOwnerSay(llList2CSV(["PRIM_TEXTURE"] + llGetLinkPrimitiveParams(2, [PRIM_TEXTURE, 1]))); llOwnerSay(llList2CSV(["PRIM_TYPE"] + llGetLinkPrimitiveParams(2, [PRIM_TYPE]))); // llOwnerSay(llList2CSV(["PRIM_TYPE_LEGACY"] + llGetLinkPrimitiveParams(2, [PRIM_TYPE_LEGACY]))); } } [04:08 AM] Object: PRIM_BUMP_SHINY [04:08 AM] Object: PRIM_CAST_SHADOWS [04:08 AM] Object: PRIM_COLOR [04:08 AM] Object: PRIM_DESC, [04:08 AM] Object: PRIM_FLEXIBLE, 0, 0, 0.000000, 0.000000, 0.000000, 0.000000, <0.000000, 0.000000, 0.000000> [04:08 AM] Object: PRIM_FULLBRIGHT [04:08 AM] Object: PRIM_GLOW [04:08 AM] Object: PRIM_LINK_TARGET, SignpostMarv Martin [04:08 AM] Object: PRIM_MATERIAL, 4 [04:08 AM] Object: PRIM_NAME, SignpostMarv Martin [04:08 AM] Object: PRIM_OMEGA, <0.000000, 0.000000, 0.000000>, 0.000000, 0.000000 [04:08 AM] Object: PRIM_PHANTOM, 0 [04:08 AM] Object: PRIM_PHYSICS, 0 [04:08 AM] Object: PRIM_PHYSICS_SHAPE_TYPE, 0 [04:08 AM] Object: PRIM_POINT_LIGHT, 0, <0.000000, 0.000000, 0.000000>, 0.000000, 0.000000, 0.000000 [04:08 AM] Object: PRIM_POS_LOCAL, <0.000000, 0.000000, 0.350010> [04:08 AM] Object: PRIM_POSITION, <23.225866, 16.266962, 29.168310> [04:08 AM] Object: PRIM_ROT_LOCAL, <0.000000, 0.000000, 0.000000, 1.000000> [04:08 AM] Object: PRIM_ROTATION, <0.000000, 0.000000, 0.000000, 1.000000> [04:08 AM] Object: PRIM_SIZE, <0.450000, 0.600000, 1.934201> [04:08 AM] Object: PRIM_SLICE, <0.000000, 1.000000, 0.000000> [04:08 AM] Object: PRIM_TEMP_ON_REZ, 0 [04:08 AM] Object: PRIM_TEXGEN [04:08 AM] Object: PRIM_TEXT, , <0.000000, 0.000000, 0.000000>, 1.000000 [04:08 AM] Object: PRIM_TEXTURE [04:08 AM] Object: PRIM_TYPE, 0, 0, <0.000000, 1.000000, 0.000000>, 0.000000, <0.000000, 0.000000, 0.000000>, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000> [04:08 AM] Error: Invalid String [SignpostMarv Martin]: llGetPrimitiveParams error: Param 0 error, texture info cannot be accessed for avatars. [04:08 AM] Error: Invalid String [SignpostMarv Martin]: llGetPrimitiveParams error: Param 0 error, unknown parameter [04:08 AM] Error: Invalid String [SignpostMarv Martin]: llGetPrimitiveParams error: Param 0 error, texture info cannot be accessed for avatars. [04:08 AM] Error: Invalid String [SignpostMarv Martin]: llGetPrimitiveParams error: Param 0 error, texture info cannot be accessed for avatars. [04:08 AM] Error: Invalid String [SignpostMarv Martin]: llGetPrimitiveParams error: Param 0 error, texture info cannot be accessed for avatars. | |||||||||
| Tags | No tags attached. | |||||||||
| Git Revision or version number | 69a5bee | |||||||||
| Run Mode | Standalone (1 Region) | |||||||||
| Physics Engine | BasicPhysics | |||||||||
| Environment | .NET / Windows32 | |||||||||
| Mono Version | None | |||||||||
| Viewer | ||||||||||
| Attached Files | From bd0edae89289af54af404e9f348356b69bfffbd4 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Wed, 1 Aug 2012 13:16:51 +0100
Subject: [PATCH] partial non-functional implementation
---
.../Shared/Api/Implementation/LSL_Api.cs | 962 ++++++++++++---------
.../Shared/Api/Implementation/OSSL_Api.cs | 4 +-
.../Shared/Api/Runtime/LSL_Constants.cs | 22 +
3 files changed, 586 insertions(+), 402 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c3b1f3d..ce62de7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -236,50 +236,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
- public List<SceneObjectPart> GetLinkParts(int linkType)
+ public List<ISceneEntity> GetLinkParts(int linkType)
{
- List<SceneObjectPart> ret = new List<SceneObjectPart>();
- ret.Add(m_host);
+ List<ISceneEntity> ret = new List<ISceneEntity>
+ {
+ m_host
+ };
switch (linkType)
{
- case ScriptBaseClass.LINK_SET:
- return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
+ case ScriptBaseClass.LINK_SET:
+ ret = new List<ISceneEntity>(m_host.ParentGroup.Parts);
+ break;
- case ScriptBaseClass.LINK_ROOT:
- ret = new List<SceneObjectPart>();
- ret.Add(m_host.ParentGroup.RootPart);
- return ret;
+ case ScriptBaseClass.LINK_ROOT:
+ ret = new List<ISceneEntity>{
+ m_host.ParentGroup.RootPart
+ };
+ break;
- case ScriptBaseClass.LINK_ALL_OTHERS:
- ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
+ case ScriptBaseClass.LINK_ALL_OTHERS:
+ ret = new List<ISceneEntity>(m_host.ParentGroup.Parts);
- if (ret.Contains(m_host))
- ret.Remove(m_host);
+ if (ret.Contains(m_host))
+ ret.Remove(m_host);
- return ret;
+ break;
- case ScriptBaseClass.LINK_ALL_CHILDREN:
- ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
+ case ScriptBaseClass.LINK_ALL_CHILDREN:
+ ret = new List<ISceneEntity>(m_host.ParentGroup.Parts);
- if (ret.Contains(m_host.ParentGroup.RootPart))
- ret.Remove(m_host.ParentGroup.RootPart);
- return ret;
+ if (ret.Contains(m_host.ParentGroup.RootPart))
+ ret.Remove(m_host.ParentGroup.RootPart);
- case ScriptBaseClass.LINK_THIS:
- return ret;
+ break;
- default:
- if (linkType < 0)
- return new List<SceneObjectPart>();
+ case ScriptBaseClass.LINK_THIS:
+ // does nothing, m_host = LINK_THIS, and m_host is already in ret
+ break;
+
+ default:
+ if (linkType < 0)
+ ret = new List<ISceneEntity>(0);
- SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
- if (target == null)
- return new List<SceneObjectPart>();
- ret = new List<SceneObjectPart>();
- ret.Add(target);
- return ret;
+ SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
+ ret = (target == null) ? new List<ISceneEntity>(0) : new List<ISceneEntity>{ target };
+
+ break;
}
+
+ return ret;
}
protected UUID InventoryKey(string name, int type)
@@ -1557,10 +1563,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
- foreach (SceneObjectPart part in parts)
- SetAlpha(part, alpha, face);
+ foreach (ISceneEntity part in parts)
+ {
+ if (part is SceneObjectPart)
+ {
+ SetAlpha((SceneObjectPart)part, alpha, face);
+ }
+ }
}
protected void SetAlpha(SceneObjectPart part, double alpha, int face)
@@ -1729,10 +1740,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
- foreach (SceneObjectPart part in parts)
- SetTexture(part, texture, face);
+ foreach (ISceneEntity part in parts)
+ {
+ if (part is SceneObjectPart)
+ {
+ SetTexture((SceneObjectPart)part, texture, face);
+ }
+ }
ScriptSleep(200);
}
@@ -2061,27 +2077,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return GetPartLocalPos(m_host);
}
- protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
+ protected LSL_Vector GetPartLocalPos(ISceneEntity part)
{
m_host.AddScriptLPS(1);
Vector3 pos;
- if (!part.IsRoot)
+ if (part is SceneObjectPart)
{
- pos = part.OffsetPosition;
- }
- else
- {
- if (part.ParentGroup.IsAttachment)
+ SceneObjectPart prim = (SceneObjectPart)part;
+ if (!prim.IsRoot)
{
- pos = part.AttachedPos;
+ pos = prim.OffsetPosition;
}
else
{
- pos = part.AbsolutePosition;
+ if (prim.ParentGroup.IsAttachment)
+ {
+ pos = prim.AttachedPos;
+ }
+ else
+ {
+ pos = prim.AbsolutePosition;
+ }
}
}
+ else
+ {
+ pos = part.AbsolutePosition - m_host.ParentGroup.RootPart.AbsolutePosition;
+ }
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
@@ -3578,10 +3602,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkColor(int linknumber, LSL_Vector color, int face)
{
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
- foreach (SceneObjectPart part in parts)
- part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ foreach (ISceneEntity part in parts)
+ {
+ if (part is SceneObjectPart)
+ {
+ ((SceneObjectPart)part).SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ }
+ }
}
public void llCreateLink(string target, int parent)
@@ -4392,28 +4421,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
UUID partItemID;
- foreach (SceneObjectPart part in parts)
+ foreach (ISceneEntity part in parts)
{
- foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems())
+ if (part is SceneObjectPart)
{
- if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT)
+ foreach (TaskInventoryItem item in ((SceneObjectPart)part).Inventory.GetInventoryItems())
{
- partItemID = item.ItemID;
- int linkNumber = m_host.LinkNum;
- if (m_host.ParentGroup.PrimCount == 1)
- linkNumber = 0;
+ if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT)
+ {
+ partItemID = item.ItemID;
+ int linkNumber = m_host.LinkNum;
+ if (m_host.ParentGroup.PrimCount == 1)
+ linkNumber = 0;
- object[] resobj = new object[]
+ object[] resobj = new object[]
{
new LSL_Integer(linkNumber), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
};
- m_ScriptEngine.PostScriptEvent(partItemID,
- new EventParams("link_message",
- resobj, new DetectParams[0]));
+ m_ScriptEngine.PostScriptEvent(partItemID,
+ new EventParams("link_message",
+ resobj, new DetectParams[0]));
+ }
}
}
}
@@ -5788,11 +5820,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
- foreach (var part in parts)
+ foreach (ISceneEntity part in parts)
{
- SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
+ if (part is SceneObjectPart)
+ {
+ SetTextureAnim((SceneObjectPart)part, mode, face, sizex, sizey, start, length, rate);
+ }
}
}
@@ -5888,15 +5923,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return land.LandData.OwnerID.ToString();
}
- /// <summary>
- /// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize
- /// only the height of avatars vary and that says:
- /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
- /// </summary>
- public LSL_Vector llGetAgentSize(string id)
+ protected LSL_Vector GetAgentSize(ScenePresence avatar)
{
- m_host.AddScriptLPS(1);
- ScenePresence avatar = World.GetScenePresence((UUID)id);
LSL_Vector agentSize;
if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region
{
@@ -5909,6 +5937,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return agentSize;
}
+ /// <summary>
+ /// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize
+ /// only the height of avatars vary and that says:
+ /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
+ /// </summary>
+ public LSL_Vector llGetAgentSize(string id)
+ {
+ m_host.AddScriptLPS(1);
+ return GetAgentSize(World.GetScenePresence((UUID)id));
+ }
+
public LSL_Integer llSameGroup(string agent)
{
m_host.AddScriptLPS(1);
@@ -6154,11 +6193,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
- foreach (var part in parts)
+ foreach (ISceneEntity part in parts)
{
- SetParticleSystem(part, rules);
+ if (part is SceneObjectPart)
+ {
+ SetParticleSystem((SceneObjectPart)part, rules);
+ }
}
}
@@ -6528,10 +6570,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(linknum == ScriptBaseClass.LINK_SET ||
linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString();
-
- List<SceneObjectPart> parts = GetLinkParts(linknum);
- if (parts.Count == 0) return UUID.Zero.ToString();
- return parts[0].SitTargetAvatar.ToString();
+
+ List<ISceneEntity> parts = GetLinkParts(linknum);
+ return (parts.Count == 0 || !(parts[0] is SceneObjectPart) )
+ ? UUID.Zero.ToString()
+ : ((SceneObjectPart)parts[0]).SitTargetAvatar.ToString()
+ ;
}
@@ -7201,10 +7245,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void setLinkPrimParams(int linknumber, LSL_List rules)
{
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
- foreach (SceneObjectPart part in parts)
- SetPrimParams(part, rules);
+ foreach (ISceneEntity part in parts)
+ {
+ if (part is SceneObjectPart)
+ {
+ SetPrimParams((SceneObjectPart)part, rules);
+ }
+ }
}
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
@@ -7712,25 +7761,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return land.GetMusicUrl();
}
- public LSL_Vector llGetRootPosition()
+ protected LSL_Vector GetRootPosition()
{
- m_host.AddScriptLPS(1);
return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y,
m_host.ParentGroup.AbsolutePosition.Z);
}
- /// <summary>
- /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetRot
- /// http://lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation
- /// Also tested in sl in regards to the behaviour in attachments/mouselook
- /// In the root prim:-
- /// Returns the object rotation if not attached
- /// Returns the avatars rotation if attached
- /// Returns the camera rotation if attached and the avatar is in mouselook
- /// </summary>
- public LSL_Rotation llGetRootRotation()
+ public LSL_Vector llGetRootPosition()
{
m_host.AddScriptLPS(1);
+ return GetRootPosition();
+ }
+
+ protected LSL_Rotation GetRootRotation()
+ {
Quaternion q;
if (m_host.ParentGroup.AttachmentPoint != 0)
{
@@ -7748,6 +7792,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}
+ /// <summary>
+ /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetRot
+ /// http://lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation
+ /// Also tested in sl in regards to the behaviour in attachments/mouselook
+ /// In the root prim:-
+ /// Returns the object rotation if not attached
+ /// Returns the avatars rotation if attached
+ /// Returns the camera rotation if attached and the avatar is in mouselook
+ /// </summary>
+ public LSL_Rotation llGetRootRotation()
+ {
+ m_host.AddScriptLPS(1);
+ return GetRootRotation();
+ }
+
public LSL_String llGetObjectDesc()
{
return m_host.Description!=null?m_host.Description:String.Empty;
@@ -7871,11 +7930,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- List<SceneObjectPart> parts = GetLinkParts(linknumber);
+ List<ISceneEntity> parts = GetLinkParts(linknumber);
LSL_List res = new LSL_List();
- foreach (var part in parts)
+ foreach (ISceneEntity part in parts)
{
LSL_List partRes = GetLinkPrimitiveParams(part, rules);
res += partRes;
@@ -7884,7 +7943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return res;
}
- public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
+ public LSL_List GetLinkPrimitiveParams(ISceneEntity part, LSL_List rules)
{
LSL_List res = new LSL_List();
int idx=0;
@@ -7893,193 +7952,208 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int code=(int)rules.GetLSLIntegerItem(idx++);
int remain=rules.Length-idx;
- switch (code)
+ if (part is SceneObjectGroup)
{
- case (int)ScriptBaseClass.PRIM_MATERIAL:
- res.Add(new LSL_Integer(part.Material));
- break;
- case (int)ScriptBaseClass.PRIM_PHYSICS:
- if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
- res.Add(new LSL_Integer(1));
- else
- res.Add(new LSL_Integer(0));
- break;
+ #region Prim
- case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
- if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0)
- res.Add(new LSL_Integer(1));
- else
- res.Add(new LSL_Integer(0));
- break;
+ SceneObjectPart prim = (SceneObjectPart)part;
+ switch (code)
+ {
+ case (int)ScriptBaseClass.PRIM_MATERIAL:
+ res.Add(new LSL_Integer(prim.Material));
+ break;
- case (int)ScriptBaseClass.PRIM_PHANTOM:
- if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
- res.Add(new LSL_Integer(1));
- else
- res.Add(new LSL_Integer(0));
- break;
+ case (int)ScriptBaseClass.PRIM_PHYSICS:
+ if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
+ res.Add(new LSL_Integer(1));
+ else
+ res.Add(new LSL_Integer(0));
+ break;
- case (int)ScriptBaseClass.PRIM_POSITION:
- LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X,
- part.AbsolutePosition.Y,
- part.AbsolutePosition.Z);
- // For some reason, the part.AbsolutePosition.* values do not change if the
- // linkset is rotated; they always reflect the child prim's world position
- // as though the linkset is unrotated. This is incompatible behavior with SL's
- // implementation, so will break scripts imported from there (not to mention it
- // makes it more difficult to determine a child prim's actual inworld position).
- if (part.ParentID != 0)
- v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition();
- res.Add(v);
- break;
+ case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
+ if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0)
+ res.Add(new LSL_Integer(1));
+ else
+ res.Add(new LSL_Integer(0));
+ break;
- case (int)ScriptBaseClass.PRIM_SIZE:
- res.Add(new LSL_Vector(part.Scale.X,
- part.Scale.Y,
- part.Scale.Z));
- break;
+ case (int)ScriptBaseClass.PRIM_PHANTOM:
+ if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
+ res.Add(new LSL_Integer(1));
+ else
+ res.Add(new LSL_Integer(0));
+ break;
- case (int)ScriptBaseClass.PRIM_ROTATION:
- res.Add(GetPartRot(part));
- break;
+ case (int)ScriptBaseClass.PRIM_POSITION:
+ LSL_Vector v = new LSL_Vector(prim.AbsolutePosition.X,
+ prim.AbsolutePosition.Y,
+ prim.AbsolutePosition.Z);
+ // For some reason, the prim.AbsolutePosition.* values do not change if the
+ // linkset is rotated; they always reflect the child prim's world position
+ // as though the linkset is unrotated. This is incompatible behavior with SL's
+ // implementation, so will break scripts imported from there (not to mention it
+ // makes it more difficult to determine a child prim's actual inworld position).
+ if (prim.ParentID != 0)
+ v = ((v - GetRootPosition()) * GetRootRotation()) + GetRootPosition();
+ res.Add(v);
+ break;
- case (int)ScriptBaseClass.PRIM_TYPE:
- // implementing box
- PrimitiveBaseShape Shape = part.Shape;
- int primType = (int)part.GetPrimType();
- res.Add(new LSL_Integer(primType));
- double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
- double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
- switch (primType)
- {
- case ScriptBaseClass.PRIM_TYPE_BOX:
- case ScriptBaseClass.PRIM_TYPE_CYLINDER:
- case ScriptBaseClass.PRIM_TYPE_PRISM:
- res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
- res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
- res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
- res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
- res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
- res.Add(new LSL_Vector(topshearx, topsheary, 0));
- break;
+ case (int)ScriptBaseClass.PRIM_SIZE:
+ res.Add(new LSL_Vector(prim.Scale.X,
+ prim.Scale.Y,
+ prim.Scale.Z));
+ break;
- case ScriptBaseClass.PRIM_TYPE_SPHERE:
- res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
- res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
- res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
- res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
- res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
- break;
+ case (int)ScriptBaseClass.PRIM_ROTATION:
+ res.Add(GetPartRot(prim));
+ break;
- case ScriptBaseClass.PRIM_TYPE_SCULPT:
- res.Add(Shape.SculptTexture.ToString());
- res.Add(new LSL_Integer(Shape.SculptType));
- break;
+ case (int)ScriptBaseClass.PRIM_TYPE:
+ // implementing box
+ PrimitiveBaseShape Shape = prim.Shape;
+ int primType = (int)prim.GetPrimType();
+ res.Add(new LSL_Integer(primType));
+ double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
+ double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
+ switch (primType)
+ {
+ case ScriptBaseClass.PRIM_TYPE_BOX:
+ case ScriptBaseClass.PRIM_TYPE_CYLINDER:
+ case ScriptBaseClass.PRIM_TYPE_PRISM:
+ res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
+ res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
+ res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
+ res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
+ res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
+ res.Add(new LSL_Vector(topshearx, topsheary, 0));
+ break;
- case ScriptBaseClass.PRIM_TYPE_RING:
- case ScriptBaseClass.PRIM_TYPE_TUBE:
- case ScriptBaseClass.PRIM_TYPE_TORUS:
- // holeshape
- res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
-
- // cut
- res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
-
- // hollow
- res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
-
- // twist
- res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
-
- // vector holesize
- res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
-
- // vector topshear
- res.Add(new LSL_Vector(topshearx, topsheary, 0));
-
- // vector profilecut
- res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
-
- // vector tapera
- res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
-
- // float revolutions
- res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d);
- // Slightly inaccurate, because an unsigned byte is being used to represent
- // the entire range of floating-point values from 1.0 through 4.0 (which is how
- // SL does it).
- //
- // Using these formulas to store and retrieve PathRevolutions, it is not
- // possible to use all values between 1.00 and 4.00. For instance, you can't
- // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you
- // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them
- // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar
- // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11.
- // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value
- // such as 1.10. So, SL must store and retreive the actual user input rather
- // than only storing the encoded value.
-
- // float radiusoffset
- res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
-
- // float skew
- res.Add(new LSL_Float(Shape.PathSkew / 100.0));
- break;
- }
- break;
+ case ScriptBaseClass.PRIM_TYPE_SPHERE:
+ res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
+ res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
+ res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
+ res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
+ res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
+ break;
- case (int)ScriptBaseClass.PRIM_TEXTURE:
- if (remain < 1)
- return res;
+ case ScriptBaseClass.PRIM_TYPE_SCULPT:
+ res.Add(Shape.SculptTexture.ToString());
+ res.Add(new LSL_Integer(Shape.SculptType));
+ break;
- int face = (int)rules.GetLSLIntegerItem(idx++);
- Primitive.TextureEntry tex = part.Shape.Textures;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0 ; face < GetNumberOfSides(part); face++)
+ case ScriptBaseClass.PRIM_TYPE_RING:
+ case ScriptBaseClass.PRIM_TYPE_TUBE:
+ case ScriptBaseClass.PRIM_TYPE_TORUS:
+ // holeshape
+ res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
+
+ // cut
+ res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
+
+ // hollow
+ res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
+
+ // twist
+ res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
+
+ // vector holesize
+ res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
+
+ // vector topshear
+ res.Add(new LSL_Vector(topshearx, topsheary, 0));
+
+ // vector profilecut
+ res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
+
+ // vector tapera
+ res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
+
+ // float revolutions
+ res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d);
+ // Slightly inaccurate, because an unsigned byte is being used to represent
+ // the entire range of floating-point values from 1.0 through 4.0 (which is how
+ // SL does it).
+ //
+ // Using these formulas to store and retrieve PathRevolutions, it is not
+ // possible to use all values between 1.00 and 4.00. For instance, you can't
+ // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you
+ // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them
+ // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar
+ // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11.
+ // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value
+ // such as 1.10. So, SL must store and retreive the actual user input rather
+ // than only storing the encoded value.
+
+ // float radiusoffset
+ res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
+
+ // float skew
+ res.Add(new LSL_Float(Shape.PathSkew / 100.0));
+ break;
+ }
+ break;
+
+ case (int)ScriptBaseClass.PRIM_TEXTURE:
+ if (remain < 1)
+ return res;
+
+ int face = (int)rules.GetLSLIntegerItem(idx++);
+ Primitive.TextureEntry tex = prim.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
-
- res.Add(new LSL_String(texface.TextureID.ToString()));
- res.Add(new LSL_Vector(texface.RepeatU,
- texface.RepeatV,
- 0));
- res.Add(new LSL_Vector(texface.OffsetU,
- texface.OffsetV,
- 0));
- res.Add(new LSL_Float(texface.Rotation));
+ for (face = 0; face < GetNumberOfSides(prim); face++)
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+
+ res.Add(new LSL_String(texface.TextureID.ToString()));
+ res.Add(new LSL_Vector(texface.RepeatU,
+ texface.RepeatV,
+ 0));
+ res.Add(new LSL_Vector(texface.OffsetU,
+ texface.OffsetV,
+ 0));
+ res.Add(new LSL_Float(texface.Rotation));
+ }
}
- }
- else
- {
- if (face >= 0 && face < GetNumberOfSides(part))
+ else
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
-
- res.Add(new LSL_String(texface.TextureID.ToString()));
- res.Add(new LSL_Vector(texface.RepeatU,
- texface.RepeatV,
- 0));
- res.Add(new LSL_Vector(texface.OffsetU,
- texface.OffsetV,
- 0));
- res.Add(new LSL_Float(texface.Rotation));
+ if (face >= 0 && face < GetNumberOfSides(prim))
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+
+ res.Add(new LSL_String(texface.TextureID.ToString()));
+ res.Add(new LSL_Vector(texface.RepeatU,
+ texface.RepeatV,
+ 0));
+ res.Add(new LSL_Vector(texface.OffsetU,
+ texface.OffsetV,
+ 0));
+ res.Add(new LSL_Float(texface.Rotation));
+ }
}
- }
- break;
+ break;
- case (int)ScriptBaseClass.PRIM_COLOR:
- if (remain < 1)
- return res;
+ case (int)ScriptBaseClass.PRIM_COLOR:
+ if (remain < 1)
+ return res;
- face=(int)rules.GetLSLIntegerItem(idx++);
+ face = (int)rules.GetLSLIntegerItem(idx++);
- tex = part.Shape.Textures;
- Color4 texcolor;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0 ; face < GetNumberOfSides(part); face++)
+ tex = prim.Shape.Textures;
+ Color4 texcolor;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(prim); face++)
+ {
+ texcolor = tex.GetFace((uint)face).RGBA;
+ res.Add(new LSL_Vector(texcolor.R,
+ texcolor.G,
+ texcolor.B));
+ res.Add(new LSL_Float(texcolor.A));
+ }
+ }
+ else
{
texcolor = tex.GetFace((uint)face).RGBA;
res.Add(new LSL_Vector(texcolor.R,
@@ -8087,176 +8161,264 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texcolor.B));
res.Add(new LSL_Float(texcolor.A));
}
- }
- else
- {
- texcolor = tex.GetFace((uint)face).RGBA;
- res.Add(new LSL_Vector(texcolor.R,
- texcolor.G,
- texcolor.B));
- res.Add(new LSL_Float(texcolor.A));
- }
- break;
+ break;
- case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
- if (remain < 1)
- return res;
+ case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
+ if (remain < 1)
+ return res;
- face=(int)rules.GetLSLIntegerItem(idx++);
+ face = (int)rules.GetLSLIntegerItem(idx++);
- tex = part.Shape.Textures;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
+ tex = prim.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- // Convert Shininess to PRIM_SHINY_*
- res.Add(new LSL_Integer((uint)texface.Shiny >> 6));
- // PRIM_BUMP_*
- res.Add(new LSL_Integer((int)texface.Bump));
+ for (face = 0; face < GetNumberOfSides(prim); face++)
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ // Convert Shininess to PRIM_SHINY_*
+ res.Add(new LSL_Integer((uint)texface.Shiny >> 6));
+ // PRIM_BUMP_*
+ res.Add(new LSL_Integer((int)texface.Bump));
+ }
}
- }
- else
- {
- if (face >= 0 && face < GetNumberOfSides(part))
+ else
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- // Convert Shininess to PRIM_SHINY_*
- res.Add(new LSL_Integer((uint)texface.Shiny >> 6));
- // PRIM_BUMP_*
- res.Add(new LSL_Integer((int)texface.Bump));
+ if (face >= 0 && face < GetNumberOfSides(prim))
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ // Convert Shininess to PRIM_SHINY_*
+ res.Add(new LSL_Integer((uint)texface.Shiny >> 6));
+ // PRIM_BUMP_*
+ res.Add(new LSL_Integer((int)texface.Bump));
+ }
}
- }
- break;
+ break;
- case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
- if (remain < 1)
- return res;
+ case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
+ if (remain < 1)
+ return res;
- face=(int)rules.GetLSLIntegerItem(idx++);
+ face = (int)rules.GetLSLIntegerItem(idx++);
- tex = part.Shape.Textures;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
+ tex = prim.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- res.Add(new LSL_Integer(texface.Fullbright ? 1 : 0));
+ for (face = 0; face < GetNumberOfSides(prim); face++)
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ res.Add(new LSL_Integer(texface.Fullbright ? 1 : 0));
+ }
}
- }
- else
- {
- if (face >= 0 && face < GetNumberOfSides(part))
+ else
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- res.Add(new LSL_Integer(texface.Fullbright ? 1 : 0));
+ if (face >= 0 && face < GetNumberOfSides(prim))
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ res.Add(new LSL_Integer(texface.Fullbright ? 1 : 0));
+ }
}
- }
- break;
+ break;
- case (int)ScriptBaseClass.PRIM_FLEXIBLE:
- PrimitiveBaseShape shape = part.Shape;
+ case (int)ScriptBaseClass.PRIM_FLEXIBLE:
+ PrimitiveBaseShape shape = prim.Shape;
- if (shape.FlexiEntry)
- res.Add(new LSL_Integer(1)); // active
- else
- res.Add(new LSL_Integer(0));
- res.Add(new LSL_Integer(shape.FlexiSoftness));// softness
- res.Add(new LSL_Float(shape.FlexiGravity)); // gravity
- res.Add(new LSL_Float(shape.FlexiDrag)); // friction
- res.Add(new LSL_Float(shape.FlexiWind)); // wind
- res.Add(new LSL_Float(shape.FlexiTension)); // tension
- res.Add(new LSL_Vector(shape.FlexiForceX, // force
- shape.FlexiForceY,
- shape.FlexiForceZ));
- break;
+ if (shape.FlexiEntry)
+ res.Add(new LSL_Integer(1)); // active
+ else
+ res.Add(new LSL_Integer(0));
+ res.Add(new LSL_Integer(shape.FlexiSoftness));// softness
+ res.Add(new LSL_Float(shape.FlexiGravity)); // gravity
+ res.Add(new LSL_Float(shape.FlexiDrag)); // friction
+ res.Add(new LSL_Float(shape.FlexiWind)); // wind
+ res.Add(new LSL_Float(shape.FlexiTension)); // tension
+ res.Add(new LSL_Vector(shape.FlexiForceX, // force
+ shape.FlexiForceY,
+ shape.FlexiForceZ));
+ break;
- case (int)ScriptBaseClass.PRIM_TEXGEN:
- if (remain < 1)
- return res;
+ case (int)ScriptBaseClass.PRIM_TEXGEN:
+ if (remain < 1)
+ return res;
- face=(int)rules.GetLSLIntegerItem(idx++);
+ face = (int)rules.GetLSLIntegerItem(idx++);
- tex = part.Shape.Textures;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
+ tex = prim.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
{
- MappingType texgen = tex.GetFace((uint)face).TexMapType;
- // Convert MappingType to PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR etc.
- res.Add(new LSL_Integer((uint)texgen >> 1));
+ for (face = 0; face < GetNumberOfSides(prim); face++)
+ {
+ MappingType texgen = tex.GetFace((uint)face).TexMapType;
+ // Convert MappingType to PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR etc.
+ res.Add(new LSL_Integer((uint)texgen >> 1));
+ }
}
- }
- else
- {
- if (face >= 0 && face < GetNumberOfSides(part))
+ else
{
- MappingType texgen = tex.GetFace((uint)face).TexMapType;
- res.Add(new LSL_Integer((uint)texgen >> 1));
+ if (face >= 0 && face < GetNumberOfSides(prim))
+ {
+ MappingType texgen = tex.GetFace((uint)face).TexMapType;
+ res.Add(new LSL_Integer((uint)texgen >> 1));
+ }
}
- }
- break;
+ break;
- case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
- shape = part.Shape;
+ case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
+ shape = prim.Shape;
- if (shape.LightEntry)
- res.Add(new LSL_Integer(1)); // active
- else
- res.Add(new LSL_Integer(0));
- res.Add(new LSL_Vector(shape.LightColorR, // color
- shape.LightColorG,
- shape.LightColorB));
- res.Add(new LSL_Float(shape.LightIntensity)); // intensity
- res.Add(new LSL_Float(shape.LightRadius)); // radius
- res.Add(new LSL_Float(shape.LightFalloff)); // falloff
- break;
+ if (shape.LightEntry)
+ res.Add(new LSL_Integer(1)); // active
+ else
+ res.Add(new LSL_Integer(0));
+ res.Add(new LSL_Vector(shape.LightColorR, // color
+ shape.LightColorG,
+ shape.LightColorB));
+ res.Add(new LSL_Float(shape.LightIntensity)); // intensity
+ res.Add(new LSL_Float(shape.LightRadius)); // radius
+ res.Add(new LSL_Float(shape.LightFalloff)); // falloff
+ break;
- case (int)ScriptBaseClass.PRIM_GLOW:
- if (remain < 1)
- return res;
+ case (int)ScriptBaseClass.PRIM_GLOW:
+ if (remain < 1)
+ return res;
- face=(int)rules.GetLSLIntegerItem(idx++);
+ face = (int)rules.GetLSLIntegerItem(idx++);
- tex = part.Shape.Textures;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
+ tex = prim.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- res.Add(new LSL_Float(texface.Glow));
+ for (face = 0; face < GetNumberOfSides(prim); face++)
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ res.Add(new LSL_Float(texface.Glow));
+ }
}
- }
- else
- {
- if (face >= 0 && face < GetNumberOfSides(part))
+ else
{
- Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- res.Add(new LSL_Float(texface.Glow));
+ if (face >= 0 && face < GetNumberOfSides(prim))
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ res.Add(new LSL_Float(texface.Glow));
+ }
}
- }
- break;
+ break;
- case (int)ScriptBaseClass.PRIM_TEXT:
- Color4 textColor = part.GetTextColor();
- res.Add(new LSL_String(part.Text));
- res.Add(new LSL_Vector(textColor.R,
- textColor.G,
- textColor.B));
- res.Add(new LSL_Float(textColor.A));
- break;
- case (int)ScriptBaseClass.PRIM_NAME:
- res.Add(new LSL_String(part.Name));
- break;
- case (int)ScriptBaseClass.PRIM_DESC:
- res.Add(new LSL_String(part.Description));
- break;
- case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
- res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W));
- break;
- case (int)ScriptBaseClass.PRIM_POS_LOCAL:
- res.Add(new LSL_Vector(GetPartLocalPos(part)));
- break;
+ case (int)ScriptBaseClass.PRIM_TEXT:
+ Color4 textColor = prim.GetTextColor();
+ res.Add(new LSL_String(prim.Text));
+ res.Add(new LSL_Vector(textColor.R,
+ textColor.G,
+ textColor.B));
+ res.Add(new LSL_Float(textColor.A));
+ break;
+ case (int)ScriptBaseClass.PRIM_NAME:
+ res.Add(new LSL_String(prim.Name));
+ break;
+ case (int)ScriptBaseClass.PRIM_DESC:
+ res.Add(new LSL_String(prim.Description));
+ break;
+ case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
+ res.Add(new LSL_Rotation(prim.RotationOffset.X, prim.RotationOffset.Y, prim.RotationOffset.Z, prim.RotationOffset.W));
+ break;
+ case (int)ScriptBaseClass.PRIM_POS_LOCAL:
+ res.Add(new LSL_Vector(GetPartLocalPos(prim)));
+ break;
+ }
+
+ #endregion
+
+ }
+ else if (part is ScenePresence)
+ {
+ ScenePresence agent = (ScenePresence)part;
+ switch (code)
+ {
+ case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
+ case (int)ScriptBaseClass.PRIM_COLOR:
+ case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
+ case (int)ScriptBaseClass.PRIM_GLOW:
+ case (int)ScriptBaseClass.PRIM_TEXGEN:
+ case (int)ScriptBaseClass.PRIM_TEXTURE:
+ /// testing in Second Life indicated these properties all returned an empty list for agents.
+ ShoutError("Param 0 error, texture info cannot be accessed for avatars.");
+ break;
+ case (int)ScriptBaseClass.PRIM_PHANTOM:
+ case (int)ScriptBaseClass.PRIM_PHYSICS:
+ case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
+ /// testing in Second Life indicate getting these properties for agents works but returns zero
+ res.Add(new LSL_Integer(ScriptBaseClass.FALSE));
+ break;
+ case (int)ScriptBaseClass.PRIM_DESC:
+ /// testing in Second Life indicated PRIM_DESC for agents returns an empty string.
+ res.Add(new LSL_String(""));
+ break;
+ case ScriptBaseClass.PRIM_MATERIAL:
+ /// testing in Second Life indicated PRIM_MATERIAL for agents returns PRIM_MATERIAL_FLESH
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH));
+ break;
+ case (int)ScriptBaseClass.PRIM_NAME:
+ /// testing in Second Life indicated PRIM_NAME for agents returns the legacy name (e.g. not display name)
+ res.Add(new LSL_String(agent.Name));
+ break;
+ case (int)ScriptBaseClass.PRIM_OMEGA:
+ /// testing in Second Life indicated that although setting PRIM_OMEGA does not work for agents, getting does.
+ res.Add(new LSL_Vector(0, 0, 0));
+ res.Add(new LSL_Float(0));
+ res.Add(new LSL_Float(0));
+ break;
+ case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_PHYSICS_SHAPE_PRIM));
+ break;
+
+ case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
+ res.Add(ScriptBaseClass.FALSE);
+ res.Add(new LSL_Vector(0, 0, 0));
+ res.Add(new LSL_Float(0));
+ res.Add(new LSL_Float(0));
+ res.Add(new LSL_Float(0));
+ break;
+ case (int)ScriptBaseClass.PRIM_POS_LOCAL:
+ res.Add(new LSL_Vector(GetPartLocalPos(part)));
+ break;
+ case (int)ScriptBaseClass.PRIM_POSITION:
+ LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X,
+ part.AbsolutePosition.Y,
+ part.AbsolutePosition.Z);
+ // For some reason, the prim.AbsolutePosition.* values do not change if the
+ // linkset is rotated; they always reflect the child prim's world position
+ // as though the linkset is unrotated. This is incompatible behavior with SL's
+ // implementation, so will break scripts imported from there (not to mention it
+ // makes it more difficult to determine a child prim's actual inworld position).
+ v = ((v - GetRootPosition()) * GetRootRotation()) + GetRootPosition();
+ res.Add(v);
+ break;
+ case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
+ Quaternion rot = agent.Rotation / m_host.ParentGroup.GroupRotation;
+ res.Add(new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W));
+ break;
+ case (int)ScriptBaseClass.PRIM_ROTATION:
+ res.Add(new LSL_Rotation(agent.Rotation.X, agent.Rotation.Y, agent.Rotation.Z, agent.Rotation.W));
+ break;
+ case (int)ScriptBaseClass.PRIM_SIZE:
+ res.Add(GetAgentSize(agent));
+ break;
+ case (int)ScriptBaseClass.PRIM_SLICE:
+ res.Add(new LSL_Vector(0, 1, 0));
+ break;
+ case (int)ScriptBaseClass.PRIM_TEXT:
+ res.Add(new LSL_String(""));
+ res.Add(new LSL_Vector(0, 0, 0));
+ res.Add(new LSL_Float(1));
+ break;
+ case (int)ScriptBaseClass.PRIM_TYPE:
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
+ res.Add(new LSL_Vector(0, 1, 0));
+ res.Add(new LSL_Float(0));
+ res.Add(new LSL_Vector(0, 0, 0));
+ res.Add(new LSL_Vector(1, 1, 0));
+ res.Add(new LSL_Vector(0, 0, 0));
+ break;
+ }
}
}
return res;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 44de176..9ac5634 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2249,8 +2249,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
InitLSL();
LSL_List retVal = new LSL_List();
- List<SceneObjectPart> parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber);
- foreach (SceneObjectPart part in parts)
+ List<ISceneEntity> parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber);
+ foreach (ISceneEntity part in parts)
{
retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams(part, rules);
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index c3eada0..0c3da10 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -323,9 +323,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_NAME = 27;
public const int PRIM_DESC = 28;
public const int PRIM_ROT_LOCAL = 29;
+ public const int PRIM_PHYSICS_SHAPE_TYPE = 30;
public const int PRIM_OMEGA = 32;
public const int PRIM_POS_LOCAL = 33;
public const int PRIM_LINK_TARGET = 34;
+ public const int PRIM_SLICE = 35;
public const int PRIM_TEXGEN_DEFAULT = 0;
public const int PRIM_TEXGEN_PLANAR = 1;
@@ -660,5 +662,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public static readonly LSLInteger RCERR_UNKNOWN = -1;
public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2;
public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3;
+
+ #region Physics
+
+ /// <summary>
+ /// default for all non-mesh objects
+ /// </summary>
+ public const int PRIM_PHYSICS_SHAPE_PRIM = 0;
+
+ /// <summary>
+ /// This cannot be applied to the root prim or avatars.
+ /// http://wiki.secondlife.com/wiki/LlGetLinkPrimitiveParams
+ /// </summary>
+ public const int PRIM_PHYSICS_SHAPE_NONE = 1;
+
+ /// <summary>
+ /// default for all mesh objects
+ /// </summary>
+ public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
+
+ #endregion
}
}
--
1.7.11.msysgit.1
| |||||||||
Relationships |
|||||||||||
|
|||||||||||
Notes |
|
|
(0021954) SignpostMarv (reporter) 2012-08-01 12:23 |
The additional info field contains the test script, script output and error output that I used to determine the appropriate values from Second Life. |
|
(0023686) Bolivar Shagnasty (reporter) 2013-03-24 03:14 |
SetLinkPrimitiveParams seems to have problems on prims as well. Attempting to make one of the prims in a linked set phantom makes them all phantom. |
|
(0023687) melanie (administrator) 2013-03-24 05:16 |
That is design behavior. An object cannot be partially phantom. |
|
(0023688) Bolivar Shagnasty (reporter) 2013-03-24 07:37 |
That is most unfortunate and there doesn't seem to be anyway to change it so I will have to accomplish the task another way. Thank you for pointing this out. |
|
(0023690) Mata Hari (reporter) 2013-03-25 12:13 |
This is the same issue I reported in 0006573 While I concur with Melanie that many of those function parameters shouldn't be possible to get or set when the link is an avatar, there are other applications that these functions are commonly used for that are supposed to work (and do currently work in SL). Examples include several very common applications that need llSetLinkPrimitiveParamsFast(PRIM_POSITION|PRIM_ROTATION|PRIM_POS_LOCAL|PRIM_ROT_LOCAL: - in-region teleporter systems that use llSetLinkPrimParamasFast) to adjust avatar position (often in multiple steps) no longer work. Yes, one can use osTeleportAgent() as a substitute but many users do not host their own sims and do not have that OSSL function enabled. - a host of the most popular "next generation" furniture in SL now allows multiple avatar animations without poseballs, accomplished by having the avatars simply sit on the object and then moving them into correct position. These scripts all fail when used in OpenSim - photo studios using linked props as the sit-target (rather than a separate poseball) use the same technique for correctly positioning avatars and work perfectly in SL |
|
(0023691) Richardus Raymaker (reporter) 2013-03-25 12:27 edited on: 2013-03-25 12:29 |
I just tried the above script on 0.7.5 release. but its generating error "PRIM_PHYSICS_SHAPE_TYPE" does not exists. and the bug report creator forgot to add what physics engine and opensim version he used. ok, physics he add, but cant believe someone is still useing basicphysics. ? |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-08-01 12:22 | SignpostMarv | New Issue | |
| 2012-08-01 12:22 | SignpostMarv | File Added: LinkPrimitiveParams-partial-non-functional.patch | |
| 2012-08-01 12:23 | SignpostMarv | Note Added: 0021954 | |
| 2013-03-24 03:14 | Bolivar Shagnasty | Note Added: 0023686 | |
| 2013-03-24 05:16 | melanie | Note Added: 0023687 | |
| 2013-03-24 07:37 | Bolivar Shagnasty | Note Added: 0023688 | |
| 2013-03-25 12:13 | Mata Hari | Note Added: 0023690 | |
| 2013-03-25 12:27 | Richardus Raymaker | Note Added: 0023691 | |
| 2013-03-25 12:29 | Richardus Raymaker | Note Edited: 0023691 | View Revisions |
| 2013-03-27 00:03 | justincc | Relationship added | related to 0006421 |
| 2013-03-27 00:04 | justincc | Relationship added | related to 0006573 |
| Copyright © 2000 - 2012 MantisBT Group |




