i update core ode plugin and make it load is meshs (i hope)

Signed-off-by: Melanie <melanie@t-data.com>
connector_plugin
UbitUmarov 2012-10-07 05:53:52 +01:00 committed by Melanie
parent 991151250d
commit 1e7fb2dc36
2 changed files with 51 additions and 2 deletions

View File

@ -100,6 +100,9 @@ namespace OpenSim.Region.Physics.OdePlugin
private Vector3 m_taintAngularLock = Vector3.One; private Vector3 m_taintAngularLock = Vector3.One;
private IntPtr Amotor = IntPtr.Zero; private IntPtr Amotor = IntPtr.Zero;
private object m_assetsLock = new object();
private bool m_assetFailed = false;
private Vector3 m_PIDTarget; private Vector3 m_PIDTarget;
private float m_PIDTau; private float m_PIDTau;
private float PID_D = 35f; private float PID_D = 35f;
@ -282,6 +285,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
m_taintadd = true; m_taintadd = true;
m_assetFailed = false;
_parent_scene.AddPhysicsActorTaint(this); _parent_scene.AddPhysicsActorTaint(this);
} }
@ -1498,6 +1502,8 @@ Console.WriteLine("CreateGeom:");
mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
// createmesh returns null when it's a shape that isn't a cube. // createmesh returns null when it's a shape that isn't a cube.
// m_log.Debug(m_localID); // m_log.Debug(m_localID);
if (mesh == null)
CheckMeshAsset();
} }
#if SPAM #if SPAM
@ -1997,7 +2003,12 @@ Console.WriteLine(" JointCreateFixed");
// Don't need to re-enable body.. it's done in SetMesh // Don't need to re-enable body.. it's done in SetMesh
if (_parent_scene.needsMeshing(_pbs)) if (_parent_scene.needsMeshing(_pbs))
{
mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical);
if (mesh == null)
CheckMeshAsset();
}
} }
CreateGeom(m_targetSpace, mesh); CreateGeom(m_targetSpace, mesh);
@ -2057,6 +2068,8 @@ Console.WriteLine(" JointCreateFixed");
/// </summary> /// </summary>
private void changeshape() private void changeshape()
{ {
m_taintshape = false;
// Cleanup of old prim geometry and Bodies // Cleanup of old prim geometry and Bodies
if (IsPhysical && Body != IntPtr.Zero) if (IsPhysical && Body != IntPtr.Zero)
{ {
@ -2084,6 +2097,7 @@ Console.WriteLine(" JointCreateFixed");
IMesh mesh = null; IMesh mesh = null;
if (_parent_scene.needsMeshing(_pbs)) if (_parent_scene.needsMeshing(_pbs))
{ {
// Don't need to re-enable body.. it's done in CreateMesh // Don't need to re-enable body.. it's done in CreateMesh
@ -2094,6 +2108,8 @@ Console.WriteLine(" JointCreateFixed");
// createmesh returns null when it doesn't mesh. // createmesh returns null when it doesn't mesh.
mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical);
if (mesh == null)
CheckMeshAsset();
} }
CreateGeom(m_targetSpace, mesh); CreateGeom(m_targetSpace, mesh);
@ -2130,7 +2146,7 @@ Console.WriteLine(" JointCreateFixed");
} }
resetCollisionAccounting(); resetCollisionAccounting();
m_taintshape = false; // m_taintshape = false;
} }
/// <summary> /// <summary>
@ -2396,6 +2412,7 @@ Console.WriteLine(" JointCreateFixed");
set set
{ {
_pbs = value; _pbs = value;
m_assetFailed = false;
m_taintshape = true; m_taintshape = true;
} }
} }
@ -3234,5 +3251,37 @@ Console.WriteLine(" JointCreateFixed");
{ {
m_material = pMaterial; m_material = pMaterial;
} }
private void CheckMeshAsset()
{
if (_pbs.SculptEntry && !m_assetFailed && _pbs.SculptTexture != UUID.Zero)
{
m_assetFailed = true;
Util.FireAndForget(delegate
{
RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod;
if (assetProvider != null)
assetProvider(_pbs.SculptTexture, MeshAssetReveived);
});
}
}
void MeshAssetReveived(AssetBase asset)
{
if (asset.Data != null && asset.Data.Length > 0)
{
if (!_pbs.SculptEntry)
return;
if (_pbs.SculptTexture.ToString() != asset.ID)
return;
_pbs.SculptData = new byte[asset.Data.Length];
asset.Data.CopyTo(_pbs.SculptData, 0);
m_assetFailed = false;
m_taintshape = true;
_parent_scene.AddPhysicsActorTaint(this);
}
}
} }
} }