From Lua to Python Guide

General

Most Lua functions or methods have a direct equivalent in Python.

Mixing Lua and Python

To convert a lua value/object in python:

fromLua(foo)

To convert a python value/object in lua:

toLua(foo)

Modifier

To start a modification:

with Modifier() as mod:
    pass # perform operations using mod

Later if you want to retrieve the current modification context:

mod = Modifier.get()

See also

guerilla.Modifier for details

Document

Retrieve scene filename:

d = Document(); d.filename

Retrieve Preference node:

d = Document(); p = d.Preferences

Perform scene manipulation:

  • new()

  • save()

  • load()

Node

New Object properties:

  • name()

  • path()

  • parent()

New Object iterators:

  • plugs()

  • children()

New Object methods:

  • hasAttr()

  • hasPlug()

  • hasChild()

Object methods (use the current Modification context):

  • create()

  • createplug()

  • rename()

Plug

New Object properties:

  • name()

  • parent()

New Object methods:

  • connections()

  • dependencies()

  • hastype()

  • isreadonly()

Object methods (use the current Modification context):

  • connect()

  • adddependency()

  • disconnect()

  • touch()

command

A command in Guerilla can be created by subclassing the command class and implementing:

  • isenabled()

  • action()

See also

guerilla.command for an example.