FCurve.Locked

Introduced

v3.0

Description

Sets or returns the locked property of fcurve as a Boolean (true if locked). If the fcurve is set as locked it cannot be changed. If you try changing an fcurve that is Locked it raises an 'Access Denied' (E_ACCESSDENIED) error.

Examples

Python Example

# 
# This Python example illustrates how to create an fcurve and set it as Locked
# 
# 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 = 8
        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
# Define some keys
keys = [ 1.00, -5.00, 100.00, 5.00 ]
# Create an fcurve on posx
fc = posx.AddFCurve2( keys, siStandardFCurve )
# Get the current Locked value
ro = fc.Locked
Application.LogMessage( 'fc.Locked before = ' + str(ro), siInfo )
# Set the fc Locked 
fc.Locked = 1
ro = fc.Locked
Application.LogMessage( 'fc.Locked after = ' + str(ro), siInfo )
# Try setting a key when the fcurve is Locked.
fckey = fc.Keys(0)
Application.LogMessage( 'fckey.value before = ' + str(fckey.Value), siInfo )
try:
        fckey.Value = 5.00
        Application.LogMessage( 'fckey.value after = ' + str(fckey.Value), siInfo )
except pythoncom.com_error, (hr, msg, exc, arg):
                # catch the error and print out the error message
                if exc and exc[2]: msg = exc[2]
                Application.LogMessage( "fcurve key set value failed:" + msg)
# Produces the following output: 
#INFO : "fc.Locked before = 0"
#INFO : "fc.Locked after = 1"
#INFO : "fckey.value before = -5.0"
#INFO : "2009 - fcurve key set value failed:Access denied"