aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2019-07-30 23:26:29 +0100
committerUbitUmarov2019-07-30 23:26:29 +0100
commit944a785a324c203c7ca5b8bdf770ec024b7b9a14 (patch)
tree3df8e0ade9b5891d5ef5da5d671f523f19a14103 /OpenSim/Region
parentcosmetics (diff)
downloadopensim-SC-944a785a324c203c7ca5b8bdf770ec024b7b9a14.zip
opensim-SC-944a785a324c203c7ca5b8bdf770ec024b7b9a14.tar.gz
opensim-SC-944a785a324c203c7ca5b8bdf770ec024b7b9a14.tar.bz2
opensim-SC-944a785a324c203c7ca5b8bdf770ec024b7b9a14.tar.xz
now i can login on win .net4.8, but just a little drop on a large (broken) OSD ocean. some of this changes are actually good even on good JIT. Failure seems to be on same code pattern, but same points seem to vary with each JIT compilation, sometimes work, others don't, others always fail, etc
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs228
1 files changed, 114 insertions, 114 deletions
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index 2aea7f9..4a92120 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -267,6 +267,7 @@ namespace OpenSim.Region.OptionalModules.Materials
267 if (matsArr == null) 267 if (matsArr == null)
268 return partchanged; 268 return partchanged;
269 269
270 OSD tmpOSD;
270 foreach (OSD elemOsd in matsArr) 271 foreach (OSD elemOsd in matsArr)
271 { 272 {
272 if (elemOsd != null && elemOsd is OSDMap) 273 if (elemOsd != null && elemOsd is OSDMap)
@@ -278,7 +279,8 @@ namespace OpenSim.Region.OptionalModules.Materials
278 { 279 {
279 lock (materialslock) 280 lock (materialslock)
280 { 281 {
281 UUID id = matMap["ID"].AsUUID(); 282 tmpOSD = matMap["ID"];
283 UUID id = tmpOSD.AsUUID();
282 if(m_Materials.ContainsKey(id)) 284 if(m_Materials.ContainsKey(id))
283 continue; 285 continue;
284 286
@@ -459,12 +461,13 @@ namespace OpenSim.Region.OptionalModules.Materials
459 OSDMap resp = new OSDMap(); 461 OSDMap resp = new OSDMap();
460 462
461 OSDArray respArr = new OSDArray(); 463 OSDArray respArr = new OSDArray();
464 OSD tmpOSD;
462 465
463 if (req.ContainsKey("Zipped")) 466 if (req.TryGetValue("Zipped", out tmpOSD))
464 { 467 {
465 OSD osd = null; 468 OSD osd = null;
466 469
467 byte[] inBytes = req["Zipped"].AsBinary(); 470 byte[] inBytes = tmpOSD.AsBinary();
468 471
469 try 472 try
470 { 473 {
@@ -531,12 +534,13 @@ namespace OpenSim.Region.OptionalModules.Materials
531 534
532 OSDArray respArr = new OSDArray(); 535 OSDArray respArr = new OSDArray();
533 536
537 OSD tmpOSD;
534 HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>(); 538 HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>();
535 if (req.ContainsKey("Zipped")) 539 if (req.TryGetValue("Zipped", out tmpOSD))
536 { 540 {
537 OSD osd = null; 541 OSD osd = null;
538 542
539 byte[] inBytes = req["Zipped"].AsBinary(); 543 byte[] inBytes = tmpOSD.AsBinary();
540 544
541 try 545 try
542 { 546 {
@@ -546,145 +550,141 @@ namespace OpenSim.Region.OptionalModules.Materials
546 { 550 {
547 materialsFromViewer = osd as OSDMap; 551 materialsFromViewer = osd as OSDMap;
548 552
549 if (materialsFromViewer.ContainsKey("FullMaterialsPerFace")) 553 if (materialsFromViewer.TryGetValue("FullMaterialsPerFace", out tmpOSD) && (tmpOSD is OSDArray))
550 { 554 {
551 OSD matsOsd = materialsFromViewer["FullMaterialsPerFace"]; 555 OSDArray matsArr = tmpOSD as OSDArray;
552 if (matsOsd is OSDArray) 556 try
553 { 557 {
554 OSDArray matsArr = matsOsd as OSDArray; 558 foreach (OSDMap matsMap in matsArr)
555
556 try
557 { 559 {
558 foreach (OSDMap matsMap in matsArr) 560 uint primLocalID = 0;
561 try
559 { 562 {
560 uint primLocalID = 0; 563 tmpOSD = matsMap["ID"];
561 try 564 primLocalID = tmpOSD.AsUInteger();
562 { 565 }
563 primLocalID = matsMap["ID"].AsUInteger(); 566 catch (Exception e)
564 } 567 {
565 catch (Exception e) 568 m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message);
566 { 569 continue;
567 m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message); 570 }
568 continue;
569 }
570 571
571 SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID); 572 SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
572 if (sop == null) 573 if (sop == null)
573 { 574 {
574 m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString()); 575 m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString());
575 continue; 576 continue;
576 } 577 }
577 578
578 if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID)) 579 if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID))
579 { 580 {
580 m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID); 581 m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID);
581 continue; 582 continue;
582 } 583 }
583 584
584 OSDMap mat = null; 585 OSDMap mat = null;
585 try 586 try
586 { 587 {
587 mat = matsMap["Material"] as OSDMap; 588 mat = matsMap["Material"] as OSDMap;
588 } 589 }
589 catch (Exception e) 590 catch (Exception e)
590 { 591 {
591 m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message); 592 m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
592 continue; 593 continue;
593 } 594 }
594 595
595 Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length); 596 Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
596 if (te == null) 597 if (te == null)
597 { 598 {
598 m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID); 599 m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID);
599 continue; 600 continue;
600 } 601 }
601 602
602 int face = -1; 603 int face = -1;
603 UUID oldid = UUID.Zero; 604 UUID oldid = UUID.Zero;
604 Primitive.TextureEntryFace faceEntry = null; 605 Primitive.TextureEntryFace faceEntry = null;
605 if (matsMap.ContainsKey("Face")) 606 if (matsMap.TryGetValue("Face", out tmpOSD))
606 { 607 {
607 face = matsMap["Face"].AsInteger(); 608 face = tmpOSD.AsInteger();
608 faceEntry = te.CreateFace((uint)face); 609 faceEntry = te.CreateFace((uint)face);
609 } 610 }
610 else 611 else
611 faceEntry = te.DefaultTexture; 612 faceEntry = te.DefaultTexture;
612 613
613 if (faceEntry == null) 614 if (faceEntry == null)
614 continue; 615 continue;
615 616
616 UUID id; 617 UUID id;
617 FaceMaterial newFaceMat = null; 618 FaceMaterial newFaceMat = null;
618 if (mat == null) 619 if (mat == null)
619 { 620 {
620 // This happens then the user removes a material from a prim 621 // This happens then the user removes a material from a prim
622 id = UUID.Zero;
623 }
624 else
625 {
626 newFaceMat = new FaceMaterial(mat);
627 if(newFaceMat.DiffuseAlphaMode == 1
628 && newFaceMat.NormalMapID == UUID.Zero
629 && newFaceMat.SpecularMapID == UUID.Zero
630 )
621 id = UUID.Zero; 631 id = UUID.Zero;
622 }
623 else 632 else
624 { 633 {
625 newFaceMat = new FaceMaterial(mat); 634 newFaceMat.genID();
626 if(newFaceMat.DiffuseAlphaMode == 1 635 id = newFaceMat.ID;
627 && newFaceMat.NormalMapID == UUID.Zero
628 && newFaceMat.SpecularMapID == UUID.Zero
629 )
630 id = UUID.Zero;
631 else
632 {
633 newFaceMat.genID();
634 id = newFaceMat.ID;
635 }
636 } 636 }
637 }
637 638
638 oldid = faceEntry.MaterialID; 639 oldid = faceEntry.MaterialID;
639 640
640 if(oldid == id) 641 if(oldid == id)
641 continue; 642 continue;
642 643
643 if (faceEntry != null) 644 if (faceEntry != null)
644 { 645 {
645 faceEntry.MaterialID = id; 646 faceEntry.MaterialID = id;
646 //m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id); 647 //m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
647 // We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually 648 // We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
648 sop.Shape.TextureEntry = te.GetBytes(9); 649 sop.Shape.TextureEntry = te.GetBytes(9);
649 } 650 }
650 651
651 if(oldid != UUID.Zero) 652 if(oldid != UUID.Zero)
652 RemoveMaterial(oldid); 653 RemoveMaterial(oldid);
653 654
654 lock(materialslock) 655 lock(materialslock)
656 {
657 if(id != UUID.Zero)
655 { 658 {
656 if(id != UUID.Zero) 659 if (m_Materials.ContainsKey(id))
660 m_MaterialsRefCount[id]++;
661 else
657 { 662 {
658 if (m_Materials.ContainsKey(id)) 663 m_Materials[id] = newFaceMat;
659 m_MaterialsRefCount[id]++; 664 m_MaterialsRefCount[id] = 1;
660 else 665 m_changed[newFaceMat] = Util.GetTimeStamp();
661 {
662 m_Materials[id] = newFaceMat;
663 m_MaterialsRefCount[id] = 1;
664 m_changed[newFaceMat] = Util.GetTimeStamp();
665 }
666 } 666 }
667 } 667 }
668
669 if(!parts.Contains(sop))
670 parts.Add(sop);
671 } 668 }
672 669
673 foreach(SceneObjectPart sop in parts) 670 if(!parts.Contains(sop))
674 { 671 parts.Add(sop);
675 if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
676 {
677 sop.TriggerScriptChangedEvent(Changed.TEXTURE);
678 sop.ScheduleFullUpdate();
679 sop.ParentGroup.HasGroupChanged = true;
680 }
681 }
682 } 672 }
683 catch (Exception e) 673
674 foreach(SceneObjectPart sop in parts)
684 { 675 {
685 m_log.Warn("[Materials]: exception processing received material ", e); 676 if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
677 {
678 sop.TriggerScriptChangedEvent(Changed.TEXTURE);
679 sop.ScheduleFullUpdate();
680 sop.ParentGroup.HasGroupChanged = true;
681 }
686 } 682 }
687 } 683 }
684 catch (Exception e)
685 {
686 m_log.Warn("[Materials]: exception processing received material ", e);
687 }
688 } 688 }
689 } 689 }
690 } 690 }