* Moved OpenMetaverse/Resources to bin/openmetaverse_data until we have a working xbuild and reorganize SVN
* Complete rewrite of AppearanceManager. Appearance editing has not been (re)implemented yet, but the normal appearance setting is much more reliable * Added a setting (defaulted to true) for automatically setting appearance * Various baking hacks to get slightly less ugly avatars * Added baked texture uploading through CAPS in AssetManager.RequestUploadBakedTexture(). UDP fallback is not implemented yet * Added Parallel.Invoke() and overloads for all three methods that take a threadCount git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3038 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -282,30 +282,30 @@ namespace AvatarPreview
|
||||
#region Baking
|
||||
|
||||
Dictionary<int, float> paramValues = GetParamValues();
|
||||
Dictionary<AppearanceManager.TextureIndex, AssetTexture> layers =
|
||||
new Dictionary<AppearanceManager.TextureIndex, AssetTexture>();
|
||||
Dictionary<AvatarTextureIndex, AssetTexture> layers =
|
||||
new Dictionary<AvatarTextureIndex, AssetTexture>();
|
||||
int textureCount = 0;
|
||||
|
||||
if ((string)control.Tag == "Head")
|
||||
{
|
||||
if (picHair.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.Hair,
|
||||
layers.Add(AvatarTextureIndex.Hair,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picHair.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picHeadBodypaint.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.HeadBodypaint,
|
||||
layers.Add(AvatarTextureIndex.HeadBodypaint,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picHeadBodypaint.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
|
||||
// Compute the head bake
|
||||
Baker baker = new Baker(
|
||||
_client, AppearanceManager.BakeType.Head, textureCount, paramValues);
|
||||
_client, BakeType.Head, textureCount, paramValues);
|
||||
|
||||
foreach (KeyValuePair<AppearanceManager.TextureIndex, AssetTexture> kvp in layers)
|
||||
foreach (KeyValuePair<AvatarTextureIndex, AssetTexture> kvp in layers)
|
||||
baker.AddTexture(kvp.Key, kvp.Value, false);
|
||||
|
||||
if (baker.BakedTexture != null)
|
||||
@@ -324,40 +324,40 @@ namespace AvatarPreview
|
||||
{
|
||||
if (picUpperBodypaint.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.UpperBodypaint,
|
||||
layers.Add(AvatarTextureIndex.UpperBodypaint,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picUpperBodypaint.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picUpperGloves.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.UpperGloves,
|
||||
layers.Add(AvatarTextureIndex.UpperGloves,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picUpperGloves.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picUpperUndershirt.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.UpperUndershirt,
|
||||
layers.Add(AvatarTextureIndex.UpperUndershirt,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picUpperUndershirt.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picUpperShirt.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.UpperShirt,
|
||||
layers.Add(AvatarTextureIndex.UpperShirt,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picUpperShirt.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picUpperJacket.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.UpperJacket,
|
||||
layers.Add(AvatarTextureIndex.UpperJacket,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picUpperJacket.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
|
||||
// Compute the upper body bake
|
||||
Baker baker = new Baker(
|
||||
_client, AppearanceManager.BakeType.UpperBody, textureCount, paramValues);
|
||||
_client, BakeType.UpperBody, textureCount, paramValues);
|
||||
|
||||
foreach (KeyValuePair<AppearanceManager.TextureIndex, AssetTexture> kvp in layers)
|
||||
foreach (KeyValuePair<AvatarTextureIndex, AssetTexture> kvp in layers)
|
||||
baker.AddTexture(kvp.Key, kvp.Value, false);
|
||||
|
||||
if (baker.BakedTexture != null)
|
||||
@@ -376,40 +376,40 @@ namespace AvatarPreview
|
||||
{
|
||||
if (picLowerBodypaint.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.LowerBodypaint,
|
||||
layers.Add(AvatarTextureIndex.LowerBodypaint,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picLowerBodypaint.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picLowerUnderpants.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.LowerUnderpants,
|
||||
layers.Add(AvatarTextureIndex.LowerUnderpants,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picLowerUnderpants.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picLowerSocks.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.LowerSocks,
|
||||
layers.Add(AvatarTextureIndex.LowerSocks,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picLowerSocks.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picLowerShoes.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.LowerShoes,
|
||||
layers.Add(AvatarTextureIndex.LowerShoes,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picLowerShoes.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
if (picLowerPants.Image != null)
|
||||
{
|
||||
layers.Add(AppearanceManager.TextureIndex.LowerPants,
|
||||
layers.Add(AvatarTextureIndex.LowerPants,
|
||||
new AssetTexture(new ManagedImage((Bitmap)picLowerPants.Image)));
|
||||
++textureCount;
|
||||
}
|
||||
|
||||
// Compute the lower body bake
|
||||
Baker baker = new Baker(
|
||||
_client, AppearanceManager.BakeType.LowerBody, textureCount, paramValues);
|
||||
_client, BakeType.LowerBody, textureCount, paramValues);
|
||||
|
||||
foreach (KeyValuePair<AppearanceManager.TextureIndex, AssetTexture> kvp in layers)
|
||||
foreach (KeyValuePair<AvatarTextureIndex, AssetTexture> kvp in layers)
|
||||
baker.AddTexture(kvp.Key, kvp.Value, false);
|
||||
|
||||
if (baker.BakedTexture != null)
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace Dashboard
|
||||
Client.Settings.USE_LLSD_LOGIN = true;
|
||||
Client.Settings.USE_ASSET_CACHE = true;
|
||||
|
||||
Client.Network.OnCurrentSimChanged += new NetworkManager.CurrentSimChangedCallback(Network_OnCurrentSimChanged);
|
||||
Client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
|
||||
Client.Self.OnInstantMessage += new AgentManager.InstantMessageCallback(Self_OnInstantMessage);
|
||||
|
||||
@@ -101,11 +100,6 @@ namespace Dashboard
|
||||
MessageBox.Show(group.Name + " = " + group.ID);
|
||||
}
|
||||
|
||||
void Network_OnCurrentSimChanged(Simulator PreviousSimulator)
|
||||
{
|
||||
Client.Appearance.SetPreviousAppearance(false);
|
||||
}
|
||||
|
||||
void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message)
|
||||
{
|
||||
InitializeClient(!ShuttingDown);
|
||||
|
||||
@@ -12,35 +12,14 @@ namespace OpenMetaverse.TestClient
|
||||
public AppearanceCommand(TestClient testClient)
|
||||
{
|
||||
Name = "appearance";
|
||||
Description = "Set your current appearance to your last saved appearance";
|
||||
Description = "Set your current appearance to your last saved appearance. Usage: appearance [rebake]";
|
||||
Category = CommandCategory.Appearance;
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
// Register a handler for the appearance event
|
||||
AutoResetEvent appearanceEvent = new AutoResetEvent(false);
|
||||
AppearanceManager.AppearanceUpdatedCallback callback =
|
||||
delegate(Primitive.TextureEntry te) { appearanceEvent.Set(); };
|
||||
Client.Appearance.OnAppearanceUpdated += callback;
|
||||
|
||||
// Start the appearance setting process (with baking enabled or disabled)
|
||||
Client.Appearance.SetPreviousAppearance(!(args.Length > 0 && args[0].Equals("nobake")));
|
||||
|
||||
// Wait for the process to complete or time out
|
||||
if (appearanceEvent.WaitOne(1000 * 120, false))
|
||||
success = true;
|
||||
|
||||
// Unregister the handler
|
||||
Client.Appearance.OnAppearanceUpdated -= callback;
|
||||
|
||||
// Return success or failure message
|
||||
if (success)
|
||||
return "Successfully set appearance";
|
||||
else
|
||||
return "Timed out while setting appearance";
|
||||
Client.Appearance.RequestSetAppearance((args.Length > 0 && args[0].Equals("rebake")));
|
||||
return "Appearance sequence started";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenMetaverse.TestClient.Commands.Appearance
|
||||
if (foundAv.Textures.FaceTextures[i] != null)
|
||||
{
|
||||
Primitive.TextureEntryFace face = foundAv.Textures.FaceTextures[i];
|
||||
AppearanceManager.TextureIndex type = (AppearanceManager.TextureIndex)i;
|
||||
AvatarTextureIndex type = (AvatarTextureIndex)i;
|
||||
|
||||
output.AppendFormat("{0}: {1}", type, face.TextureID);
|
||||
output.AppendLine();
|
||||
|
||||
@@ -31,16 +31,9 @@ namespace OpenMetaverse.TestClient
|
||||
|
||||
target = target.TrimEnd();
|
||||
|
||||
try
|
||||
{
|
||||
Client.Appearance.WearOutfit(target.Split('/'), bake);
|
||||
}
|
||||
catch (InvalidOutfitException ex)
|
||||
{
|
||||
return "Invalid outfit (" + ex.Message + ")";
|
||||
}
|
||||
//Client.Appearance.WearOutfit(target.Split('/'), bake);
|
||||
|
||||
return String.Empty;
|
||||
return "FIXME: Implement this";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,22 +31,19 @@ namespace OpenMetaverse.TestClient
|
||||
|
||||
// initialize results list
|
||||
List<InventoryBase> found = new List<InventoryBase>();
|
||||
try
|
||||
|
||||
// find the folder
|
||||
found = Client.Inventory.LocalFind(Client.Inventory.Store.RootFolder.UUID, target.Split('/'), 0, true);
|
||||
|
||||
if (found.Count.Equals(1))
|
||||
{
|
||||
// find the folder
|
||||
found = Client.Inventory.LocalFind(Client.Inventory.Store.RootFolder.UUID, target.Split('/'), 0, true);
|
||||
if (found.Count.Equals(1))
|
||||
{
|
||||
// move the folder to the trash folder
|
||||
Client.Inventory.MoveFolder(found[0].UUID, Client.Inventory.FindFolderForType(AssetType.TrashFolder));
|
||||
return String.Format("Moved folder {0} to Trash", found[0].Name);
|
||||
}
|
||||
// move the folder to the trash folder
|
||||
Client.Inventory.MoveFolder(found[0].UUID, Client.Inventory.FindFolderForType(AssetType.TrashFolder));
|
||||
|
||||
return String.Format("Moved folder {0} to Trash", found[0].Name);
|
||||
}
|
||||
catch (InvalidOutfitException ex)
|
||||
{
|
||||
return "Folder Not Found: (" + ex.Message + ")";
|
||||
}
|
||||
return string.Empty;
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,20 +55,20 @@ namespace OpenMetaverse.TestClient
|
||||
{
|
||||
ImageType type = ImageType.Normal;
|
||||
|
||||
switch ((AppearanceManager.TextureIndex)j)
|
||||
switch ((AvatarTextureIndex)j)
|
||||
{
|
||||
case AppearanceManager.TextureIndex.HeadBaked:
|
||||
case AppearanceManager.TextureIndex.EyesBaked:
|
||||
case AppearanceManager.TextureIndex.UpperBaked:
|
||||
case AppearanceManager.TextureIndex.LowerBaked:
|
||||
case AppearanceManager.TextureIndex.SkirtBaked:
|
||||
case AvatarTextureIndex.HeadBaked:
|
||||
case AvatarTextureIndex.EyesBaked:
|
||||
case AvatarTextureIndex.UpperBaked:
|
||||
case AvatarTextureIndex.LowerBaked:
|
||||
case AvatarTextureIndex.SkirtBaked:
|
||||
type = ImageType.Baked;
|
||||
break;
|
||||
}
|
||||
|
||||
OutfitAssets.Add(face.TextureID);
|
||||
Client.Assets.RequestImage(face.TextureID, type, Assets_OnImageReceived);
|
||||
output.Append(((AppearanceManager.TextureIndex)j).ToString());
|
||||
output.Append(((AvatarTextureIndex)j).ToString());
|
||||
output.Append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,14 +60,14 @@ namespace OpenMetaverse.TestClient
|
||||
|
||||
// Determine if this is a baked outfit texture or a normal texture
|
||||
ImageType type = ImageType.Normal;
|
||||
AppearanceManager.TextureIndex index = (AppearanceManager.TextureIndex)i;
|
||||
AvatarTextureIndex index = (AvatarTextureIndex)i;
|
||||
switch (index)
|
||||
{
|
||||
case AppearanceManager.TextureIndex.EyesBaked:
|
||||
case AppearanceManager.TextureIndex.HeadBaked:
|
||||
case AppearanceManager.TextureIndex.LowerBaked:
|
||||
case AppearanceManager.TextureIndex.SkirtBaked:
|
||||
case AppearanceManager.TextureIndex.UpperBaked:
|
||||
case AvatarTextureIndex.EyesBaked:
|
||||
case AvatarTextureIndex.HeadBaked:
|
||||
case AvatarTextureIndex.LowerBaked:
|
||||
case AvatarTextureIndex.SkirtBaked:
|
||||
case AvatarTextureIndex.UpperBaked:
|
||||
type = ImageType.Baked;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user