public virtual bool HandleDirtyUpdate(UMAData data)
        {
            if (data == null)
            {
                return(true);
            }

            if (umaData != data)
            {
                umaData = data;

                if (!umaData.Validate())
                {
                    return(true);
                }

                if (meshCombiner != null)
                {
                    meshCombiner.Preprocess(umaData);
                }
                umaData.FireCharacterBegunEvents();
            }

            if (umaData.isTextureDirty)
            {
                if (activeGeneratorCoroutine == null)
                {
                    TextureProcessBaseCoroutine textureProcessCoroutine;
                    textureProcessCoroutine = new TextureProcessPROCoroutine();
                    textureProcessCoroutine.Prepare(data, this);

                    activeGeneratorCoroutine = new UMAGeneratorCoroutine();
                    activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine, !umaData.isMeshDirty);
                }

                bool workDone = activeGeneratorCoroutine.Work();
                if (workDone)
                {
                    activeGeneratorCoroutine = null;
                    umaData.isTextureDirty   = false;
                    umaData.isAtlasDirty     = true;
                }

                if (!workDone || !fastGeneration || umaData.isMeshDirty)
                {
                    return(false);
                }
            }

            if (umaData.isMeshDirty)
            {
                UpdateUMAMesh(umaData.isAtlasDirty);
                umaData.isAtlasDirty = false;
                umaData.isMeshDirty  = false;

                if (!fastGeneration)
                {
                    return(false);
                }
            }

            if (umaData.isShapeDirty)
            {
                UpdateUMABody(umaData);
                umaData.isShapeDirty = false;
            }
            UMAReady();
            return(true);
        }
Exemple #2
0
        public bool GenerateSingleUMA(UMAData data, bool fireEvents)
        {
            UMAContextBase.IgnoreTag = ignoreTag;
            if (data == null)
            {
                return(true);
            }

            data.umaGenerator = this;
            FreezeTime        = true;
            umaData           = data;

            if (umaData.RebuildSkeleton)
            {
                if (umaData.umaRoot != null)
                {
                    SaveMountedItems(umaData);
                }
                DestroyImmediate(umaData.umaRoot, false);
                umaData.umaRoot         = null;
                umaData.RebuildSkeleton = false;
                umaData.isShapeDirty    = true;
            }

            if (!umaData.Validate())
            {
                return(true);
            }

            if (meshCombiner != null)
            {
                meshCombiner.Preprocess(umaData);
            }
            umaData.FireCharacterBegunEvents();
            PreApply(umaData);

            if (umaData.isTextureDirty)
            {
                UMAGeneratorPro ugp = new UMAGeneratorPro();
                ugp.ProcessTexture(this, umaData, !umaData.isMeshDirty, InitialScaleFactor);
                umaData.isTextureDirty = false;
                umaData.isAtlasDirty  |= umaData.isMeshDirty;
                TextureChanged++;
            }

            if (umaData.isMeshDirty)
            {
                UpdateUMAMesh(umaData.isAtlasDirty);
                umaData.isAtlasDirty = false;
                umaData.isMeshDirty  = false;
                SlotsChanged++;
                forceGarbageCollect++;
            }

            if (umaData.isShapeDirty)
            {
                if (!umaData.skeleton.isUpdating)
                {
                    umaData.skeleton.BeginSkeletonUpdate();
                }
                UpdateUMABody(umaData);
                umaData.isShapeDirty = false;
                DnaChanged++;
            }
            else if (umaData.skeleton.isUpdating)
            {
                umaData.skeleton.EndSkeletonUpdate();
            }

            umaData.dirty = false;
            if (fireEvents)
            {
                UMAReady();
            }
            else
            {
                umaData.Show();
            }
            FreezeTime = false;
            return(true);
        }
