Exemplo n.º 1
0
        public List <ARAugmentedImageDatabaseEntry> GetDirtyQualityEntries()
        {
            var    dirtyEntries = new List <ARAugmentedImageDatabaseEntry>();
            string cliBinaryPath;

            if (!FindCliBinaryPath(out cliBinaryPath))
            {
                return(dirtyEntries);
            }

            string currentCliVersion;
            {
                string error;
#if !UNITY_EDITOR_WIN
                string output;
                ShellHelper.RunCommand("chmod", "+x " + cliBinaryPath, out output, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    Debug.LogWarning(error);
                    return(dirtyEntries);
                }
#endif
                ShellHelper.RunCommand(cliBinaryPath, "version", out currentCliVersion, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    ARDebug.LogInfo(error);
                    return(dirtyEntries);
                }
            }

            bool cliUpdated = m_CliVersion != currentCliVersion;
            // When CLI is updated, mark all entries dirty.
            if (cliUpdated)
            {
                for (int i = 0; i < m_Images.Count; ++i)
                {
                    ARAugmentedImageDatabaseEntry updatedImage = m_Images[i];
                    updatedImage.Quality = string.Empty;
                    m_Images[i]          = updatedImage;
                }

                m_CliVersion = currentCliVersion;
                EditorUtility.SetDirty(this);
            }

            for (int i = 0; i < m_Images.Count; ++i)
            {
                if (!string.IsNullOrEmpty(m_Images[i].Quality))
                {
                    continue;
                }

                dirtyEntries.Add(m_Images[i]);
            }

            return(dirtyEntries);
        }
Exemplo n.º 2
0
 /**
  * \if english
  * @brief  Adds an image to this database.
  *
  * \else
  * @brief 向数据库中增加图片记录
  *
  * \endif
  */
 public void Add(ARAugmentedImageDatabaseEntry entry)
 {
     m_Images.Add(entry);
     m_IsRawDataDirty = true;
     EditorUtility.SetDirty(this);
 }