ucupumar / ucupaint

Ucupaint is Blender addon to manage texture layers for Eevee and Cycles renderer.
GNU General Public License v3.0
874 stars 31 forks source link

"Toggle Eraser" button only works on brushes named "TexDraw" / "Draw" / "Paint" #57

Closed kobligo closed 4 months ago

kobligo commented 8 months ago

Ucupaint 1.1.0, Blender 3.6.5, Windows10

I would like to point out a general design flaw with the Toggle Eraser button. As can be seen in the execute() function in vcol_editor.py starting at line 112, Toggle Eraser makes oddly specific assumptions about the user's brush data. In the case that the standard brush ("TexDraw" / "Draw" / "Paint") has been deleted or renamed, the Toggle Eraser button does nothing and pressing it often results in an error pop-up.

Perhaps simply toggling the blend mode of the active brush would be safer than trying to get references to specific brushes that may or may not exist, especially when done without a null check or any other kind of precaution. The user will never understand what's wrong unless they look at the code.

ucupumar commented 8 months ago

Thanks for the report! I see, currently i can't access my pc so maybe you can create a pull request for fix so i can check it later.

kobligo commented 8 months ago

Turns out it's not as easy as I thought in terms of design. I do not understand your reasoning behind picking the "TexDraw" brush specifically, and I don't feel like I should mess with your "vision" for this Toggle button.

Was it part of your design that the user would always reserve the default TexDraw brush as a dedicated eraser? If you want a dedicated Eraser brush, why not have the add-on create one on the fly and name it "Eraser"? Why don't we use the current brush as an eraser and just toggle its blend mode?

ucupumar commented 8 months ago

I see, I just checked the code. The reason I use 'Texdraw', 'draw', and 'paint' is the brush name for each texture paint, vertex paint, and sculpt mode that has blend mode. The reason why don't I just create a new brush is my lack of experience with blender brush system because I always use the default one. My only vision is the solution should work on Blender 2.79 if possible, if it's not possible, just create an if else branching for each solution. If you want, maybe you can try to implement a new custom brush whenever the eraser toggle is on, I think you're already halfway there. 😀