BakeResult command fails to bake single camera shape attribute driven by expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I'm having an issue where a bakeResult call fails when called on a camera shape with a expression driven attribute. Specifically it seems to bake the channel, but fails to connect the curve throwing this error:
# Error: Connection not made: 'animCurveTU1.output' -> 'cameraShape1.horizontalFilmAperture'. Destination attribute must be writable.
# # Traceback (most recent call last):
# # File "<maya console>", line 1, in <module>
# # RuntimeError: Connection not made: 'animCurveTU1.output' -> 'cameraShape1.horizontalFilmAperture'. Destination attribute must be writable.
This can be repeated by running the following code:
import maya.cmds as cmds
camera = cmds.camera()
cmds.expression(s="cameraShape1.horizontalFilmAperture=time", o="cameraShape1", ae=1, uc="all")
cmds.bakeResults(
*camera,
simulation=True,
t = (1, 30),
sampleBy=1,
disableImplicitControl=True,
preserveOutsideKeys=True,
sparseAnimCurveBake=False,
removeBakedAttributeFromLayer=False,
removeBakedAnimFromLayer=False,
bakeOnOverrideLayer=False,
minimizeRotation=True,
at=["horizontalFilmAperture"]
)
This is in maya 2023. The same result can be achieved with any attribute on the shape.
Here are a few related observations:
- Doesn't happen to the transform node and attributes such as "tx"
- Doesn't happen if you specify more than one shape node attribute ["fStop", "focusDistance"]
- Weirdly doesn't happen if you use the bake simulation user interface and select one specific attribute from the channel box.
There are enough options here that I can work around it, I just wanted to flag the issue!
Thanks