aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2012-12-12 23:34:20 -0500
committerBlueWall2012-12-12 23:34:20 -0500
commit7a87c35f94a846e9a2b74d2347c2be5ba0511a38 (patch)
treeecb370ecb60a256a0b40787d76932a0d86b78ec4
parentMove setting to correct locations in ini (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-7a87c35f94a846e9a2b74d2347c2be5ba0511a38.zip
opensim-SC_OLD-7a87c35f94a846e9a2b74d2347c2be5ba0511a38.tar.gz
opensim-SC_OLD-7a87c35f94a846e9a2b74d2347c2be5ba0511a38.tar.bz2
opensim-SC_OLD-7a87c35f94a846e9a2b74d2347c2be5ba0511a38.tar.xz
Merge branch 'master' of /home/opensim/var/repo/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs28
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs18
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs81
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs23
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt47
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs43
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs54
12 files changed, 228 insertions, 93 deletions
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
index 16a63e0..dff956a 100644
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ b/OpenSim/Framework/Console/ConsoleUtil.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Console
97 if (!UUID.TryParse(rawUuid, out uuid)) 97 if (!UUID.TryParse(rawUuid, out uuid))
98 { 98 {
99 if (console != null) 99 if (console != null)
100 console.OutputFormat("{0} is not a valid uuid", rawUuid); 100 console.OutputFormat("ERROR: {0} is not a valid uuid", rawUuid);
101 101
102 return false; 102 return false;
103 } 103 }
@@ -110,7 +110,7 @@ namespace OpenSim.Framework.Console
110 if (!uint.TryParse(rawLocalId, out localId)) 110 if (!uint.TryParse(rawLocalId, out localId))
111 { 111 {
112 if (console != null) 112 if (console != null)
113 console.OutputFormat("{0} is not a valid local id", localId); 113 console.OutputFormat("ERROR: {0} is not a valid local id", localId);
114 114
115 return false; 115 return false;
116 } 116 }
@@ -118,7 +118,7 @@ namespace OpenSim.Framework.Console
118 if (localId == 0) 118 if (localId == 0)
119 { 119 {
120 if (console != null) 120 if (console != null)
121 console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId); 121 console.OutputFormat("ERROR: {0} is not a valid local id - it must be greater than 0", localId);
122 122
123 return false; 123 return false;
124 } 124 }
@@ -150,10 +150,30 @@ namespace OpenSim.Framework.Console
150 } 150 }
151 151
152 if (console != null) 152 if (console != null)
153 console.OutputFormat("{0} is not a valid UUID or local id", rawId); 153 console.OutputFormat("ERROR: {0} is not a valid UUID or local id", rawId);
154 154
155 return false; 155 return false;
156 } 156 }
157
158 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
160 /// </summary>
161 /// <param name='console'>Can be null if no console is available.</param>
162 /// <param name='rawConsoleVector'>/param>
163 /// <param name='vector'></param>
164 /// <returns></returns>
165 public static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i)
166 {
167 if (!int.TryParse(rawConsoleInt, out i))
168 {
169 if (console != null)
170 console.OutputFormat("ERROR: {0} is not a valid integer", rawConsoleInt);
171
172 return false;
173 }
174
175 return true;
176 }
157 177
158 /// <summary> 178 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 179 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 089fcda..883045a 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
76 76
77 public void RemoveRegion(Scene scene) 77 public void RemoveRegion(Scene scene)
78 { 78 {
79 m_scene.EventManager.OnClientLogin -= OnNewClient; 79 m_scene.EventManager.OnNewClient -= OnNewClient;
80 } 80 }
81 81
82 public void RegionLoaded(Scene scene) 82 public void RegionLoaded(Scene scene)
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
85 return; 85 return;
86 86
87 m_scene = scene; 87 m_scene = scene;
88 m_scene.EventManager.OnClientLogin += OnNewClient; 88 m_scene.EventManager.OnNewClient += OnNewClient;
89 89
90 m_scene.RegisterModuleInterface<ISoundModule>(this); 90 m_scene.RegisterModuleInterface<ISoundModule>(this);
91 } 91 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 83c78f6..c8aad8d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -105,12 +105,12 @@ public sealed class BSCharacter : BSPhysObject
105 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", 105 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
106 LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass); 106 LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass);
107 107
108 // do actual create at taint time 108 // do actual creation in taint time
109 PhysicsScene.TaintedObject("BSCharacter.create", delegate() 109 PhysicsScene.TaintedObject("BSCharacter.create", delegate()
110 { 110 {
111 DetailLog("{0},BSCharacter.create,taint", LocalID); 111 DetailLog("{0},BSCharacter.create,taint", LocalID);
112 // New body and shape into PhysBody and PhysShape 112 // New body and shape into PhysBody and PhysShape
113 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null); 113 PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this);
114 114
115 SetPhysicalProperties(); 115 SetPhysicalProperties();
116 }); 116 });
@@ -189,6 +189,11 @@ public sealed class BSCharacter : BSPhysObject
189 set { 189 set {
190 // When an avatar's size is set, only the height is changed. 190 // When an avatar's size is set, only the height is changed.
191 _size = value; 191 _size = value;
192 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
193 // replace with the default values.
194 if (_size.X == 0f) _size.X = PhysicsScene.Params.avatarCapsuleDepth;
195 if (_size.Y == 0f) _size.Y = PhysicsScene.Params.avatarCapsuleWidth;
196
192 ComputeAvatarScale(_size); 197 ComputeAvatarScale(_size);
193 ComputeAvatarVolumeAndMass(); 198 ComputeAvatarVolumeAndMass();
194 DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}", 199 DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}",
@@ -196,18 +201,18 @@ public sealed class BSCharacter : BSPhysObject
196 201
197 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 202 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
198 { 203 {
199 if (PhysShape.HasPhysicalShape) 204 if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape)
200 { 205 {
201 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 206 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
202 UpdatePhysicalMassProperties(RawMass); 207 UpdatePhysicalMassProperties(RawMass);
208 // Make sure this change appears as a property update event
209 BulletSimAPI.PushUpdate2(PhysBody.ptr);
203 } 210 }
204 }); 211 });
205 212
206 } 213 }
207 } 214 }
208 215
209 public override OMV.Vector3 Scale { get; set; }
210
211 public override PrimitiveBaseShape Shape 216 public override PrimitiveBaseShape Shape
212 { 217 {
213 set { BaseShape = value; } 218 set { BaseShape = value; }
@@ -638,9 +643,6 @@ public sealed class BSCharacter : BSPhysObject
638 643
639 private void ComputeAvatarScale(OMV.Vector3 size) 644 private void ComputeAvatarScale(OMV.Vector3 size)
640 { 645 {
641 // The 'size' given by the simulator is the mid-point of the avatar
642 // and X and Y are unspecified.
643
644 OMV.Vector3 newScale = size; 646 OMV.Vector3 newScale = size;
645 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth; 647 // newScale.X = PhysicsScene.Params.avatarCapsuleWidth;
646 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth; 648 // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
index 390c2f9..c113a43 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
@@ -50,10 +50,11 @@ public struct MaterialAttributes
50 Avatar, 50 Avatar,
51 NumberOfTypes // the count of types in the enum. 51 NumberOfTypes // the count of types in the enum.
52 } 52 }
53
53 // Names must be in the order of the above enum. 54 // Names must be in the order of the above enum.
54 public static string[] MaterialNames = { "Stone", "Metal", "Glass", "Wood", 55 // These names must coorespond to the lower case field names in the MaterialAttributes
55 "Flesh", "Plastic", "Rubber", "Light", "Avatar" }; 56 // structure as reflection is used to select the field to put the value in.
56 public static string[] MaterialAttribs = { "Density", "Friction", "Restitution"}; 57 public static readonly string[] MaterialAttribs = { "Density", "Friction", "Restitution"};
57 58
58 public MaterialAttributes(string t, float d, float f, float r) 59 public MaterialAttributes(string t, float d, float f, float r)
59 { 60 {
@@ -70,60 +71,74 @@ public struct MaterialAttributes
70 71
71public static class BSMaterials 72public static class BSMaterials
72{ 73{
73 public static MaterialAttributes[] Attributes; 74 // Attributes for each material type
75 private static readonly MaterialAttributes[] Attributes;
76
77 // Map of material name to material type code
78 public static readonly Dictionary<string, MaterialAttributes.Material> MaterialMap;
74 79
75 static BSMaterials() 80 static BSMaterials()
76 { 81 {
77 // Attribute sets for both the non-physical and physical instances of materials. 82 // Attribute sets for both the non-physical and physical instances of materials.
78 Attributes = new MaterialAttributes[(int)MaterialAttributes.Material.NumberOfTypes * 2]; 83 Attributes = new MaterialAttributes[(int)MaterialAttributes.Material.NumberOfTypes * 2];
84
85 // Map of name to type code.
86 MaterialMap = new Dictionary<string, MaterialAttributes.Material>();
87 MaterialMap.Add("Stone", MaterialAttributes.Material.Stone);
88 MaterialMap.Add("Metal", MaterialAttributes.Material.Metal);
89 MaterialMap.Add("Glass", MaterialAttributes.Material.Glass);
90 MaterialMap.Add("Wood", MaterialAttributes.Material.Wood);
91 MaterialMap.Add("Flesh", MaterialAttributes.Material.Flesh);
92 MaterialMap.Add("Plastic", MaterialAttributes.Material.Plastic);
93 MaterialMap.Add("Rubber", MaterialAttributes.Material.Rubber);
94 MaterialMap.Add("Light", MaterialAttributes.Material.Light);
95 MaterialMap.Add("Avatar", MaterialAttributes.Material.Avatar);
79 } 96 }
80 97
81 // This is where all the default material attributes are defined. 98 // This is where all the default material attributes are defined.
82 public static void InitializeFromDefaults(ConfigurationParameters parms) 99 public static void InitializeFromDefaults(ConfigurationParameters parms)
83 { 100 {
84 // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL 101 // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL
85 // public static string[] MaterialNames = { "Stone", "Metal", "Glass", "Wood", 102 float dDensity = parms.defaultDensity;
86 // "Flesh", "Plastic", "Rubber", "Light", "Avatar" };
87 float dFriction = parms.defaultFriction; 103 float dFriction = parms.defaultFriction;
88 float dRestitution = parms.defaultRestitution; 104 float dRestitution = parms.defaultRestitution;
89 float dDensity = parms.defaultDensity;
90 Attributes[(int)MaterialAttributes.Material.Stone] = 105 Attributes[(int)MaterialAttributes.Material.Stone] =
91 new MaterialAttributes("stone",dDensity, 0.8f, 0.4f); 106 new MaterialAttributes("stone",dDensity, 0.8f, 0.4f);
92 Attributes[(int)MaterialAttributes.Material.Metal] = 107 Attributes[(int)MaterialAttributes.Material.Metal] =
93 new MaterialAttributes("metal",dDensity, 0.3f, 0.4f); 108 new MaterialAttributes("metal",dDensity, 0.3f, 0.4f);
94 Attributes[(int)MaterialAttributes.Material.Glass] = 109 Attributes[(int)MaterialAttributes.Material.Glass] =
95 new MaterialAttributes("glass",dDensity, 0.2f, 0.7f); 110 new MaterialAttributes("glass",dDensity, 0.2f, 0.7f);
96 Attributes[(int)MaterialAttributes.Material.Wood] = 111 Attributes[(int)MaterialAttributes.Material.Wood] =
97 new MaterialAttributes("wood",dDensity, 0.6f, 0.5f); 112 new MaterialAttributes("wood",dDensity, 0.6f, 0.5f);
98 Attributes[(int)MaterialAttributes.Material.Flesh] = 113 Attributes[(int)MaterialAttributes.Material.Flesh] =
99 new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f); 114 new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f);
100 Attributes[(int)MaterialAttributes.Material.Plastic] = 115 Attributes[(int)MaterialAttributes.Material.Plastic] =
101 new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f); 116 new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f);
102 Attributes[(int)MaterialAttributes.Material.Rubber] = 117 Attributes[(int)MaterialAttributes.Material.Rubber] =
103 new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f); 118 new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f);
104 Attributes[(int)MaterialAttributes.Material.Light] = 119 Attributes[(int)MaterialAttributes.Material.Light] =
105 new MaterialAttributes("light",dDensity, dFriction, dRestitution); 120 new MaterialAttributes("light",dDensity, dFriction, dRestitution);
106 Attributes[(int)MaterialAttributes.Material.Avatar] = 121 Attributes[(int)MaterialAttributes.Material.Avatar] =
107 new MaterialAttributes("avatar",60f, 0.2f, 0f); 122 new MaterialAttributes("avatar",60f, 0.2f, 0f);
108 123
109 Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] = 124 Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] =
110 new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f); 125 new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f);
111 Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] = 126 Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] =
112 new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f); 127 new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f);
113 Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] = 128 Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] =
114 new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f); 129 new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f);
115 Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] = 130 Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] =
116 new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f); 131 new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f);
117 Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] = 132 Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] =
118 new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f); 133 new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f);
119 Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] = 134 Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] =
120 new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f); 135 new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f);
121 Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] = 136 Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] =
122 new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f); 137 new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f);
123 Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] = 138 Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] =
124 new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution); 139 new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution);
125 Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] = 140 Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] =
126 new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f); 141 new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f);
127 } 142 }
128 143
129 // Under the [BulletSim] section, one can change the individual material 144 // Under the [BulletSim] section, one can change the individual material
@@ -139,34 +154,34 @@ public static class BSMaterials
139 // the physical value. 154 // the physical value.
140 public static void InitializefromParameters(IConfig pConfig) 155 public static void InitializefromParameters(IConfig pConfig)
141 { 156 {
142 int matType = 0; 157 foreach (KeyValuePair<string, MaterialAttributes.Material> kvp in MaterialMap)
143 foreach (string matName in MaterialAttributes.MaterialNames)
144 { 158 {
159 string matName = kvp.Key;
145 foreach (string attribName in MaterialAttributes.MaterialAttribs) 160 foreach (string attribName in MaterialAttributes.MaterialAttribs)
146 { 161 {
147 string paramName = matName + attribName; 162 string paramName = matName + attribName;
148 if (pConfig.Contains(paramName)) 163 if (pConfig.Contains(paramName))
149 { 164 {
150 float paramValue = pConfig.GetFloat(paramName); 165 float paramValue = pConfig.GetFloat(paramName);
151 SetAttributeValue(matType, attribName, paramValue); 166 SetAttributeValue((int)kvp.Value, attribName, paramValue);
152 // set the physical value also 167 // set the physical value also
153 SetAttributeValue(matType + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); 168 SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue);
154 } 169 }
155 paramName += "Physical"; 170 paramName += "Physical";
156 if (pConfig.Contains(paramName)) 171 if (pConfig.Contains(paramName))
157 { 172 {
158 float paramValue = pConfig.GetFloat(paramName); 173 float paramValue = pConfig.GetFloat(paramName);
159 SetAttributeValue(matType + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); 174 SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue);
160 } 175 }
161 } 176 }
162 matType++;
163 } 177 }
164 } 178 }
165 179
180 // Use reflection to set the value in the attribute structure.
166 private static void SetAttributeValue(int matType, string attribName, float val) 181 private static void SetAttributeValue(int matType, string attribName, float val)
167 { 182 {
168 MaterialAttributes thisAttrib = Attributes[matType]; 183 MaterialAttributes thisAttrib = Attributes[matType];
169 FieldInfo fieldInfo = thisAttrib.GetType().GetField(attribName); 184 FieldInfo fieldInfo = thisAttrib.GetType().GetField(attribName.ToLower());
170 if (fieldInfo != null) 185 if (fieldInfo != null)
171 { 186 {
172 fieldInfo.SetValue(thisAttrib, val); 187 fieldInfo.SetValue(thisAttrib, val);
@@ -174,12 +189,12 @@ public static class BSMaterials
174 } 189 }
175 } 190 }
176 191
192 // Given a material type, return a structure of attributes.
177 public static MaterialAttributes GetAttributes(MaterialAttributes.Material type, bool isPhysical) 193 public static MaterialAttributes GetAttributes(MaterialAttributes.Material type, bool isPhysical)
178 { 194 {
179 int ind = (int)type; 195 int ind = (int)type;
180 if (isPhysical) ind += (int)MaterialAttributes.Material.NumberOfTypes; 196 if (isPhysical) ind += (int)MaterialAttributes.Material.NumberOfTypes;
181 return Attributes[ind]; 197 return Attributes[ind];
182 } 198 }
183
184} 199}
185} 200}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f3b6993..6539b43 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -109,7 +109,7 @@ public abstract class BSPhysObject : PhysicsActor
109 public EntityProperties CurrentEntityProperties { get; set; } 109 public EntityProperties CurrentEntityProperties { get; set; }
110 public EntityProperties LastEntityProperties { get; set; } 110 public EntityProperties LastEntityProperties { get; set; }
111 111
112 public abstract OMV.Vector3 Scale { get; set; } 112 public virtual OMV.Vector3 Scale { get; set; }
113 public abstract bool IsSolid { get; } 113 public abstract bool IsSolid { get; }
114 public abstract bool IsStatic { get; } 114 public abstract bool IsStatic { get; }
115 115
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 35d22c0..19c29cc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -45,7 +45,6 @@ public sealed class BSPrim : BSPhysObject
45 private static readonly string LogHeader = "[BULLETS PRIM]"; 45 private static readonly string LogHeader = "[BULLETS PRIM]";
46 46
47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh. 47 // _size is what the user passed. Scale is what we pass to the physics engine with the mesh.
48 // Often Scale is unity because the meshmerizer will apply _size when creating the mesh.
49 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user 48 private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user
50 49
51 private bool _grabbed; 50 private bool _grabbed;
@@ -93,7 +92,7 @@ public sealed class BSPrim : BSPhysObject
93 _physicsActorType = (int)ActorTypes.Prim; 92 _physicsActorType = (int)ActorTypes.Prim;
94 _position = pos; 93 _position = pos;
95 _size = size; 94 _size = size;
96 Scale = size; // the scale will be set by CreateGeom depending on object type 95 Scale = size; // prims are the size the user wants them to be (different for BSCharactes).
97 _orientation = rotation; 96 _orientation = rotation;
98 _buoyancy = 1f; 97 _buoyancy = 1f;
99 _velocity = OMV.Vector3.Zero; 98 _velocity = OMV.Vector3.Zero;
@@ -159,12 +158,10 @@ public sealed class BSPrim : BSPhysObject
159 // We presume the scale and size are the same. If scale must be changed for 158 // We presume the scale and size are the same. If scale must be changed for
160 // the physical shape, that is done when the geometry is built. 159 // the physical shape, that is done when the geometry is built.
161 _size = value; 160 _size = value;
161 Scale = _size;
162 ForceBodyShapeRebuild(false); 162 ForceBodyShapeRebuild(false);
163 } 163 }
164 } 164 }
165 // Scale is what we set in the physics engine. It is different than 'size' in that
166 // 'size' can be encorporated into the mesh. In that case, the scale is <1,1,1>.
167 public override OMV.Vector3 Scale { get; set; }
168 165
169 public override PrimitiveBaseShape Shape { 166 public override PrimitiveBaseShape Shape {
170 set { 167 set {
@@ -1369,7 +1366,6 @@ public sealed class BSPrim : BSPhysObject
1369 // Create the correct physical representation for this type of object. 1366 // Create the correct physical representation for this type of object.
1370 // Updates PhysBody and PhysShape with the new information. 1367 // Updates PhysBody and PhysShape with the new information.
1371 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. 1368 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary.
1372 // Returns 'true' if either the body or the shape was changed.
1373 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) 1369 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody)
1374 { 1370 {
1375 // Called if the current prim body is about to be destroyed. 1371 // Called if the current prim body is about to be destroyed.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index f4f2801..cf5bb57 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -309,6 +309,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
309 BSMaterials.InitializeFromDefaults(Params); 309 BSMaterials.InitializeFromDefaults(Params);
310 if (pConfig != null) 310 if (pConfig != null)
311 { 311 {
312 // Let the user add new and interesting material property values.
312 BSMaterials.InitializefromParameters(pConfig); 313 BSMaterials.InitializefromParameters(pConfig);
313 } 314 }
314 } 315 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 4ab9a99..ea996ae 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -126,6 +126,11 @@ public sealed class BSShapeCollection : IDisposable
126 return ret; 126 return ret;
127 } 127 }
128 128
129 public bool GetBodyAndShape(bool forceRebuild, BulletSim sim, BSPhysObject prim)
130 {
131 return GetBodyAndShape(forceRebuild, sim, prim, null, null);
132 }
133
129 // Track another user of a body. 134 // Track another user of a body.
130 // We presume the caller has allocated the body. 135 // We presume the caller has allocated the body.
131 // Bodies only have one user so the body is just put into the world if not already there. 136 // Bodies only have one user so the body is just put into the world if not already there.
@@ -460,6 +465,11 @@ public sealed class BSShapeCollection : IDisposable
460 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 465 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100
461 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) 466 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) )
462 { 467 {
468 // Get the scale of any existing shape so we can see if the new shape is same native type and same size.
469 OMV.Vector3 scaleOfExistingShape = OMV.Vector3.Zero;
470 if (prim.PhysShape.HasPhysicalShape)
471 scaleOfExistingShape = BulletSimAPI.GetLocalScaling2(prim.PhysShape.ptr);
472
463 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", 473 if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}",
464 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); 474 prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type);
465 475
@@ -469,7 +479,7 @@ public sealed class BSShapeCollection : IDisposable
469 { 479 {
470 haveShape = true; 480 haveShape = true;
471 if (forceRebuild 481 if (forceRebuild
472 || prim.Scale != prim.Size 482 || prim.Scale != scaleOfExistingShape
473 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE 483 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE
474 ) 484 )
475 { 485 {
@@ -483,7 +493,7 @@ public sealed class BSShapeCollection : IDisposable
483 { 493 {
484 haveShape = true; 494 haveShape = true;
485 if (forceRebuild 495 if (forceRebuild
486 || prim.Scale != prim.Size 496 || prim.Scale != scaleOfExistingShape
487 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX 497 || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX
488 ) 498 )
489 { 499 {
@@ -542,7 +552,6 @@ public sealed class BSShapeCollection : IDisposable
542 prim.LocalID, newShape, prim.Scale); 552 prim.LocalID, newShape, prim.Scale);
543 553
544 // native shapes are scaled by Bullet 554 // native shapes are scaled by Bullet
545 prim.Scale = prim.Size;
546 prim.PhysShape = newShape; 555 prim.PhysShape = newShape;
547 return true; 556 return true;
548 } 557 }
@@ -555,8 +564,8 @@ public sealed class BSShapeCollection : IDisposable
555 ShapeData nativeShapeData = new ShapeData(); 564 ShapeData nativeShapeData = new ShapeData();
556 nativeShapeData.Type = shapeType; 565 nativeShapeData.Type = shapeType;
557 nativeShapeData.ID = prim.LocalID; 566 nativeShapeData.ID = prim.LocalID;
558 nativeShapeData.Scale = prim.Size; 567 nativeShapeData.Scale = prim.Scale;
559 nativeShapeData.Size = prim.Size; // unneeded, I think. 568 nativeShapeData.Size = prim.Scale; // unneeded, I think.
560 nativeShapeData.MeshKey = (ulong)shapeKey; 569 nativeShapeData.MeshKey = (ulong)shapeKey;
561 nativeShapeData.HullKey = (ulong)shapeKey; 570 nativeShapeData.HullKey = (ulong)shapeKey;
562 571
@@ -611,8 +620,6 @@ public sealed class BSShapeCollection : IDisposable
611 620
612 ReferenceShape(newShape); 621 ReferenceShape(newShape);
613 622
614 // meshes are already scaled by the meshmerizer
615 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
616 prim.PhysShape = newShape; 623 prim.PhysShape = newShape;
617 624
618 return true; // 'true' means a new shape has been added to this prim 625 return true; // 'true' means a new shape has been added to this prim
@@ -683,8 +690,6 @@ public sealed class BSShapeCollection : IDisposable
683 690
684 ReferenceShape(newShape); 691 ReferenceShape(newShape);
685 692
686 // hulls are already scaled by the meshmerizer
687 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
688 prim.PhysShape = newShape; 693 prim.PhysShape = newShape;
689 return true; // 'true' means a new shape has been added to this prim 694 return true; // 'true' means a new shape has been added to this prim
690 } 695 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 1c7b577..11c1387 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -20,6 +20,10 @@ Neb car jiggling left and right
20 Happens on terrain and any other mesh object. Flat cubes are much smoother. 20 Happens on terrain and any other mesh object. Flat cubes are much smoother.
21 This has been reduced but not eliminated. 21 This has been reduced but not eliminated.
22For limitMotorUp, use raycast down to find if vehicle is in the air. 22For limitMotorUp, use raycast down to find if vehicle is in the air.
23Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE.
24 Verify that angular motion specified around Z moves in the vehicle coordinates.
25Verify llGetVel() is returning a smooth and good value for vehicle movement.
26llGetVel() should return the root's velocity if requested in a child prim.
23Implement function efficiency for lineaar and angular motion. 27Implement function efficiency for lineaar and angular motion.
24Should vehicle angular/linear movement friction happen after all the components 28Should vehicle angular/linear movement friction happen after all the components
25 or does it only apply to the basic movement? 29 or does it only apply to the basic movement?
@@ -32,19 +36,14 @@ Border crossing with linked vehicle causes crash
32 36
33BULLETSIM TODO LIST: 37BULLETSIM TODO LIST:
34================================================= 38=================================================
35Avatar height off after unsitting (float off ground) 39Avatar height off after unsitting (floats off ground)
36 Editting appearance then moving restores. 40 Editting appearance then moving restores.
37 Must not be initializing height when recreating capsule after unsit. 41 Must not be initializing height when recreating capsule after unsit.
38Duplicating a physical prim causes old prim to jump away 42Duplicating a physical prim causes old prim to jump away
39 Dup a phys prim and the original become unselected and thus interacts w/ selected prim. 43 Dup a phys prim and the original become unselected and thus interacts w/ selected prim.
40Disable activity of passive linkset children.
41 Since the linkset is a compound object, the old prims are left lying
42 around and need to be phantomized so they don't collide, ...
43Scenes with hundred of thousands of static objects take a lot of physics CPU time. 44Scenes with hundred of thousands of static objects take a lot of physics CPU time.
44BSPrim.Force should set a continious force on the prim. The force should be 45BSPrim.Force should set a continious force on the prim. The force should be
45 applied each tick. Some limits? 46 applied each tick. Some limits?
46Linksets should allow collisions to individual children
47 Add LocalID to children shapes in LinksetCompound and create events for individuals
48Gun sending shooter flying. 47Gun sending shooter flying.
49Collision margin (gap between physical objects lying on each other) 48Collision margin (gap between physical objects lying on each other)
50Boundry checking (crashes related to crossing boundry) 49Boundry checking (crashes related to crossing boundry)
@@ -57,14 +56,34 @@ Small physical objects do not interact correctly
57 The chain will fall apart and pairs will dance around on ground 56 The chain will fall apart and pairs will dance around on ground
58 Chains of 1x1x.2 will stay connected but will dance. 57 Chains of 1x1x.2 will stay connected but will dance.
59 Chains above 2x2x.4 are move stable and get stablier as torui get larger. 58 Chains above 2x2x.4 are move stable and get stablier as torui get larger.
60Add material type linkage and input all the material property definitions.
61 Skeleton classes and table are in the sources but are not filled or used.
62Add PID motor for avatar movement (slow to stop, ...) 59Add PID motor for avatar movement (slow to stop, ...)
63setForce should set a constant force. Different than AddImpulse. 60setForce should set a constant force. Different than AddImpulse.
64Implement raycast. 61Implement raycast.
65Implement ShapeCollection.Dispose() 62Implement ShapeCollection.Dispose()
66Implement water as a plain so raycasting and collisions can happen with same. 63Implement water as a plain so raycasting and collisions can happen with same.
64Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
65 Also osGetPhysicsEngineVerion() maybe.
66
67LINKSETS
68======================================================
69Linksets should allow collisions to individual children
70 Add LocalID to children shapes in LinksetCompound and create events for individuals
71Verify/think through scripts in children of linksets. What do they reference
72 and return when getting position, velocity, ...
73Confirm constraint linksets still work after making all the changes for compound linksets.
74Add 'changed' flag or similar to reduce the number of times a linkset is rebuilt.
75 For compound linksets, add ability to remove or reposition individual child shapes.
76Disable activity of passive linkset children.
77 Since the linkset is a compound object, the old prims are left lying
78 around and need to be phantomized so they don't collide, ...
79Speed up creation of large physical linksets
80 For instance, sitting in Neb's car (130 prims) takes several seconds to become physical
81Eliminate collisions between objects in a linkset. (LinksetConstraint)
82 Have UserPointer point to struct with localID and linksetID?
83 Objects in original linkset still collide with each other?
67 84
85MORE
86======================================================
68Find/remove avatar collision with ID=0. 87Find/remove avatar collision with ID=0.
69Test avatar walking up stairs. How does compare with SL. 88Test avatar walking up stairs. How does compare with SL.
70 Radius of the capsule affects ability to climb edges. 89 Radius of the capsule affects ability to climb edges.
@@ -73,8 +92,6 @@ Debounce avatar contact so legs don't keep folding up when standing.
73Implement LSL physics controls. Like STATUS_ROTATE_X. 92Implement LSL physics controls. Like STATUS_ROTATE_X.
74Add border extensions to terrain to help region crossings and objects leaving region. 93Add border extensions to terrain to help region crossings and objects leaving region.
75 94
76Speed up creation of large physical linksets
77 For instance, sitting in Neb's car (130 prims) takes several seconds to become physical
78Performance test with lots of avatars. Can BulletSim support a thousand? 95Performance test with lots of avatars. Can BulletSim support a thousand?
79Optimize collisions in C++: only send up to the object subscribed to collisions. 96Optimize collisions in C++: only send up to the object subscribed to collisions.
80 Use collision subscription and remove the collsion(A,B) and collision(B,A) 97 Use collision subscription and remove the collsion(A,B) and collision(B,A)
@@ -85,10 +102,6 @@ Avatar jump
85Performance measurement and changes to make quicker. 102Performance measurement and changes to make quicker.
86Implement detailed physics stats (GetStats()). 103Implement detailed physics stats (GetStats()).
87 104
88Eliminate collisions between objects in a linkset. (LinksetConstraint)
89 Have UserPointer point to struct with localID and linksetID?
90 Objects in original linkset still collide with each other?
91
92Measure performance improvement from hulls 105Measure performance improvement from hulls
93Test not using ghost objects for volume detect implementation. 106Test not using ghost objects for volume detect implementation.
94Performance of closures and delegates for taint processing 107Performance of closures and delegates for taint processing
@@ -101,6 +114,9 @@ Physics Arena central pyramid: why is one side permiable?
101 114
102INTERNAL IMPROVEMENT/CLEANUP 115INTERNAL IMPROVEMENT/CLEANUP
103================================================= 116=================================================
117Consider moving prim/character body and shape destruction in destroy()
118 to postTimeTime rather than protecting all the potential sets that
119 might have been queued up.
104Remove unused fields from ShapeData (not used in API2) 120Remove unused fields from ShapeData (not used in API2)
105Breakout code for mesh/hull/compound/native into separate BSShape* classes 121Breakout code for mesh/hull/compound/native into separate BSShape* classes
106 Standardize access to building and reference code. 122 Standardize access to building and reference code.
@@ -154,3 +170,6 @@ Package Bullet source mods for Bullet internal stats output
154 (Resolution: move code into WorldData.h rather than relying on patches) 170 (Resolution: move code into WorldData.h rather than relying on patches)
155Single prim vehicles don't seem to properly vehiclize. 171Single prim vehicles don't seem to properly vehiclize.
156 (Resolution: mass was not getting set properly for single prim linksets) 172 (Resolution: mass was not getting set properly for single prim linksets)
173Add material type linkage and input all the material property definitions.
174 Skeleton classes and table are in the sources but are not filled or used.
175 (Resolution:
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 0cef550..00a99c3 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -59,6 +59,18 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
59 public interface IScriptInstance 59 public interface IScriptInstance
60 { 60 {
61 /// <summary> 61 /// <summary>
62 /// Debug level for this script instance.
63 /// </summary>
64 /// <remarks>
65 /// Level == 0, no extra data is logged.
66 /// Level >= 1, state changes are logged.
67 /// Level >= 2, event firing is logged.
68 /// <value>
69 /// The debug level.
70 /// </value>
71 int DebugLevel { get; set; }
72
73 /// <summary>
62 /// Is the script currently running? 74 /// Is the script currently running?
63 /// </summary> 75 /// </summary>
64 bool Running { get; set; } 76 bool Running { get; set; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 5ad6eeb..dfe8386 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -93,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
93 private UUID m_CurrentStateHash; 93 private UUID m_CurrentStateHash;
94 private UUID m_RegionID; 94 private UUID m_RegionID;
95 95
96 public int DebugLevel { get; set; }
97
96 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } 98 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
97 99
98 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); 100 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@@ -548,9 +550,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
548 // forcibly abort the work item (this aborts the underlying thread). 550 // forcibly abort the work item (this aborts the underlying thread).
549 if (!m_InSelfDelete) 551 if (!m_InSelfDelete)
550 { 552 {
551// m_log.ErrorFormat( 553 m_log.DebugFormat(
552// "[SCRIPT INSTANCE]: Aborting script {0} {1} in prim {2} {3} {4} {5}", 554 "[SCRIPT INSTANCE]: Aborting unstopped script {0} {1} in prim {2}, localID {3}, timeout was {4} ms",
553// ScriptName, ItemID, PrimName, ObjectID, m_InSelfDelete, DateTime.Now.Ticks); 555 ScriptName, ItemID, PrimName, LocalID, timeout);
554 556
555 workItem.Abort(); 557 workItem.Abort();
556 } 558 }
@@ -703,21 +705,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
703 if (data.EventName == "collision") 705 if (data.EventName == "collision")
704 m_CollisionInQueue = false; 706 m_CollisionInQueue = false;
705 } 707 }
706 708
707// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this); 709 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
710
711 if (DebugLevel >= 2)
712 m_log.DebugFormat(
713 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
714 data.EventName,
715 ScriptName,
716 part.Name,
717 part.LocalId,
718 part.ParentGroup.Name,
719 part.ParentGroup.UUID,
720 part.AbsolutePosition,
721 part.ParentGroup.Scene.Name);
708 722
709 m_DetectParams = data.DetectParams; 723 m_DetectParams = data.DetectParams;
710 724
711 if (data.EventName == "state") // Hardcoded state change 725 if (data.EventName == "state") // Hardcoded state change
712 { 726 {
713 // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
714 // PrimName, ScriptName, data.Params[0].ToString());
715 State = data.Params[0].ToString(); 727 State = data.Params[0].ToString();
728
729 if (DebugLevel >= 1)
730 m_log.DebugFormat(
731 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
732 State,
733 ScriptName,
734 part.Name,
735 part.LocalId,
736 part.ParentGroup.Name,
737 part.ParentGroup.UUID,
738 part.AbsolutePosition,
739 part.ParentGroup.Scene.Name);
740
716 AsyncCommandManager.RemoveScript(Engine, 741 AsyncCommandManager.RemoveScript(Engine,
717 LocalID, ItemID); 742 LocalID, ItemID);
718 743
719 SceneObjectPart part = Engine.World.GetSceneObjectPart(
720 LocalID);
721 if (part != null) 744 if (part != null)
722 { 745 {
723 part.SetScriptEvents(ItemID, 746 part.SetScriptEvents(ItemID,
@@ -729,8 +752,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
729 if (Engine.World.PipeEventsForScript(LocalID) || 752 if (Engine.World.PipeEventsForScript(LocalID) ||
730 data.EventName == "control") // Don't freeze avies! 753 data.EventName == "control") // Don't freeze avies!
731 { 754 {
732 SceneObjectPart part = Engine.World.GetSceneObjectPart(
733 LocalID);
734 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 755 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
735 // PrimName, ScriptName, data.EventName, State); 756 // PrimName, ScriptName, data.EventName, State);
736 757
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 965101a..828f2fb 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
304 304
305 MainConsole.Instance.Commands.AddCommand( 305 MainConsole.Instance.Commands.AddCommand(
306 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", 306 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
307 "Show information on all scripts known to the script engine." 307 "Show information on all scripts known to the script engine.\n"
308 + "If a <script-item-uuid> is given then only information on that script will be shown.", 308 + "If a <script-item-uuid> is given then only information on that script will be shown.",
309 HandleShowScripts); 309 HandleShowScripts);
310 310
@@ -323,22 +323,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine
323 MainConsole.Instance.Commands.AddCommand( 323 MainConsole.Instance.Commands.AddCommand(
324 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts", 324 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts",
325 "Resumes all currently suspended scripts.\n" 325 "Resumes all currently suspended scripts.\n"
326 + "Resumed scripts will process all events accumulated whilst suspended." 326 + "Resumed scripts will process all events accumulated whilst suspended.\n"
327 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.", 327 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
328 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript)); 328 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript));
329 329
330 MainConsole.Instance.Commands.AddCommand( 330 MainConsole.Instance.Commands.AddCommand(
331 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts", 331 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts",
332 "Stops all running scripts." 332 "Stops all running scripts.\n"
333 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.", 333 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
334 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript)); 334 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript));
335 335
336 MainConsole.Instance.Commands.AddCommand( 336 MainConsole.Instance.Commands.AddCommand(
337 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts", 337 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts",
338 "Starts all stopped scripts." 338 "Starts all stopped scripts.\n"
339 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", 339 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
340 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 340 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
341 341
342 MainConsole.Instance.Commands.AddCommand(
343 "Scripts", false, "debug script log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script",
344 "Activates or deactivates extra debug logging for the given script.\n"
345 + "Level == 0, deactivate extra debug logging.\n"
346 + "Level >= 1, log state changes.\n"
347 + "Level >= 2, log event invocations.\n",
348 HandleDebugScriptLogCommand);
349
342// MainConsole.Instance.Commands.AddCommand( 350// MainConsole.Instance.Commands.AddCommand(
343// "Debug", false, "debug xengine", "debug xengine [<level>]", 351// "Debug", false, "debug xengine", "debug xengine [<level>]",
344// "Turn on detailed xengine debugging.", 352// "Turn on detailed xengine debugging.",
@@ -347,6 +355,41 @@ namespace OpenSim.Region.ScriptEngine.XEngine
347// HandleDebugLevelCommand); 355// HandleDebugLevelCommand);
348 } 356 }
349 357
358 private void HandleDebugScriptLogCommand(string module, string[] args)
359 {
360 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
361 return;
362
363 if (args.Length != 5)
364 {
365 MainConsole.Instance.Output("Usage: debug script log <item-id> <log-level>");
366 return;
367 }
368
369 UUID itemId;
370
371 if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, args[3], out itemId))
372 return;
373
374 int newLevel;
375
376 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out newLevel))
377 return;
378
379 IScriptInstance si;
380
381 lock (m_Scripts)
382 {
383 // XXX: We can't give the user feedback on a bad item id because this may apply to a different script
384 // engine
385 if (!m_Scripts.TryGetValue(itemId, out si))
386 return;
387 }
388
389 si.DebugLevel = newLevel;
390 MainConsole.Instance.OutputFormat("Set debug level of {0} {1} to {2}", si.ScriptName, si.ItemID, newLevel);
391 }
392
350 /// <summary> 393 /// <summary>
351 /// Change debug level 394 /// Change debug level
352 /// </summary> 395 /// </summary>
@@ -418,7 +461,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
418 461
419 if (!UUID.TryParse(rawItemId, out itemId)) 462 if (!UUID.TryParse(rawItemId, out itemId))
420 { 463 {
421 MainConsole.Instance.OutputFormat("Error - {0} is not a valid UUID", rawItemId); 464 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid UUID", rawItemId);
422 return; 465 return;
423 } 466 }
424 467
@@ -542,6 +585,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
542 sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued); 585 sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued);
543 sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed); 586 sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed);
544 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); 587 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID);
588 sb.AppendFormat("Asset UUID : {0}\n", instance.AssetID);
545 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); 589 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName);
546 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID); 590 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
547 sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition); 591 sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition);