picture home | art | events | music | rack extensions | downloads | pixel blog

omino pixel blog

pixels, motion, and scripting
entries for category "after effects"
david van brink // Fri 2023.09.8 21:26 // {after effects}

OminoLuaNote[4]: Fonts and Files

This omino lua script shows two features. First, how to load a font file with ca:addFont(path). If successful, returns an integer zero or greater which is the index to use in ca:textSetFont(). If unsuccessful, -1.

Second, it shows how to read a text file into a lua string variable. The script here prints the beginning of the string, increasing by frame number.

The rendered video below shows the parameters animated. In the case of text size, it doesn’t animate very smoothly! (The text renderer snaps to pixels for better readability.) So if you want an animated text size, better to resize the whole layer.

function render(ca, cv)
  local fi = ca:addFont('/Library/Fonts/LithosPro-black.otf')
  local sz = cv.float0
  if sz < 10 then sz = 10 end
  ca:textSetSize(sz)
  ca:textSetPoint(10,sz)
  ca:textSetFont(fi)
  ca:textSetAngle(cv.float1)
  ca:textSetPoint(cv.point0)

  local s = omReadFile('/Users/poly/Desktop/swText.txt')
  s = string.sub(s,1, cv.frame)

  ca:textPrint(s)
end

function updateControls(cn, cv)
  cn:hideAll()
  cn.float0 = 'fontSize'
  cn.float1 = 'textRotation'
  cn.point0 = 'textPoint'
end
oh, i dont know. what do you think?


david van brink // Wed 2023.09.6 12:56 // {after effects}

OminoLuaNote[3]: Builtin Values

omino lua provides several useful builtin values. They are in the two arguments of the render() function. The first argument, the canvas, is responsible for drawing text and graphics, and has graphical information. The second argument, the control values, has the visible sliders and checkboxes and such, plus a few extras.

function render(ca, cv)
  local sz = 22
  ca:textSetSize(sz)
  ca:textSetPoint(10, sz + 10)
  ca:textSetColor(cv.color0.i)
  ca:textSetFont(1)

  ca:textPrint('canvas\n')
  ca:textPrint(sprintf(' width: %d\n', ca.width))
  ca:textPrint(sprintf(' height: %d\n', ca.height))
  ca:textPrint('\n')
  ca:textPrint('controlValues\n')
  ca:textPrint(sprintf(' frame: %d\n', cv.frame))
  ca:textPrint(sprintf(' time: %f\n', cv.time))
  ca:textPrint(sprintf(' fps: %f\n', cv.fps))
  ca:textPrint(sprintf(' project path: %s\n', cv.projectPath))
  ca:textPrint(sprintf(' version: %s\n', cv.version))

  local pp = cv.projectPath
  local lastSlash = string.find(pp, '/[^/]*$')
  local lastDot = string.find(pp, '%.[^%.]*$')
  local dir = string.sub(pp, 1, lastSlash)
  local file = string.sub(pp, lastSlash+1)
  local name = string.sub(pp, lastSlash+1,lastDot-1)

  ca:textPrint('\n')
  ca:textPrint(sprintf(' dir: %s\n', dir))
  ca:textPrint(sprintf(' file: %s\n', file))
  ca:textPrint(sprintf(' name: %s\n', name))
end

Here we see that ca.width and ca.height have the dimensions of the solid layer that has the effect. Cooridnates in omino lua are always at natural resolution, even when rendering is downsampled by half or more.

And cv, the control values, has the current frame and time within the layer (not the comp), and the frame rate.

We can also see the project path here. That’s maybe nice for watermarking your renders or something. But it will also be useful for data-driven projects where you provide a data file, and want to keep it next to your After Effects project file. Oh yes, omino lua can read files!

Lastly, we see an example of Lua’s regular expressions, lastDot = string.find(pp, ‘%.[^%.]*$’). This looks for a dot, followed by not-dots until the end of the line. Lua’s REs differ from many by using the percent-sign as the literal escape, and indexes start from 1, and ranges are inclusive.

