Jump to content

Getting image dimensions within code for save config widget?


Recommended Posts

I'm in the process of adding mipmap generation to my DDS plugin. To this end, I've added a checkbox to my UI to allow for the generation of mips to be optional.

I need to be able to disable this checkbox, but I'm unsure as to how to get the currently-being-saved image's width & height. Reason being that you can only have mipmaps for power-of-two images in the DDS file format... so the option should be disabled for non-power-of-two images.

I thought about putting the width/height in my token, but that seemed pretty crappy.. I don't want it serialised. I looked in the existing filetype plugins, but none use the width/height of the image within the save config widget code.

Hints appreciated.. :)

Cheers,

Dean

Link to comment
Share on other sites

This information is not available to the SaveConfigWidget. You should instead name your checkbox something like, "Generate mip-maps if possible for 2^n sized images"

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Hmm.. that's a real shame. It makes the output somewhat unpredictable.. all you need is a slight size problem, and it would silently stop exporting it. It can make a significant difference to filesize, and to runtime performance when using the texture. At least if I could do this, it would be clear to the user as to what was going on..

I might have to hack a workaround (if I can think of a way of doing it!), as I'm not convinced that any ambiguity like this at the point the image is saved is a good thing.. :(

Dean

Link to comment
Share on other sites

Please don't hack in a workaround, as it is very likely to break in future version of Paint.NET. Or it would go outside the boundaries of what the plugin framework is providing, and will not be usable in all scenarios (now or in the future).

I can accomodate this in a future release of Paint.NET but for now please do not hack around this. Otherwise I will be forced to break your plugin in a future release of Paint.NET just so that I can maintain a hack-free plugin framework.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Had some time to check up in some DDS reference materials this lunchtime, as well as speak to some colleagues. Turns out it's quite valid to have non power-of-two DXT textures with mipmaps (it wasn't valid when I was working on Xbox titles way back.. hence the confusion).

So as it happens this was all irrelevant anyway..

You could delete the thread, if you so wished.. :)

Cheers,

Dean

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...