今天我们来看一下MotionBuilder中的 Editor Connection!
一、PropertyConnectioneEditor
衔接编辑器,进行属性操作
先来看一下UI效果
UI_FBMConnectionEditor.gif
这里展示了选择和remove,以及Remove All,来看一下代码
#!/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:
# Shows how to use a FBPropertyConnectionEditor to edit FBPropertyListObject of an object
#
# Topic: FBPropertyConnectionEditor, FBTool
#
from pyfbsdk import *
from pyfbsdk_additions import *
def PopulateLayout(mainLyt):
x = FBAddRegionParam(0, FBAttachType.kFBAttachLeft, "")
y = FBAddRegionParam(0, FBAttachType.kFBAttachTop, "")
w = FBAddRegionParam(0, FBAttachType.kFBAttachRight, "")
h = FBAddRegionParam(0, FBAttachType.kFBAttachBottom, "")
global lConnEditor
lConnEditor = FBPropertyConnectionEditor()
mainLyt.AddRegion("main", "main", x, y, w, h)
mainLyt.SetControl("main", lConnEditor)
# Create Dummy cube that you will be able to set as Camera "Interest": Look at object
cube = FBModelCube("mycube")
# Create Camera
camera = FBCamera("mycamera")
camera.Interest = cube
# IMPORTANT: a FBPropertyConnectionEditor allow edition of a FBPropertyListObject in an object.
# A FBPropertyListObject is anywhere in the UI where you can specify another object as a "source".
# A good example is the "Interest" of a camera (see in the UI of a camera object).
# PYTHON IMPLEMENTATION NOTE:
# you CANNOT make lConnEditor.Property = camera.Interest
# This doesn't work because camera.Interest doesn't return the FBPropertyListObject, it returns
# the object referred by the property (in this case it's cube).
# To be able to get the PropertyListObject you need to use the .PropertyList.Find idiom.
# The name of this property is "Look At Object". You can see this name if you look in the Properties tab
# in the UI when the camera is selected.
lConnEditor.Property = camera.PropertyList.Find("Look At Object")
def CreateTool():
# Tool creation will serve as the hub for all other controls
t = FBCreateUniqueTool("PropertyConnectionEditor")
t.StartSizeX = 300
t.StartSizeY = 300
PopulateLayout(t)
ShowTool(t)
tool = CreateTool()
这里注释非常详细,decomposition and refactor!
二、结语
之后还是要即使自我督促, 不能忘了更新!
继续!
共勉!
网友评论