NLA Editor: End Frame

Hello,

I am using this script (with the help of a previous post to make a strip active)

def to_nla(name, start_frame):

 context = bpy.context
 object = context.object
 scene = context.scene
 if scene.frame_end != 250:
    scene.frame_end = scene.frame_end + 200
 frame = start_frame
 action = context.object.animation_data.action

 # add an NLA track

 newtrack = object.animation_data.nla_tracks.new()
 newtrack.name = name

 # add a new Strip at current frame 
        
 strip = newtrack.strips.new(name=action.name, start=start_frame, action=action)
 bpy.types.NlaStrip.name = action.name
 #bpy.types.NlaStrip.frame_start = start_frame
 #bpy.types.NlaStrip.action_frame_start = start_frame
 bpy.types.NlaStrip.frame_end = start_frame + 200
 #bpy.types.NlaStrip.action_frame_end = start_frame + 200

The problem is with the frame_end, because if I use

 bpy.types.NlaStrip.name = action.name
bpy.types.NlaStrip.frame_end = start_frame + 200

it extends the strip to infinity, but if I just use

 
bpy.types.NlaStrip.frame_end = start_frame + 200

it does not do anything…

Can somebody let me know what I am doing wrong?:frowning:

Mitsaki

No, no, no you’re doing it all wrong.


 # add a new Strip at current frame 
        
 strip = newtrack.strips.new(name=action.name, start=start_frame, action=action)
 strip.name = action.name
 #bpy.types.NlaStrip.frame_start = start_frame
 strip.action_frame_start = start_frame
 strip.frame_end = start_frame + 200
 #bpy.types.NlaStrip.action_frame_end = start_frame + 200

You are trying to change the type rather than an instance (the strip) of the type.

Now I understand what I am doing wrong:)