Jump to content

Feature Request: Math in Property Input Fields


Recommended Posts

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

midoras signature.gif

Link to comment
Share on other sites

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 by NinthDesertDude
Link to comment
Share on other sites

  • 1 year later...
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.

Link to comment
Share on other sites

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.

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

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?

 

Link to comment
Share on other sites

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

  • Thanks 1
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...