a few more changes to texturesentry handling on libomv and os

0.9.1.0-post-fixes
UbitUmarov 2019-01-14 00:35:45 +00:00
parent 4cfcf805b3
commit 8bb644159e
7 changed files with 96 additions and 59 deletions

View File

@ -173,6 +173,8 @@ namespace OpenSim.Framework
{ {
if (m_array == null) if (m_array == null)
{ {
if(m_dict.Count == 0)
return new TValue[0];
m_array = new TValue[m_dict.Count]; m_array = new TValue[m_dict.Count];
m_dict.Values.CopyTo(m_array, 0); m_dict.Values.CopyTo(m_array, 0);
} }

View File

@ -248,11 +248,7 @@ namespace OpenSim.Region.Framework.Scenes
public scriptEvents AggregateScriptEvents; public scriptEvents AggregateScriptEvents;
public Vector3 AttachedPos public Vector3 AttachedPos { get; set; }
{
get;
set;
}
// rotation locks on local X,Y and or Z axis bit flags // rotation locks on local X,Y and or Z axis bit flags
// bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum
@ -955,13 +951,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
} }
} }
// float roll, pitch, yaw = 0;
// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
//
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Set euler {0} for RotationOffset on {1} {2}",
// new Vector3(roll, pitch, yaw), Name, LocalId);
} }
} }
@ -2266,6 +2255,7 @@ namespace OpenSim.Region.Framework.Scenes
dupe.KeyframeMotion = null; dupe.KeyframeMotion = null;
dupe.PayPrice = (int[])PayPrice.Clone(); dupe.PayPrice = (int[])PayPrice.Clone();
if(DynAttrs != null)
dupe.DynAttrs.CopyFrom(DynAttrs); dupe.DynAttrs.CopyFrom(DynAttrs);
if (userExposed) if (userExposed)
@ -3834,7 +3824,7 @@ namespace OpenSim.Region.Framework.Scenes
texcolor.A = clippedAlpha; texcolor.A = clippedAlpha;
} }
tex.FaceTextures[face].RGBA = texcolor; tex.FaceTextures[face].RGBA = texcolor;
UpdateTextureEntry(tex.GetBytes()); UpdateTextureEntry(tex);
return; return;
} }
else if (face == ALL_SIDES) else if (face == ALL_SIDES)
@ -3863,7 +3853,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
tex.DefaultTexture.RGBA = texcolor; tex.DefaultTexture.RGBA = texcolor;
} }
UpdateTextureEntry(tex.GetBytes()); UpdateTextureEntry(tex);
return; return;
} }
} }
@ -5178,15 +5168,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="serializedTextureEntry"></param> /// <param name="serializedTextureEntry"></param>
public void UpdateTextureEntry(byte[] serializedTextureEntry) public void UpdateTextureEntry(byte[] serializedTextureEntry)
{ {
UpdateTextureEntry(new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length)); Primitive.TextureEntry newTex = new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length);
}
/// <summary>
/// Update the texture entry for this part.
/// </summary>
/// <param name="newTex"></param>
public void UpdateTextureEntry(Primitive.TextureEntry newTex)
{
Primitive.TextureEntry oldTex = Shape.Textures; Primitive.TextureEntry oldTex = Shape.Textures;
Changed changeFlags = 0; Changed changeFlags = 0;
@ -5264,6 +5246,36 @@ namespace OpenSim.Region.Framework.Scenes
TriggerScriptChangedEvent(changeFlags); TriggerScriptChangedEvent(changeFlags);
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate(); ScheduleFullUpdate();
}
/// <summary>
/// Update the texture entry for this part.
/// </summary>
/// <param name="newTex"></param>
public void UpdateTextureEntry(Primitive.TextureEntry newTex)
{
TextureAttributes dirty = newTex.GetDirtyFlags(32, true);
dirty &= ~TextureAttributes.MaterialID;
if(dirty == TextureAttributes.None)
return;
Changed changeFlags = 0;
if((dirty & TextureAttributes.RGBA) != 0)
{
changeFlags = Changed.COLOR;
dirty &= ~TextureAttributes.RGBA;
}
if (dirty != TextureAttributes.None)
changeFlags |= Changed.TEXTURE;
if (changeFlags == 0)
return;
m_shape.TextureEntry = newTex.GetBytes();
TriggerScriptChangedEvent(changeFlags);
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
} }
internal void UpdatePhysicsSubscribedEvents() internal void UpdatePhysicsSubscribedEvents()

View File

