Example #1
0
        /// <summary>
        /// <para>
        /// Loads <see cref="Morph"/>s  from a given key. This is done when the rootObject is initially set or when
        /// this CoreMorphs object is reset.
        /// </para>
        /// <para>
        /// Loading Morphs for CoreMorphs is handled by the <see cref="MCSCharacterManager"/> when it sets the
        /// <see cref="rootObject"/> for it's CoreMorphs object. Under normal circumstances a 3rd party developer
        /// would not need to use this method.
        /// </para>
        /// </summary>
        /// <param name="key">Should be the mesh.name, eg: Genesis2Female.Shape_LOD0</param>
        public void RefreshMorphsFromMeshKey(string key)
        {
            MorphManifest manifest = streamingMorphs.GetManifest(key, Application.isPlaying);

            //purge the old ones
            morphs.Clear();
            morphLookup.Clear();

            //dump the old groups
            morphStateGroups.Clear();
            BuildDefaultStateMorphGroups();

            foreach (string name in manifest.names)
            {
                Morph m = new Morph(name, 0f, false, false);

#if !NIKEI_ENABLED
                if (m.name.ToLower().Contains("nikei"))
                {
                    //Skip nikei
                    continue;
                }
#endif

                morphs.Add(m);
                morphLookup.Add(m.localName, m);

                //add this morph to the All group
                morphStateGroups["All"].Add(m);
            }

            //by default always sort the root morphs group alphabetically
            //SortMorphs(morphs);
        }
Example #2
0
            public MorphManifest GetManifestForCoreMesh(CoreMesh coreMesh, ManifestSelection selectionMethod)
            {
                string meshKey = selectionMethod.ToString();

                if (selectionMethod == ManifestSelection.AutoDetect)
                {
                    // There is no easy way to detect to which base avatar (MCSFemale/MCSMale) our asset belongs.
                    // The most reliable way I could find is to check their morphdata for blendshapes that are unique to one gender.
                    // Not all objects are affected by all blendshapes (e.g. shoes don't have face morphs), so we'll pick a couple that affect the whole body to cover our bases.
                    // If this still wrongly identifies a mesh, pick manual selectionMethod.
                    bool isFemale = (GetMorphData(coreMesh.runtimeMorphPath, "FBMGogoBody") != null || GetMorphData(coreMesh.runtimeMorphPath, "FHMGogoHead") != null);
                    meshKey = (isFemale) ? "MCSFemale" : "MCSMale";
                }

                if (_currentReport != null && _currentReport.name == coreMesh.name)
                {
                    _currentReport.manifest = meshKey;
                }
                return(streamingMorphs.GetManifest(meshKey, false));
            }