Exemple #3
0
        public virtual bool HandleDirtyUpdate(UMAData data)
        {
            if (data == null)
            {
                return(true);
            }

            if (umaData != data)
            {
                umaData = data;

                if (!umaData.Validate())
                {
                    return(true);
                }

                if (meshCombiner != null)
                {
                    meshCombiner.Preprocess(umaData);
                }
                umaData.FireCharacterBegunEvents();
            }

            PreApply(umaData);

            if (umaData.isTextureDirty)
            {
                bool meshWasDirty = umaData.isMeshDirty;
                if (activeGeneratorCoroutine == null)
                {
                    TextureProcessBaseCoroutine textureProcessCoroutine;
                    textureProcessCoroutine = new TextureProcessPROCoroutine();
                    textureProcessCoroutine.Prepare(data, this);

                    activeGeneratorCoroutine = new UMAGeneratorCoroutine();
                    activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine, !umaData.isMeshDirty, InitialScaleFactor);
                }

                bool workDone = activeGeneratorCoroutine.Work();
                if (workDone)
                {
                    activeGeneratorCoroutine = null;
                    umaData.isTextureDirty   = false;
                    umaData.isAtlasDirty    |= umaData.isMeshDirty;
                    TextureChanged++;
                }

                //shouldn't this only cause another loop if this part MADE the mesh dirty?
                if (!workDone || !fastGeneration || (!meshWasDirty && umaData.isMeshDirty))
                {
                    //Debug.Log("workDone = " + workDone + " fastGeneration = " + fastGeneration + " umaData.isMeshDirty = " + umaData.isMeshDirty);
                    return(false);
                }
            }

            if (umaData.isMeshDirty)
            {
                UpdateUMAMesh(umaData.isAtlasDirty);
                umaData.isAtlasDirty = false;
                umaData.isMeshDirty  = false;
                SlotsChanged++;
                forceGarbageCollect++;

                if (!fastGeneration)
                {
                    return(false);
                }
            }

            if (umaData.isShapeDirty)
            {
                if (!umaData.skeleton.isUpdating)
                {
                    umaData.skeleton.BeginSkeletonUpdate();
                }
                UpdateUMABody(umaData);
                umaData.isShapeDirty = false;
                DnaChanged++;
            }
            else if (umaData.skeleton.isUpdating)
            {
                umaData.skeleton.EndSkeletonUpdate();
            }

            UMAReady();
            return(true);
        }
Exemple #4
0
        public virtual bool HandleDirtyUpdate(UMAData data)
        {
            if (data == null)
            {
                return(true);
            }

            if (umaData != data)
            {
                umaData = data;

                if (!umaData.Validate())
                {
                    return(true);
                }

                if (meshCombiner != null)
                {
                    meshCombiner.Preprocess(umaData);
                }
                umaData.FireCharacterBegunEvents();
            }

            if (umaData.isTextureDirty)
            {
                if (activeGeneratorCoroutine == null)
                {
                    TextureProcessBaseCoroutine textureProcessCoroutine;
                    textureProcessCoroutine = new TextureProcessPROCoroutine();
                    textureProcessCoroutine.Prepare(data, this);

                    activeGeneratorCoroutine = new UMAGeneratorCoroutine();
                    activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine, !umaData.isMeshDirty, InitialScaleFactor);
                }

                bool workDone = activeGeneratorCoroutine.Work();
                if (workDone)
                {
                    activeGeneratorCoroutine = null;
                    umaData.isTextureDirty   = false;
                    umaData.isAtlasDirty    |= umaData.isMeshDirty;
                    TextureChanged++;
                }

                if (!workDone || !fastGeneration || umaData.isMeshDirty)
                {
                    return(false);
                }
            }

            if (umaData.isMeshDirty)
            {
                UpdateUMAMesh(umaData.isAtlasDirty);
                umaData.isAtlasDirty = false;
                umaData.isMeshDirty  = false;
                SlotsChanged++;
                forceGarbageCollect++;

                if (!fastGeneration)
                {
                    return(false);
                }
            }

            if (umaData.isShapeDirty)
            {
                if (!umaData.skeleton.isUpdating)
                {
                    umaData.skeleton.BeginSkeletonUpdate();
                }
                UpdateUMABody(umaData);
                umaData.isShapeDirty = false;
                DnaChanged++;
            }
            else if (umaData.skeleton.isUpdating)
            {
                umaData.skeleton.EndSkeletonUpdate();
            }

            UMAReady();
            return(true);
        }