aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-15 22:59:29 +0100
committerJustin Clark-Casey (justincc)2011-09-15 22:59:29 +0100
commitc4efb97d49dec736151dfa3fa102efe6a5f6fbab (patch)
treea2d43cad036a4e6d8df4a19714e37e9328770299 /OpenSim
parentrefactor: rename SOG/SOP.GetProperties() to SendPropertiesToClient() to refle... (diff)
downloadopensim-SC-c4efb97d49dec736151dfa3fa102efe6a5f6fbab.zip
opensim-SC-c4efb97d49dec736151dfa3fa102efe6a5f6fbab.tar.gz
opensim-SC-c4efb97d49dec736151dfa3fa102efe6a5f6fbab.tar.bz2
opensim-SC-c4efb97d49dec736151dfa3fa102efe6a5f6fbab.tar.xz
Write code to create minimum necessary body parts/clothing and avatar entries to make a newly created user appear as a non-cloud on viewer 2
Viewer 2 no longer contains the default avatar assets (i.e. "Ruth") that would appear if the user had insufficient body part/clothing entries. Instead, avatars always appear as a cloud, which is a very bad experience for out-of-the-box OpenSim. Default is currently off. My intention is to switch it on for standalone shortly. This is not particularly flexible as "Ruth" is hardcoded, but this can change in the future, in co-ordination with the existing RemoteAdmin capabilities. Need to fix creation of suitable entries for users created as estate owners on standalone. Avatars still appear with spooky empty eyes, need to see if we can address this. This commit adds a "Default Iris" to the library (thanks to Eirynne Sieyes from http://opensimulator.org/mantis/view.php?id=1461) which can be used.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs152
3 files changed, 147 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index b6a1564..c5a1828 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -467,7 +467,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
467 return; 467 return;
468 } 468 }
469 469
470 // m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId); 470// m_log.DebugFormat("[AVFACTORY]: Received request for wearables of {0}", client.Name);
471 471
472 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 472 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
473 } 473 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c5c9260..f394a95 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1237,6 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes
1237 first, last); 1237 first, last);
1238 1238
1239 1239
1240
1240 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last); 1241 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
1241 1242
1242 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; 1243 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 8b8a8f9..21ce86c 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -28,15 +28,15 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net;
31using Nini.Config; 32using Nini.Config;
33using OpenMetaverse;
32using OpenSim.Data; 34using OpenSim.Data;
35using OpenSim.Framework;
33using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
34using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
35using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
36 39
37using OpenMetaverse;
38using log4net;
39
40namespace OpenSim.Services.UserAccountService 40namespace OpenSim.Services.UserAccountService
41{ 41{
42 public class UserAccountService : UserAccountServiceBase, IUserAccountService 42 public class UserAccountService : UserAccountServiceBase, IUserAccountService
@@ -44,10 +44,16 @@ namespace OpenSim.Services.UserAccountService
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 private static UserAccountService m_RootInstance; 45 private static UserAccountService m_RootInstance;
46 46
47 /// <summary>
48 /// Should we create default entries (minimum body parts/clothing, avatar wearable entries) for a new avatar?
49 /// </summary>
50 private bool m_CreateDefaultAvatarEntries;
51
47 protected IGridService m_GridService; 52 protected IGridService m_GridService;
48 protected IAuthenticationService m_AuthenticationService; 53 protected IAuthenticationService m_AuthenticationService;
49 protected IGridUserService m_GridUserService; 54 protected IGridUserService m_GridUserService;
50 protected IInventoryService m_InventoryService; 55 protected IInventoryService m_InventoryService;
56 protected IAvatarService m_AvatarService;
51 57
52 public UserAccountService(IConfigSource config) 58 public UserAccountService(IConfigSource config)
53 : base(config) 59 : base(config)
@@ -77,6 +83,12 @@ namespace OpenSim.Services.UserAccountService
77 if (invServiceDll != string.Empty) 83 if (invServiceDll != string.Empty)
78 m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config }); 84 m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config });
79 85
86 string avatarServiceDll = userConfig.GetString("AvatarService", string.Empty);
87 if (avatarServiceDll != string.Empty)
88 m_AvatarService = LoadPlugin<IAvatarService>(avatarServiceDll, new Object[] { config });
89
90 m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);
91
80 if (MainConsole.Instance != null) 92 if (MainConsole.Instance != null)
81 { 93 {
82 MainConsole.Instance.Commands.AddCommand("UserService", false, 94 MainConsole.Instance.Commands.AddCommand("UserService", false,
@@ -102,9 +114,7 @@ namespace OpenSim.Services.UserAccountService
102 "show account <first> <last>", 114 "show account <first> <last>",
103 "Show account details for the given user", HandleShowAccount); 115 "Show account details for the given user", HandleShowAccount);
104 } 116 }
105
106 } 117 }
107
108 } 118 }
109 119
110 #region IUserAccountService 120 #region IUserAccountService
@@ -493,12 +503,20 @@ namespace OpenSim.Services.UserAccountService
493 { 503 {
494 success = m_InventoryService.CreateUserInventory(account.PrincipalID); 504 success = m_InventoryService.CreateUserInventory(account.PrincipalID);
495 if (!success) 505 if (!success)
506 {
496 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", 507 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
497 firstName, lastName); 508 firstName, lastName);
509 }
510 else if (m_CreateDefaultAvatarEntries)
511 {
512 CreateDefaultAppearanceEntries(account.PrincipalID);
513 }
498 } 514 }
499 515
500 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); 516 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
501 } else { 517 }
518 else
519 {
502 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName); 520 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName);
503 } 521 }
504 } 522 }
@@ -507,5 +525,125 @@ namespace OpenSim.Services.UserAccountService
507 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); 525 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
508 } 526 }
509 } 527 }
528
529 private void CreateDefaultAppearanceEntries(UUID principalID)
530 {
531 m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID);
532
533 InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Bodypart);
534
535 InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID);
536 eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
537 eyes.Name = "Default Eyes";
538 eyes.CreatorId = principalID.ToString();
539 eyes.AssetType = (int)AssetType.Bodypart;
540 eyes.InvType = (int)InventoryType.Wearable;
541 eyes.Folder = bodyPartsFolder.ID;
542 eyes.BasePermissions = (uint)PermissionMask.All;
543 eyes.CurrentPermissions = (uint)PermissionMask.All;
544 eyes.EveryOnePermissions = (uint)PermissionMask.All;
545 eyes.GroupPermissions = (uint)PermissionMask.All;
546 eyes.NextPermissions = (uint)PermissionMask.All;
547 eyes.Flags = (uint)WearableType.Eyes;
548 m_InventoryService.AddItem(eyes);
549
550 InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID);
551 shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
552 shape.Name = "Default Shape";
553 shape.CreatorId = principalID.ToString();
554 shape.AssetType = (int)AssetType.Bodypart;
555 shape.InvType = (int)InventoryType.Wearable;
556 shape.Folder = bodyPartsFolder.ID;
557 shape.BasePermissions = (uint)PermissionMask.All;
558 shape.CurrentPermissions = (uint)PermissionMask.All;
559 shape.EveryOnePermissions = (uint)PermissionMask.All;
560 shape.GroupPermissions = (uint)PermissionMask.All;
561 shape.NextPermissions = (uint)PermissionMask.All;
562 shape.Flags = (uint)WearableType.Shape;
563 m_InventoryService.AddItem(shape);
564
565 InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID);
566 skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET;
567 skin.Name = "Default Skin";
568 skin.CreatorId = principalID.ToString();
569 skin.AssetType = (int)AssetType.Bodypart;
570 skin.InvType = (int)InventoryType.Wearable;
571 skin.Folder = bodyPartsFolder.ID;
572 skin.BasePermissions = (uint)PermissionMask.All;
573 skin.CurrentPermissions = (uint)PermissionMask.All;
574 skin.EveryOnePermissions = (uint)PermissionMask.All;
575 skin.GroupPermissions = (uint)PermissionMask.All;
576 skin.NextPermissions = (uint)PermissionMask.All;
577 skin.Flags = (uint)WearableType.Skin;
578 m_InventoryService.AddItem(skin);
579
580 InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID);
581 hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET;
582 hair.Name = "Default Hair";
583 hair.CreatorId = principalID.ToString();
584 hair.AssetType = (int)AssetType.Bodypart;
585 hair.InvType = (int)InventoryType.Wearable;
586 hair.Folder = bodyPartsFolder.ID;
587 hair.BasePermissions = (uint)PermissionMask.All;
588 hair.CurrentPermissions = (uint)PermissionMask.All;
589 hair.EveryOnePermissions = (uint)PermissionMask.All;
590 hair.GroupPermissions = (uint)PermissionMask.All;
591 hair.NextPermissions = (uint)PermissionMask.All;
592 hair.Flags = (uint)WearableType.Hair;
593 m_InventoryService.AddItem(hair);
594
595 InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Clothing);
596
597 InventoryItemBase shirt = new InventoryItemBase(UUID.Random(), principalID);
598 shirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET;
599 shirt.Name = "Default Shirt";
600 shirt.CreatorId = principalID.ToString();
601 shirt.AssetType = (int)AssetType.Clothing;
602 shirt.InvType = (int)InventoryType.Wearable;
603 shirt.Folder = clothingFolder.ID;
604 shirt.BasePermissions = (uint)PermissionMask.All;
605 shirt.CurrentPermissions = (uint)PermissionMask.All;
606 shirt.EveryOnePermissions = (uint)PermissionMask.All;
607 shirt.GroupPermissions = (uint)PermissionMask.All;
608 shirt.NextPermissions = (uint)PermissionMask.All;
609 shirt.Flags = (uint)WearableType.Shirt;
610 m_InventoryService.AddItem(shirt);
611
612 InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID);
613 pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET;
614 pants.Name = "Default Pants";
615 pants.CreatorId = principalID.ToString();
616 pants.AssetType = (int)AssetType.Clothing;
617 pants.InvType = (int)InventoryType.Wearable;
618 pants.Folder = clothingFolder.ID;
619 pants.BasePermissions = (uint)PermissionMask.All;
620 pants.CurrentPermissions = (uint)PermissionMask.All;
621 pants.EveryOnePermissions = (uint)PermissionMask.All;
622 pants.GroupPermissions = (uint)PermissionMask.All;
623 pants.NextPermissions = (uint)PermissionMask.All;
624 pants.Flags = (uint)WearableType.Pants;
625 m_InventoryService.AddItem(pants);
626
627 if (m_AvatarService != null)
628 {
629 m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default avatar entries for {0}", principalID);
630
631 AvatarWearable[] wearables = new AvatarWearable[6];
632 wearables[AvatarWearable.EYES] = new AvatarWearable(eyes.ID, eyes.AssetID);
633 wearables[AvatarWearable.BODY] = new AvatarWearable(shape.ID, shape.AssetID);
634 wearables[AvatarWearable.SKIN] = new AvatarWearable(skin.ID, skin.AssetID);
635 wearables[AvatarWearable.HAIR] = new AvatarWearable(hair.ID, hair.AssetID);
636 wearables[AvatarWearable.SHIRT] = new AvatarWearable(shirt.ID, shirt.AssetID);
637 wearables[AvatarWearable.PANTS] = new AvatarWearable(pants.ID, pants.AssetID);
638
639 AvatarAppearance ap = new AvatarAppearance();
640 for (int i = 0; i < 6; i++)
641 {
642 ap.SetWearable(i, wearables[i]);
643 }
644
645 m_AvatarService.SetAppearance(principalID, ap);
646 }
647 }
510 } 648 }
511} 649} \ No newline at end of file