Exemple #1
0
        /// <summary>
        /// Retrieves import options for the texture we're currently inspecting.
        /// </summary>
        /// <returns>Texture import options object.</returns>
        private TextureImportOptions GetImportOptions()
        {
            Texture2D            texture = InspectedObject as Texture2D;
            TextureImportOptions output  = null;

            if (texture != null)
            {
                LibraryEntry texEntry = ProjectLibrary.GetEntry(ProjectLibrary.GetPath(texture));
                if (texEntry != null && texEntry.Type == LibraryEntryType.File)
                {
                    FileEntry texFileEntry = (FileEntry)texEntry;
                    output = texFileEntry.Options as TextureImportOptions;
                }
            }

            if (output == null)
            {
                if (importOptions == null)
                {
                    output = new TextureImportOptions();
                }
                else
                {
                    output = importOptions;
                }
            }

            return(output);
        }
Exemple #2
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject != null)
            {
                importOptions = GetImportOptions();

                formatField.OnSelectionChanged += x => importOptions.Format = (PixelFormat)x;
                generateMipsField.OnChanged    += x => importOptions.GenerateMipmaps = x;
                maximumMipsField.OnChanged     += x => importOptions.MaxMipmapLevel = x;
                srgbField.OnChanged            += x => importOptions.IsSRGB = x;
                cpuReadableField.OnChanged     += x => importOptions.CPUReadable = x;

                reimportButton.OnClick += TriggerReimport;

                Layout.AddElement(formatField);
                Layout.AddElement(generateMipsField);
                Layout.AddElement(maximumMipsField);
                Layout.AddElement(srgbField);
                Layout.AddElement(cpuReadableField);
                Layout.AddSpace(10);

                GUILayout reimportButtonLayout = Layout.AddLayoutX();
                reimportButtonLayout.AddFlexibleSpace();
                reimportButtonLayout.AddElement(reimportButton);
            }
        }
Exemple #3
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            importOptions = GetImportOptions();

            formatField.OnSelectionChanged            += x => importOptions.Format = (PixelFormat)x;
            generateMipsField.OnChanged               += x => importOptions.GenerateMips = x;
            maximumMipsField.OnChanged                += x => importOptions.MaxMip = x;
            srgbField.OnChanged                       += x => importOptions.SRGB = x;
            cpuCachedField.OnChanged                  += x => importOptions.CpuCached = x;
            isCubemapField.OnChanged                  += x => importOptions.Cubemap = x;
            cubemapSourceTypeField.OnSelectionChanged += x => importOptions.CubemapSourceType = (CubemapSourceType)x;
            reimportButton.OnClick                    += TriggerReimport;

            Layout.AddElement(formatField);
            Layout.AddElement(generateMipsField);
            Layout.AddElement(maximumMipsField);
            Layout.AddElement(srgbField);
            Layout.AddElement(cpuCachedField);
            Layout.AddElement(isCubemapField);
            Layout.AddElement(cubemapSourceTypeField);
            Layout.AddSpace(10);

            GUILayout reimportButtonLayout = Layout.AddLayoutX();

            reimportButtonLayout.AddFlexibleSpace();
            reimportButtonLayout.AddElement(reimportButton);
        }
Exemple #4
0
        /// <summary>
        /// Retrieves import options for the texture we're currently inspecting.
        /// </summary>
        /// <returns>Texture import options object.</returns>
        private TextureImportOptions GetImportOptions()
        {
            TextureImportOptions output = null;

            LibraryEntry texEntry = ProjectLibrary.GetEntry(InspectedResourcePath);

            if (texEntry != null && texEntry.Type == LibraryEntryType.File)
            {
                FileEntry texFileEntry = (FileEntry)texEntry;
                output = texFileEntry.Options as TextureImportOptions;
            }

            if (output == null)
            {
                if (importOptions == null)
                {
                    output = new TextureImportOptions();
                }
                else
                {
                    output = importOptions;
                }
            }

            return(output);
        }
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject != null)
            {
                importOptions = GetImportOptions();

                formatField.OnSelectionChanged += x => importOptions.Format = (PixelFormat)x;
                generateMipsField.OnChanged += x => importOptions.GenerateMipmaps = x;
                maximumMipsField.OnChanged += x => importOptions.MaxMipmapLevel = x;
                srgbField.OnChanged += x => importOptions.IsSRGB = x;
                cpuReadableField.OnChanged += x => importOptions.CPUReadable = x;

                reimportButton.OnClick += TriggerReimport;

                Layout.AddElement(formatField);
                Layout.AddElement(generateMipsField);
                Layout.AddElement(maximumMipsField);
                Layout.AddElement(srgbField);
                Layout.AddElement(cpuReadableField);
                Layout.AddSpace(10);

                GUILayout reimportButtonLayout = Layout.AddLayoutX();
                reimportButtonLayout.AddFlexibleSpace();
                reimportButtonLayout.AddElement(reimportButton);
            }
        }
Exemple #6
0
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            TextureImportOptions newImportOptions = GetImportOptions();

            formatField.Value       = (ulong)newImportOptions.Format;
            generateMipsField.Value = newImportOptions.GenerateMipmaps;
            maximumMipsField.Value  = newImportOptions.MaxMipmapLevel;
            srgbField.Value         = newImportOptions.IsSRGB;
            cpuReadableField.Value  = newImportOptions.CPUReadable;

            importOptions = newImportOptions;

            return(InspectableState.NotModified);
        }
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            TextureImportOptions newImportOptions = GetImportOptions();

            formatField.Value = (ulong)newImportOptions.Format;
            generateMipsField.Value = newImportOptions.GenerateMipmaps;
            maximumMipsField.Value = newImportOptions.MaxMipmapLevel;
            srgbField.Value = newImportOptions.IsSRGB;
            cpuReadableField.Value = newImportOptions.CPUReadable;

            importOptions = newImportOptions;

            return InspectableState.NotModified;
        }
Exemple #8
0
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            TextureImportOptions newImportOptions = GetImportOptions();

            formatField.Value            = (ulong)newImportOptions.Format;
            generateMipsField.Value      = newImportOptions.GenerateMips;
            maximumMipsField.Value       = newImportOptions.MaxMip;
            srgbField.Value              = newImportOptions.SRGB;
            cpuCachedField.Value         = newImportOptions.CpuCached;
            isCubemapField.Value         = newImportOptions.Cubemap;
            cubemapSourceTypeField.Value = (ulong)newImportOptions.CubemapSourceType;

            cubemapSourceTypeField.Active = importOptions.Cubemap;

            importOptions = newImportOptions;

            return(InspectableState.NotModified);
        }
Exemple #9
0
 private static extern void Internal_CreateInstance(TextureImportOptions instance);
 private static extern void Internal_CreateInstance(TextureImportOptions instance);
 private static extern void Internal_create(TextureImportOptions managedInstance);
        /// <summary>
        /// Retrieves import options for the texture we're currently inspecting.
        /// </summary>
        /// <returns>Texture import options object.</returns>
        private TextureImportOptions GetImportOptions()
        {
            Texture2D texture = InspectedObject as Texture2D;
            TextureImportOptions output = null;

            if (texture != null)
            {
                LibraryEntry texEntry = ProjectLibrary.GetEntry(ProjectLibrary.GetPath(texture));
                if (texEntry != null && texEntry.Type == LibraryEntryType.File)
                {
                    FileEntry texFileEntry = (FileEntry)texEntry;
                    output = texFileEntry.Options as TextureImportOptions;
                }
            }

            if (output == null)
            {
                if (importOptions == null)
                    output = new TextureImportOptions();
                else
                    output = importOptions;
            }

            return output;
        }