aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorUbitUmarov2019-04-18 13:17:40 +0100
committerUbitUmarov2019-04-18 13:17:40 +0100
commit2b4e5fcded071cde180149ddc6eee454e8ce4e2b (patch)
treeec1c1917de41bc1d419db6645601f6ded04112a2 /OpenSim/Region/ScriptEngine
parentlludp: change burst, make it per category (overall reduction) (diff)
downloadopensim-SC-2b4e5fcded071cde180149ddc6eee454e8ce4e2b.zip
opensim-SC-2b4e5fcded071cde180149ddc6eee454e8ce4e2b.tar.gz
opensim-SC-2b4e5fcded071cde180149ddc6eee454e8ce4e2b.tar.bz2
opensim-SC-2b4e5fcded071cde180149ddc6eee454e8ce4e2b.tar.xz
mantis 8517: let texture argument of PRIM_TEXTURE only change the other parameters. On PRIM_NORMAL and PRIM_SPECULAR will be as NULL_KEY removing the material. This may be changed for coerence in future
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs125
1 files changed, 72 insertions, 53 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 45efa77..cbd2b3c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2410,12 +2410,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2410 return; 2410 return;
2411 2411
2412 UUID textureID = new UUID(); 2412 UUID textureID = new UUID();
2413 2413 bool dotexture = true;
2414 textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); 2414 if(String.IsNullOrEmpty(texture))
2415 if (textureID == UUID.Zero) 2415 dotexture = false;
2416 else
2416 { 2417 {
2417 if (!UUID.TryParse(texture, out textureID)) 2418 textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
2418 return; 2419 if (textureID == UUID.Zero)
2420 {
2421 if (!UUID.TryParse(texture, out textureID))
2422 return;
2423 }
2419 } 2424 }
2420 2425
2421 Primitive.TextureEntry tex = part.Shape.Textures; 2426 Primitive.TextureEntry tex = part.Shape.Textures;
@@ -2424,7 +2429,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2424 if (face >= 0 && face < nsides) 2429 if (face >= 0 && face < nsides)
2425 { 2430 {
2426 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 2431 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
2427 texface.TextureID = textureID; 2432 if (dotexture)
2433 texface.TextureID = textureID;
2428 texface.RepeatU = (float)scaleU; 2434 texface.RepeatU = (float)scaleU;
2429 texface.RepeatV = (float)ScaleV; 2435 texface.RepeatV = (float)ScaleV;
2430 texface.OffsetU = (float)offsetU; 2436 texface.OffsetU = (float)offsetU;
@@ -2440,7 +2446,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2440 { 2446 {
2441 if (tex.FaceTextures[i] != null) 2447 if (tex.FaceTextures[i] != null)
2442 { 2448 {
2443 tex.FaceTextures[i].TextureID = textureID; 2449 if (dotexture)
2450 tex.FaceTextures[i].TextureID = textureID;
2444 tex.FaceTextures[i].RepeatU = (float)scaleU; 2451 tex.FaceTextures[i].RepeatU = (float)scaleU;
2445 tex.FaceTextures[i].RepeatV = (float)ScaleV; 2452 tex.FaceTextures[i].RepeatV = (float)ScaleV;
2446 tex.FaceTextures[i].OffsetU = (float)offsetU; 2453 tex.FaceTextures[i].OffsetU = (float)offsetU;
@@ -2448,7 +2455,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2448 tex.FaceTextures[i].Rotation = (float)rotation; 2455 tex.FaceTextures[i].Rotation = (float)rotation;
2449 } 2456 }
2450 } 2457 }
2451 tex.DefaultTexture.TextureID = textureID; 2458 if (dotexture)
2459 tex.DefaultTexture.TextureID = textureID;
2452 tex.DefaultTexture.RepeatU = (float)scaleU; 2460 tex.DefaultTexture.RepeatU = (float)scaleU;
2453 tex.DefaultTexture.RepeatV = (float)ScaleV; 2461 tex.DefaultTexture.RepeatV = (float)ScaleV;
2454 tex.DefaultTexture.OffsetU = (float)offsetU; 2462 tex.DefaultTexture.OffsetU = (float)offsetU;
@@ -10422,17 +10430,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10422 } 10430 }
10423 10431
10424 string mapname = rules.Data[idx++].ToString(); 10432 string mapname = rules.Data[idx++].ToString();
10425 10433 UUID mapID = UUID.Zero;
10426 UUID mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture); 10434 if (!string.IsNullOrEmpty(mapname))
10427 if (mapID == UUID.Zero)
10428 { 10435 {
10429 if (!UUID.TryParse(mapname, out mapID)) 10436 mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture);
10437 if (mapID == UUID.Zero)
10430 { 10438 {
10431 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NORMAL: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1)); 10439 if (!UUID.TryParse(mapname, out mapID))
10432 return new LSL_List(); 10440 {
10441 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NORMAL: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1));
10442 return new LSL_List();
10443 }
10433 } 10444 }
10434 } 10445 }
10435
10436 LSL_Vector mnrepeat; 10446 LSL_Vector mnrepeat;
10437 try 10447 try
10438 { 10448 {
@@ -10489,17 +10499,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10489 } 10499 }
10490 10500
10491 string smapname = rules.Data[idx++].ToString(); 10501 string smapname = rules.Data[idx++].ToString();
10492 10502 UUID smapID = UUID.Zero;
10493 UUID smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture); 10503 if(!string.IsNullOrEmpty(smapname))
10494 if (smapID == UUID.Zero)
10495 { 10504 {
10496 if (!UUID.TryParse(smapname, out smapID)) 10505 smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture);
10506 if (smapID == UUID.Zero)
10497 { 10507 {
10498 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SPECULAR: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1)); 10508 if (!UUID.TryParse(smapname, out smapID))
10499 return new LSL_List(); 10509 {
10510 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SPECULAR: arg #{1} - must be a UUID or a texture name on object inventory", rulesParsed, idx - idxStart - 1));
10511 return new LSL_List();
10512 }
10500 } 10513 }
10501 } 10514 }
10502
10503 LSL_Vector msrepeat; 10515 LSL_Vector msrepeat;
10504 try 10516 try
10505 { 10517 {
@@ -10715,24 +10727,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10715 FaceMaterial mat = null; 10727 FaceMaterial mat = null;
10716 UUID oldid = texface.MaterialID; 10728 UUID oldid = texface.MaterialID;
10717 10729
10718 if(oldid != UUID.Zero) 10730 if(mapID != UUID.Zero)
10719 mat = m_materialsModule.GetMaterialCopy(oldid); 10731 {
10732 if(oldid != UUID.Zero)
10733 mat = m_materialsModule.GetMaterialCopy(oldid);
10720 10734
10721 if(mat == null) 10735 if(mat == null)
10722 mat = new FaceMaterial(); 10736 mat = new FaceMaterial();
10723 10737
10724 mat.NormalMapID = mapID; 10738 mat.NormalMapID = mapID;
10725 mat.NormalOffsetX = offsetX; 10739 mat.NormalOffsetX = offsetX;
10726 mat.NormalOffsetY = offsetY; 10740 mat.NormalOffsetY = offsetY;
10727 mat.NormalRepeatX = repeatX; 10741 mat.NormalRepeatX = repeatX;
10728 mat.NormalRepeatY = repeatY; 10742 mat.NormalRepeatY = repeatY;
10729 mat.NormalRotation = rot; 10743 mat.NormalRotation = rot;
10730 10744
10731 UUID id = m_materialsModule.AddNewMaterial(mat); 10745 mapID = m_materialsModule.AddNewMaterial(mat);
10732 if(oldid == id) 10746 }
10747 if(oldid == mapID)
10733 return false; 10748 return false;
10734 10749
10735 texface.MaterialID = id; 10750 texface.MaterialID = mapID;
10736 part.Shape.TextureEntry = tex.GetBytes(9); 10751 part.Shape.TextureEntry = tex.GetBytes(9);
10737 m_materialsModule.RemoveMaterial(oldid); 10752 m_materialsModule.RemoveMaterial(oldid);
10738 return true; 10753 return true;
@@ -10777,29 +10792,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10777 FaceMaterial mat = null; 10792 FaceMaterial mat = null;
10778 UUID oldid = texface.MaterialID; 10793 UUID oldid = texface.MaterialID;
10779 10794
10780 if(oldid != UUID.Zero) 10795 if (mapID != UUID.Zero)
10781 mat = m_materialsModule.GetMaterialCopy(oldid); 10796 {
10797 if (oldid != UUID.Zero)
10798 mat = m_materialsModule.GetMaterialCopy(oldid);
10782 10799
10783 if(mat == null) 10800 if (mat == null)
10784 mat = new FaceMaterial(); 10801 mat = new FaceMaterial();
10785 10802
10786 mat.SpecularMapID = mapID; 10803 mat.SpecularMapID = mapID;
10787 mat.SpecularOffsetX = offsetX; 10804 mat.SpecularOffsetX = offsetX;
10788 mat.SpecularOffsetY = offsetY; 10805 mat.SpecularOffsetY = offsetY;
10789 mat.SpecularRepeatX = repeatX; 10806 mat.SpecularRepeatX = repeatX;
10790 mat.SpecularRepeatY = repeatY; 10807 mat.SpecularRepeatY = repeatY;
10791 mat.SpecularRotation = rot; 10808 mat.SpecularRotation = rot;
10792 mat.SpecularLightColorR = colorR; 10809 mat.SpecularLightColorR = colorR;
10793 mat.SpecularLightColorG = colorG; 10810 mat.SpecularLightColorG = colorG;
10794 mat.SpecularLightColorB = colorB; 10811 mat.SpecularLightColorB = colorB;
10795 mat.SpecularLightExponent = gloss; 10812 mat.SpecularLightExponent = gloss;
10796 mat.EnvironmentIntensity = env; 10813 mat.EnvironmentIntensity = env;
10797 10814
10798 UUID id = m_materialsModule.AddNewMaterial(mat); 10815 mapID = m_materialsModule.AddNewMaterial(mat);
10799 if(oldid == id) 10816 }
10817
10818 if(oldid == mapID)
10800 return false; 10819 return false;
10801 10820
10802 texface.MaterialID = id; 10821 texface.MaterialID = mapID;
10803 part.Shape.TextureEntry = tex.GetBytes(9); 10822 part.Shape.TextureEntry = tex.GetBytes(9);
10804 m_materialsModule.RemoveMaterial(oldid); 10823 m_materialsModule.RemoveMaterial(oldid);
10805 return true; 10824 return true;