r2d2rigo Posted July 12, 2011 Share Posted July 12, 2011 I'm doing a filetype plugin and when I'm loading a file I want to store some custom internal data in the current document (like the existence of mipmaps or not) that will be properly parsed when re-saving. Is there any way to do this? Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted July 12, 2011 Share Posted July 12, 2011 Document has a Metadata property on it, which is a container for any type of metadata, organized by sections. Come up with a section name for your stuff, and toss whatever key/value pairs you want into it. It also holds the EXIF metadata in a section named "$exif" (preferably, use Metadata.ExifSectionName instead of "$exif", or better yet use methods like GetExifValues(), RemoveExifValues(), ReplaceExifValues()). Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Rick Brewster Posted July 12, 2011 Share Posted July 12, 2011 Also, each Layer has its own Metadata instance. So if you need to store per-layer metadata, prefer that instead of some encoding scheme on the document. It's been there since v2.5 (6 years), but I don't think anything (including Paint.NET) has used it yet. It will successfully persist, however. Only EXIF metadata has a chance of being preserved when saving as a non-.PDN file type. Or, of course, if you save/load the Metadata, then your custom file type will do it. But JPG, PNG, etc. won't. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
r2d2rigo Posted July 22, 2011 Author Share Posted July 22, 2011 Thank you, Rick! Now I have another question: is there any way I can access the document being saved from the funciton OnCreateSaveConfigUI? I want to give different default values to some of the properties, depending on the original ones readen from the loaded file and stored as document metadata. Is this possible? Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted July 23, 2011 Share Posted July 23, 2011 Nope. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.