コード例 #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);
        }
コード例 #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);
            }
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
            }
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #9
0
ファイル: ImportOptions.cs プロジェクト: Ruu/BansheeEngine
 private static extern void Internal_CreateInstance(TextureImportOptions instance);
コード例 #10
0
 private static extern void Internal_CreateInstance(TextureImportOptions instance);
コード例 #11
0
 private static extern void Internal_create(TextureImportOptions managedInstance);
コード例 #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;
        }