FormatFromTextureParameters() private method

private FormatFromTextureParameters ( TextureImporterSettings settings, TextureImporterPlatformSettings platformSettings, bool doesTextureContainAlpha, bool sourceWasHDR, BuildTarget destinationPlatform ) : TextureImporterFormat
settings TextureImporterSettings
platformSettings TextureImporterPlatformSettings
doesTextureContainAlpha bool
sourceWasHDR bool
destinationPlatform BuildTarget
return TextureImporterFormat
コード例 #1
0
 public void Sync()
 {
     if (!this.isDefault && (!this.overridden || this.m_OverriddenIsDifferent))
     {
         TextureImportPlatformSettings textureImportPlatformSettings = this.m_Inspector.m_PlatformSettings[0];
         this.m_PlatformSettings.maxTextureSize       = textureImportPlatformSettings.maxTextureSize;
         this.m_MaxTextureSizeIsDifferent             = textureImportPlatformSettings.m_MaxTextureSizeIsDifferent;
         this.m_PlatformSettings.textureCompression   = textureImportPlatformSettings.textureCompression;
         this.m_TextureCompressionIsDifferent         = textureImportPlatformSettings.m_TextureCompressionIsDifferent;
         this.m_PlatformSettings.format               = textureImportPlatformSettings.format;
         this.m_TextureFormatIsDifferent              = textureImportPlatformSettings.m_TextureFormatIsDifferent;
         this.m_PlatformSettings.compressionQuality   = textureImportPlatformSettings.compressionQuality;
         this.m_CompressionQualityIsDifferent         = textureImportPlatformSettings.m_CompressionQualityIsDifferent;
         this.m_PlatformSettings.crunchedCompression  = textureImportPlatformSettings.crunchedCompression;
         this.m_CrunchedCompressionIsDifferent        = textureImportPlatformSettings.m_CrunchedCompressionIsDifferent;
         this.m_PlatformSettings.allowsAlphaSplitting = textureImportPlatformSettings.allowsAlphaSplitting;
         this.m_AlphaSplitIsDifferent = textureImportPlatformSettings.m_AlphaSplitIsDifferent;
     }
     if ((this.overridden || this.m_OverriddenIsDifferent) && this.m_PlatformSettings.format < (TextureImporterFormat)0)
     {
         this.m_PlatformSettings.format  = TextureImporter.FormatFromTextureParameters(this.GetSettings(this.importers[0]), this.m_PlatformSettings, this.importers[0].DoesSourceTextureHaveAlpha(), this.importers[0].IsSourceTextureHDR(), this.m_Target);
         this.m_TextureFormatIsDifferent = false;
         for (int i = 1; i < this.importers.Length; i++)
         {
             TextureImporter         textureImporter       = this.importers[i];
             TextureImporterSettings settings              = this.GetSettings(textureImporter);
             TextureImporterFormat   textureImporterFormat = TextureImporter.FormatFromTextureParameters(settings, this.m_PlatformSettings, textureImporter.DoesSourceTextureHaveAlpha(), textureImporter.IsSourceTextureHDR(), this.m_Target);
             if (textureImporterFormat != this.m_PlatformSettings.format)
             {
                 this.m_TextureFormatIsDifferent = true;
             }
         }
     }
 }
コード例 #2
0
        public void Sync()
        {
            // Use settings from default if any of the targets are not overridden
            if (!isDefault && (!overridden || m_OverriddenIsDifferent))
            {
                TextureImportPlatformSettings defaultSettings = m_Inspector.m_PlatformSettings[0];
                m_PlatformSettings.maxTextureSize       = defaultSettings.maxTextureSize;
                m_MaxTextureSizeIsDifferent             = defaultSettings.m_MaxTextureSizeIsDifferent;
                m_PlatformSettings.resizeAlgorithm      = defaultSettings.resizeAlgorithm;
                m_ResizeAlgorithmIsDifferent            = defaultSettings.m_ResizeAlgorithmIsDifferent;
                m_PlatformSettings.textureCompression   = defaultSettings.textureCompression;
                m_TextureCompressionIsDifferent         = defaultSettings.m_TextureCompressionIsDifferent;
                m_PlatformSettings.format               = defaultSettings.format;
                m_TextureFormatIsDifferent              = defaultSettings.m_TextureFormatIsDifferent;
                m_PlatformSettings.compressionQuality   = defaultSettings.compressionQuality;
                m_CompressionQualityIsDifferent         = defaultSettings.m_CompressionQualityIsDifferent;
                m_PlatformSettings.crunchedCompression  = defaultSettings.crunchedCompression;
                m_CrunchedCompressionIsDifferent        = defaultSettings.m_CrunchedCompressionIsDifferent;
                m_PlatformSettings.allowsAlphaSplitting = defaultSettings.allowsAlphaSplitting;
                m_AlphaSplitIsDifferent = defaultSettings.m_AlphaSplitIsDifferent;
                m_AndroidETC2FallbackOverrideIsDifferent = defaultSettings.m_AndroidETC2FallbackOverrideIsDifferent;
            }

            if ((overridden || m_OverriddenIsDifferent) && m_PlatformSettings.format < 0)
            {
                m_PlatformSettings.format = TextureImporter.FormatFromTextureParameters(GetSettings(importers[0]),
                                                                                        m_PlatformSettings,
                                                                                        importers[0].DoesSourceTextureHaveAlpha(),
                                                                                        importers[0].IsSourceTextureHDR(),
                                                                                        m_Target
                                                                                        );
                m_TextureFormatIsDifferent = false;

                for (int i = 1; i < importers.Length; i++)
                {
                    TextureImporter         imp      = importers[i];
                    TextureImporterSettings settings = GetSettings(imp);

                    TextureImporterFormat format = TextureImporter.FormatFromTextureParameters(settings,
                                                                                               m_PlatformSettings,
                                                                                               imp.DoesSourceTextureHaveAlpha(),
                                                                                               imp.IsSourceTextureHDR(),
                                                                                               m_Target
                                                                                               );
                    if (format != m_PlatformSettings.format)
                    {
                        m_TextureFormatIsDifferent = true;
                    }
                }
            }
        }
コード例 #3
0
        public TextureImporterFormat GetAutomaticFormat(string platform)
        {
            TextureImporterSettings textureImporterSettings = new TextureImporterSettings();

            this.ReadTextureSettings(textureImporterSettings);
            TextureImporterPlatformSettings        platformTextureSettings = this.GetPlatformTextureSettings(platform);
            List <BuildPlayerWindow.BuildPlatform> validPlatforms          = BuildPlayerWindow.GetValidPlatforms();
            TextureImporterFormat result;

            foreach (BuildPlayerWindow.BuildPlatform current in validPlatforms)
            {
                if (current.name == platform)
                {
                    result = TextureImporter.FormatFromTextureParameters(textureImporterSettings, platformTextureSettings, this.DoesSourceTextureHaveAlpha(), this.IsSourceTextureHDR(), current.DefaultTarget);
                    return(result);
                }
            }
            result = TextureImporterFormat.Automatic;
            return(result);
        }