oh, i dont know. what do you think?


david van brink // Mon 2023.09.4 23:22 // {after effects}

OminoLuaNote[2]: Naming Controls

omino lua presents a grab-bag of controls that your script can use. Here they are:

Here’s a short script which shows omino lua‘s text drawing, and uses controls to set the font size, color, and location.

function render(ca, cv)
  ca:textSetPoint(cv.point0)
  ca:textSetSize(cv.float0)
  ca:textSetAngle(cv.float1)
  ca:textSetColor(cv.color0.i)
  ca:textPrint(sprintf('frame %d',cv.frame))
end

And a screen shot of it in action.

Only four of the controls do anything; the rest are unused. And the names color0 and float1 are not helpful either. So you can a second function to your script to help with this.

function updateControls(cn, cv)
  cn:hideAll()
  cn.float0 = 'text size'
  cn.float1 = 'text angle'
  cn.color0 = 'text color'
  cn.point0 = 'text location'
end

It starts by disabling and hiding all the controls, and then naming just the several we’d like to see. (They cannot be reordered.) And it looks like this:

Now the controls make sense! This is valuable for whoever is using that script, whether it’s yourself or another team member.

3 comments
hanneesh // Wed 2024.01.3 19:577:57 pm

Is there a reason why the windows 64 version 2.1 omino diffusion has disappeared?

david van brink // Thu 2024.01.4 21:229:22 pm

Hi Hanneesh — on the downloads page off the link “older releases”

https://omino.com/store/downloads/

But I haven’t used it in a while, hopefully it still works!

Best //dvb

venny // Fri 2024.01.19 15:393:39 pm

Hello!

I wanted to ask, if it might be possible, to update the “Omino” Plugin for Windows 64-bit for After Effects 2023 and 2024? Because, unfortunately, the Plug-in, does not work for those 2 Versions!

It would be great if you could maybe update the Plug-in.

oh, i dont know. what do you think?


david van brink // Sun 2023.09.3 15:21 // {after effects}

OminoLuaNote[1]: Your First Rectangles

I’ll be jotting out a couple of notes to help explain the omino lua After Effects plug-in.

To get started, drag omino_lua.plugin into the After Effects Plug-ins folder. (Oh, it’s macOS only for now. Windows in future.)

Then launch After Effects, create a comp, a solid layer, and apply omino lua effect to it. It will have a default script in it, which you can peruse, but in this post we’ll start from scratch. So, first we’ll have to clear the editor. Just click and drag and hit backspace, on the script control area, just like any text editor.

Then try out this code, to draw the brown rectangle shown afterwards:

function render(ca, cv)
  ca:rect(0xff004090, 100,150, 200,300)
end

What’s all this.
ca is the canvas object, it does drawing
ca:rect() is the lua style to execute a method of the canvas
0xff004090 is a color number similar to HTML color hex. The digits are 0xAABBGGRR.
100,150, 200,300 is the xy coordinate for the top-left of the rectangle 100,150, and its dimensions 200,300.

But! You can also control your script with controls. omino lua has sliders, colors, points, &c. This next version uses cv, the control values.

function render(ca, cv)
  ca:rect(cv.color0.i,
          cv.point0.x,
          cv.point0.y,
          200,300)
end

And that’s some of the beginnings of using omino lua!

1 comments
tot // Sun 2023.09.3 19:337:33 pm

Pls god bring it back to windows this is my favorite plug in and i wanna play with the new versions but i don’t own a mac 🙁

oh, i dont know. what do you think?



Deprecated: Function the_block_template_skip_link is deprecated since version 6.4.0! Use wp_enqueue_block_template_skip_link() instead. in /home/polyomino/omino.com/pixelblog/wp-includes/functions.php on line 6114

0.0346s
(c) 2003-2023 omino.com / contact poly@omino.com