MotionBuilder Python Script20 -U

2019-08-14  本文已影响0人  Houdinini
Continue!
今天耗费了比较长的时间,但了解了软件以及状态切换流程,还是可以

今天我们来看一下MotionBuilder中的备忘录。

一Memo

备忘录

我们先来看一下UI效果


Memo

好像还真的是实现了备忘录功能。。虽然好像可能也许并没有任何的实际用处,但是并不妨碍我们看一下它的代码

#!/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!

二、结语

继续!

共勉!

有什么问题可以留言!

上一篇 下一篇

猜你喜欢

热点阅读