Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#23532] bpy.ops.nla.actionclip_add results in the error 'no active track to add strip to' even though it should create the track itself

Date:
2010-08-27 01:26
Priority:
3
State:
Closed
Submitted by:
Josh Wedlake (joshwedlake)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
 
Summary:
bpy.ops.nla.actionclip_add results in the error 'no active track to add strip to' even though it should create the track itself
Detailed description
hello again from the tube project

trying to produce the functionality of the NLA snowflake button using python (convert linked action to nla) results in a 'no active track to add strip to' error in the console report...

1. open the default scene and insert a keyframe on the default cube
2. put the following into a text editor and hit run script...

import bpy

current_type=bpy.context.area.type
bpy.context.area.type='NLA_EDITOR'
bpy.ops.nla.actionclip_add(action=bpy.context.active_object.animation_data.action.name)
bpy.context.area.type=current_type




...
as far as I can tell this code should convert the action linked to the active object to an NLA strip, as confirmed by Joshua here:
http://blenderartists.org/forum/showthread.php?p=1691416

im not sure if this has been broken by the RNA refactor.


also should it be necessary to have to change bpy.context.area.type to 'NLA_EDITOR' given that the only information the operator needs (presumably the active_object and bpy.context.active_object.animation_data.action.name) is available in the 3D view window type?

thanks

Followup

Message
  • Date: 2010-08-27 22:56
  • Sender: Tom Edwards
  • I'm pretty sure you're supposed to call bpy.ops.nla.tracks_add() first...but if Blender has just started that doesn't work either!

    Before tracks_add() can be called, the user has to have unfrozen the armature's NLA tracks through the UI (I'm looking for a Python call to do that, but no luck so far).

    After the user has un-frozen, the op works even if the tracks have been re-frozen.
  • Date: 2010-11-23 13:18
  • Sender: Campbell Barton
  • There was a bug in python calling operators fixed r23532.

    But to get this working you need to do 2 things.
    - Click on the snowflake button in the NLA (otherwise adding in the UI also gives the same error)
    - Now the action isnt attached directly to the object. This works.

    import bpy
    current_type=bpy.context.area.type
    bpy.context.area.type='NLA_EDITOR'
    bpy.ops.nla.actionclip_add(action='CubeAction')
    bpy.context.area.type=current_type


    closing.
 

Attached Files:

No Files Currently Attached

Changes:

Field Old Value Date By
ResolutionInvestigate2010-11-23 13:18campbellbarton
close_date2010-11-23 13:182010-11-23 13:18campbellbarton
status_idOpen2010-11-23 13:18campbellbarton
ResolutionNew2010-11-16 17:25campbellbarton
assigned_tonone2010-11-16 17:25campbellbarton