ほとんどの部分で、Python スクリプトをボタンに関連付ける操作は、他のスクリプト言語と同様です。任意のコマンドをボタンに割り当てることができ、Script Editor からコード断片をツールバー上にドラッグすると、Softimage はコード断片からコマンドへの変換を処理します。
コマンドまたはコード内でクラスを使用することもできます。ただし、クラス コンストラクタをコマンドのハンドラとして使用することはできません。 クラスを初期化するには、次の例のようにダミー プロシージャを使用します。
#-------------------------------------------------------------------------
class MyMsg:
"""Testing of Classes within Softimage Environment"""
def __init__(self, First="3D", Last="Artist"):
self.f = First
self.l = Last
Application.LogMessage("Hello, %s %s, MyMsg!" %(self.f, self.l))
def first(self):
Application.LogMessage("%s, First Method is a go!" % (self.f))
def second(self):
Application.LogMessage("%s, Second Method is a go!" %(self.f))
def third(self):
pass
#-----------------------------------------------------------------------
#initialize the class and methods
def TestPython():
parent = MyMsg("Daffy", "Duck")
parent.first()
parent.second()
#-----------------------------------------------------------------------