Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
4e180e84e2
|
@ -169,6 +169,81 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
|
||||||
|
|
||||||
|
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID RezSingleAttachmentFromInventory(
|
||||||
|
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
|
||||||
|
{
|
||||||
|
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt);
|
||||||
|
|
||||||
|
if (updateInventoryStatus)
|
||||||
|
{
|
||||||
|
if (att == null)
|
||||||
|
{
|
||||||
|
ShowDetachInUserInventory(itemID, remoteClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == att)
|
||||||
|
return UUID.Zero;
|
||||||
|
else
|
||||||
|
return att.UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
||||||
|
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||||
|
{
|
||||||
|
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||||
|
if (invAccess != null)
|
||||||
|
{
|
||||||
|
SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
|
||||||
|
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||||
|
false, false, remoteClient.AgentId, true);
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
|
||||||
|
// objatt.Name, remoteClient.Name, AttachmentPt);
|
||||||
|
|
||||||
|
if (objatt != null)
|
||||||
|
{
|
||||||
|
bool tainted = false;
|
||||||
|
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
||||||
|
tainted = true;
|
||||||
|
|
||||||
|
AttachObject(
|
||||||
|
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
||||||
|
//objatt.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
|
if (tainted)
|
||||||
|
objatt.HasGroupChanged = true;
|
||||||
|
|
||||||
|
// Fire after attach, so we don't get messy perms dialogs
|
||||||
|
// 3 == AttachedRez
|
||||||
|
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
|
||||||
|
|
||||||
|
// Do this last so that event listeners have access to all the effects of the attachment
|
||||||
|
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
|
||||||
|
itemID, remoteClient.Name, AttachmentPt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return objatt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID SetAttachmentInventoryStatus(
|
public UUID SetAttachmentInventoryStatus(
|
||||||
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,29 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
bool AttachObject(
|
bool AttachObject(
|
||||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent);
|
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rez an attachment from user inventory and change inventory status to match.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="itemID"></param>
|
||||||
|
/// <param name="AttachmentPt"></param>
|
||||||
|
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
|
||||||
|
UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rez an attachment from user inventory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="itemID"></param>
|
||||||
|
/// <param name="AttachmentPt"></param>
|
||||||
|
/// <param name="updateinventoryStatus">
|
||||||
|
/// If true, we also update the user's inventory to show that the attachment is set. If false, we do not.
|
||||||
|
/// False is required so that we don't attempt to update information when a user enters a scene with the
|
||||||
|
/// attachment already correctly set up in inventory.
|
||||||
|
/// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns>
|
||||||
|
UUID RezSingleAttachmentFromInventory(
|
||||||
|
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the user inventory to the attachment of an item
|
/// Update the user inventory to the attachment of an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1842,35 +1842,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
EventManager.TriggerOnAttach(localID, itemID, avatarID);
|
EventManager.TriggerOnAttach(localID, itemID, avatarID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the client receives a request to rez a single attachment on to the avatar from inventory
|
|
||||||
/// (RezSingleAttachmentFromInv packet).
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
/// <param name="itemID"></param>
|
|
||||||
/// <param name="AttachmentPt"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
|
|
||||||
|
|
||||||
SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
|
|
||||||
|
|
||||||
if (att == null)
|
|
||||||
{
|
|
||||||
AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient);
|
|
||||||
return UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
|
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
|
||||||
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
|
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
|
||||||
{
|
{
|
||||||
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
|
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
|
||||||
{
|
{
|
||||||
RezSingleAttachment(remoteClient, obj.ItemID, obj.AttachmentPt);
|
AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2338,10 +2338,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
|
//m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
|
||||||
|
|
||||||
ScenePresence sp = GetScenePresence(userID);
|
ScenePresence sp = GetScenePresence(userID);
|
||||||
if (sp != null)
|
if (sp != null && AttachmentsModule != null)
|
||||||
{
|
{
|
||||||
uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
|
uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
|
||||||
m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt);
|
AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -2643,12 +2643,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
|
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
|
|
||||||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
|
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
|
||||||
client.OnObjectDetach += m_sceneGraph.DetachObject;
|
client.OnObjectDetach += m_sceneGraph.DetachObject;
|
||||||
|
|
||||||
if (AttachmentsModule != null)
|
if (AttachmentsModule != null)
|
||||||
{
|
{
|
||||||
|
client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
|
||||||
client.OnObjectAttach += AttachmentsModule.AttachObject;
|
client.OnObjectAttach += AttachmentsModule.AttachObject;
|
||||||
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
|
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
|
||||||
}
|
}
|
||||||
|
@ -2800,11 +2800,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
|
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
|
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
|
||||||
client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
|
|
||||||
client.OnObjectDetach -= m_sceneGraph.DetachObject;
|
client.OnObjectDetach -= m_sceneGraph.DetachObject;
|
||||||
|
|
||||||
if (AttachmentsModule != null)
|
if (AttachmentsModule != null)
|
||||||
{
|
{
|
||||||
|
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
|
||||||
client.OnObjectAttach -= AttachmentsModule.AttachObject;
|
client.OnObjectAttach -= AttachmentsModule.AttachObject;
|
||||||
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
|
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,59 +486,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Rez an attachment
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
/// <param name="itemID"></param>
|
|
||||||
/// <param name="AttachmentPt"></param>
|
|
||||||
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
|
|
||||||
public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
|
||||||
{
|
|
||||||
IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>();
|
|
||||||
if (invAccess != null)
|
|
||||||
{
|
|
||||||
SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
|
|
||||||
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
|
||||||
false, false, remoteClient.AgentId, true);
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
|
|
||||||
// objatt.Name, remoteClient.Name, AttachmentPt);
|
|
||||||
|
|
||||||
if (objatt != null)
|
|
||||||
{
|
|
||||||
bool tainted = false;
|
|
||||||
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
|
||||||
tainted = true;
|
|
||||||
|
|
||||||
m_parentScene.AttachmentsModule.AttachObject(
|
|
||||||
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
|
||||||
//objatt.ScheduleGroupForFullUpdate();
|
|
||||||
|
|
||||||
if (tainted)
|
|
||||||
objatt.HasGroupChanged = true;
|
|
||||||
|
|
||||||
// Fire after attach, so we don't get messy perms dialogs
|
|
||||||
// 3 == AttachedRez
|
|
||||||
objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
|
|
||||||
|
|
||||||
// Do this last so that event listeners have access to all the effects of the attachment
|
|
||||||
m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
|
|
||||||
itemID, remoteClient.Name, AttachmentPt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return objatt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
|
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
|
||||||
{
|
{
|
||||||
ScenePresence newAvatar = null;
|
ScenePresence newAvatar = null;
|
||||||
|
|
|
@ -676,7 +676,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
|
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
|
||||||
|
|
||||||
m_userLevel = account.UserLevel;
|
if (account != null)
|
||||||
|
m_userLevel = account.UserLevel;
|
||||||
|
|
||||||
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
|
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
|
||||||
if (gm != null)
|
if (gm != null)
|
||||||
|
@ -3738,7 +3739,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (null == m_appearance)
|
if (null == m_appearance)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID);
|
m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3762,12 +3763,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Rez from inventory
|
// Rez from inventory
|
||||||
UUID asset = m_scene.RezSingleAttachment(ControllingClient,
|
UUID asset
|
||||||
itemID, (uint)p);
|
= m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p);
|
||||||
|
|
||||||
m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
|
|
||||||
p, itemID, assetID, asset);
|
|
||||||
|
|
||||||
|
m_log.InfoFormat(
|
||||||
|
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
|
||||||
|
p, itemID, assetID, asset);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -827,15 +827,16 @@ namespace PrimMesher
|
||||||
|
|
||||||
if (createFaces)
|
if (createFaces)
|
||||||
{
|
{
|
||||||
int numOuterVerts = this.coords.Count;
|
//int numOuterVerts = this.coords.Count;
|
||||||
int numHollowVerts = hollowCoords.Count;
|
//numOuterVerts = this.coords.Count;
|
||||||
int numTotalVerts = numOuterVerts + numHollowVerts;
|
//int numHollowVerts = hollowCoords.Count;
|
||||||
|
int numTotalVerts = this.numOuterVerts + this.numHollowVerts;
|
||||||
|
|
||||||
if (numOuterVerts == numHollowVerts)
|
if (this.numOuterVerts == this.numHollowVerts)
|
||||||
{
|
{
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
|
|
||||||
for (int coordIndex = 0; coordIndex < numOuterVerts - 1; coordIndex++)
|
for (int coordIndex = 0; coordIndex < this.numOuterVerts - 1; coordIndex++)
|
||||||
{
|
{
|
||||||
newFace.v1 = coordIndex;
|
newFace.v1 = coordIndex;
|
||||||
newFace.v2 = coordIndex + 1;
|
newFace.v2 = coordIndex + 1;
|
||||||
|
@ -850,12 +851,12 @@ namespace PrimMesher
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (numOuterVerts < numHollowVerts)
|
if (this.numOuterVerts < this.numHollowVerts)
|
||||||
{
|
{
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
int j = 0; // j is the index for outer vertices
|
int j = 0; // j is the index for outer vertices
|
||||||
int maxJ = numOuterVerts - 1;
|
int maxJ = this.numOuterVerts - 1;
|
||||||
for (int i = 0; i < numHollowVerts; i++) // i is the index for inner vertices
|
for (int i = 0; i < this.numHollowVerts; i++) // i is the index for inner vertices
|
||||||
{
|
{
|
||||||
if (j < maxJ)
|
if (j < maxJ)
|
||||||
if (angles.angles[j + 1].angle - hollowAngles.angles[i].angle < hollowAngles.angles[i].angle - angles.angles[j].angle + 0.000001f)
|
if (angles.angles[j + 1].angle - hollowAngles.angles[i].angle < hollowAngles.angles[i].angle - angles.angles[j].angle + 0.000001f)
|
||||||
|
@ -879,8 +880,8 @@ namespace PrimMesher
|
||||||
{
|
{
|
||||||
Face newFace = new Face();
|
Face newFace = new Face();
|
||||||
int j = 0; // j is the index for inner vertices
|
int j = 0; // j is the index for inner vertices
|
||||||
int maxJ = numHollowVerts - 1;
|
int maxJ = this.numHollowVerts - 1;
|
||||||
for (int i = 0; i < numOuterVerts; i++)
|
for (int i = 0; i < this.numOuterVerts; i++)
|
||||||
{
|
{
|
||||||
if (j < maxJ)
|
if (j < maxJ)
|
||||||
if (hollowAngles.angles[j + 1].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[j].angle + 0.000001f)
|
if (hollowAngles.angles[j + 1].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[j].angle + 0.000001f)
|
||||||
|
@ -981,7 +982,7 @@ namespace PrimMesher
|
||||||
int startVert = hasProfileCut && !hasHollow ? 1 : 0;
|
int startVert = hasProfileCut && !hasHollow ? 1 : 0;
|
||||||
if (startVert > 0)
|
if (startVert > 0)
|
||||||
this.faceNumbers.Add(-1);
|
this.faceNumbers.Add(-1);
|
||||||
for (int i = 0; i < numOuterVerts - 1; i++)
|
for (int i = 0; i < this.numOuterVerts - 1; i++)
|
||||||
this.faceNumbers.Add(sides < 5 ? faceNum++ : faceNum);
|
this.faceNumbers.Add(sides < 5 ? faceNum++ : faceNum);
|
||||||
|
|
||||||
//if (!hasHollow && !hasProfileCut)
|
//if (!hasHollow && !hasProfileCut)
|
||||||
|
@ -994,7 +995,7 @@ namespace PrimMesher
|
||||||
|
|
||||||
if (hasHollow)
|
if (hasHollow)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numHollowVerts; i++)
|
for (int i = 0; i < this.numHollowVerts; i++)
|
||||||
this.faceNumbers.Add(faceNum);
|
this.faceNumbers.Add(faceNum);
|
||||||
|
|
||||||
faceNum++;
|
faceNum++;
|
||||||
|
@ -1019,7 +1020,7 @@ namespace PrimMesher
|
||||||
{
|
{
|
||||||
this.faceUVs = new List<UVCoord>();
|
this.faceUVs = new List<UVCoord>();
|
||||||
foreach (Coord c in this.coords)
|
foreach (Coord c in this.coords)
|
||||||
this.faceUVs.Add(new UVCoord(1.0f - (0.5f + c.X), 1.0f - (0.5f - c.Y)));
|
this.faceUVs.Add(new UVCoord(0.5f + c.X, 0.5f - c.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Profile Copy()
|
internal Profile Copy()
|
||||||
|
@ -1348,7 +1349,6 @@ namespace PrimMesher
|
||||||
float stepSize = twoPi / this.stepsPerRevolution;
|
float stepSize = twoPi / this.stepsPerRevolution;
|
||||||
|
|
||||||
int step = (int)(startAngle / stepSize);
|
int step = (int)(startAngle / stepSize);
|
||||||
// int firstStep = step;
|
|
||||||
float angle = startAngle;
|
float angle = startAngle;
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
@ -1738,7 +1738,6 @@ namespace PrimMesher
|
||||||
// append this layer
|
// append this layer
|
||||||
|
|
||||||
int coordsLen = this.coords.Count;
|
int coordsLen = this.coords.Count;
|
||||||
// int lastCoordsLen = coordsLen;
|
|
||||||
newLayer.AddValue2FaceVertexIndices(coordsLen);
|
newLayer.AddValue2FaceVertexIndices(coordsLen);
|
||||||
|
|
||||||
this.coords.AddRange(newLayer.coords);
|
this.coords.AddRange(newLayer.coords);
|
||||||
|
|
|
@ -53,42 +53,49 @@ namespace PrimMesher
|
||||||
public enum SculptType { sphere = 1, torus = 2, plane = 3, cylinder = 4 };
|
public enum SculptType { sphere = 1, torus = 2, plane = 3, cylinder = 4 };
|
||||||
|
|
||||||
#if SYSTEM_DRAWING
|
#if SYSTEM_DRAWING
|
||||||
// private Bitmap ScaleImage(Bitmap srcImage, float scale)
|
private Bitmap ScaleImage(Bitmap srcImage, float scale, bool removeAlpha)
|
||||||
// {
|
{
|
||||||
// int sourceWidth = srcImage.Width;
|
int sourceWidth = srcImage.Width;
|
||||||
// int sourceHeight = srcImage.Height;
|
int sourceHeight = srcImage.Height;
|
||||||
// int sourceX = 0;
|
int sourceX = 0;
|
||||||
// int sourceY = 0;
|
int sourceY = 0;
|
||||||
|
|
||||||
// int destX = 0;
|
int destX = 0;
|
||||||
// int destY = 0;
|
int destY = 0;
|
||||||
// int destWidth = (int)(srcImage.Width * scale);
|
int destWidth = (int)(srcImage.Width * scale);
|
||||||
// int destHeight = (int)(srcImage.Height * scale);
|
int destHeight = (int)(srcImage.Height * scale);
|
||||||
|
|
||||||
// if (srcImage.PixelFormat == PixelFormat.Format32bppArgb)
|
Bitmap scaledImage;
|
||||||
// for (int y = 0; y < srcImage.Height; y++)
|
|
||||||
// for (int x = 0; x < srcImage.Width; x++)
|
|
||||||
// {
|
|
||||||
// Color c = srcImage.GetPixel(x, y);
|
|
||||||
// srcImage.SetPixel(x, y, Color.FromArgb(255, c.R, c.G, c.B));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Bitmap scaledImage = new Bitmap(destWidth, destHeight,
|
if (removeAlpha)
|
||||||
// PixelFormat.Format24bppRgb);
|
{
|
||||||
|
if (srcImage.PixelFormat == PixelFormat.Format32bppArgb)
|
||||||
|
for (int y = 0; y < srcImage.Height; y++)
|
||||||
|
for (int x = 0; x < srcImage.Width; x++)
|
||||||
|
{
|
||||||
|
Color c = srcImage.GetPixel(x, y);
|
||||||
|
srcImage.SetPixel(x, y, Color.FromArgb(255, c.R, c.G, c.B));
|
||||||
|
}
|
||||||
|
|
||||||
// scaledImage.SetResolution(96.0f, 96.0f);
|
scaledImage = new Bitmap(destWidth, destHeight,
|
||||||
|
PixelFormat.Format24bppRgb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
scaledImage = new Bitmap(srcImage, destWidth, destHeight);
|
||||||
|
|
||||||
// Graphics grPhoto = Graphics.FromImage(scaledImage);
|
scaledImage.SetResolution(96.0f, 96.0f);
|
||||||
// grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low;
|
|
||||||
|
|
||||||
// grPhoto.DrawImage(srcImage,
|
Graphics grPhoto = Graphics.FromImage(scaledImage);
|
||||||
// new Rectangle(destX, destY, destWidth, destHeight),
|
grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low;
|
||||||
// new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
|
|
||||||
// GraphicsUnit.Pixel);
|
|
||||||
|
|
||||||
// grPhoto.Dispose();
|
grPhoto.DrawImage(srcImage,
|
||||||
// return scaledImage;
|
new Rectangle(destX, destY, destWidth, destHeight),
|
||||||
// }
|
new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
|
||||||
|
GraphicsUnit.Pixel);
|
||||||
|
|
||||||
|
grPhoto.Dispose();
|
||||||
|
return scaledImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public SculptMesh SculptMeshFromFile(string fileName, SculptType sculptType, int lod, bool viewerMode)
|
public SculptMesh SculptMeshFromFile(string fileName, SculptType sculptType, int lod, bool viewerMode)
|
||||||
|
@ -268,6 +275,11 @@ namespace PrimMesher
|
||||||
for (imageY = imageYStart; imageY < imageYEnd; imageY++)
|
for (imageY = imageYStart; imageY < imageYEnd; imageY++)
|
||||||
{
|
{
|
||||||
Color c = bitmap.GetPixel(imageX, imageY);
|
Color c = bitmap.GetPixel(imageX, imageY);
|
||||||
|
if (c.A != 255)
|
||||||
|
{
|
||||||
|
bitmap.SetPixel(imageX, imageY, Color.FromArgb(255, c.R, c.G, c.B));
|
||||||
|
c = bitmap.GetPixel(imageX, imageY);
|
||||||
|
}
|
||||||
rSum += c.R;
|
rSum += c.R;
|
||||||
gSum += c.G;
|
gSum += c.G;
|
||||||
bSum += c.B;
|
bSum += c.B;
|
||||||
|
@ -298,12 +310,18 @@ namespace PrimMesher
|
||||||
if (sculptType == SculptType.plane)
|
if (sculptType == SculptType.plane)
|
||||||
invert = !invert;
|
invert = !invert;
|
||||||
|
|
||||||
float sourceScaleFactor = (float)(lod) / (float)Math.Sqrt(sculptBitmap.Width * sculptBitmap.Height);
|
float sculptBitmapLod = (float)Math.Sqrt(sculptBitmap.Width * sculptBitmap.Height);
|
||||||
|
|
||||||
int scale = (int)(1.0f / sourceScaleFactor);
|
float sourceScaleFactor = (float)(lod) / sculptBitmapLod;
|
||||||
if (scale < 1) scale = 1;
|
|
||||||
|
|
||||||
_SculptMesh(bitmap2Coords(sculptBitmap, scale, mirror), sculptType, viewerMode, mirror, invert);
|
float fScale = 1.0f / sourceScaleFactor;
|
||||||
|
|
||||||
|
int iScale = (int)fScale;
|
||||||
|
if (iScale < 1) iScale = 1;
|
||||||
|
if (iScale > 2 && iScale % 2 == 0)
|
||||||
|
_SculptMesh(bitmap2Coords(ScaleImage(sculptBitmap, 64.0f / sculptBitmapLod, true), 64 / lod, mirror), sculptType, viewerMode, mirror, invert);
|
||||||
|
else
|
||||||
|
_SculptMesh(bitmap2Coords(sculptBitmap, iScale, mirror), sculptType, viewerMode, mirror, invert);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,7 @@ namespace OpenSim.Services.GridService
|
||||||
if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0)
|
if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0)
|
||||||
{
|
{
|
||||||
// Regions reserved for the null key cannot be taken.
|
// Regions reserved for the null key cannot be taken.
|
||||||
//
|
if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
|
||||||
if (region.Data["PrincipalID"] == UUID.Zero.ToString())
|
|
||||||
return "Region location us reserved";
|
return "Region location us reserved";
|
||||||
|
|
||||||
// Treat it as an auth request
|
// Treat it as an auth request
|
||||||
|
@ -132,7 +131,6 @@ namespace OpenSim.Services.GridService
|
||||||
// NOTE: Fudging the flags value here, so these flags
|
// NOTE: Fudging the flags value here, so these flags
|
||||||
// should not be used elsewhere. Don't optimize
|
// should not be used elsewhere. Don't optimize
|
||||||
// this with the later retrieval of the same flags!
|
// this with the later retrieval of the same flags!
|
||||||
//
|
|
||||||
rflags |= OpenSim.Data.RegionFlags.Authenticate;
|
rflags |= OpenSim.Data.RegionFlags.Authenticate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +487,7 @@ namespace OpenSim.Services.GridService
|
||||||
f |= (OpenSim.Data.RegionFlags)val;
|
f |= (OpenSim.Data.RegionFlags)val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Error in flag specification: " + p);
|
MainConsole.Instance.Output("Error in flag specification: " + p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,10 +168,11 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
IPAddress ipaddr = null;
|
//IPAddress ipaddr = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ipaddr = Util.GetHostFromDNS(host);
|
//ipaddr = Util.GetHostFromDNS(host);
|
||||||
|
Util.GetHostFromDNS(host);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue