FCurve.NoKeyValue

説明

キーがない場合に F カーブの値を(Doubleとして)設定したり、戻したりします。

C#構文

// get accessor

Object rtn = FCurve.NoKeyValue;

// set accessor

FCurve.NoKeyValue = Object;

1. VBScript の例

'

'	This example demonstrates how to get the value of 

'	an FCurve when there are no keys.

'

set oCube = ActiveSceneRoot.AddGeometry("Cube","MeshSurface")

dim aValues

aValues = Array(0.00, 5.00, 1.00, 6.00, 2.00, 7.00, 3.00, 8.00, 4.00, 9.00, 5.00, 10.00)

set oFCurve = oCube.PosX.AddFCurve2( aValues)

LogMessage "FCurve NoKeyValue : " & oFCurve.NoKeyValue

' Outputs:

'INFO : FCurve NoKeyValue : 5

2. Python の例

# 

# This Python example illustrates how to create an fcurve and set the no key 

# value. This value is used when an fcurve is created with no keys. By default

# it is the value at the time the fcurve was created.

# 

# We try to import the Softimage constants from win32com.client. This assumes that

# the makepy.py utility has been used on the Softimage type library files (.tlb);

# this automatically installs the Softimage constants into win32com.client.constants

# 

from win32com.client import constants

from win32com.shell import shell

import pythoncom

# Define constants

try:

	siInfo = constants.siInfo

	siStandardFCurve = constants.siStandardFCurve

except:

	# typelib not found

	siInfo = 4

	siStandardFCurve = 20

# Create new scene

null = Application.NewScene("", 0)

# Create a null

null = Application.GetPrim("Null", "", "", "")

# Get the posx parameter from the null

posx = null.posx

# Set the value of posx; this will be the default nokeyvalue

posx.value =  10

val = posx.value

Application.LogMessage( 'posx.value before = ' + str(val), siInfo )

# Define an empty keys array

keys = []

# Create an fcurve on posx

fc = posx.AddFCurve2( keys, siStandardFCurve )

# Get the current nokeyvalue value

val = fc.NoKeyValue

Application.LogMessage( 'fc.NoKeyValue before = ' + str(val), siInfo )

# Set the fc nokeyvalue

fc.NoKeyValue = 2.5

val = fc.NoKeyValue

Application.LogMessage( 'fc.NoKeyValue after = ' + str(val), siInfo )

# Get the value of posx; should be the new nokeyvalue

val = posx.Value

Application.LogMessage( 'posx.value after = ' + str(val), siInfo )

# Test undo/redo

# Undo Set fc no key value 

Application.Undo()

val  = fc.NoKeyValue

Application.LogMessage( 'fc.NoKeyValue undo = ' + str(val), siInfo )

# Redo Set fc no key value 

Application.Redo()

val = fc.NoKeyValue

Application.LogMessage( 'fc.NoKeyValue redo = ' + str(val), siInfo )

# Produces the following output: 

#INFO : posx.value before = 10.0

#INFO : fc.NoKeyValue before = 10.0

#INFO : fc.NoKeyValue after = 2.5

#INFO : posx.value after = 2.5

#INFO : fc.NoKeyValue undo = 10.0

#INFO : fc.NoKeyValue redo = 2.5