quickSuggestion Posted December 14, 2021 Share Posted December 14, 2021 We should be able to do math in any property input fields (ex. typing in 14*40 for width would yield 560, 500/2 would yield 250, etc). I don't believe it's possible to do this through plugins, and many other programs have this feature. 2 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 14, 2021 Share Posted December 14, 2021 Can you give an example of another program that supports this? I've never seen it myself 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...
midora Posted December 14, 2021 Share Posted December 14, 2021 (edited) I'm allowing this in some of my applications but you are forced to start the expression with an '=' operator (like in excel cells). BTW: OptionBased allows to add a default unit to the creation of a control (plus mappings for alternative units with factors for scaling and offset). The value will always be returned in the default unit. I.e. the Parallel lines and patterns plugin allows you to enter values in px, mm, cm, in, and pt (the tooltip shows the values in all units). Edited December 14, 2021 by midora Quote Link to comment Share on other sites More sharing options...
NinthDesertDude Posted December 14, 2021 Share Posted December 14, 2021 (edited) 1 hour ago, Rick Brewster said: Can you give an example of another program that supports this? I've never seen it myself It's in a few, like Blender. Of course, Blender is a massive super-project so I'm not sure that counts. It's nifty; I'm not sure how important it is to support here since unlike Blender, PDN isn't rife with exact editing of sliders. If it should be anywhere, I'd say the rgb and hsv boxes in the color window make the most sense of all Edited December 14, 2021 by NinthDesertDude Quote Link to comment Share on other sites More sharing options...
753 Posted May 4 Share Posted May 4 On 12/14/2021 at 11:03 AM, Rick Brewster said: Can you give an example of another program that supports this? I've never seen it myself Gimp, Blender, and Unity all support this feature. It's especially useful for game design where you'll often need to adjust things by exact ratios or powers of 2. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted May 5 Share Posted May 5 19 hours ago, 753 said: Gimp, Blender, and Unity all support this feature. Looks like Krita does as well. If someone knows of an example of how to implement this in WinForms, that would speed up being able to add this. 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...
BoltBait Posted May 5 Share Posted May 5 2 hours ago, Rick Brewster said: If someone knows of an example of how to implement this in WinForms This looks like overkill*: https://github.com/dynamicexpresso/DynamicExpresso Maybe something like this: https://stackoverflow.com/questions/17183314/mathematical-expression-entered-in-one-text-box-and-display-its-result-in-other/17184090#17184090 Might need to add ( ) and make it recursive though. * Of course, with this you could define variables, like Selection.Width, Selection.Height, Canvas.Width, Canvas.Height, etc. which would be pretty cool. But, would this open security risks with interpreted code? Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Disk4mat Posted May 5 Share Posted May 5 Im only asking out of ignorance. What might be a scenario where you could use this? Im thinking things like 10*50... Why not type in 500? So Im sure that this whole thing is going over my head some how. TIA Quote Link to comment Share on other sites More sharing options...
NinthDesertDude Posted May 6 Share Posted May 6 > Im thinking things like 10*50... Why not type in 500? easy, 47 * 23. Annoying enough that a calculator is much easier. If you struggle to find something, I did basic math parsing once with infix notation in https://github.com/NinthDesertDude/SharpParser which does allow simple functions, but also has a version that doesn't. Maybe it's useful 1 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.