コード例 #1
0
        private bool LoadCompositeTag(IIndexItem tag, bool lods)
        {
            if (modelTypes.ContainsKey(tag.Id))
            {
                return(true);
            }

            string defaultVariant;

            //find the corresponding hlmt tag
            var hlmt = FindModelTag(tag, out defaultVariant);

            if (hlmt == null)
            {
                return(false);
            }

            var modelType = new ModelType(tag, defaultVariant);

            if (!modelTypes.TryAdd(tag.Id, modelType))
            {
                return(true); //looks like another thread is already working on this model
            }
            if (configCache.ContainsKey(hlmt.Id))
            {
                modelType.VariantConfig = configCache[hlmt.Id];
            }
            else
            {
                var config = modelType.VariantConfig = ModelConfig.FromIndexItem(hlmt);
                if (!configCache.TryAdd(hlmt.Id, config))
                {
                    return(true); //looks like another thread is already working on this model
                }
                LoadTag(config.RenderModelTag, lods);

                foreach (var att in config.Variants.SelectMany(v => v.Attachments))
                {
                    LoadTag(att.ChildTag, lods);
                }
            }

            return(true);
        }