@ -1947,7 +1947,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
tex.FaceTextures[face].RGBA = texcolor; tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -1968,7 +1968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor; tex.DefaultTexture.RGBA = texcolor;
} }
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
@ -2069,7 +2069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
tex.CreateFace((uint) face); tex.CreateFace((uint) face);
tex.FaceTextures[face].TexMapType = textype; tex.FaceTextures[face].TexMapType = textype;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -2080,9 +2080,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
tex.FaceTextures[i].TexMapType = textype; tex.FaceTextures[i].TexMapType = textype;
} }
tex.DefaultTexture.TexMapType = textype;
} }
part.UpdateTextureEntry(tex.GetBytes()); tex.DefaultTexture.TexMapType = textype;
part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2099,7 +2099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
tex.CreateFace((uint) face); tex.CreateFace((uint) face);
tex.FaceTextures[face].Glow = glow; tex.FaceTextures[face].Glow = glow;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -2110,9 +2110,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
tex.FaceTextures[i].Glow = glow; tex.FaceTextures[i].Glow = glow;
} }
tex.DefaultTexture.Glow = glow;
} }
part.UpdateTextureEntry(tex.GetBytes()); tex.DefaultTexture.Glow = glow;
part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2151,7 +2151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tex.CreateFace((uint) face); tex.CreateFace((uint) face);
tex.FaceTextures[face].Shiny = sval; tex.FaceTextures[face].Shiny = sval;
tex.FaceTextures[face].Bump = bump; tex.FaceTextures[face].Bump = bump;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -2163,10 +2163,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tex.FaceTextures[i].Shiny = sval; tex.FaceTextures[i].Shiny = sval;
tex.FaceTextures[i].Bump = bump; tex.FaceTextures[i].Bump = bump;
} }
}
tex.DefaultTexture.Shiny = sval; tex.DefaultTexture.Shiny = sval;
tex.DefaultTexture.Bump = bump; tex.DefaultTexture.Bump = bump;
} part.UpdateTextureEntry(tex);
part.UpdateTextureEntry(tex.GetBytes());
return; return;
} }
} }
@ -2182,7 +2182,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
tex.CreateFace((uint) face); tex.CreateFace((uint) face);
tex.FaceTextures[face].Fullbright = bright; tex.FaceTextures[face].Fullbright = bright;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -2195,7 +2195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
tex.DefaultTexture.Fullbright = bright; tex.DefaultTexture.Fullbright = bright;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2263,7 +2263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texcolor = tex.CreateFace((uint)face).RGBA; texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.FaceTextures[face].RGBA = texcolor; tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -2287,7 +2287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tex.DefaultTexture.RGBA = texcolor; tex.DefaultTexture.RGBA = texcolor;
} }
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2464,7 +2464,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.TextureID = textureID; texface.TextureID = textureID;
tex.FaceTextures[face] = texface; tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
else if (face == ScriptBaseClass.ALL_SIDES) else if (face == ScriptBaseClass.ALL_SIDES)
@ -2477,7 +2477,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
tex.DefaultTexture.TextureID = textureID; tex.DefaultTexture.TextureID = textureID;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2504,7 +2504,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texface.RepeatU = (float)u; texface.RepeatU = (float)u;
texface.RepeatV = (float)v; texface.RepeatV = (float)v;
tex.FaceTextures[face] = texface; tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
if (face == ScriptBaseClass.ALL_SIDES) if (face == ScriptBaseClass.ALL_SIDES)
@ -2519,7 +2519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
tex.DefaultTexture.RepeatU = (float)u; tex.DefaultTexture.RepeatU = (float)u;
tex.DefaultTexture.RepeatV = (float)v; tex.DefaultTexture.RepeatV = (float)v;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2545,7 +2545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texface.OffsetU = (float)u; texface.OffsetU = (float)u;
texface.OffsetV = (float)v; texface.OffsetV = (float)v;
tex.FaceTextures[face] = texface; tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
if (face == ScriptBaseClass.ALL_SIDES) if (face == ScriptBaseClass.ALL_SIDES)
@ -2560,7 +2560,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
tex.DefaultTexture.OffsetU = (float)u; tex.DefaultTexture.OffsetU = (float)u;
tex.DefaultTexture.OffsetV = (float)v; tex.DefaultTexture.OffsetV = (float)v;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -2585,7 +2585,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.Rotation = (float)rotation; texface.Rotation = (float)rotation;
tex.FaceTextures[face] = texface; tex.FaceTextures[face] = texface;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
if (face == ScriptBaseClass.ALL_SIDES) if (face == ScriptBaseClass.ALL_SIDES)
@ -2598,7 +2598,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
tex.DefaultTexture.Rotation = (float)rotation; tex.DefaultTexture.Rotation = (float)rotation;
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex);
return; return;
} }
} }
@ -13110,6 +13110,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ParcelMediaCommandEnum? commandToSend = null; ParcelMediaCommandEnum? commandToSend = null;
float time = 0.0f; // default is from start float time = 0.0f; // default is from start
uint cmndFlags = 0;
ScenePresence presence = null; ScenePresence presence = null;
int cmd; int cmd;
for (int i = 0; i < commandList.Data.Length; i++) for (int i = 0; i < commandList.Data.Length; i++)
@ -13142,19 +13143,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ParcelMediaCommandEnum.Loop: case ParcelMediaCommandEnum.Loop:
loop = 1; loop = 1;
cmndFlags |= (1 << ScriptBaseClass.PARCEL_MEDIA_COMMAND_LOOP);
commandToSend = command; commandToSend = command;
update = true; //need to send the media update packet to set looping update = true; //need to send the media update packet to set looping
break; break;
case ParcelMediaCommandEnum.Play: case ParcelMediaCommandEnum.Play:
loop = 0; loop = 0;
cmndFlags |= (1 << ScriptBaseClass.PARCEL_MEDIA_COMMAND_PLAY);
commandToSend = command; commandToSend = command;
update = true; //need to send the media update packet to make sure it doesn't loop update = true; //need to send the media update packet to make sure it doesn't loop
break; break;
case ParcelMediaCommandEnum.Pause: case ParcelMediaCommandEnum.Pause:
cmndFlags |= (1 << ScriptBaseClass.PARCEL_MEDIA_COMMAND_PAUSE);
commandToSend = command;
break;
case ParcelMediaCommandEnum.Stop: case ParcelMediaCommandEnum.Stop:
cmndFlags |= (1 << ScriptBaseClass.PARCEL_MEDIA_COMMAND_STOP);
commandToSend = command;
break;
case ParcelMediaCommandEnum.Unload: case ParcelMediaCommandEnum.Unload:
cmndFlags |= (1 << ScriptBaseClass.PARCEL_MEDIA_COMMAND_UNLOAD);
commandToSend = command; commandToSend = command;
break; break;
@ -13190,6 +13200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (commandList.Data[i + 1] is LSL_Float) if (commandList.Data[i + 1] is LSL_Float)
{ {
time = (float)(LSL_Float)commandList.Data[i + 1]; time = (float)(LSL_Float)commandList.Data[i + 1];
cmndFlags |= (1 << ScriptBaseClass.PARCEL_MEDIA_COMMAND_TIME);
} }
else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TIME must be a float"); else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TIME must be a float");
++i; ++i;
@ -13316,14 +13327,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
if (sp.currentParcelUUID == landData.GlobalID) if (sp.currentParcelUUID == landData.GlobalID)
{ {
sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? sp.ControllingClient.SendParcelMediaCommand(cmndFlags,
commandToSend.Value, time); commandToSend.Value, time);
} }
}); });
} }
else if (!presence.IsChildAgent) else if (!presence.IsChildAgent)
{ {
presence.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? presence.ControllingClient.SendParcelMediaCommand(cmndFlags,
commandToSend.Value, time); commandToSend.Value, time);
} }
} }
@ -13334,6 +13345,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LSL_List list = new LSL_List(); LSL_List list = new LSL_List();
Vector3 pos = m_host.AbsolutePosition;
ILandObject landObject = World.LandChannel.GetLandObject(pos);
if(landObject == null)
return list;
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia, false))
return list;
LandData land = landObject.LandData;
if(land == null)
return list;
//TO DO: make the implementation for the missing commands //TO DO: make the implementation for the missing commands
//PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
for (int i = 0; i < aList.Data.Length; i++) for (int i = 0; i < aList.Data.Length; i++)
@ -13344,27 +13368,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString())) switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString()))
{ {
case ParcelMediaCommandEnum.Url: case ParcelMediaCommandEnum.Url:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaURL)); list.Add(new LSL_String(land.MediaURL));
break; break;
case ParcelMediaCommandEnum.Desc: case ParcelMediaCommandEnum.Desc:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).Description)); list.Add(new LSL_String(land.MediaDescription));
break; break;
case ParcelMediaCommandEnum.Texture: case ParcelMediaCommandEnum.Texture:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaID.ToString())); list.Add(new LSL_String(land.MediaID.ToString()));
break; break;
case ParcelMediaCommandEnum.Type: case ParcelMediaCommandEnum.Type:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaType)); list.Add(new LSL_String(land.MediaType));
break; break;
case ParcelMediaCommandEnum.Size: case ParcelMediaCommandEnum.Size:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaWidth)); list.Add(new LSL_String(land.MediaWidth));
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaHeight)); list.Add(new LSL_String(land.MediaHeight));
break; break;
default: default:
ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
break; break;
} }
} }
} }
ScriptSleep(m_sleepMsOnParcelMediaQuery); ScriptSleep(m_sleepMsOnParcelMediaQuery);

Binary file not shown.

Binary file not shown.

Binary file not shown.