Linked Questions

52 votes
2 answers
48k views

poll() failed, context incorrect? - Example: bpy.ops.view3d.background_image_add()

I keep on getting context errors in the Blender Python API. I don't understand the issue of the context in the API, how do I know which is the correct context? Thanks!
Jonathan's user avatar
  • 621
14 votes
2 answers
2k views

A comprehensive list of operator overrides

I feel like I'm always spending far too much time playing scripting whack-a-mole whenever I want to override an operator in one of my scripts. I'd like to build a comprehensive one-stop-shop list for ...
Gorgious's user avatar
  • 31.4k
3 votes
1 answer
5k views

How to merge all vertices by distance and remove all inner faces?

I have a bunch of 3D objects adjacent one to another (they all have a coincident face). I want to merge them all without having inner faces. I can achieve this by doing the following: Object Mode an ...
alBarras's user avatar
3 votes
2 answers
3k views

Loop cut and slide using python script in blender

I have created a cylinder using python API of blender. This cylinder has only vertical strips. I want horizontal loop cuts in this cylinder so that it would have a perfect mesh shape of quads. How to ...
user2481909's user avatar
6 votes
1 answer
1k views

Loop Cut and Slide using Python not working

I'm trying to use loop-cut and slide in Python. I've tried the following: Loop cut and slide using python script in blender How do I override context for bpy.ops.mesh.loopcut? Loop Cut and Slide ...
Mike's user avatar
  • 420
2 votes
2 answers
958 views

Python Scripting: Assign existing geometry node group to newly generate object

I'm creating a number of objects in a loop, how can I assign an existing Geometry Node group to these created objects? I've tried to assign data.node_group.name the name of the group but that just ...
Maj's user avatar
  • 153
4 votes
2 answers
892 views

How to use loopcut_slide operation without any UI?

So i need to perform some basic loop cut and slide operators on a mesh. The edge index is known and the slide amount is also fixed. using override method from How do I override context for bpy.ops....
Prime007's user avatar
  • 183
0 votes
1 answer
2k views

Problem with changing the current area type

Hey when executing this code it works perfectly the first part of it ...
Mahmoud S. M. Shaqfa's user avatar
3 votes
1 answer
2k views

Align active camera to view using python

To align active camera to match the current view I could simply pan, zoom or rotate the view. Select active camera from outliner then hit Ctrl + Alt + Numpad 0. I only wonder, is there a way to write ...
sirrus's user avatar
  • 169
3 votes
1 answer
751 views

"Context is incorrect" python error, while script moves modifier up in modifier list during rendering

I would like to run a python script, which adds every frame a new Mask-modifier to an object (and deleting the old). While following script works if the code runs in interactive blender window, during ...
Zulu's user avatar
  • 33
1 vote
1 answer
624 views

UV Project From View script fails when using bpy.ops.view3d.view_axis()

I've been trying to make a small python script that among other things project unwraps UVs using a specific axis and projection type and it fails to project the UVs at the 3D View's manipulated camera ...
Takanu's user avatar
  • 197
9 votes
1 answer
739 views

Can loopcuts be made when Blender is in background with the "-b" option?

I am trying to make loopcuts on an object in a Python script running Blender 2.77a in the background with the "-b" commandline option. If I don't override the context I get this error: ...
X-Mann's user avatar
  • 191
1 vote
2 answers
997 views

Purging unused data from Python

I found a lot of solutions for deleting unused data. Most of them are not practical for my case. I have a very long script and during this, I want to purge all the unused data from the memory. I'm ...
Mahmoud S. M. Shaqfa's user avatar
0 votes
0 answers
546 views

I am using chat-gpt to make a UFO in Blender 3d, It is returning an error

...
Andrew Williams's user avatar
1 vote
0 answers
122 views

Using Python to programmatically bend a box

I'm trying to write a script that uses bpy.ops.transform.bend and am running into context issues. I'm just learning the api but it seems like the command requires some sort of UI interaction/context ...
ineedhelp's user avatar
  • 165

15 30 50 per page