工具癖

MotionBuilder Python Script04 -

2019-07-21  本文已影响2人  Houdinini
Continue!

今天更新UI的border内容

一、Border

Border是指UI布局的分割线,即边界

来看一下UI效果


会看到有在Motionbuilder中有比较全或的border

这样在设置UI布局的时候有比较清晰的边界线,官方代码如下:

#!/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 that shows how to specify attach in a FBLayout
#
# Topic: FBAttachType, FBLayout

from pyfbsdk import *
from pyfbsdk_additions import *


# Tool creation will serve as the hub for all other controls
t = FBCreateUniqueTool("Attach Example")

b = FBButton()
b.Caption = "But"

# Create a button that is left justify
x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
# ... and at the top of the layout.
y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
# its width is fixed at 40 pixels
w = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
# and its height is fixed at 40 pixels
h = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
t.AddRegion("Btn","Btn", x, y, w, h)
t.SetControl("Btn",b)

b2 = FBButton()
b2.Caption = "But2"

# Create a button that is situated to the right of the region "Btn"
x1 = FBAddRegionParam(5,FBAttachType.kFBAttachRight,"Btn")
# attach to the top of the layout
y1 = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
# its width is fixed at 40 pixels
w1 = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
# and its height is fixed at 40 pixels
h1 = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
t.AddRegion("Btn2","Btn2", x1, y1, w1, h1)
t.SetControl("Btn2",b2)

b3 = FBButton()
b3.Caption = "But3"

# Create a button that Right justify in the FBLayout.
# since the x Region param sets the left corner of the controls
# we need to offset the attach by -45 pixels so the button is shown.
x3 = FBAddRegionParam(-45,FBAttachType.kFBAttachRight,"")
y3 = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
w3 = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
h3 = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
t.AddRegion("Btn3","Btn3", x3, y3, w3, h3)
t.SetControl("Btn3",b3)

b4 = FBButton()
b4.Caption = "But4"

# create a button that is situated at the left of region "Btn3".
# we need to offset it by -45 pixels so it doesn't overlap Btn3
x4 = FBAddRegionParam(-45,FBAttachType.kFBAttachLeft,"Btn3")
y4 = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
w4 = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
h4 = FBAddRegionParam(40,FBAttachType.kFBAttachNone,"")
t.AddRegion("Btn4","Btn4", x4, y4, w4, h4)
t.SetControl("Btn4",b4)

ShowTool(t)

大家执行一下试一试,decomposition and Restructure!

二、结语

大家继续加油!

共勉!

上一篇下一篇

猜你喜欢

热点阅读