Skip to main content

Questions tagged [python]

Python is an object-oriented programming language. In Blender, it is used as a general purpose scripting language and to create add-ons to extend Blender's functionality.

38 votes
2 answers
15k views

Python performance with Blender operators

In my script, I have for loop over many cube objects (~1000) and the treatment is very slow. Looking more in details, I notice that in the same amount of loops: if ...
Salvatore's user avatar
  • 757
35 votes
2 answers
25k views

Can I run a Python script step by step in Blender?

Can I run a python script step by step with normal blender, a build, external software or an addon? I'm developing a script (town generator) and I want to to execute the code step by step like a ...
lucblender's user avatar
  • 3,343
34 votes
4 answers
6k views

Why avoid bpy.ops?

Simple and maybe stupid question: I was reading this lot of time, that "you should avoid using bpy.ops, or "instead of ...
Zéiksz's user avatar
  • 1,979
32 votes
1 answer
18k views

What do operator methods do? (poll, invoke, execute, draw & modal)

I've seen the functions called poll and invoke used in scripts. I'm curious what these are for and when they are called.
TARDIS Maker's user avatar
  • 5,762
32 votes
3 answers
21k views

Is the Blender GUI package available for other programs?

I really love the look of Blender's built-in GUI, and would potentially like to use these tools in some of my other Python applications. As I understand it, Blender created all of these tools from ...
Gwen's user avatar
  • 11.6k
31 votes
3 answers
55k views

Python: Selecting object by name in 2.8

The following: bpy.data.objects['Cube'].select = True bpy.context.scene.objects.active = bpy.data.objects['Sphere.017'] don't work in Blender 2.8, they did in 2....
Michael Teiniker's user avatar
31 votes
2 answers
14k views

Is it possible to create image data and save to a file from a script

I'm currently trying to extract textures from a binary file, and ideally I'd like to save each texture to a file or embed in the .blend file. However, before saving ...
MrFlamey's user avatar
  • 3,879
30 votes
9 answers
30k views

Efficient way to get selected vertices via python (without iterating over the entire mesh)

What's the best/fastest way to construct a list of selected vertices for a mesh object in python? I want to avoid iterating over every vertex in the mesh if possible, since that seems like a really ...
Qutorial's user avatar
  • 3,322
30 votes
2 answers
64k views

How can I get vertex positions from a mesh?

I want to read the vertex x and y coordinates with a script or a function. How can I do that? The MeshVertex appears to have ...
B Newmark's user avatar
  • 1,240
30 votes
3 answers
20k views

Is there a way to restart a modified addon?

I'm currently twiddling with an old addon and insert some print statements for debugging. Currently I'm restarting Blender each time to see the new messages. Is there a way to 'refresh' an already ...
stacker's user avatar
  • 38.7k
30 votes
1 answer
11k views

How to implement custom icons for my script/addon?

Is it possible to use different icons other than the default set and how?
Jaroslav Jerryno Novotny's user avatar
28 votes
1 answer
31k views

Blender 2.8 API, python, set active object

I'm trying to amend an addon that I made for Blender 2.7X to work with Blender 2.80. The problem is with bpy.context.scene.objects.active = some_object This is ...
Georges D's user avatar
  • 5,042
27 votes
1 answer
14k views

Create an interface which is similar to the material list box

How can I make a Interface which is similar to the Material-Interface within Blender via Python? It should look like these. Could you guide me to the right direction? I don't think it's in bpy.ops, ...
Hamburml's user avatar
  • 957
27 votes
1 answer
1k views

Closing "Fibonacci's Hole"

Creating a sphere using the points defined by Spherical Fibonacci Mapping. For the most part it is easy to "skin" by using two consecutive fibonacci numbers as steps to loop on the index. And get ...
batFINGER's user avatar
  • 84.6k
26 votes
13 answers
34k views

How can I add a cube?

I am trying to add cubes to my scene. I'm sure there are lots of ways to get a cube into the scene (but for the purposes of this question, I have no idea what they are) - Are there any ways to add a ...
X-27 is done with the network's user avatar

15 30 50 per page