Esempio n. 1
0
 public object Invoke(ImportContext context, string data)
 {
     return(Instance == null ? null : m_MethodInfo.Invoke(m_Instance, new object[] { context, data }));
 }
Esempio n. 2
0
        public void PreprocessAsset(ImportContext context, bool checkForConformity = true)
        {
            if (checkForConformity)
            {
                if (m_FilterToFolder)
                {
                    List <Filter> filters = Filters;
                    filters.Add(new Filter(Filter.ConditionTarget.Directory, Filter.Condition.StartsWith, DirectoryPath));
                    if (Filter.Conforms(context.Importer, filters) == false)
                    {
                        return;
                    }
                }
                else if (Filter.Conforms(context.Importer, m_Filters) == false)
                {
                    return;
                }
            }

            bool saveMeta = false;

            if (m_RunOnImport)
            {
                for (int i = 0; i < m_ImportTasks.Count; ++i)
                {
                    if (m_ImportTasks[i] != null)
                    {
                        m_ImportTasks[i].PreprocessTask(context, this);
                        saveMeta = true;
                        if (m_ImportTasks[i].TaskProcessType == BaseImportTask.ProcessingType.Pre)
                        {
                            m_ImportTasks[i].Apply(context, this);
                            m_ImportTasks[i].SetManuallyProcessing(context.AssetPath, false);
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < m_ImportTasks.Count; ++i)
                {
                    if (m_ImportTasks[i] != null && m_ImportTasks[i].IsManuallyProcessing(context.Importer))
                    {
                        m_ImportTasks[i].PreprocessTask(context, this);
                        saveMeta = true;
                        if (m_ImportTasks[i].TaskProcessType == BaseImportTask.ProcessingType.Pre)
                        {
                            m_ImportTasks[i].Apply(context, this);
                            m_ImportTasks[i].SetManuallyProcessing(context.AssetPath, false);
                        }
                    }
                }
            }

            if (saveMeta)
            {
                UserDataSerialization data = UserDataSerialization.Get(context.AssetPath);
                if (data != null)
                {
                    data.SaveMetaData();
                }
            }
        }