Beispiel #1
0
        //
        // Outfit application methods

        private void ApplyOutfit(string forClothing, string outfitName)
        {
            string outfitDirectory = FindOutfitDirectory(forClothing, outfitName);

            // Get the clothing item materials.
            DAZClothingItem clothes = GameObject
                                      .FindObjectsOfType <DAZClothingItem>()
                                      .Where(dci => dci.containingAtom == containingAtom)
                                      .Where(dci => dci.name == forClothing)
                                      .FirstOrDefault();

            if (clothes == null)
            {
                throw new Exception("Tried to apply '{outfitName}' to '{forClothing}' but '{myPerson.name}' isn't wearing that.");
            }

            string[] files = SuperController.singleton.GetFilesAtPath(outfitDirectory);

            foreach (Material mat in clothes
                     .GetComponentsInChildren <DAZSkinWrap>()
                     .SelectMany(dsw => dsw.GPUmaterials))
            {
                ApplyTexture(outfitDirectory, mat, PROP_DIFFUSE);
                ApplyTexture(outfitDirectory, mat, PROP_CUTOUT);
                ApplyTexture(outfitDirectory, mat, PROP_NORMAL);
                ApplyTexture(outfitDirectory, mat, PROP_SPEC);
                ApplyTexture(outfitDirectory, mat, PROP_GLOSS);
            }
        }
Beispiel #2
0
        public void DumpButtonCallback()
        {
            try
            {
                // Obtain the currently selected clothes.
                DAZClothingItem clothes = GameObject
                                          .FindObjectsOfType <DAZClothingItem>()
                                          .Where(dci => dci.containingAtom == containingAtom)
                                          .Where(dci => dci.name == clothingItems.val)
                                          .DefaultIfEmpty((DAZClothingItem)null)
                                          .FirstOrDefault();

                // Bug out if it doesn't exist.
                if (clothes == null)
                {
                    SuperController.LogError($"Could not finding clothing item '{clothingItems.val}'");
                    return;
                }

                // Get the first skinwrap mesh.
                DAZMesh mesh = clothes
                               .GetComponentsInChildren <DAZMesh>()
                               .FirstOrDefault();

                // Export
                OBJExporter exporter = new OBJExporter();
                exporter.Export(clothes.name + ".obj", mesh.uvMappedMesh, mesh.uvMappedMesh.vertices, mesh.uvMappedMesh.normals, mesh.materials);
            }
            catch (Exception ex)
            {
                SuperController.LogMessage($"Could not export OBJ file for this clothing item: {ex}");
            }
        }
Beispiel #3
0
 private static bool IsHeadClothing(DAZClothingItem c)
 {
     if (c.displayName.IndexOf("eye", StringComparison.OrdinalIgnoreCase) > -1)
     {
         return(true);
     }
     if (c.displayName.IndexOf("lashes", StringComparison.OrdinalIgnoreCase) > -1)
     {
         return(true);
     }
     if (c.displayName.IndexOf("brows", StringComparison.OrdinalIgnoreCase) > -1)
     {
         return(true);
     }
     if (c.displayName.IndexOf("hair", StringComparison.OrdinalIgnoreCase) > -1)
     {
         return(true);
     }
     if (c.displayName.IndexOf("face", StringComparison.OrdinalIgnoreCase) > -1)
     {
         return(true);
     }
     if (c.displayName.IndexOf("lips", StringComparison.OrdinalIgnoreCase) > -1)
     {
         return(true);
     }
     if (c.tagsArray == null)
     {
         return(false);
     }
     if (c.tagsArray.Length == 0)
     {
         return(false);
     }
     if (Array.IndexOf(c.tagsArray, "head") > -1)
     {
         return(true);
     }
     if (Array.IndexOf(c.tagsArray, "glasses") > -1)
     {
         return(true);
     }
     return(false);
 }
Beispiel #4
0
 public ClothingHandler(DAZClothingItem clothing)
 {
     _clothing = clothing;
 }