diff options
author | UbitUmarov | 2012-03-14 18:24:04 +0000 |
---|---|---|
committer | UbitUmarov | 2012-03-14 18:24:04 +0000 |
commit | cf9ebd301c32fa7cd991e78647ce011b0aefc796 (patch) | |
tree | 3d29095b6ac2d6f50caeff2eab303dc1faaf4f9a /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-cf9ebd301c32fa7cd991e78647ce011b0aefc796.zip opensim-SC_OLD-cf9ebd301c32fa7cd991e78647ce011b0aefc796.tar.gz opensim-SC_OLD-cf9ebd301c32fa7cd991e78647ce011b0aefc796.tar.bz2 opensim-SC_OLD-cf9ebd301c32fa7cd991e78647ce011b0aefc796.tar.xz |
bug fixs, added a default physics shape estimator based on being a mesh or not and use it on unlink if new root part as type none. Viewer doesn't get updated even with fullupdates we are missing something still
Diffstat (limited to 'OpenSim/Region')
4 files changed, 82 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 23beaec..160a5d1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -7029,7 +7029,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7029 | physdata.Bounce = phsblock.Restitution; | 7029 | physdata.Bounce = phsblock.Restitution; |
7030 | physdata.Density = phsblock.Density; | 7030 | physdata.Density = phsblock.Density; |
7031 | physdata.Friction = phsblock.Friction; | 7031 | physdata.Friction = phsblock.Friction; |
7032 | physdata.GravitationModifier = phsblock.GravityMultiplier; | ||
7032 | } | 7033 | } |
7034 | |||
7033 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | 7035 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); |
7034 | } | 7036 | } |
7035 | return true; | 7037 | return true; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6feb333..5507aa0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2723,6 +2723,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2723 | // When we delete a group, we currently have to force persist to the database if the object id has changed | 2723 | // When we delete a group, we currently have to force persist to the database if the object id has changed |
2724 | // (since delete works by deleting all rows which have a given object id) | 2724 | // (since delete works by deleting all rows which have a given object id) |
2725 | 2725 | ||
2726 | // this is as it seems to be in sl now | ||
2727 | if(linkPart.PhysicsShapeType == (byte)PhysShapeType.none) | ||
2728 | linkPart.PhysicsShapeType = linkPart.DefaultPhysicsShapeType(); // root prims can't have type none for now | ||
2729 | |||
2726 | if (m_rootPart.PhysActor != null) | 2730 | if (m_rootPart.PhysActor != null) |
2727 | m_rootPart.PhysActor.Building = false; | 2731 | m_rootPart.PhysActor.Building = false; |
2728 | 2732 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a68b3eb..84ed40c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -986,7 +986,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
986 | public PrimitiveBaseShape Shape | 986 | public PrimitiveBaseShape Shape |
987 | { | 987 | { |
988 | get { return m_shape; } | 988 | get { return m_shape; } |
989 | set { m_shape = value;} | 989 | set |
990 | { | ||
991 | m_shape = value; | ||
992 | m_physicsShapeType = DefaultPhysicsShapeType(); | ||
993 | } | ||
990 | } | 994 | } |
991 | 995 | ||
992 | /// <summary> | 996 | /// <summary> |
@@ -1377,31 +1381,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
1377 | { | 1381 | { |
1378 | if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial) | 1382 | if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial) |
1379 | { | 1383 | { |
1380 | m_material = (Material)value; | 1384 | bool update = false; |
1381 | m_friction = SOPMaterialData.friction(m_material); | 1385 | |
1382 | m_bounce = SOPMaterialData.bounce(m_material); | 1386 | if (m_material != (Material)value) |
1383 | if (PhysActor != null) | 1387 | { |
1388 | update = true; | ||
1389 | m_material = (Material)value; | ||
1390 | } | ||
1391 | |||
1392 | if (m_friction != SOPMaterialData.friction(m_material)) | ||
1393 | { | ||
1394 | update = true; | ||
1395 | m_friction = SOPMaterialData.friction(m_material); | ||
1396 | } | ||
1397 | |||
1398 | if (m_bounce != SOPMaterialData.bounce(m_material)) | ||
1384 | { | 1399 | { |
1385 | PhysActor.SetMaterial((int)value); | 1400 | update = true; |
1401 | m_bounce = SOPMaterialData.bounce(m_material); | ||
1402 | } | ||
1403 | |||
1404 | if (update) | ||
1405 | { | ||
1406 | if (PhysActor != null) | ||
1407 | { | ||
1408 | PhysActor.SetMaterial((int)value); | ||
1409 | } | ||
1410 | if(ParentGroup != null) | ||
1411 | ParentGroup.HasGroupChanged = true; | ||
1412 | ScheduleFullUpdateIfNone(); | ||
1386 | } | 1413 | } |
1387 | } | 1414 | } |
1388 | } | 1415 | } |
1389 | } | 1416 | } |
1390 | 1417 | ||
1418 | // not a propriety to move to methods place later | ||
1419 | public byte DefaultPhysicsShapeType() | ||
1420 | { | ||
1421 | byte type; | ||
1422 | |||
1423 | if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh)) | ||
1424 | type = (byte)PhysShapeType.convex; | ||
1425 | else | ||
1426 | type = (byte)PhysShapeType.prim; | ||
1427 | |||
1428 | return type; | ||
1429 | } | ||
1430 | |||
1391 | public byte PhysicsShapeType | 1431 | public byte PhysicsShapeType |
1392 | { | 1432 | { |
1393 | get { return m_physicsShapeType; } | 1433 | get { return m_physicsShapeType; } |
1394 | set | 1434 | set |
1395 | { | 1435 | { |
1396 | if (value < 0 || value >= (byte)PhysShapeType.convex) | 1436 | if (value >= 0 && value <= (byte)PhysShapeType.convex) |
1397 | value = (byte)PhysShapeType.prim; //convex not supported ? | ||
1398 | |||
1399 | else if (value == (byte)PhysShapeType.none) | ||
1400 | { | 1437 | { |
1401 | if (ParentGroup == null || ParentGroup.RootPart == this) | 1438 | if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) |
1402 | value = (byte)PhysShapeType.prim; | 1439 | m_physicsShapeType = DefaultPhysicsShapeType(); |
1440 | else | ||
1441 | m_physicsShapeType = value; | ||
1442 | ScheduleFullUpdateIfNone(); | ||
1403 | } | 1443 | } |
1404 | m_physicsShapeType = value; | 1444 | else |
1445 | m_physicsShapeType = DefaultPhysicsShapeType(); | ||
1405 | } | 1446 | } |
1406 | } | 1447 | } |
1407 | 1448 | ||
@@ -1413,6 +1454,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1413 | if (value >=1 && value <= 22587.0) | 1454 | if (value >=1 && value <= 22587.0) |
1414 | { | 1455 | { |
1415 | m_density = value; | 1456 | m_density = value; |
1457 | ScheduleFullUpdateIfNone(); | ||
1416 | } | 1458 | } |
1417 | } | 1459 | } |
1418 | } | 1460 | } |
@@ -1423,6 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1423 | set | 1465 | set |
1424 | { if( value >= -1 && value <=28.0f) | 1466 | { if( value >= -1 && value <=28.0f) |
1425 | m_gravitymod = value; | 1467 | m_gravitymod = value; |
1468 | ScheduleFullUpdateIfNone(); | ||
1426 | } | 1469 | } |
1427 | } | 1470 | } |
1428 | 1471 | ||
@@ -1434,6 +1477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1434 | if (value >= 0 && value <= 255.0f) | 1477 | if (value >= 0 && value <= 255.0f) |
1435 | { | 1478 | { |
1436 | m_friction = value; | 1479 | m_friction = value; |
1480 | ScheduleFullUpdateIfNone(); | ||
1437 | } | 1481 | } |
1438 | } | 1482 | } |
1439 | } | 1483 | } |
@@ -1446,6 +1490,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1446 | if (value >= 0 && value <= 1.0f) | 1490 | if (value >= 0 && value <= 1.0f) |
1447 | { | 1491 | { |
1448 | m_bounce = value; | 1492 | m_bounce = value; |
1493 | ScheduleFullUpdateIfNone(); | ||
1449 | } | 1494 | } |
1450 | } | 1495 | } |
1451 | } | 1496 | } |
@@ -2942,6 +2987,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2942 | APIDTarget = Quaternion.Identity; | 2987 | APIDTarget = Quaternion.Identity; |
2943 | } | 2988 | } |
2944 | 2989 | ||
2990 | |||
2991 | |||
2992 | public void ScheduleFullUpdateIfNone() | ||
2993 | { | ||
2994 | if (ParentGroup == null) | ||
2995 | return; | ||
2996 | |||
2997 | // ??? ParentGroup.HasGroupChanged = true; | ||
2998 | |||
2999 | if (UpdateFlag != UpdateRequired.FULL) | ||
3000 | ScheduleFullUpdate(); | ||
3001 | } | ||
3002 | |||
2945 | /// <summary> | 3003 | /// <summary> |
2946 | /// Schedules this prim for a full update | 3004 | /// Schedules this prim for a full update |
2947 | /// </summary> | 3005 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index dfa24e5..1cd8189 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -597,22 +597,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
597 | 597 | ||
598 | private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) | 598 | private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) |
599 | { | 599 | { |
600 | obj.Density = (byte)reader.ReadElementContentAsInt("Density", String.Empty); | 600 | obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); |
601 | } | 601 | } |
602 | 602 | ||
603 | private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) | 603 | private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) |
604 | { | 604 | { |
605 | obj.Friction = (byte)reader.ReadElementContentAsInt("Friction", String.Empty); | 605 | obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); |
606 | } | 606 | } |
607 | 607 | ||
608 | private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) | 608 | private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) |
609 | { | 609 | { |
610 | obj.Bounciness = (byte)reader.ReadElementContentAsInt("Bounce", String.Empty); | 610 | obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty); |
611 | } | 611 | } |
612 | 612 | ||
613 | private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) | 613 | private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) |
614 | { | 614 | { |
615 | obj.GravityModifier = (byte)reader.ReadElementContentAsInt("GravityModifier", String.Empty); | 615 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); |
616 | } | 616 | } |
617 | 617 | ||
618 | private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) | 618 | private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) |
@@ -1321,7 +1321,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1321 | if (sop.sopVehicle != null) | 1321 | if (sop.sopVehicle != null) |
1322 | sop.sopVehicle.ToXml2(writer); | 1322 | sop.sopVehicle.ToXml2(writer); |
1323 | 1323 | ||
1324 | if(sop.PhysicsShapeType != (byte)PhysShapeType.prim) | 1324 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) |
1325 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1325 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
1326 | if (sop.Density != 1000.0f) | 1326 | if (sop.Density != 1000.0f) |
1327 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | 1327 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); |