diff options
author | Jeff Lee | 2009-12-19 18:25:45 -0500 |
---|---|---|
committer | Melanie | 2009-12-21 15:48:30 +0000 |
commit | d04f6688e42f340f0dedec2c4982cf2fd4cf1686 (patch) | |
tree | 23ab7b189946f0e23beba973cb5b6f201ba88040 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-d04f6688e42f340f0dedec2c4982cf2fd4cf1686.zip opensim-SC-d04f6688e42f340f0dedec2c4982cf2fd4cf1686.tar.gz opensim-SC-d04f6688e42f340f0dedec2c4982cf2fd4cf1686.tar.bz2 opensim-SC-d04f6688e42f340f0dedec2c4982cf2fd4cf1686.tar.xz |
Fixes some incorrect values returned by llGetPrimitiveParams() and osGetLinkPrimitiveParams().
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7f71d09..79b2391 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5801,7 +5801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5801 | m_host.AddScriptLPS(1); | 5801 | m_host.AddScriptLPS(1); |
5802 | return World.SimulatorFPS; | 5802 | return World.SimulatorFPS; |
5803 | } | 5803 | } |
5804 | 5804 | ||
5805 | 5805 | ||
5806 | /* particle system rules should be coming into this routine as doubles, that is | 5806 | /* particle system rules should be coming into this routine as doubles, that is |
5807 | rule[0] should be an integer from this list and rule[1] should be the arg | 5807 | rule[0] should be an integer from this list and rule[1] should be the arg |
@@ -7401,9 +7401,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7401 | break; | 7401 | break; |
7402 | 7402 | ||
7403 | case (int)ScriptBaseClass.PRIM_POSITION: | 7403 | case (int)ScriptBaseClass.PRIM_POSITION: |
7404 | res.Add(new LSL_Vector(part.AbsolutePosition.X, | 7404 | LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X, |
7405 | part.AbsolutePosition.Y, | 7405 | part.AbsolutePosition.Y, |
7406 | part.AbsolutePosition.Z)); | 7406 | part.AbsolutePosition.Z); |
7407 | // For some reason, the part.AbsolutePosition.* values do not change if the | ||
7408 | // linkset is rotated; they always reflect the child prim's world position | ||
7409 | // as though the linkset is unrotated. This is incompatible behavior with SL's | ||
7410 | // implementation, so will break scripts imported from there (not to mention it | ||
7411 | // makes it more difficult to determine a child prim's actual inworld position). | ||
7412 | if (part.ParentID != 0) | ||
7413 | v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition(); | ||
7414 | res.Add( v ); | ||
7407 | break; | 7415 | break; |
7408 | 7416 | ||
7409 | case (int)ScriptBaseClass.PRIM_SIZE: | 7417 | case (int)ScriptBaseClass.PRIM_SIZE: |
@@ -7421,6 +7429,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7421 | PrimitiveBaseShape Shape = part.Shape; | 7429 | PrimitiveBaseShape Shape = part.Shape; |
7422 | int primType = getScriptPrimType(part.Shape); | 7430 | int primType = getScriptPrimType(part.Shape); |
7423 | res.Add(new LSL_Integer(primType)); | 7431 | res.Add(new LSL_Integer(primType)); |
7432 | double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX | ||
7433 | double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. | ||
7424 | switch (primType) | 7434 | switch (primType) |
7425 | { | 7435 | { |
7426 | case ScriptBaseClass.PRIM_TYPE_BOX: | 7436 | case ScriptBaseClass.PRIM_TYPE_BOX: |
@@ -7431,7 +7441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7431 | res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); | 7441 | res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); |
7432 | res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); | 7442 | res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); |
7433 | res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); | 7443 | res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); |
7434 | res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); | 7444 | res.Add(new LSL_Vector(topshearx, topsheary, 0)); |
7435 | break; | 7445 | break; |
7436 | 7446 | ||
7437 | case ScriptBaseClass.PRIM_TYPE_SPHERE: | 7447 | case ScriptBaseClass.PRIM_TYPE_SPHERE: |
@@ -7466,7 +7476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7466 | res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); | 7476 | res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); |
7467 | 7477 | ||
7468 | // vector topshear | 7478 | // vector topshear |
7469 | res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); | 7479 | res.Add(new LSL_Vector(topshearx, topsheary, 0)); |
7470 | 7480 | ||
7471 | // vector profilecut | 7481 | // vector profilecut |
7472 | res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); | 7482 | res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); |
@@ -7475,8 +7485,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7475 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); | 7485 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); |
7476 | 7486 | ||
7477 | // float revolutions | 7487 | // float revolutions |
7478 | res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :( | 7488 | res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned |
7479 | 7489 | // byte is being used to represent the entire | |
7490 | // range of floating-point values from 1.0 | ||
7491 | // through 4.0 (which is how SL does it). | ||
7492 | |||
7480 | // float radiusoffset | 7493 | // float radiusoffset |
7481 | res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); | 7494 | res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); |
7482 | 7495 | ||