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.
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-15 22:59:29 +01:00
parent de19dc3024
commit c4efb97d49
12 changed files with 362 additions and 148 deletions

View File

@ -467,7 +467,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return;
}
// m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId);
// m_log.DebugFormat("[AVFACTORY]: Received request for wearables of {0}", client.Name);
client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
}

View File

@ -1237,6 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes
first, last);
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;

View File

@ -28,15 +28,15 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Console;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using log4net;
namespace OpenSim.Services.UserAccountService
{
public class UserAccountService : UserAccountServiceBase, IUserAccountService
@ -44,10 +44,16 @@ namespace OpenSim.Services.UserAccountService
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static UserAccountService m_RootInstance;
/// <summary>
/// Should we create default entries (minimum body parts/clothing, avatar wearable entries) for a new avatar?
/// </summary>
private bool m_CreateDefaultAvatarEntries;
protected IGridService m_GridService;
protected IAuthenticationService m_AuthenticationService;
protected IGridUserService m_GridUserService;
protected IInventoryService m_InventoryService;
protected IAvatarService m_AvatarService;
public UserAccountService(IConfigSource config)
: base(config)
@ -77,6 +83,12 @@ namespace OpenSim.Services.UserAccountService
if (invServiceDll != string.Empty)
m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config });
string avatarServiceDll = userConfig.GetString("AvatarService", string.Empty);
if (avatarServiceDll != string.Empty)
m_AvatarService = LoadPlugin<IAvatarService>(avatarServiceDll, new Object[] { config });
m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("UserService", false,
@ -102,9 +114,7 @@ namespace OpenSim.Services.UserAccountService
"show account <first> <last>",
"Show account details for the given user", HandleShowAccount);
}
}
}
#region IUserAccountService
@ -493,12 +503,20 @@ namespace OpenSim.Services.UserAccountService
{
success = m_InventoryService.CreateUserInventory(account.PrincipalID);
if (!success)
{
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
firstName, lastName);
}
else if (m_CreateDefaultAvatarEntries)
{
CreateDefaultAppearanceEntries(account.PrincipalID);
}
}
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
} else {
}
else
{
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Account creation failed for account {0} {1}", firstName, lastName);
}
}
@ -507,5 +525,125 @@ namespace OpenSim.Services.UserAccountService
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
}
}
private void CreateDefaultAppearanceEntries(UUID principalID)
{
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID);
InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Bodypart);
InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID);
eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
eyes.Name = "Default Eyes";
eyes.CreatorId = principalID.ToString();
eyes.AssetType = (int)AssetType.Bodypart;
eyes.InvType = (int)InventoryType.Wearable;
eyes.Folder = bodyPartsFolder.ID;
eyes.BasePermissions = (uint)PermissionMask.All;
eyes.CurrentPermissions = (uint)PermissionMask.All;
eyes.EveryOnePermissions = (uint)PermissionMask.All;
eyes.GroupPermissions = (uint)PermissionMask.All;
eyes.NextPermissions = (uint)PermissionMask.All;
eyes.Flags = (uint)WearableType.Eyes;
m_InventoryService.AddItem(eyes);
InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID);
shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
shape.Name = "Default Shape";
shape.CreatorId = principalID.ToString();
shape.AssetType = (int)AssetType.Bodypart;
shape.InvType = (int)InventoryType.Wearable;
shape.Folder = bodyPartsFolder.ID;
shape.BasePermissions = (uint)PermissionMask.All;
shape.CurrentPermissions = (uint)PermissionMask.All;
shape.EveryOnePermissions = (uint)PermissionMask.All;
shape.GroupPermissions = (uint)PermissionMask.All;
shape.NextPermissions = (uint)PermissionMask.All;
shape.Flags = (uint)WearableType.Shape;
m_InventoryService.AddItem(shape);
InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID);
skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET;
skin.Name = "Default Skin";
skin.CreatorId = principalID.ToString();
skin.AssetType = (int)AssetType.Bodypart;
skin.InvType = (int)InventoryType.Wearable;
skin.Folder = bodyPartsFolder.ID;
skin.BasePermissions = (uint)PermissionMask.All;
skin.CurrentPermissions = (uint)PermissionMask.All;
skin.EveryOnePermissions = (uint)PermissionMask.All;
skin.GroupPermissions = (uint)PermissionMask.All;
skin.NextPermissions = (uint)PermissionMask.All;
skin.Flags = (uint)WearableType.Skin;
m_InventoryService.AddItem(skin);
InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID);
hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET;
hair.Name = "Default Hair";
hair.CreatorId = principalID.ToString();
hair.AssetType = (int)AssetType.Bodypart;
hair.InvType = (int)InventoryType.Wearable;
hair.Folder = bodyPartsFolder.ID;
hair.BasePermissions = (uint)PermissionMask.All;
hair.CurrentPermissions = (uint)PermissionMask.All;
hair.EveryOnePermissions = (uint)PermissionMask.All;
hair.GroupPermissions = (uint)PermissionMask.All;
hair.NextPermissions = (uint)PermissionMask.All;
hair.Flags = (uint)WearableType.Hair;
m_InventoryService.AddItem(hair);
InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Clothing);
InventoryItemBase shirt = new InventoryItemBase(UUID.Random(), principalID);
shirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET;
shirt.Name = "Default Shirt";
shirt.CreatorId = principalID.ToString();
shirt.AssetType = (int)AssetType.Clothing;
shirt.InvType = (int)InventoryType.Wearable;
shirt.Folder = clothingFolder.ID;
shirt.BasePermissions = (uint)PermissionMask.All;
shirt.CurrentPermissions = (uint)PermissionMask.All;
shirt.EveryOnePermissions = (uint)PermissionMask.All;
shirt.GroupPermissions = (uint)PermissionMask.All;
shirt.NextPermissions = (uint)PermissionMask.All;
shirt.Flags = (uint)WearableType.Shirt;
m_InventoryService.AddItem(shirt);
InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID);
pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET;
pants.Name = "Default Pants";
pants.CreatorId = principalID.ToString();
pants.AssetType = (int)AssetType.Clothing;
pants.InvType = (int)InventoryType.Wearable;
pants.Folder = clothingFolder.ID;
pants.BasePermissions = (uint)PermissionMask.All;
pants.CurrentPermissions = (uint)PermissionMask.All;
pants.EveryOnePermissions = (uint)PermissionMask.All;
pants.GroupPermissions = (uint)PermissionMask.All;
pants.NextPermissions = (uint)PermissionMask.All;
pants.Flags = (uint)WearableType.Pants;
m_InventoryService.AddItem(pants);
if (m_AvatarService != null)
{
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default avatar entries for {0}", principalID);
AvatarWearable[] wearables = new AvatarWearable[6];
wearables[AvatarWearable.EYES] = new AvatarWearable(eyes.ID, eyes.AssetID);
wearables[AvatarWearable.BODY] = new AvatarWearable(shape.ID, shape.AssetID);
wearables[AvatarWearable.SKIN] = new AvatarWearable(skin.ID, skin.AssetID);
wearables[AvatarWearable.HAIR] = new AvatarWearable(hair.ID, hair.AssetID);
wearables[AvatarWearable.SHIRT] = new AvatarWearable(shirt.ID, shirt.AssetID);
wearables[AvatarWearable.PANTS] = new AvatarWearable(pants.ID, pants.AssetID);
AvatarAppearance ap = new AvatarAppearance();
for (int i = 0; i < 6; i++)
{
ap.SetWearable(i, wearables[i]);
}
m_AvatarService.SetAppearance(principalID, ap);
}
}
}
}
}

