Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
49 views

2.80 Addon zip file installation

Will 2.80 support zip file installation of addons? What are the requirements for the zip structure and its contents? I have tried multiple directory structures (as noted in this related question), all ...
0
votes
0answers
87 views

What is the Python code related to collection actions for blender 2.8?

2.8 is new and I can't find how to: Create a new collection. Add selected object to collection "name here" . Add selected object to collection created in the same code. Could someone show me how? i ...
0
votes
0answers
34 views

blender 2.8 glRectf() not there

I'm trying to convert a 2.79 add-on to 2.80. I'm running into a problem with openGL function glRectf(). The code that's currently in the add-on draws the menu as follows ...
2
votes
1answer
23 views

Python viewplane

I have a question on getting the mouse coordinates (in 3d space) when I click in the 3d view. I have a draw handler in a modal operator (POST_VIEW) and I want to get the mouse cursor x, y vertex and ...
1
vote
1answer
41 views

draw_handler_add() and draw_handler_remove()

The bpy.types.Space class has two methods draw_handler_add() and draw_handler_remove(). ...
0
votes
0answers
44 views

2.8 Rotate multiple objects around the origin in edit mode?

for some reason the bpy.ops.transform.rotate code dont take account the pivot point, i dont understand why? and its only one part of my problem... in my code : ...
1
vote
1answer
18 views

Enable lamp 'Use Nodes' from python Console

I am new to both Blender and Python, I am trying to enable Use Nodes of a lamp from Python console. I tried the tooltip showing on the button ...
0
votes
2answers
60 views

How do I set multiple settings with one button?

How can I change a viewport shading settings from one button? I am creating a toolbox I put in the Right panel. Everything's Ok exept for this. I'd like to get my settings in one click. Anyone? <...
1
vote
1answer
57 views

How to get the Class of selected object in Blender 2.8?

What is the python code to get the Class() of selected object in Blender 2.8 ? I want to know if the selected object is grease pencil or any other. Thanks
1
vote
1answer
31 views

Blender in ElementaryOS installed from most recent 2.79 build

I installed most recent blender from ppa:thomas-schiex/blender to get the most recent blender version. Starting blender now results in crash. Running blender inside terminal from directory /usr/lib/...
0
votes
2answers
56 views

How to add and use renamed Mirror modifier with Python?

In this code for 2.8, that works, I am creating a mirror modifier assigned to a cube. ...
1
vote
1answer
16 views

python: removing vertices from mesh but still can access them from data

I'm trying to understand what's going on here: ...
0
votes
2answers
45 views

Using python to change the settings of all subdivision surface modifiers

I found this python script to add a subdivision surface modifier to all objects ...
0
votes
0answers
15 views

How to create an object from part of a mesh in the same location(like saparate) using Python in Blender?

Knowledgeable people of the internet! I’m working on a script, that at some point, using bmesh module and being in Edit Mode, creates verts and edges which are then used to generate a mesh via ...
1
vote
1answer
104 views

Blender 2.8 - Modal Operator: How to change modifier settings?

I am trying to change a the "ratio" within a "decimate" modifier with a modal operator, but cannot get the value to update (my guess is I am not passing the right value?) ...
0
votes
0answers
38 views

Cut and Seal Mesh (python script)

Following on from this thread, I would like to be able to cut a mesh into smaller objects, while sealing off the cut (with a plane) so that my particle system works as intended. Both objects created ...
0
votes
1answer
24 views

How to detect if a vse strip is used in conjunction with an effect strip with python?

Moving strips which are used in conjunction with an effect strips will cause errors if moved(with python) without the effect strips, and most of the effect strips can't themselves be moved because ...
0
votes
0answers
21 views

Which api/data structure does blender use to represent its meshes?

I am wondering which underlying data structure blender uses to represent its meshes. I tried going through the source code but answering that question myself is harder than expected.
1
vote
0answers
27 views

Using Python to read an audio file that controls animation?

I've done a lot of web searches but I must not be asking the right question -- what I'd like to do is use an audio file to control animation. Specifically, I want the volume of the file to make the ...
1
vote
0answers
30 views

How to make a simple Format Conversion Script?

I am a newbie in Blender and have only basic knowledge of Python scripting. But I thought I could make this script on my own - but failed. My basic idea is to import the file with ...
0
votes
0answers
9 views

How do I apply a texture to each 'Part' in my model via python script

I have imported a .obj model into blender, which contains a long list of individual parts making up the model, and I wish to iterate through each part and apply the same texture to them. How do I ...
0
votes
0answers
11 views

How to get a Bone id (that is shared with the vertex group)?

I'm making an exporter for a 3D renderer of mine and am implementing a simple static armature exporter. Currently all of the bone IDs are the value of group in ...
0
votes
2answers
79 views

How can I view and edit modifier properties in the viewport in Blender 2.8?

I've just recently started playing around with Blender 2.8 after years of modelling in different software packages. I've memorized the most used keyboard shortcuts and customized most of the stuff, so ...
1
vote
1answer
28 views

Convert Cycles depth/z to distance to image plane

I want to simulate a depth sensor with Blender Cycles, but the z-pass returns the length of the sight ray and not the distance to the image plane. Here is a formula to convert the depth map, but I am ...
0
votes
2answers
41 views

How to bind a series of commands to a custom hotkey (scripted macro)?

