예제 #1
0
        internal static void BatchConverters(List <RenderPipelineConverter> converters)
        {
            // This need to be sorted by Priority property
            converters = converters.OrderBy(o => o.priority).ToList();

            foreach (RenderPipelineConverter converter in converters)
            {
                List <ConverterItemDescriptor> converterItemInfos = new List <ConverterItemDescriptor>();
                var initCtx = new InitializeConverterContext {
                    items = converterItemInfos
                };
                initCtx.isBatchMode = true;
                converter.OnInitialize(initCtx, () => { });

                converter.OnPreRun();
                for (int i = 0; i < initCtx.items.Count; i++)
                {
                    var item = new ConverterItemInfo()
                    {
                        index      = i,
                        descriptor = initCtx.items[i],
                    };
                    var ctx = new RunItemContext(item);
                    ctx.isBatchMode = true;
                    converter.OnRun(ref ctx);

                    string converterStatus = ctx.didFail ? $"Fail\nInfo: {ctx.info}" : "Pass";
                    Debug.Log($"Name: {ctx.item.descriptor.name}\nConverter Status: {converterStatus}");
                }

                converter.OnPostRun();

                AssetDatabase.SaveAssets();
            }
        }
 void ConvertIndex(int coreConverterIndex, int index)
 {
     if (!m_ConverterStates[coreConverterIndex].items[index].hasConverted)
     {
         m_ConverterStates[coreConverterIndex].items[index].hasConverted = true;
         var item = new ConverterItemInfo()
         {
             index      = index,
             descriptor = m_ItemsToConvert[coreConverterIndex][index],
         };
         var ctx = new RunItemContext(item);
         m_CoreConvertersList[coreConverterIndex].OnRun(ref ctx);
         UpdateInfo(coreConverterIndex, ctx);
     }
 }