View File

@ -4,7 +4,7 @@
<Key Name="assetID" Value="d342e6c0-b9d2-11dc-95ff-0800200c9a66"/>
<Key Name="name" Value="Hair"/>
<Key Name="assetType" Value="13" />
<Key Name="fileName" Value="newhair.dat"/>
<Key Name="fileName" Value="base_hair.dat"/>
</Section>
<Section Name="Skin">
@ -34,6 +34,14 @@
<Key Name="assetType" Value="13" />
<Key Name="fileName" Value="base_shape.dat"/>
</Section>
<Section Name="Eyes">
<Key Name="assetID" Value="4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7"/>
<Key Name="name" Value="Eyes"/>
<Key Name="assetType" Value="13" />
<Key Name="fileName" Value="base_eyes.dat"/>
</Section>
<!--
<Section Name="Jim Shape">
<Key Name="assetID" Value="66c41e39-38f9-f75a-024e-585989bfab74"/>

View File

@ -0,0 +1,26 @@
LLWearable version 22
New Eyes
permissions 0
{
base_mask 7fffffff
owner_mask 7fffffff
group_mask 00000000
everyone_mask 00000000
next_owner_mask 00082000
creator_id 11111111-1111-0000-0000-000100bba000
owner_id 11111111-1111-0000-0000-000100bba000
last_owner_id 00000000-0000-0000-0000-000000000000
group_id 00000000-0000-0000-0000-000000000000
}
sale_info 0
{
sale_type not
sale_price 10
}
type 3
parameters 2
98 0
99 0
textures 1
3 6522e74d-1660-4e7f-b601-6f48c1659a77

