Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NODES] Simple math operations in numeric input fields #472

Open
prokoudine opened this issue Feb 10, 2019 · 6 comments
Open

[NODES] Simple math operations in numeric input fields #472

prokoudine opened this issue Feb 10, 2019 · 6 comments
Labels
Low Priority Nodes/Compositing Usage of nodes for compositing

Comments

@prokoudine
Copy link
Contributor

It's quite useful to have basic math operations in numeric input fields in cases when you know exactly by how much you want to change a value.

Here is how it works e.g. in GIMP:

  1. Place the cursor after the last number in the numeric input field
  2. Type +231, or -7643, or *3, or /28
  3. Press Tab to compute
  4. The original value in the input field then gets replaced with the computed value
@alcomposer
Copy link
Contributor

alcomposer commented Feb 10, 2019

Blender has a great way of doing this, also allows other variable's to be used, (such as frame).
In order to tell Blender that a user wants a scripted driver a # is used.

Such an expression could be: #sin(frame).

I can straight away think of a few very useful variables:
frame frame number of clip
sframe frame number of sequence
length length of clip which effect is on

With frame & length a user could easily make a ken burns effect for example, which dynamically responds to editing. Only issue I can see is how to deal with transitions? frame would have to start from beginning of transition, not clip.

@prokoudine
Copy link
Contributor Author

@alcomposer Yeah, I left it out for simplicity's sake, but yes — GIMP does that sort of thing too (e.g. 1000px + 2cm, or 700+2%), and it's useful indeed. 'frame', 'sframe', and 'length' look good to me :)

@capezotte
Copy link
Contributor

Some more I can think of are height, width and their s- prefixed versions, for doing operations that might depend on clip/sequence dimensions.

However, one should think, how this would work (or not) with keyframes? And would it be animatable? (ex: compute #sin(frame) every frame)

@alcomposer
Copy link
Contributor

alcomposer commented Feb 10, 2019

@oc1024 obviously this is a long term idea. If you check out Blender, yes #sin(frame) would be calculated for every frame.)

If this was to work with keyframes then there would need to be another keyword: keyframe.
The keyframe keyword would allow a user to feed the keyframed value into the field. Something like:

#keyframe+sin(frame) would add a wobble to the keyframed animation.

@dma3000
Copy link

dma3000 commented Feb 17, 2019

I think it would be convenient to do the simplest mathematical operations to change the time on the timeline when the video is being edited. Just as implemented in a blender VSE.

@frink
Copy link

frink commented Mar 4, 2019

This is where GLSL may be better as a scripting language because of its context of computing per frame pixel. While sin, cos, and tan may be interesting for some scenarios. Easing functions that handle tweening may be much easier to understand and implement than hard core inline math. This is the way that CSS went after having hardcore math in Flash. In the end most artistic types just weren't that handy with calculating computation. Easing functions were easier to understand...

@itsmattkc itsmattkc added Low Priority Nodes/Compositing Usage of nodes for compositing and removed Feature Request labels Sep 13, 2020
@itsmattkc itsmattkc changed the title Simple math operations in numeric input fields [NODES] Simple math operations in numeric input fields Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Low Priority Nodes/Compositing Usage of nodes for compositing
Projects
None yet
Development

No branches or pull requests

6 participants