/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="assetBase"></param> private void RecordWearableAssetUuids(AssetBase assetBase) { AssetWearable wearableAsset = new AssetBodypart(assetBase.FullID, assetBase.Data); wearableAsset.Decode(); foreach (UUID uuid in wearableAsset.Textures.Values) { GatheredUuids[uuid] = (sbyte)AssetType.Texture; } }
/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="assetBase"></param> private void RecordWearableAssetUuids(AssetBase assetBase) { //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart(assetBase.FullID, assetBase.Data); wearableAsset.Decode(); //m_log.DebugFormat( // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); foreach (UUID uuid in wearableAsset.Textures.Values) { GatheredUuids[uuid] = (sbyte)AssetType.Texture; } }
/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="wearableAssetUuid"></param> /// <param name="assetUuids">Dictionary in which to record the references</param> protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary <UUID, int> assetUuids) { AssetBase assetBase = GetAsset(wearableAssetUuid); //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data); wearableAsset.Decode(); //m_log.DebugFormat( // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); foreach (UUID uuid in wearableAsset.Textures.Values) { //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); assetUuids[uuid] = 1; } }
/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="wearableAssetUuid"></param> /// <param name="assetUuids">Dictionary in which to record the references</param> private void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary <UUID, AssetType> assetUuids) { AssetBase assetBase = GetAsset(wearableAssetUuid); if (null != assetBase) { //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data); wearableAsset.Decode(); //m_log.DebugFormat( // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); foreach (UUID uuid in wearableAsset.Textures.Values) { assetUuids[uuid] = AssetType.Texture; } } }
/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="wearableAssetUuid"></param> /// <param name="assetUuids">Dictionary in which to record the references</param> private void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, sbyte> assetUuids) { AssetBase assetBase = GetAsset(wearableAssetUuid); if (null != assetBase) { //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data); wearableAsset.Decode(); //m_log.DebugFormat( // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); foreach (UUID uuid in wearableAsset.Textures.Values) { assetUuids[uuid] = (sbyte)AssetType.Texture; } } }
public void MakeDefaultAppearance(string wear) { try { if (wear == "yes") { //TODO: Implement random outfit picking m_log.DebugFormat("Picks a random outfit. Not yet implemented."); } else if (wear != "save") { saveDir = "MyAppearance/" + wear; } saveDir = saveDir + "/"; string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly); string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly); InventoryFolder clothfolder = FindClothingFolder(); UUID transid = UUID.Random(); List <InventoryBase> listwearables = new List <InventoryBase>(); for (int i = 0; i < clothing.Length; i++) { UUID assetID = UUID.Random(); AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i])); asset.Decode(); asset.Owner = Client.Self.AgentID; asset.WearableType = GetWearableType(clothing[i]); asset.Encode(); transid = Client.Assets.RequestUpload(asset, true); Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing, transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask) PermissionMask.All, delegate(bool success, InventoryItem item) { if (success) { listwearables.Add(item); } else { m_log.WarnFormat("Failed to create item {0}", item.Name); } } ); } for (int i = 0; i < bodyparts.Length; i++) { UUID assetID = UUID.Random(); AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i])); asset.Decode(); asset.Owner = Client.Self.AgentID; asset.WearableType = GetWearableType(bodyparts[i]); asset.Encode(); transid = Client.Assets.RequestUpload(asset, true); Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart, transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask) PermissionMask.All, delegate(bool success, InventoryItem item) { if (success) { listwearables.Add(item); } else { m_log.WarnFormat("Failed to create item {0}", item.Name); } } ); } Thread.Sleep(1000); if (listwearables == null || listwearables.Count == 0) { m_log.DebugFormat("Nothing to send on this folder!"); } else { m_log.DebugFormat("Sending {0} wearables...", listwearables.Count); Client.Appearance.WearOutfit(listwearables, false); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void MakeDefaultAppearance(string wear) { try { if (wear == "yes") { //TODO: Implement random outfit picking m_log.DebugFormat("Picks a random outfit. Not yet implemented."); } else if (wear != "save") saveDir = "MyAppearance/" + wear; saveDir = saveDir + "/"; string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly); string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly); InventoryFolder clothfolder = FindClothingFolder(); UUID transid = UUID.Random(); List<InventoryBase> listwearables = new List<InventoryBase>(); for (int i = 0; i < clothing.Length; i++) { UUID assetID = UUID.Random(); AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i])); asset.Decode(); asset.Owner = Client.Self.AgentID; asset.WearableType = GetWearableType(clothing[i]); asset.Encode(); transid = Client.Assets.RequestUpload(asset,true); Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing, transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask)PermissionMask.All, delegate(bool success, InventoryItem item) { if (success) { listwearables.Add(item); } else { m_log.WarnFormat("Failed to create item {0}", item.Name); } } ); } for (int i = 0; i < bodyparts.Length; i++) { UUID assetID = UUID.Random(); AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i])); asset.Decode(); asset.Owner = Client.Self.AgentID; asset.WearableType = GetWearableType(bodyparts[i]); asset.Encode(); transid = Client.Assets.RequestUpload(asset,true); Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart, transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask)PermissionMask.All, delegate(bool success, InventoryItem item) { if (success) { listwearables.Add(item); } else { m_log.WarnFormat("Failed to create item {0}", item.Name); } } ); } Thread.Sleep(1000); if (listwearables == null || listwearables.Count == 0) { m_log.DebugFormat("Nothing to send on this folder!"); } else { m_log.DebugFormat("Sending {0} wearables...", listwearables.Count); Client.Appearance.WearOutfit(listwearables, false); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="wearableAssetUuid"></param> /// <param name="assetUuids">Dictionary in which to record the references</param> protected void GetWearableAssetUuids (UUID wearableAssetUuid, IDictionary<UUID, AssetType> assetUuids) { AssetBase assetBase = GetAsset (wearableAssetUuid); if (null != assetBase) { //MainConsole.Instance.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart (wearableAssetUuid, assetBase.Data); wearableAsset.Decode (); //MainConsole.Instance.DebugFormat( // "[Archiver]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); foreach (UUID uuid in wearableAsset.Textures.Values) { assetUuids [uuid] = AssetType.Texture; } } }
/// <summary> /// Record the uuids referenced by the given wearable asset /// </summary> /// <param name="assetBase"></param> private void RecordWearableAssetUuids(AssetBase assetBase) { //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart(assetBase.FullID, assetBase.Data); wearableAsset.Decode(); //m_log.DebugFormat( // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); foreach (UUID uuid in wearableAsset.Textures.Values) GatheredUuids[uuid] = (sbyte)AssetType.Texture; }