View File

@ -0,0 +1,26 @@
LLWearable version 22
New Eyes
permissions 0
{
base_mask 7fffffff
owner_mask 7fffffff
group_mask 00000000
everyone_mask 00000000
next_owner_mask 00082000
creator_id 11111111-1111-0000-0000-000100bba000
owner_id 11111111-1111-0000-0000-000100bba000
last_owner_id 00000000-0000-0000-0000-000000000000
group_id 00000000-0000-0000-0000-000000000000
}
sale_info 0
{
sale_type not
sale_price 10
}
type 3
parameters 2
98 0
99 0
textures 1
3 6522e74d-1660-4e7f-b601-6f48c1659a77

View File

@ -1,105 +1,165 @@
LLWearable version 22
Female Shape and Outfit 3 Shape
Created by system from avatar's appearance.
New Shape
permissions 0
{
base_mask 00000000
owner_mask 00000000
base_mask 7fffffff
owner_mask 7fffffff
group_mask 00000000
everyone_mask 00000000
next_owner_mask 00000000
next_owner_mask 00082000
creator_id 11111111-1111-0000-0000-000100bba000
owner_id 11111111-1111-0000-0000-000100bba000
last_owner_id 11111111-1111-0000-0000-000100bba000
last_owner_id 00000000-0000-0000-0000-000000000000
group_id 00000000-0000-0000-0000-000000000000
}
sale_info 0
{
sale_type not
sale_price 0
sale_price 10
}
type 0
parameters 82
1 .21
2 -.5
4 -.11
5 -.1
6 -.3
7 -.4
8 -.5
10 .7
11 .34
12 -.5
parameters 142
1 0
2 0
4 0
5 0
6 0
7 0
8 0
10 0
11 0
12 0
13 0
14 .04
15 .58
17 .56
18 -.26
19 -.73
20 -.34
21 -.01
22 1
23 -.5
24 -.63
25 .44
27 .05
33 -.24
34 -.7
35 -.16
36 -.2
37 -.98
38 -.5
14 0
15 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0
25 0
26 0
27 0
28 0
29 .12
30 .12
32 0
33 0
34 0
35 0
36 -.5
37 0
38 0
40 0
80 0
105 .07
155 -.22
100 0
104 0
105 .5
106 0
151 0
152 0
153 0
155 0
156 0
157 0
185 -1
193 .86
196 -.74
505 .65
506 .12
507 -1.5
185 0
186 0
187 0
188 0
189 0
193 .5
194 .67
195 .33
196 0
505 .5
506 0
507 0
515 0
517 .16
518 .8
629 0
517 0
518 0
626 0
627 0
629 .5
630 0
631 0
633 0
634 0
635 0
637 0
646 .4
647 1
649 .36
650 .85
652 .49
653 -1
646 0
647 0
648 0
649 .5
650 0
651 0
652 .5
653 0
655 -.08
656 0
659 .65
657 0
658 0
659 .5
660 0
661 0
662 .5
663 0
664 0
665 0
675 -.15
676 .26
678 .28
682 .27
683 -.19
684 -.09
675 0
676 0
677 0
678 .5
679 -.08
680 -.08
681 -.08
682 .5
683 -.15
684 0
685 0
690 .45
692 .4
693 -0
753 -.5
756 -.08
758 .24
759 .6
760 .11
764 -.38
765 -.3
769 .42
773 .51
795 .16
796 .11
799 .36
686 0
687 0
688 0
689 0
690 .5
691 0
692 0
693 .6
694 -.08
695 0
753 0
756 0
758 0
759 .5
760 0
764 0
765 0
767 0
768 0
769 .5
770 0
772 0
773 .5
794 .17
795 .25
796 0
797 0
798 0
799 .5
841 0
842 -.82
842 0
843 0
853 0
854 0
855 0
879 0
880 0
1103 0
1104 0
1105 0
1200 0
1201 0
textures 0

