MotionBuilder Python Script15 - UI_FCurveEditor

一定要坚持!

这个系列还没正式开始就差点又要死在我的懒惰里,反省!

今天周五了,明天又要放假了,我们再来看一看MoBu中曲线编辑器的调用

一、CurveEditor

曲线编辑器

先来看一下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 with a FCurve editor and shows how to create an interpolator fcurve
# and sets its
#
# Topic: FBAnimationNode, FBFCurve, FBFCurveEditor
#

from pyfbsdk import *
from pyfbsdk_additions import *

AnimationNode = None


def PopulateLayout(mainLyt):
    # create Spread
    Editor = FBFCurveEditor()

    x = FBAddRegionParam(0, FBAttachType.kFBAttachLeft, "")
    y = FBAddRegionParam(0, FBAttachType.kFBAttachTop, "")
    w = FBAddRegionParam(0, FBAttachType.kFBAttachRight, "")
    h = FBAddRegionParam(0, FBAttachType.kFBAttachBottom, "")

    mainLyt.AddRegion("FCurveEditor", "FCurveEditor", x, y, w, h)

    mainLyt.SetControl("FCurveEditor", Editor)

    AnimationNode = FBAnimationNode("Test")
    FCurve = FBFCurve().CreateInterpolatorCurve(FBInterpolatorCurveType.kFBInterpolatorCurveSmoothOut)
    AnimationNode.FCurve = FCurve
    Editor.AddAnimationNode(AnimationNode)
    FCurve.FBDelete()


def CreateTool():
    # Tool creation will serve as the hub for all other controls
    t = FBCreateUniqueTool("FCurve editor sample")

    t.StartSizeX = 300
    t.StartSizeY = 300

    PopulateLayout(t)
    ShowTool(t)


CreateTool()

敲一敲,decomposition and refactor !

二、结语

有什么问题可以留言

做事情一定要坚持!

继续!

共勉!!

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

推荐阅读更多精彩内容

  • 今天我们来看一下MotionBuilder中的 Editor Connection! 一、PropertyConn...
    Houdinini阅读 573评论 0 0
  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 11,148评论 1 32
  • 更新:这篇文章已经不推荐阅读,大家想了解 PHP 的设计模式,建议阅读这篇文章: https://laravel-...
    冰淤阅读 11,517评论 2 11
  • 左贡七点半,没有闹钟却准时醒来; 小刘和同房间那哥们在收拾东西。 我在犹豫是否要跟上,还是休整等待队友。 便先行去...
    Qian墨阅读 515评论 2 4
  • 时间:2017.02.16 地点:梵净山 人物:学生一枚 目的:世界那么大,我想去看看 感想:梵净山比较高,想去的...
    梦寻扶苏阅读 439评论 2 2