Setting Stage Frame Range with Python

   420   1   1
User Avatar
Member
9 posts
Joined: June 2017
Offline
Hey I am trying to achieve something relatively simple:

I want to set the frame range of the current stage with a Python snippet.

I have tried those approaches:

01:
frame_in = 1001
frame_out = 1100

stage = hou.pwd().editableStage()
root_layer = stage.GetRootLayer()
stage.SetEditTarget(root_layer)
stage.SetStartTimeCode(frame_in)
stage.SetEndTimeCode(frame_out)

02:
frame_in = 1001
frame_out = 1100

stage = hou.pwd().editableStage()
root_layer = stage.GetRootLayer()
root_layer.startTimeCode = frame_in
root_layer.endTimeCode = frame_out

03:
frame_in = 1001
frame_out = 1100


layer = hou.pwd().editableLayer()
layer.startTimeCode = frame_in
layer.endTimeCode = frame_out

But none of them seem to work...

I am using Houdini 19.5.569

What am I doing wrong?
Edited by pullpullson - Dec. 11, 2023 11:34:29
User Avatar
Staff
4438 posts
Joined: July 2005
Offline
To quote the documentation for the Python LOP:
You must not edit the root layer of the stage. Although this root layer is accessible through the Python API, the LOP cooking architecture requires that it be free to manage that root layer free from interference from any single LOP node.

There an an existing RFE to allow setting root prim metadata like this with the python LOP, and we have an idea on how to accomplish it, but the facility does not currently exist. For now you must use a Configure Layer LOP to set this kind of stage level root prim metadata.
  • Quick Links