Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 9
0
 private static extern void Internal_CreateInstance(TextureImportOptions instance);
Ejemplo n.º 10
0
 private static extern void Internal_CreateInstance(TextureImportOptions instance);
 private static extern void Internal_create(TextureImportOptions managedInstance);
Ejemplo n.º 12
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;
        }