MotionBuilder Python Script17 - UI_ImageContainer

你若安好,便是晴天

这几天成都的空气变得异常焦灼,但总比整天沉着脸好!

今天我们来看一下MotionBuilder里的 ImageContainer

一、ImageContainer

图片显示,or图片容器

我们先来看一下UI效果


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!

二、结语

坚持坚持坚持!

有什么问题可以留言

共勉!

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 13,801评论 1 32
  • 周末了,放个假休息休息,就再来更新一篇! 之前介绍的脚本以"脚本的感觉"来实现的,今天我们来介绍一下"系统级别"的...
    Houdinini阅读 4,247评论 0 0
  • 今天周五了,明天又要放假了,我们再来看一看MoBu中曲线编辑器的调用 一、CurveEditor 曲线编辑器 先来...
    Houdinini阅读 3,909评论 0 0
  • 还是托更了,前两天专注于新家打扫,之后又重新接到了一些耗时的任务,不知不觉竟然将近5天没有更新,还是没有把小事做好...
    Houdinini阅读 4,385评论 0 0
  • 《笑面人》是由雨果在1869年写成的长篇小说,以17世纪末18世纪初的英国社会为背景。写爵士后代格温普兰成为宫廷阴...
    DRL阅读 3,836评论 0 0