这几天成都的空气变得异常焦灼,但总比整天沉着脸好!
今天我们来看一下MotionBuilder里的 ImageContainer
一、ImageContainer
图片显示,or图片容器
我们先来看一下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 show how to specify an Image in a container
#
# Topic: FBImageContainer
#
from pyfbsdk import *
from pyfbsdk_additions import *
def PopulateLayout(mainLyt):
x = FBAddRegionParam(0, FBAttachType.kFBAttachLeft, "")
y = FBAddRegionParam(0, FBAttachType.kFBAttachTop, "")
w = FBAddRegionParam(50, FBAttachType.kFBAttachNone, "")
h = FBAddRegionParam(50, FBAttachType.kFBAttachNone, "")
mainLyt.AddRegion("main", "main", x, y, w, h)
img = FBImageContainer()
img.Filename = "tape/tape_play_off.png"
mainLyt.SetControl("main", img)
def CreateTool():
# Tool creation will serve as the hub for all other controls
t = FBCreateUniqueTool("Image Container Example")
PopulateLayout(t)
t.StartSizeX = 400
t.StartSizeY = 400
ShowTool(t)
CreateTool()
代码比较清晰,decomposition and refactor!
二、结语
坚持坚持坚持!
有什么问题可以留言
共勉!