| 11 |
using OpenSim.Region.Framework.Scenes; |
using OpenSim.Region.Framework.Scenes; |
| 12 |
using OpenSim.Data.NHibernate; |
using OpenSim.Data.NHibernate; |
| 13 |
using OpenSim.Framework; |
using OpenSim.Framework; |
| 14 |
|
using ModularRex.NHibernate; |
| 15 |
|
using OpenSim.Framework.Communications.Cache; |
| 16 |
|
|
| 17 |
namespace ModularRex.RexParts |
namespace ModularRex.RexParts |
| 18 |
{ |
{ |
| 34 |
{ |
{ |
| 35 |
m_scenes.Add(scene); |
m_scenes.Add(scene); |
| 36 |
|
|
| 37 |
|
scene.RegisterModuleInterface<ModrexObjects>(this); |
| 38 |
scene.EventManager.OnClientConnect += EventManager_OnClientConnect; |
scene.EventManager.OnClientConnect += EventManager_OnClientConnect; |
| 39 |
scene.SceneContents.OnObjectDuplicate += SceneGraph_OnObjectDuplicate; |
scene.SceneContents.OnObjectDuplicate += SceneGraph_OnObjectDuplicate; |
| 40 |
scene.SceneContents.OnObjectRemove += SceneGraph_OnObjectRemove; |
scene.SceneContents.OnObjectRemove += SceneGraph_OnObjectRemove; |
| 67 |
|
|
| 68 |
void EventManager_OnClientConnect(OpenSim.Framework.Client.IClientCore client) |
void EventManager_OnClientConnect(OpenSim.Framework.Client.IClientCore client) |
| 69 |
{ |
{ |
| 70 |
RexClientView rcv; |
RexClientViewBase rcv; |
| 71 |
if (client.TryGet(out rcv)) |
if (client.TryGet(out rcv)) |
| 72 |
{ |
{ |
| 73 |
rcv.OnRexObjectProperties += rcv_OnRexObjectProperties; |
rcv.OnRexObjectProperties += rcv_OnRexObjectProperties; |
| 79 |
} |
} |
| 80 |
} |
} |
| 81 |
|
|
| 82 |
private void rcv_OnPrimFreeData(RexClientView sender, List<string> parameters) |
private void rcv_OnPrimFreeData(IClientAPI sender, List<string> parameters) |
| 83 |
{ |
{ |
| 84 |
m_log.Info("[REXOBJS] Received Prim free data"); |
m_log.Info("[REXOBJS] Received Prim free data"); |
| 85 |
if (parameters.Count == 2) |
if (parameters.Count == 2) |
| 132 |
scene.ForEachScenePresence( |
scene.ForEachScenePresence( |
| 133 |
delegate(ScenePresence avatar) |
delegate(ScenePresence avatar) |
| 134 |
{ |
{ |
| 135 |
RexClientView rex; |
RexClientViewBase rex; |
| 136 |
if (avatar.ClientView.TryGet(out rex)) |
if (avatar.ClientView.TryGet(out rex)) |
| 137 |
{ |
{ |
| 138 |
rex.SendRexObjectProperties(id,props); |
rex.SendRexObjectProperties(id,props); |
| 141 |
} |
} |
| 142 |
} |
} |
| 143 |
|
|
| 144 |
private void SendPreloadAssetsToUser(RexClientView user) |
private void SendPreloadAssetsToUser(RexClientViewBase user) |
| 145 |
{ |
{ |
| 146 |
try |
try |
| 147 |
{ |
{ |
| 170 |
} |
} |
| 171 |
} |
} |
| 172 |
|
|
| 173 |
void SendAllPropertiesToUser(RexClientView user) |
void SendAllPropertiesToUser(RexClientViewBase user) |
| 174 |
{ |
{ |
| 175 |
SendPreloadAssetsToUser(user); |
SendPreloadAssetsToUser(user); |
| 176 |
|
|
| 180 |
} |
} |
| 181 |
} |
} |
| 182 |
|
|
| 183 |
void rcv_OnRexObjectProperties(RexClientView sender, UUID id, RexObjectProperties props) |
void rcv_OnRexObjectProperties(IClientAPI sender, UUID id, RexObjectProperties props) |
| 184 |
{ |
{ |
| 185 |
m_log.Info("[REXOBJS] Received RexObjData for " + id); |
m_log.Info("[REXOBJS] Received RexObjData for " + id); |
| 186 |
if (props.ParentObjectID == UUID.Zero) |
if (props.ParentObjectID == UUID.Zero) |
| 306 |
|
|
| 307 |
if (p.RexCollisionMeshUUID != UUID.Zero && sop.PhysActor is IRexPhysicsActor) |
if (p.RexCollisionMeshUUID != UUID.Zero && sop.PhysActor is IRexPhysicsActor) |
| 308 |
{ |
{ |
| 309 |
AssetBase tempmodel = sop.ParentGroup.Scene.CommsManager.AssetCache.GetAsset(p.RexCollisionMeshUUID, false); |
AssetBase tempmodel = sop.ParentGroup.Scene.AssetService.Get(p.RexCollisionMeshUUID.ToString()); |
| 310 |
if (tempmodel != null) |
if (tempmodel != null) |
| 311 |
((IRexPhysicsActor)sop.PhysActor).SetCollisionMesh(tempmodel.Data, tempmodel.Name, p.RexScaleToPrim); |
((IRexPhysicsActor)sop.PhysActor).SetCollisionMesh(tempmodel.Data, tempmodel.Name, p.RexScaleToPrim); |
| 312 |
} |
} |
| 314 |
|
|
| 315 |
public byte GetAssetType(UUID assetid) |
public byte GetAssetType(UUID assetid) |
| 316 |
{ |
{ |
| 317 |
AssetBase tempmodel = m_scenes[0].CommsManager.AssetCache.GetAsset(assetid, true); |
AssetBase tempmodel = m_scenes[0].AssetService.Get(assetid.ToString()); |
| 318 |
if (tempmodel == null) |
if (tempmodel == null) |
| 319 |
m_scenes[0].CommsManager.AssetCache.GetAsset(assetid, false); |
m_scenes[0].AssetService.Get(assetid.ToString()); |
| 320 |
|
|
| 321 |
if (tempmodel != null) |
if (tempmodel != null) |
| 322 |
return(byte)(tempmodel.Type); |
return(byte)(tempmodel.Type); |
| 375 |
RexObjectProperties props = RexObjectPropertiesCache[id]; |
RexObjectProperties props = RexObjectPropertiesCache[id]; |
| 376 |
if (props == null) |
if (props == null) |
| 377 |
{ |
{ |
| 378 |
|
//Objects that are not in the scene can't be found from cache. |
| 379 |
|
//So before we create new properties, we try to find them from db |
| 380 |
|
props = m_db.LoadObject(id); |
| 381 |
|
if (props == null) |
| 382 |
|
{ |
| 383 |
props = new RexObjectProperties(id, this); |
props = new RexObjectProperties(id, this); |
| 384 |
|
} |
| 385 |
RexObjectPropertiesCache.Add(id, props); |
RexObjectPropertiesCache.Add(id, props); |
| 386 |
} |
} |
| 387 |
return props; |
return props; |
| 403 |
return false; |
return false; |
| 404 |
} |
} |
| 405 |
|
|
|
|
|
| 406 |
#endregion |
#endregion |
| 407 |
|
|
| 408 |
|
|