
Continue!
今天我們來看一下MotionBuilder中的備忘錄。
一Memo
備忘錄
我們先來看一下UI效果

Memo
好像還真的是實(shí)現(xiàn)了備忘錄功能。。雖然好像可能也許并沒有任何的實(shí)際用處,但是并不妨礙我們看一下它的代碼
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2009 Autodesk, Inc. All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Create a tool witha Memo and shows how to sets its content
# and retrieve its lines.
#
# Topic: FBStringList, FBMemo
#
from pyfbsdk import *
from pyfbsdk_additions import *
def OnChange(control, event):
print control.Text
def PopulateLayout(mainLyt):
# create Spread
m = FBMemo()
x = FBAddRegionParam(0, FBAttachType.kFBAttachLeft, "")
y = FBAddRegionParam(0, FBAttachType.kFBAttachTop, "")
w = FBAddRegionParam(0, FBAttachType.kFBAttachRight, "")
h = FBAddRegionParam(0, FBAttachType.kFBAttachBottom, "")
mainLyt.AddRegion("memo", "memo", x, y, w, h)
mainLyt.SetControl("memo", m)
sl = FBStringList()
sl.Add("String 1")
sl.Add("String 2")
m.SetStrings(sl)
sl2 = FBStringList()
m.GetStrings(sl2)
print "printing string list"
for s in sl2:
print s
m.OnChange.Add(OnChange)
def CreateTool():
# Tool creation will serve as the hub for all other controls
t = FBCreateUniqueTool("Memo Example")
t.StartSizeX = 300
t.StartSizeY = 300
PopulateLayout(t)
ShowTool(t)
CreateTool()
decomposition and refactor!
二、結(jié)語(yǔ)
繼續(xù)!
共勉!
有什么問題可以留言!