From cf16ca9bdaad75d42213089e18c0ee8f8422bbd6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 1 Aug 2012 22:36:24 +0100 Subject: Create the ability for physics modules to request assets on demand by themselves. For that, the physics module simply calls RequestAssetMethod, which in turn points to Scene.PhysicsRequestAsset. This gives physics access to the asset system without introducing unwanted knowledge of the scene class. --- OpenSim/Region/Framework/Scenes/Scene.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index eb4ba41..c77457c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5421,5 +5421,21 @@ namespace OpenSim.Region.Framework.Scenes m_SpawnPoint = 1; return m_SpawnPoint - 1; } + + // Wrappers to get physics modules retrieve assets. Has to be done this way + // because we can't assign the asset service to physics directly - at the + // time physics are instantiated it's not registered but it will be by + // the time the first prim exists. + public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) + { + AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); + } + + private void PhysicsAssetReceived(string id, Object sender, AssetBase asset) + { + AssetReceivedDelegate callback = (AssetReceivedDelegate)sender; + + callback(asset); + } } } -- cgit v1.1