Beispiel #1
0
        private void RebuildRenderTexture(UMAData data)
        {
            var rt = data.GetFirstRenderTexture();

            if (rt != null && !rt.IsCreated())
            {
                if (NoCoroutines)
                {
                    UMAGeneratorPro ugp = new UMAGeneratorPro();
                    ugp.ProcessTexture(this, umaData, true, InitialScaleFactor);
                    TextureChanged++;
                }
                else
                {
                    umaData = data;
                    TextureProcessBaseCoroutine textureProcessCoroutine;
                    textureProcessCoroutine = new TextureProcessPROCoroutine();
                    textureProcessCoroutine.Prepare(data, this);

                    activeGeneratorCoroutine = new UMAGeneratorCoroutine();
                    activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine, true, InitialScaleFactor);

                    while (!activeGeneratorCoroutine.Work())
                    {
                        ;
                    }

                    activeGeneratorCoroutine = null;
                }

                TextureChanged++;
            }
        }
Beispiel #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);
        }