Exemple #1
0
        public virtual bool CheckTrackedAssetsDirty()
        {
            // Early out: no assets being tracked.
            if (m_TrackedAssets.Count == 0)
            {
                return(false);
            }

            bool isTrackedAssetDirty = false;

            foreach (var styleSheetAssetEntry in m_TrackedAssets)
            {
                var tracking          = styleSheetAssetEntry.Value;
                int currentDirtyCount = AssetOperationsAccess.GetAssetDirtyCount(tracking.m_Asset);

                if (tracking.m_LastDirtyCount != currentDirtyCount)
                {
                    tracking.m_LastDirtyCount = currentDirtyCount;
                    isTrackedAssetDirty       = true;
                }
            }

            if (m_RemovedAssets.Count > 0)
            {
                foreach (var removedAsset in m_RemovedAssets)
                {
                    m_TrackedAssets.Remove(removedAsset);
                }
                m_RemovedAssets.Clear();
            }

            return(isTrackedAssetDirty);
        }
Exemple #2
0
        public void StartTrackingAsset(T asset)
        {
            int assetId = asset.GetInstanceID();

            if (m_TrackedAssets.TryGetValue(assetId, out var tracking))
            {
                tracking.m_ReferenceCount++;
            }
            else
            {
                m_TrackedAssets[assetId] = new AssetTracking <T>()
                {
                    m_Asset          = asset,
                    m_AssetPath      = AssetOperationsAccess.GetAssetPath(asset),
                    m_LastDirtyCount = AssetOperationsAccess.GetAssetDirtyCount(asset),
                    m_ReferenceCount = 1
                };
            }
        }