aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorSignpostMarv2012-08-01 15:18:02 +0100
committerJustin Clark-Casey (justincc)2012-08-17 23:23:03 +0100
commit466d684fbe26b4ea24a0003120d7a875fbbca037 (patch)
treed362efb063f6e8deb9997a52f003605ea9992601 /OpenSim/Region
parentattempt to handle InvalidCastException in a manner similar to Second Life (diff)
downloadopensim-SC_OLD-466d684fbe26b4ea24a0003120d7a875fbbca037.zip
opensim-SC_OLD-466d684fbe26b4ea24a0003120d7a875fbbca037.tar.gz
opensim-SC_OLD-466d684fbe26b4ea24a0003120d7a875fbbca037.tar.bz2
opensim-SC_OLD-466d684fbe26b4ea24a0003120d7a875fbbca037.tar.xz
implemented
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs50
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
3 files changed, 64 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index bd6369c..e84ab05 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4236,6 +4236,56 @@ namespace OpenSim.Region.Framework.Scenes
4236 ScheduleFullUpdate(); 4236 ScheduleFullUpdate();
4237 } 4237 }
4238 4238
4239 public void UpdateSlice(float begin, float end)
4240 {
4241 if (end < begin)
4242 {
4243 float temp = begin;
4244 begin = end;
4245 end = temp;
4246 }
4247 end = Math.Min(1f, Math.Max(0f, end));
4248 begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
4249 if (begin < 0.02f && end < 0.02f)
4250 {
4251 begin = 0f;
4252 end = 0.02f;
4253 }
4254
4255 ushort uBegin = (ushort)(50000.0 * begin);
4256 ushort uEnd = (ushort)(50000.0 * (1f - end));
4257 bool updatePossiblyNeeded = false;
4258 if (GetPrimType() == PrimType.SPHERE)
4259 {
4260 if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
4261 {
4262 m_shape.ProfileBegin = uBegin;
4263 m_shape.ProfileEnd = uEnd;
4264 updatePossiblyNeeded = true;
4265 }
4266 }
4267 else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
4268 {
4269 m_shape.PathBegin = uBegin;
4270 m_shape.PathEnd = uEnd;
4271 updatePossiblyNeeded = true;
4272 }
4273
4274 if (updatePossiblyNeeded && ParentGroup != null)
4275 {
4276 ParentGroup.HasGroupChanged = true;
4277 }
4278 if (updatePossiblyNeeded && PhysActor != null)
4279 {
4280 PhysActor.Shape = m_shape;
4281 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
4282 }
4283 if (updatePossiblyNeeded)
4284 {
4285 ScheduleFullUpdate();
4286 }
4287 }
4288
4239 /// <summary> 4289 /// <summary>
4240 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics 4290 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
4241 /// engine can use it. 4291 /// engine can use it.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 255fc8e..75491da 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7666,6 +7666,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7666 LSL_Float gain = rules.GetLSLFloatItem(idx++); 7666 LSL_Float gain = rules.GetLSLFloatItem(idx++);
7667 TargetOmega(part, axis, (double)spinrate, (double)gain); 7667 TargetOmega(part, axis, (double)spinrate, (double)gain);
7668 break; 7668 break;
7669 case (int)ScriptBaseClass.PRIM_SLICE:
7670 if (remain < 1)
7671 return;
7672 LSL_Vector slice = rules.GetVector3Item(idx++);
7673 part.UpdateSlice((float)slice.x, (float)slice.y);
7674 break;
7669 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 7675 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
7670 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 7676 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
7671 return null; 7677 return null;
@@ -8340,6 +8346,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8340 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8346 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8341 res.Add(new LSL_Vector(GetPartLocalPos(part))); 8347 res.Add(new LSL_Vector(GetPartLocalPos(part)));
8342 break; 8348 break;
8349 case (int)ScriptBaseClass.PRIM_SLICE:
8350 res.Add(new LSL_Vector(
8351 (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
8352 1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
8353 0
8354 ));
8355 break;
8343 } 8356 }
8344 } 8357 }
8345 return res; 8358 return res;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index e1c054d..cad8518 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -328,6 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
328 public const int PRIM_OMEGA = 32; 328 public const int PRIM_OMEGA = 32;
329 public const int PRIM_POS_LOCAL = 33; 329 public const int PRIM_POS_LOCAL = 33;
330 public const int PRIM_LINK_TARGET = 34; 330 public const int PRIM_LINK_TARGET = 34;
331 public const int PRIM_SLICE = 35;
331 public const int PRIM_TEXGEN_DEFAULT = 0; 332 public const int PRIM_TEXGEN_DEFAULT = 0;
332 public const int PRIM_TEXGEN_PLANAR = 1; 333 public const int PRIM_TEXGEN_PLANAR = 1;
333 334