美文网首页工具癖
MotionBuilder Python Script17 -

MotionBuilder Python Script17 -

作者: Houdinini | 来源:发表于2019-08-11 14:51 被阅读20次
    你若安好,便是晴天

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

    今天我们来看一下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!

    二、结语

    坚持坚持坚持!

    有什么问题可以留言

    共勉!

    相关文章

      网友评论

        本文标题:MotionBuilder Python Script17 -

        本文链接:https://www.haomeiwen.com/subject/ebfsjctx.html