bpy.ops.action.new() does nothing when invoked from script #51011
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#51011
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Win 8.1, GTX1070
Blender Version
Broken: 2.78c
e92f235283
Short description of error
bpy.ops.action.new() does nothing when invoked from a script. Maybe you're not supposed to but then why is it listed in the API?
Exact steps for others to reproduce the error
Create some object. Create an action in the action editor. Open a text editor and write
and click run script. Nothing happens. I would expect the same thing happening that happens when you click the add action button in the UI: a new action is created with identical keyframes and then selected in the action editor list automatically.
edit: changed from Addons to BF Blender tag.
Changed status to: 'Open'
Added subscriber: @cyaoeu
Added subscriber: @BrendonMurphy
Changed status from 'Open' to: 'Archived'
hi,
to test:
On default cube, insert keyfame 0, move timeline to 100, scale & move the cube, insert keyframe.
run this:
A new action is created as expected.
Closing as invalid.
What? You created the action when inserting the keyframes...
But I guess I can be more clear about what's wrong.
hi, ok, getting it now.
I think probably this is a more a python support issue, I see now that indeed you are correct & your code does fail.
have you looked at blender stackexchange for similar questions?
it would seem to be that to do this by py you need to set a keyframe first?
also unsure if contexts for this operator are correct or need to be set.
I saw in the Blenderartist forums that someone had the same problem, the advice that was given was to "not use the operator", which seems like a bad workaround if you really want the same behavior. I really like the + button operator, it creates a new action with the same name+.001, selects it in the action editor automatically and even copies all of the keyframes from the previous animation. Basically great for when you're making for example looping variations. The only problem with it is that it doesn't work in scripts right now.
I think the context for the operator should be correct, if you remove the bpy.context.area.type = 'DOPESHEET_EDITOR'
bpy.context.space_data.mode = 'ACTION' stuff you get a polling error. But if you execute those commands you don't get an error. To me this means that it should be correct. Nothing happens though which is a bit strange. If you're not supposed to be able to use the operator in scripts I would expect an error explaining why it can't be used. But if it's really a bug that it doesn't do anything right now I would be happy if it could be fixed.
Changed status from 'Archived' to: 'Open'
reopening for more investigation
Added subscriber: @mano-wii
Analyzing the
bpy.ops.action.new
's code, I could see that it only works when it is called from a button.This is because it reads the button context and gets the current action through it.
This is a bad assumption, as this operator is totally useless if called in python.
This issue was referenced by
24ebed4d84
Changed status from 'Confirmed' to: 'Resolved'