Aredon Posted December 27, 2020 Share Posted December 27, 2020 I've downloaded this Plugin now, ut can't set oder add new Brushes because i get alwaysthe same error message: Quote The settings folder could not be located. Your settings may not be loaded or saved. What happens here? Quote Link to comment Share on other sites More sharing options...
Roly Poly Goblinoli Posted December 27, 2020 Author Share Posted December 27, 2020 9 hours ago, Aredon said: I've downloaded this Plugin now, ut can't set oder add new Brushes because i get alwaysthe same error message: What happens here? Paint.net sometimes returns no location when we ask where the documents folder is, which is a new problem. I don't get this problem personally, so it's difficult to mitigate. Brush Factory tries to directly guess the common location, e.g. C:\Users\you\Documents\paint.net User Files. If the folder doesn't exist there, it gives up with that error message. The program is usable except it won't save settings, but I understand how that's irritating. It's possible that you moved paint.net, renamed it, or installed it somewhere else. Or changed the location of the paint.net user files folder. I really shouldn't have to make a guessing game at where that folder is, but currently paint.net doesn't want to cooperate, I guess. @Rick Brewster userFilesService.UserFilesPath returns null these days. Any idea why? I get the service in a window OnShown event. IUserFilesService userFilesService = (IUserFilesService)Services.GetService(typeof(IUserFilesService)); (IUserFilesService)Services.GetService(typeof(IUserFilesService)); If I get the answer I could avoid guessing later. I didn't write this particular code so I have even less of an idea why it's broken than normal. Thanks for looking. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 28, 2020 Share Posted December 28, 2020 If PDN is returning `null` for `UserFilesPath`, it's because Windows itself, via the SHGetFolderPathW API, isn't giving up the location. Possibly because it doesn't exist and can't be created (PDN does pass `CSIDL_FLAG_CREATE` into `SHGetFolderPathW`). Maybe because of some file system permissions issue. Or maybe over-zealous antivirus is blocking creation. It's not clear to me, and depends on context (like maybe the Documents folder itself doesn't exist itself? or has been moved to a more strict location?). You must be able to gracefully handle a `null` result here, unfortunately. You will probably see the same problem when trying to work with custom palettes via the Colors window. The "best" way to "handle" this error, in my opinion, is to just show an error dialog. You can do this via the `IExceptionDialogService` service and its `ShowErrorDialog` methods. That's what the app does when needed (e.g. when trying to work with custom palettes in the Colors form). You can pass `null` for the `owner` parameter and PDN will do its best to figure out what to hang the dialog off of (e.g. the main window or the effect form). I highly recommend doing this on the UI thread, which will be the case if you're doing this in the `Shown` event handler. 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 December 28, 2020 Share Posted December 28, 2020 I can also add a method to the IUserFilesService, such as GetUserFilesPath(), that will pass along the exception (this just provides more information for troubleshooting purposes). It will throw on error instead of returning null, in other words. The existing TryGetUserFilesPath() method will return null as well -- the exception is discarded and transformed into a null return value. 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...
n_n Posted December 29, 2020 Share Posted December 29, 2020 (edited) whoa. this post is still active after 5 years or so. i got a little problem: click this link and you'll see the problem i have.Added text under the imgur screenshots Edited December 29, 2020 by n_n deleted unnecessary text on the post Quote Link to comment Share on other sites More sharing options...
Daralima Posted December 29, 2020 Share Posted December 29, 2020 12 hours ago, n_n said: whoa. this post is still active after 5 years or so. i got a little problem: click this link and you'll see the problem i have.Added text under the imgur screenshots Same here. Quote Link to comment Share on other sites More sharing options...
Roly Poly Goblinoli Posted December 30, 2020 Author Share Posted December 30, 2020 (edited) Quote whoa. this post is still active after 5 years or so. Not an uncommon sight on this forum, and I intend to at least maintain it until it becomes obsolete or people stop finding it useful. Quote i got a little problem: click this link and you'll see the problem i have. I don't think my plugin is responsible for the disappearance of others in the same category; not sure how that would happen (or how it would be fixed if so). Quote The "best" way to "handle" this error, in my opinion, is to just show an error dialog. Agreed, so I currently do. Unfortunate it's just an ambient environmental problem that causes null to be returned. Adding exception details would be useful for logging to learn what the problem might be. Luckily I go one step further to checking the documents folder. Thanks for responding. Until there's more info on what the common issues are, I can't do much about it, so for the people who consistently have errors, a few questions: - Are you running Windows 10 or a different version? - Can other plugins access the "paint.net User Files" folder, if you know? You'll see data stored there if so. Try this if you're having the settings problem ~~~ Try creating a folder exactly called paint.net User Files in your Documents folder at "C:\Users\your_name\Documents\" (where your_name is your current username...the Documents shortcut button in File Explorer on the left-hand side should take you to the right place). Brush Factory currently looks for this folder and tries to load things from it; if there's just a mismatch with finding the path of the paint.net user files folder, this should mitigate the problem. An ugly workaround, but better than nothing (with my luck it will persist anyway. Knocking on wood) (p.s. Happy New Year's, everyone -- or at least we're done with 2020) Edited December 30, 2020 by Joshua Lamusga 2 Quote Link to comment Share on other sites More sharing options...
ardneh Posted December 30, 2020 Share Posted December 30, 2020 Brush Factory shows the same two error windows. Am able to use Add Brushes button to manually load a brush from paint.net User Files in Documents folder. (Or any other folder.) I have removed and recreated the "paint.net User Files" folder. Running Windows 10. Smudge can access the "paint.net User Files" folder. Quote You'll see data stored there if so. Not sure what this means. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted December 30, 2020 Share Posted December 30, 2020 I was curious about these errors, so I opened Brush Factory this morning, and I too see the error messages. Running Windows 10 20H2. I'm using IUserFilesService in a few of my plugins, and it's working fine in those. I'll take a look at what's going on in the Brush Factory source code later tonight when I get back from work. 1 Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 31, 2020 Share Posted December 31, 2020 13 hours ago, Joshua Lamusga said: Try this if you're having the settings problem ~~~ Try creating a folder exactly called paint.net User Files in your Documents folder at "C:\Users\your_name\Documents\" (where your_name is your current username... The name of this folder is localized (translated), so that suggestion will only work for English. I would have them click on Open Palettes Folder and see how well that works. It will automatically create all the folders if possible: 1 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...
ardneh Posted December 31, 2020 Share Posted December 31, 2020 1 hour ago, Rick Brewster said: would have them click on Open Palettes Folder and see how well that works Made no difference. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted December 31, 2020 Share Posted December 31, 2020 (edited) @Joshua Lamusga, IUserFilesService is working correctly in this plugin; it returns the directory path without issue. The problem arises when checking if BrushFactorySettings.xml exists in that directory. If the XML file doesn't exist, then your code throws an exception. To make matters worse, the plugin won't ever create the XML file, because an instance of BrushFactorySettings never gets initialized. Edited December 31, 2020 by toe_head2001 2 3 Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Allen Shau Posted December 31, 2020 Share Posted December 31, 2020 Manually creating a file named C:\Users\(you)\Documents\paint.net User Files\BrushFactorySettings.xml works for me. ----- begin of BrushFactorySettings.xml ----- <BrushFactorySettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> </BrushFactorySettings> ----- end of BrushFactorySettings.xml ----- 1 1 Quote Link to comment Share on other sites More sharing options...
Daralima Posted January 1, 2021 Share Posted January 1, 2021 The above worked for me. However I have another issue, for me, when I add a custom (png if that matters) brush, when I turn colorize brush off, it only uses the same general texture, not the same colors? Quote Link to comment Share on other sites More sharing options...
Roly Poly Goblinoli Posted January 1, 2021 Author Share Posted January 1, 2021 4 hours ago, Daralima said: when I add a custom (png if that matters) brush, when I turn colorize brush off, it only uses the same general texture, not the same colors? If you use a perfectly opaque image as a brush, Brush Factory will use the intensity of the image (V in HSV) as transparency. If you use an image with any pixel that isn't perfectly opaque, Brush Factory will use the transparency information of the image. Being PNG or not doesn't affect this behavior. I'm guessing you're using a perfectly opaque image. Hope that helps. If not, you'll need to clarify and provide an image. Quote Link to comment Share on other sites More sharing options...
Daralima Posted January 1, 2021 Share Posted January 1, 2021 Making the alpha 254 worked, thanks! Quote Link to comment Share on other sites More sharing options...
n_n Posted January 15, 2021 Share Posted January 15, 2021 On 12/31/2020 at 9:57 AM, Allen Shau said: Manually creating a file named C:\Users\(you)\Documents\paint.net User Files\BrushFactorySettings.xml works for me. ----- begin of BrushFactorySettings.xml ----- <BrushFactorySettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> </BrushFactorySettings> ----- end of BrushFactorySettings.xml ----- Yeah, that fixed it for me too but I'm still missing those: Quote Link to comment Share on other sites More sharing options...
ardneh Posted January 15, 2021 Share Posted January 15, 2021 Those are all pyrochild plugins. Probably should post the question there. 1 Quote Link to comment Share on other sites More sharing options...
n_n Posted January 15, 2021 Share Posted January 15, 2021 Oh whoops. For some reason I thought those were part of brush factory. Well in that case i didn't mean to ask it here. Quote Link to comment Share on other sites More sharing options...
pdn_user999 Posted March 5, 2021 Share Posted March 5, 2021 (edited) Hi, I am having issues with the "use clipboard as background" feature within Brush Factory. I am finding that my clipboard image is being copied through but only a clipped version of it appears in Brush Factory. I have tried experimenting with this a bit further and find that having my image in the first quarter of my canvas pulls the image through completely but when I proceed to use a brush and click ok to exit BF, the produced brush does not line up as it did within BF. Any suggestions? Would be grateful for any help with this. Thanks. Apologies if I am doing this post wrong with the pictures. Long time user of PDN but never had to use the forum. Edited March 5, 2021 by pdn_user999 reorder images Quote Link to comment Share on other sites More sharing options...
Roly Poly Goblinoli Posted March 6, 2021 Author Share Posted March 6, 2021 8 hours ago, pdn_user999 said: Hi, I am having issues with the "use clipboard as background" feature within Brush Factory. I am finding that my clipboard image is being copied through but only a clipped version of it appears in Brush Factory. I have tried experimenting with this a bit further and find that having my image in the first quarter of my canvas pulls the image through completely but when I proceed to use a brush and click ok to exit BF, the produced brush does not line up as it did within BF. Any suggestions? Would be grateful for any help with this. Thanks. Apologies if I am doing this post wrong with the pictures. Long time user of PDN but never had to use the forum. I tried different canvas to background image sizes, and the background image always stretched to the canvas as it should. I'm not sure why the image isn't growing/shrinking to fit the canvas. If you can start over from scratch, and meticulously list everything you do to get this problematic behavior to occur, I could hopefully follow those steps to get a better idea what the cause might be so I can fix it. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted March 7, 2021 Share Posted March 7, 2021 On 3/6/2021 at 9:01 AM, pdn_user999 said: Any suggestions? Are you running multiple monitors, monitor management software, or a setup which use different DPI settings on your monitors? I'm asking these questions because there may be a DPI or scaling issue there somewhere. 1 Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
pdn_user999 Posted March 7, 2021 Share Posted March 7, 2021 6 hours ago, Ego Eram Reputo said: Are you running multiple monitors, monitor management software, or a setup which use different DPI settings on your monitors? I'm asking these questions because there may be a DPI or scaling issue there somewhere. Hi, no, I am doing this on my laptop. No other screens connected. Quote Link to comment Share on other sites More sharing options...
pdn_user999 Posted March 7, 2021 Share Posted March 7, 2021 On 3/6/2021 at 4:53 AM, Joshua Lamusga said: I tried different canvas to background image sizes, and the background image always stretched to the canvas as it should. I'm not sure why the image isn't growing/shrinking to fit the canvas. If you can start over from scratch, and meticulously list everything you do to get this problematic behavior to occur, I could hopefully follow those steps to get a better idea what the cause might be so I can fix it. Hi, thanks for your reply. I will have a fresh run through this today. I will also try restarting my laptop incase that has anything to do with it. I will update you once I have had a chance to do this. Thanks. 1 Quote Link to comment Share on other sites More sharing options...
pdn_user999 Posted March 8, 2021 Share Posted March 8, 2021 On 3/6/2021 at 4:53 AM, Joshua Lamusga said: I tried different canvas to background image sizes, and the background image always stretched to the canvas as it should. I'm not sure why the image isn't growing/shrinking to fit the canvas. If you can start over from scratch, and meticulously list everything you do to get this problematic behavior to occur, I could hopefully follow those steps to get a better idea what the cause might be so I can fix it. Hi Joshua, I had another go at making this happen last night after restarting my PC. However, the results were no different. My steps are as below: 1. Open image saved on my computer 2. Copy layer (where image sits) 3. Create new layer 4. Effects>Tools>Brush Factory 5. On opening BF, I tend to always get this error msg "Brush Factory (Version 2.0) Your custom brushes could not be loaded. You can try defining them again." - which I always click ok. 6. Right click on transparent space and select "Use clipboard image as background". After this I get a zoomed in and clipped version of the clipboard image. Since trying this a number of times and with different images, I notice the canvas size tends to be the same with the BF canvas size which I would say makes sense. However, when I right click and select to use clipboard image as background, it seems to be scaling the image disproportionately on my device for some reason (like images in my previous post for example) instead of pasting the exact image from clipboard. Hope this helps. If you need details about my PC or OS, I am using PDN on a Windows 10 Laptop. Thank you. Quote 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.