/*** Hacking Movie ***/

かっこいいファンタジー映画をつくるまで。

Aftereffects に Python で。-omino-

Omino Python レビュー at AEP Projectによればominoでテキストファイルを読み込んで行ごとにテキストを表示させたり出来るとのこと。

とりあえずダウンロード。
omino downloads

omino python documentationをみると
f:id:katososuke:20140107231425p:plain
とりあえずsample開いてみる。

ompy41: fields_of_c

テキスト系のサンプルをぱっと見た感じ「ompy41: fields_of_c」。みてみる。



f:id:katososuke:20140107235136p:plain


omino python というエフェクトでパラメータが上の感じで結果が下の感じ。



ompy41 fields of c


folderでpythonファイルのあるフォルダを指定して
「ompy##.py」という命名規則でパラメータが「41」なので
ompy41.pyをみてみる


# +----------------------
# | local utility to print a line, and advance downword
# |
def printLine(ob,s):
    ob.ctx.set_font_size(ob.size)

    # draw once
    ob.ctx.set_source_rgb(ob.color1.r,ob.color1.g,ob.color1.b)
    ob.ctx.move_to(ob.p0.x + 1,ob.p0.y + 1)
    ob.ctx.show_text(s)

    # draw again
    ob.ctx.set_source_rgb(ob.color0.r,ob.color0.g,ob.color0.b)
    ob.ctx.move_to(ob.p0.x,ob.p0.y)
    ob.ctx.show_text(s)
    ob.p0 = ompy_point(ob.p0.x,ob.p0.y + ob.size)
    return


def ompy_main(c):
    # +-------------------------------------------------
    # | This script shows some of the misc features
    # | of Omino Python
    # |
    # | Especially, notice that we use the same font size
    # | and move_to coordinates, and get correct behavior
    # | for non-square pixels and for reduced-resolution
    # | preview in the composition
    #
    ctx = c.layer_out_context

    p0 = c.points[0]
    size = c.floats[0]
    if(size < 12): size = 12.0


    ob = ompy_object()
    ob.color0 = c.colors[0]
    ob.color1 = c.colors[1]
    ob.ctx = ctx
    ob.size = size
    ob.p0 = p0

    printLine(ob,"ompy_main(c)...")
    printLine(ob,"c.script_path = %s" % c.script_path)
    printLine(ob,"c.downsample_x = %s" % c.downsample_x)
    printLine(ob,"c.downsample_y = %s" % c.downsample_y)
    printLine(ob,"c.width = %s" % c.width)
    printLine(ob,"c.height = %s" % c.height)
    printLine(ob,"c.layer_out_surface.get_width() = %s" % c.layer_out_surface.get_width())
    printLine(ob,"c.layer_out_surface.get_height() = %s" % c.layer_out_surface.get_height())
    printLine(ob,"c.time = %s" % c.time)
    printLine(ob,"c.frame = %s" % c.frame)
    printLine(ob,"")
    printLine(ob,"(change the pixel aspect ratio, & resolutions...)")

# end of file


んーとくにフォントは指定してないのかな?

フォントさえ指定できれば、あとはゴリゴリ書いてできそう。

フォント指定できるか時間あるときdocumentもっと読んでみよう。