| 22 |
private IronPython.Hosting.PythonEngine mPython = null; |
private IronPython.Hosting.PythonEngine mPython = null; |
| 23 |
private bool m_PythonEnabled; |
private bool m_PythonEnabled; |
| 24 |
private bool m_EngineStarted; |
private bool m_EngineStarted; |
| 25 |
|
private ModrexObjects m_rexObjects; |
| 26 |
|
|
| 27 |
public RexScriptEngine() |
public RexScriptEngine() |
| 28 |
{ |
{ |
| 64 |
|
|
| 65 |
public void PostInitialise() |
public void PostInitialise() |
| 66 |
{ |
{ |
| 67 |
|
OpenSim.Region.Environment.Interfaces.IRegionModule module = World.Modules["RexObjectsModule"]; |
| 68 |
|
if (module != null && module is ModrexObjects) |
| 69 |
|
{ |
| 70 |
|
m_rexObjects = (ModrexObjects)module; |
| 71 |
|
} |
| 72 |
|
|
| 73 |
InitializeEngine(World); |
InitializeEngine(World); |
| 74 |
} |
} |
| 75 |
|
|
| 184 |
string PyText = ""; |
string PyText = ""; |
| 185 |
int tagindex = 0; |
int tagindex = 0; |
| 186 |
|
|
| 187 |
List<EntityBase> EntityList = World.GetEntities(); |
foreach (EntityBase ent in World.GetEntities()) |
|
foreach (EntityBase ent in EntityList) |
|
| 188 |
{ |
{ |
| 189 |
if (ent is RexObjects.RexObjectGroup) |
if (ent is SceneObjectGroup) |
| 190 |
{ |
{ |
| 191 |
|
RexFramework.RexObjectProperties rexobj = m_rexObjects.Load(((SceneObjectGroup)ent).RootPart.UUID); |
| 192 |
PythonClassName = "rxactor.Actor"; |
PythonClassName = "rxactor.Actor"; |
| 193 |
PythonTag = ""; |
PythonTag = ""; |
| 194 |
|
|
|
SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); |
|
|
if (part is RexObjects.RexObjectPart) |
|
|
{ |
|
|
RexObjects.RexObjectPart rexpart = (RexObjects.RexObjectPart)part; |
|
|
if (rexpart != null) |
|
|
{ |
|
| 195 |
// First check m_RexClassName, then description of object |
// First check m_RexClassName, then description of object |
| 196 |
if (rexpart.RexClassName.Length > 0) |
if (rexobj.RexClassName.Length > 0) |
| 197 |
{ |
{ |
| 198 |
tagindex = rexpart.RexClassName.IndexOf("?", 0); |
tagindex = rexobj.RexClassName.IndexOf("?", 0); |
| 199 |
if (tagindex > -1) |
if (tagindex > -1) |
| 200 |
{ |
{ |
| 201 |
PythonClassName = rexpart.RexClassName.Substring(0, tagindex); |
PythonClassName = rexobj.RexClassName.Substring(0, tagindex); |
| 202 |
PythonTag = rexpart.RexClassName.Substring(tagindex + 1); |
PythonTag = rexobj.RexClassName.Substring(tagindex + 1); |
|
} |
|
|
else |
|
|
PythonClassName = rexpart.RexClassName; |
|
| 203 |
} |
} |
|
else if (rexpart.Description.Length > 9 && rexpart.Description.Substring(0, 4).ToLower() == "<py>") |
|
|
{ |
|
|
tagindex = rexpart.Description.IndexOf("</py>", 4); |
|
|
if (tagindex > -1) |
|
|
PyText = rexpart.Description.Substring(4, tagindex - 4); |
|
| 204 |
else |
else |
| 205 |
continue; |
PythonClassName = rexobj.RexClassName; |
| 206 |
|
|
| 207 |
tagindex = PyText.IndexOf("?", 0); |
((SceneObjectGroup)ent).RootPart.SetScriptEvents(rexobj.ParentObjectID, (int)scriptEvents.touch_start); |
|
if (tagindex > -1) |
|
|
{ |
|
|
PythonClassName = PyText.Substring(0, tagindex); |
|
|
PythonTag = PyText.Substring(tagindex + 1); |
|
|
} |
|
|
else |
|
|
PythonClassName = PyText; |
|
|
} |
|
| 208 |
} |
} |
| 209 |
|
//TODO: Get Py-classname and tag from prim description? |
| 210 |
} |
} |
| 211 |
CreateActorToPython(ent.LocalId.ToString(), PythonClassName, PythonTag); |
CreateActorToPython(ent.LocalId.ToString(), PythonClassName, PythonTag); |
| 212 |
} |
} |
|
} |
|
| 213 |
|
|
| 214 |
|
#region old code for checking class name from RexObjectPart. not in use, only as reference |
| 215 |
|
//List<EntityBase> EntityList = World.GetEntities(); |
| 216 |
|
//foreach (EntityBase ent in EntityList) |
| 217 |
|
//{ |
| 218 |
|
// if (ent is RexObjects.RexObjectGroup) |
| 219 |
|
// { |
| 220 |
|
// PythonClassName = "rxactor.Actor"; |
| 221 |
|
// PythonTag = ""; |
| 222 |
|
|
| 223 |
|
// SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); |
| 224 |
|
// if (part is RexObjects.RexObjectPart) |
| 225 |
|
// { |
| 226 |
|
// RexObjects.RexObjectPart rexpart = (RexObjects.RexObjectPart)part; |
| 227 |
|
// if (rexpart != null) |
| 228 |
|
// { |
| 229 |
|
// // First check m_RexClassName, then description of object |
| 230 |
|
// if (rexpart.RexClassName.Length > 0) |
| 231 |
|
// { |
| 232 |
|
// tagindex = rexpart.RexClassName.IndexOf("?", 0); |
| 233 |
|
// if (tagindex > -1) |
| 234 |
|
// { |
| 235 |
|
// PythonClassName = rexpart.RexClassName.Substring(0, tagindex); |
| 236 |
|
// PythonTag = rexpart.RexClassName.Substring(tagindex + 1); |
| 237 |
|
// } |
| 238 |
|
// else |
| 239 |
|
// PythonClassName = rexpart.RexClassName; |
| 240 |
|
// } |
| 241 |
|
// else if (rexpart.Description.Length > 9 && rexpart.Description.Substring(0, 4).ToLower() == "<py>") |
| 242 |
|
// { |
| 243 |
|
// tagindex = rexpart.Description.IndexOf("</py>", 4); |
| 244 |
|
// if (tagindex > -1) |
| 245 |
|
// PyText = rexpart.Description.Substring(4, tagindex - 4); |
| 246 |
|
// else |
| 247 |
|
// continue; |
| 248 |
|
|
| 249 |
|
// tagindex = PyText.IndexOf("?", 0); |
| 250 |
|
// if (tagindex > -1) |
| 251 |
|
// { |
| 252 |
|
// PythonClassName = PyText.Substring(0, tagindex); |
| 253 |
|
// PythonTag = PyText.Substring(tagindex + 1); |
| 254 |
|
// } |
| 255 |
|
// else |
| 256 |
|
// PythonClassName = PyText; |
| 257 |
|
// } |
| 258 |
|
// } |
| 259 |
|
// } |
| 260 |
|
// CreateActorToPython(ent.LocalId.ToString(), PythonClassName, PythonTag); |
| 261 |
|
// } |
| 262 |
|
//} |
| 263 |
|
#endregion |
| 264 |
|
|
| 265 |
// Create avatars |
// Create avatars |
| 266 |
string PParams = ""; |
string PParams = ""; |