美文网首页
MotionBuilder Python Script23 -

MotionBuilder Python Script23 -

作者: Houdinini | 来源:发表于2021-06-20 21:37 被阅读0次
差点彻底断掉

自从3月份更新了一篇之后就又断掉了,对于现在的UI例子文档只不过是录个gif再贴上官方代码,非常简单的事竟然会持续断更,罪过罪过...

之后尽量把这套example的代码贴完!

一、RadioButton

单选按钮控件

先看一下UI效果


Radiobox Example.gif

再看一下效果实现的代码

# 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 with radio buttons and show how to manage them with a FBButtonGroup.
#
# Topic: FBAttachType, FBButtonStyle, FBButton, FBButtonGroup
#

from pyfbsdk import *
from pyfbsdk_additions import *

def BtnRadioCallback(control, event):
    print control.Caption, " has been clicked!"

def PopulateLayout(mainLyt):
    group = FBButtonGroup()
    group.AddCallback(BtnRadioCallback)
    anchor = ""
    attachType = FBAttachType.kFBAttachTop
    
    for i in range(5):
        name = "BtnRadio " + str(i)
        b = FBButton()
        group.Add(b)
        
        b.Caption = name
        b.Style = FBButtonStyle.kFBRadioButton
    
        x = FBAddRegionParam(10,FBAttachType.kFBAttachLeft,"")
        y = FBAddRegionParam(10,attachType,anchor)
        w = FBAddRegionParam(100,FBAttachType.kFBAttachNone,"")
        h = FBAddRegionParam(25,FBAttachType.kFBAttachNone,"")
    
        mainLyt.AddRegion(name,name, x, y, w, h)
    
        mainLyt.SetControl(name,b)
                
        attachType = FBAttachType.kFBAttachBottom
        anchor = name

def CreateTool():    
    # Tool creation will serve as the hub for all other controls
    t = FBCreateUniqueTool("Radiobox Example")
    
    PopulateLayout(t)    
    ShowTool(t)


CreateTool()

二、结语

有问题可以留言~

共勉!

相关文章

  • MotionBuilder Python Script23 -

    自从3月份更新了一篇之后就又断掉了,对于现在的UI例子文档只不过是录个gif再贴上官方代码,非常简单的事竟然会持续...

  • MotionBuilder Python Tools - Ren

    回归来更新一个重命名插件 Renamer 参考3dsmax重命名工具,添加了motionbuilder的重命名插件...

  • MotionBuilder Python Script18 -

    今天学习了一部分导入流程,写完这篇就整理整理 今天我们来看一下UI中最常用的控件 Label 一、Label 标签...

  • MotionBuilder Python Script17 -

    这几天成都的空气变得异常焦灼,但总比整天沉着脸好! 今天我们来看一下MotionBuilder里的 ImageCo...

  • MotionBuilder Python Script08 -

    今天我们来看一下怎么实现Motionbuilder中的close事件! 一、CloseTool How to sh...

  • MotionBuilder Python Script09 -

    最近发现了咪咕音乐可以听周杰伦的歌 我们再来看一下MoBu中的Container的实现,与之前的BoxLayout...

  • MotionBuilder Python Script11 -

    周末了,放个假休息休息,就再来更新一篇! 之前介绍的脚本以"脚本的感觉"来实现的,今天我们来介绍一下"系统级别"的...

  • MotionBuilder Python Script10 -

    昨天走的早,忘了写东西。。惭愧! 今天我们来看一下MotionBuilder的Edit 的部分实现方法 一、Edi...

  • MotionBuilder Python Script14 -

    今天我们来看一下MotionBuilder中的 Editor Connection! 一、PropertyConn...

  • MotionBuilder Python Script13 -

    搞了一天猴,还没搞定,难受 昨天讲了MessageBox的一些内容,今天我们再来看看MotionBuilder中M...

网友评论

      本文标题:MotionBuilder Python Script23 -

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