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

MotionBuilder Python Script15 -

作者: Houdinini | 来源:发表于2019-08-02 20:53 被阅读1次
一定要坚持!
这个系列还没正式开始就差点又要死在我的懒惰里,反省!

今天周五了,明天又要放假了,我们再来看一看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 Python Script15 -

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