View File

@ -1,63 +0,0 @@
LLWearable version 22
New Hair
permissions 0
{
base_mask 7fffffff
owner_mask 7fffffff
group_mask 00000000
everyone_mask 00000000
next_owner_mask 00082000
creator_id a52db6d0-e96c-4454-85e5-3523722daa25
owner_id a52db6d0-e96c-4454-85e5-3523722daa25
last_owner_id 00000000-0000-0000-0000-000000000000
group_id 00000000-0000-0000-0000-000000000000
}
sale_info 0
{
sale_type not
sale_price 10
}
type 2
parameters 39
16 0
31 .5
112 0
113 0
114 .5
115 0
119 .5
130 .45
131 .5
132 .39
133 .25
134 .5
135 .55
136 .5
137 .5
140 0
141 0
142 0
143 .13
166 0
167 0
168 0
169 0
177 0
181 .14
182 .7
183 .05
184 0
192 0
674 -.3
750 .7
752 .5
754 0
755 .05
757 -1
762 0
763 .55
785 0
789 0
textures 1
4 7ca39b4c-bd19-4699-aff7-f93fd03d3e7b

View File

@ -430,6 +430,13 @@
<Key Name="fileName" Value="default_avatar.jp2" />
</Section>
<Section Name="Default Iris">
<Key Name="assetID" Value="6522e74d-1660-4e7f-b601-6f48c1659a77"/>
<Key Name="name" Value="Default Iris"/>
<Key Name="assetType" Value="0" />
<Key Name="fileName" Value="default_iris.jp2" />
</Section>
<Section Name="Cypress 1">
<Key Name="assetID" Value="fb2ae204-3fd1-df33-594f-c9f882830e66"/>
<Key Name="name" Value="Cypress 1"/>

Binary file not shown.

View File

@ -70,6 +70,7 @@
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
GridService = "OpenSim.Services.GridService.dll:GridService"
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
[GridUserService]
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService"

View File

@ -561,4 +561,14 @@
<Key Name="assetType" Value="0" />
<Key Name="inventoryType" Value="0" />
</Section>
<Section Name="Default Iris Texture">
<Key Name="inventoryID" Value="00000000-0000-2222-9999-000000000013"/>
<Key Name="assetID" Value="6e610cae-3b0d-4729-b482-2c31ab2e49f9"/>
<Key Name="folderID" Value="00000112-000f-0000-0000-000100bba001"/>
<Key Name="description" Value=""/>
<Key Name="name" Value="Default Iris Texture" />
<Key Name="assetType" Value="0" />
<Key Name="inventoryType" Value="0" />
</Section>
</Nini>