< Summary

Class:DCL.AssetPromiseSettings_Rendering
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Common/AssetPromiseSettings_Rendering.cs
Covered lines:22
Uncovered lines:0
Coverable lines:22
Total lines:72
Line coverage:100% (22 of 22)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:4
Method coverage:100% (4 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AssetPromiseSettings_Rendering()0%110100%
ApplyBeforeLoad(...)0%660100%
ApplyAfterLoad(...)0%110100%
ApplyAfterLoad(...)0%330100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Common/AssetPromiseSettings_Rendering.cs

#LineLine coverage
 1using DCL.Helpers;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace DCL
 6{
 7    public class AssetPromiseSettings_Rendering : IAssetPromiseSettings<Transform>
 8    {
 9        public enum VisibleFlags
 10        {
 11            INVISIBLE,
 12            VISIBLE_WITHOUT_TRANSITION,
 13            VISIBLE_WITH_TRANSITION
 14        }
 15
 15016        public VisibleFlags visibleFlags = VisibleFlags.VISIBLE_WITH_TRANSITION;
 17        public Shader shaderOverride;
 18
 19        public Transform parent;
 20        public Vector3? initialLocalPosition;
 21        public Quaternion? initialLocalRotation;
 22        public Vector3? initialLocalScale;
 23        public int? layer;
 24
 25        public bool forceNewInstance;
 26        public bool forceGPUOnlyMesh = false;
 15027        public bool smrUpdateWhenOffScreen = true;
 28
 29        public void ApplyBeforeLoad(Transform t)
 30        {
 26031            if (parent != null)
 32            {
 18333                t.SetParent(parent, false);
 18334                t.ResetLocalTRS();
 35            }
 36
 26037            if (initialLocalPosition.HasValue)
 38            {
 539                t.localPosition = initialLocalPosition.Value;
 40            }
 41
 26042            if (initialLocalRotation.HasValue)
 43            {
 244                t.localRotation = initialLocalRotation.Value;
 45            }
 46
 26047            if (initialLocalScale.HasValue)
 48            {
 249                t.localScale = initialLocalScale.Value;
 50            }
 51
 26052            if (layer.HasValue)
 353                Utils.SetLayerRecursively(t, layer.Value);
 26054        }
 55
 27656        public void ApplyAfterLoad(Transform transform) { ApplyAfterLoad(new List<Renderer>(transform.GetComponentsInChi
 57
 58        public void ApplyAfterLoad(List<Renderer> renderers = null)
 59        {
 13860            int renderersCount = renderers.Count;
 61
 81662            for (int i = 0; i < renderersCount; i++)
 63            {
 27064                Renderer renderer = renderers[i];
 27065                renderer.enabled = visibleFlags != VisibleFlags.INVISIBLE;
 66
 27067                if (renderer is SkinnedMeshRenderer smr)
 9968                    smr.updateWhenOffscreen = smrUpdateWhenOffScreen;
 69            }
 13870        }
 71    }
 72}