Jump to content
How to Install Plugins ×

Dynamic Draw v4.0 (7/25/24)


Recommended Posts

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.

Link to comment
Share on other sites

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.

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

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.

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

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 by Joshua Lamusga
  • Like 2
Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

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:

image.png

 

  • Upvote 1

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

@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 by toe_head2001
  • Like 2
  • Upvote 3

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

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 -----

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...
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:
 

Unbenannt.PNG

Link to comment
Share on other sites

  • 1 month later...

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.

 

 

 

 

 

 

Attempt 1_Canvas Before BF.JPG

Attempt 1_in BF.JPG

Attempt 2_Canvas Before BF.JPG

Attempt 2_in BF.JPG

Attempt 2_Result.JPG

Edited by pdn_user999
reorder images
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Upvote 1
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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. 

  • Upvote 1
Link to comment
Share on other sites

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.

 

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...