How would I go about creating a hotkey that would operate as follows?: With an object selected in the modeling viewport: Press Shift + D (this would be the custom shortcut to trigger what follows ,...
1
vote
1answer
24 views

Python script to make all adjacent keyframes have constant interpolation

I made a Cycles animation with motion blur enabled. Whenever the camera (and scene objects) "cuts/jumps" the render is a big, blurred sweep. How do I write a Python script that changes the ...
2
votes
2answers
106 views

bl_idname requirements for 2.80

The python api change notes for 2.80 give new requirements for bl_idname. I'm getting an error telling me that "MAPLUS_OT_changetypebaseclass" is an invalid name: ...
1
vote
1answer
35 views

Make a Blender script run an external program

I'm making a script to share data between Blender and After Effects: i created an addon in Blender which exports a .txt file in the After Effects directory (or a custom one) and I created a After ...
0
votes
0answers
13 views

Python - how to 'get' an object after creating it

If I create an object... circle = bpy.ops.mesh.primitive_circle_add(radius=size, view_align=False, enter_editmode=False, location=(x, y, z)) What is returned (<...
0
votes
0answers
15 views

Change object position depending on resolution

How can I using the console change the objets position on viewport? For example 1920 the object it's on a position: But if I change the resolution to 600: The viewport cut the elements, how can I ...
0
votes
0answers
18 views

What is the difference between bpy.context.object and bpy.context.active_object?

I recently came across this question, which has an interesting detail in the accepted answer: Also be aware that sometimes you should be checking for ...
0
votes
1answer
16 views

How to track an object to a specific property in the Blender Game Engine

I make a game with the Blender Game Engine. I would like to make a cube (Enemy) which moves inside a navigation mesh. This cube should follow all the objects with a specific property. The cube also ...
3
votes
2answers
258 views

Select an object with Python in 2.8

I'm new at scripting. I know that it's a basic question but I tried everything I could and nothing works. So here's my problem: I want to create a shortcut that automatically sets up a mirror ...
0
votes
0answers
31 views

Asset Management (addon): How to add all materials in the scene to the library?

How to add all the materials in the scene to the library in the Asset Managemnt addon? There is any python code to do that?
1
vote
0answers
41 views

How to get to work with the image of the camera with python

I'm moving the camera around an object all with python script. Now I want to get the image from the camera and work with it (some image processing) and then save it..Etc Now I'm just rendering the ...
2
votes
0answers
23 views

Getting object has no attribute 'startFrame' when trying to export animation using a script

Hello I am trying to get a simple script to which will import an rtm file(animation file) > do a few actions > export rtm file. In my script everything works except for the last of bit code which ...
1
vote
1answer
32 views

Can't get the active_object in Operator

I try to get the active object by "bpy.context.scene.objects.active" in my operator, but I receive a error 'Context' object has no attribute 'objects', what's wrong?My scripts is as follow: ...
0
votes
0answers
20 views

Calculate 2.5D point cloud from scene

Ich would like to generate a 2.5D point cloud of a scene from the camera's perspective with python. Let's say the camera has a rosolution of [n,m] pixel and as a result I want to have n*m 3D vectors ...
0
votes
0answers
24 views

Select adjoined handle in Sequencer with python?

How do I select the adjoined handle in the Sequencer with python? I believe that the code actually should do this, but it doesn't? ...
0
votes
1answer
38 views

Blender Python: Running multiple timers

I have a bit of a weird problem that I simply cannot seem to get around. I want to run 2 timers, each set to a different interval. The problem that I'm having is that both classes receive each others ...
1
vote
1answer
19 views

How to script blender to quit after rendering is complete Mac OS10.13

I've got a script that automatically renders and saves the render, but I'd also like to have Blender quit when the render and save is completed. Since I will be running renders overnight, I'd prefer ...
1
vote
1answer
101 views

link collections in python

As simple as it is to link a collection with another one just by drag and drop I can't manage to find the way in python. ...
0
votes
0answers
22 views

Sure UVW Panel - properities display

I am trying to adapt old Sure UVM Box add-on to Blender 2.80, but I have problem with displaying the parameters panel in 3D Viewport ( do not know how to name it ). When I run it via PieMenuEditor ...
1
vote
0answers
31 views

Garbage collection in Blender

I'm working on an iterative process for optimizing the placement of some objects. This iterative process seems to leak the memory (I use numpy matrices). I do destruct the lists and matrices after ...
0
votes
1answer
62 views

Blender 2.8 : python code to switch shading mode (between wireframe and solid mode)

If i switch between solid and wireframe mode, i can see in the info window that these commands are invoked : ...
0
votes
0answers
10 views

How to create Modal Operator that extrudes, moves and rotates selected in Edit Mode?

I'm trying to learn about modal operators in blender. I'm a complete novice and I'm struggling with the idea of how to correctly map the mouse movement onto the bmesh operators. I'm essentially ...
0
votes
0answers
81 views

“bpy.context.scene.object_bases” not working in 2.80?

The 2.8 documentation for the context override is found here: https://docs.blender.org/api/blender2.8/bpy.ops.html?highlight=object_bases ...
0
votes
1answer
66 views

How to read a pixel from an image texture with Python

My Python script needs to read RGBA values from a specific pixel of a texture bitmap. How can I do this in Blender?
0
votes
0answers
49 views

How to split object by plane via script

I have a single complex 3D object. I would like to cut this object at regular intervals along the x-axis into separate objects. This is because I want to apply a separate particle system to each piece,...
1
vote
1answer
54 views

How do I access workspace areas in 2.80

In a previous script I made for 2.79 I could change properties on a particular layout area without having it active: ...