Thank you, Ewe Loon, for a patch that fixes various aspects of

llSetPrimitiveParams and llSetLinkPrimitiveParams
0.6.0-stable
Melanie Thielker 2008-09-01 23:35:52 +00:00
parent a5d2674a43
commit 0e7bac07f6
1 changed files with 48 additions and 48 deletions

View File

@ -5177,7 +5177,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return Util.Md5Hash(src + ":" + nonce.ToString()); return Util.Md5Hash(src + ":" + nonce.ToString());
} }
private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) private ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
@ -5220,38 +5220,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
hollow = 0.95f; hollow = 0.95f;
} }
shapeBlock.ProfileHollow = (ushort)(50000 * hollow); shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
if (twist.x < -0.5f) if (twist.x < -1.0f)
{ {
twist.x = -0.5f; twist.x = -1.0f;
} }
if (twist.x > 0.5f) if (twist.x > 1.0f)
{ {
twist.x = 0.5f; twist.x = 1.0f;
} }
if (twist.y < -0.5f) if (twist.y < -1.0f)
{ {
twist.y = -0.5f; twist.y = -1.0f;
} }
if (twist.y > 0.5f) if (twist.y > 1.0f)
{ {
twist.y = 0.5f; twist.y = 1.0f;
} }
shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x);
shapeBlock.PathTwist = (sbyte)(200 * twist.y); shapeBlock.PathTwist = (sbyte)(100 * twist.y);
shapeBlock.ObjectLocalID = m_host.LocalId; shapeBlock.ObjectLocalID = part.LocalId;
// retain pathcurve // retain pathcurve
shapeBlock.PathCurve = m_host.Shape.PathCurve; shapeBlock.PathCurve = part.Shape.PathCurve;
return shapeBlock; return shapeBlock;
} }
private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock; ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
shapeBlock.ProfileCurve += fudge; shapeBlock.ProfileCurve += fudge;
@ -5271,8 +5271,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
taper_b.y = 2f; taper_b.y = 2f;
} }
shapeBlock.PathScaleX = (byte)(100 * taper_b.x); shapeBlock.PathScaleX = (byte)(100 * (2.0 - taper_b.x));
shapeBlock.PathScaleY = (byte)(100 * taper_b.y); shapeBlock.PathScaleY = (byte)(100 * (2.0 - taper_b.y));
if (topshear.x < -0.5f) if (topshear.x < -0.5f)
{ {
topshear.x = -0.5f; topshear.x = -0.5f;
@ -5292,14 +5292,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
shapeBlock.PathShearX = (byte)(100 * topshear.x); shapeBlock.PathShearX = (byte)(100 * topshear.x);
shapeBlock.PathShearY = (byte)(100 * topshear.y); shapeBlock.PathShearY = (byte)(100 * topshear.y);
m_host.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock; ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
// profile/path swapped for a sphere // profile/path swapped for a sphere
shapeBlock.PathBegin = shapeBlock.ProfileBegin; shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@ -5333,14 +5333,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
m_host.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock; ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
shapeBlock.ProfileCurve += fudge; shapeBlock.ProfileCurve += fudge;
@ -5432,7 +5432,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
revolutions = 4f; revolutions = 4f;
} }
shapeBlock.PathRevolutions = (byte)(100 * revolutions); shapeBlock.PathRevolutions = (byte)(66.666667 * (revolutions - 1.0));
// limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1
if (radiusoffset < 0f) if (radiusoffset < 0f)
{ {
@ -5453,10 +5453,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
shapeBlock.PathSkew = (sbyte)(100 * skew); shapeBlock.PathSkew = (sbyte)(100 * skew);
m_host.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
private void SetPrimitiveShapeParams(string map, int type) private void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
LLUUID sculptId; LLUUID sculptId;
@ -5467,7 +5467,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
shapeBlock.ObjectLocalID = m_host.LocalId; shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100; shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150; shapeBlock.PathScaleY = 150;
@ -5481,11 +5481,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
// retain pathcurve // retain pathcurve
shapeBlock.PathCurve = m_host.Shape.PathCurve; shapeBlock.PathCurve = part.Shape.PathCurve;
m_host.Shape.SetSculptData((byte)type, sculptId); part.Shape.SetSculptData((byte)type, sculptId);
m_host.Shape.SculptEntry = true; part.Shape.SculptEntry = true;
m_host.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
public void llSetPrimitiveParams(LSL_Types.list rules) public void llSetPrimitiveParams(LSL_Types.list rules)
@ -5572,8 +5572,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
m_host.Shape.PathCurve = (byte) Extrusion.Straight; part.Shape.PathCurve = (byte)Extrusion.Straight;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
@ -5586,9 +5586,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
m_host.Shape.ProfileShape = ProfileShape.Circle; part.Shape.ProfileShape = ProfileShape.Circle;
m_host.Shape.PathCurve = (byte) Extrusion.Straight; part.Shape.PathCurve = (byte)Extrusion.Straight;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_PRISM: case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
@ -5601,8 +5601,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
m_host.Shape.PathCurve = (byte) Extrusion.Straight; part.Shape.PathCurve = (byte)Extrusion.Straight;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 3); SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
@ -5614,8 +5614,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
hollow = (float)Convert.ToDouble(rules.Data[idx++]); hollow = (float)Convert.ToDouble(rules.Data[idx++]);
twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple
m_host.Shape.PathCurve = (byte) Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_TORUS: case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
@ -5633,8 +5633,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
revolutions = (float)Convert.ToDouble(rules.Data[idx++]); revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
skew = (float)Convert.ToDouble(rules.Data[idx++]); skew = (float)Convert.ToDouble(rules.Data[idx++]);
m_host.Shape.PathCurve = (byte) Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_TUBE: case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@ -5652,8 +5652,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
revolutions = (float)Convert.ToDouble(rules.Data[idx++]); revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
skew = (float)Convert.ToDouble(rules.Data[idx++]); skew = (float)Convert.ToDouble(rules.Data[idx++]);
m_host.Shape.PathCurve = (byte) Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_RING: case (int)ScriptBaseClass.PRIM_TYPE_RING:
@ -5671,8 +5671,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
revolutions = (float)Convert.ToDouble(rules.Data[idx++]); revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
skew = (float)Convert.ToDouble(rules.Data[idx++]); skew = (float)Convert.ToDouble(rules.Data[idx++]);
m_host.Shape.PathCurve = (byte) Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@ -5681,8 +5681,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string map = rules.Data[idx++].ToString(); string map = rules.Data[idx++].ToString();
face = Convert.ToInt32(rules.Data[idx++].ToString()); // type face = Convert.ToInt32(rules.Data[idx++].ToString()); // type
m_host.Shape.PathCurve = (byte) Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(map, face); SetPrimitiveShapeParams(part, map, face);
break; break;
} }