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.

Filter by
Sorted by
Tagged with
2
votes
0answers
15 views

Python code to add objects to the 3D Cursor

Python code to add objects to the 3D Cursor I added a cube and looked at the Python Console ...
0
votes
1answer
19 views

How to add playing videos to the 3d viewport?

Is it possible to add videos to the 3d viewport? I want to add multiple ones playing in a loop.
1
vote
0answers
10 views

How to duplicate a scene ('FULL_COPY') in Python without ops?

I need to create a full copy of the current scene using Python then rename it, I've tried using: bpy.ops.scene.new(type= 'FULL_COPY') But for some reason it gives ...
0
votes
0answers
22 views

Adding edges to the mesh by python in specific region

I have a body pattern for clothing. In order to sew two patterns which are front and back, I have to add edges to them at the very outside of mesh like pictures below. As you can see, left picture ...
2
votes
0answers
16 views

How can I add an image sequence in the compositor with Python?

How can we use python to add images as a sequence into the compositor. I am trying to add a transparent graph onto every frame of the render I have successfully done this on the blender itself, but my ...
1
vote
1answer
28 views

Single slider for transparency in Material Preview/Rendered display

My users would like to be able to adjust the transparency of their mesh objects with a single slider in the panel of an addon, where the transparency ranges from invisible to opaque. The desired ...
1
vote
1answer
16 views

Insert keyframe to object's Offset Factor Python API

I am trying to insert a keyframe at an object's "Follow Path" constraint programmatically. More specifically I am trying to insert a keyframe to the "Offset Factor" property of the ...
2
votes
1answer
31 views

What is the replacement of 'scene.render.layers['RenderLayer']' in blender 2.8?

It seems that the property scene.render.layers['RenderLayer'] is no longer available in blender-2.8. I just want to set the ...
0
votes
0answers
9 views
1
vote
0answers
13 views

Python Text Content Not Updating in Animation [duplicate]

I'm trying to create a timeline that graphically shifts across the screen and a text box which displays the currently selected year as the timeline shifts. To accomplish this, I've created a Python ...
0
votes
0answers
16 views

Update ANT Landscape with script in render

I'm completely new to Blender and I'm toying around with landscapes and scripting. I want to animate the Noise Size of the generated landscape for each new frame. I keyframed the value of the Noise ...
0
votes
0answers
14 views

Can shortcuts be accessed through python script 2.8?

Can shortcuts be accessed through python script 2.8? I'm referring here at box select, tweak, cursor. I know that is not best practice but I just curious how to access those left window buttons.
0
votes
0answers
37 views

Trying to draw a specific curve with Python

I am an amateur and beginner using Blender 2.82a on my Windows PC (nothing fancy). I am trying to make a 3D animation of some pipes, but I am stuck at even the very beginning. I am extremely bad at ...
1
vote
1answer
16 views

[obj.keyframe_insert, bpy.data.particles[“ParticleSettings”].lifetime]; how to insert keyframe to an existed particle setting, e.g lifetime

I am trying to randomize some values of selected objects in blender How can I keyframe_instert of the active particle properties? I can do it with clicking "I" of the desired area and it ...
0
votes
0answers
8 views

Is there a way to create a preview window in a panel/popup to show the compositor result with Python?

Is there a way to create a preview window in a panel/popup and show the “Render Result”? Would like to show updates when changes made in the compositor.
0
votes
1answer
24 views

Not created again already exists material

I have a such a code ...
0
votes
0answers
14 views

How can I check whether the Principled BSDF has texture maps connected to it with Python?

I am trying to script a simple exporter that would help me get material data to a webGL engine from Blender 2.8. I am able to get default values of roughness, metallic and transparency. For now this ...
1
vote
0answers
16 views

obj to glTF batch exporter

I have a set of obj exports comprising of a million files(each file between 100-200kb). Is there are a way to pick up files from a folder and export them to glTF? What I am talking about is batch ...
0
votes
0answers
17 views

script mathematical mesh with xyz function surface, each coordinate parametric with u,v

Circa 2015, in the python script window we could enter: ...
0
votes
0answers
15 views

Fill vertices using python

i am new to the Python API for Blender. I'm currently trying to write an addon which connects each vertex to the two nearest vertices. If I just go to edit mode and hit ...
0
votes
0answers
18 views

It is possible to change between 3D_cursor and selection_box using python script?

It is possible to change between 3D_cursor and selection_box using python script? There is no code because I don't have any idea on how to swap 3d cursor with select_box in python and vice versa. Is ...
1
vote
1answer
27 views

Animated glowing textures - how?

A common effect I'd like to understand is how to achieve moving, glowing lines. An example is on Robert Hodgin's "Taxi, Taxi!". (I don't know what he uses, but have an idea it might be ...
1
vote
1answer
40 views

How to get cursor position in 2.8

So I'm trying to convert the following script in 2.8 I have replaced scene with depsgraph. But I'm getting an erroneous on last line: Scene object has no attribute 'cursor.location' ...
-1
votes
0answers
17 views

2.8 how to create object when mouse click on a plane?

It is possible to create an object at the mouse click location using a python script? Or at least copy an existing object to the clicked location?
0
votes
0answers
10 views

Python: bpy.ops.uv.smart_project doesn't run on newly created UV Layer but on old one

I want to create a new UV layer and have the UV's smart projected. This way I can be sure the UV layer has usable mapping. I've written the code below to do this. It creates the new layer just fine ...
2
votes
1answer
19 views

Python script - objects are grey after export to glb file

There is my short code. I'm using blender_osm addon to generate these buildings. After the first render, it looks fine with colors on textures. But when I export it and reopen all textures are grey. ...
0
votes
0answers
12 views

Create multiple different versions of project

I am working on a script that makes some changes to a Blender project file (for example, randomising material base colours) and then saves those changes to a new project file. I would like to create ...
0
votes
1answer
27 views

Why can't I display an EnumProperty in a UIList?

Actually, I know how to "insert" or "add" custom properties into a UIList in blender 2.8. But actually I'm stuck with enum and collection properties. I don't know why I can't ...
0
votes
0answers
12 views

Making a button active when clicking another button with Python?

Let's say that I have a panel with two buttons. One o them is inactive/gray out. By pressing the second button I want to make the gray one clickable. Can I do this from the Main Panel?
0
votes
0answers
20 views

How to modify curves and make object to follow path using Python scripting

I want to create x number of BezierCurves and manipulate them so that the objects which follow their path do not seems colliding with each other when playing animation. So, basically, I have some ...
0
votes
1answer
19 views

How to deselect origin center/ cursor blender with python?

Is there any method to deselect origin center/yellow dot, or make it inactive?
0
votes
0answers
36 views

Can not move polygons but only vertices of an object by bmesh!

I can only move the vertices of the monkey to (2,4,6) but not by polygons and effects look strange. What is the right way to calculate the polygons by the vertices according to their Z value? ...
2
votes
0answers
26 views

How to create a hook modifier on every point of a curve using python

I made a script to add a hook modifier on every point of a curve using a for loop but I get an error in 2nd iteration. Below is the code: ...
1
vote
1answer
15 views

How to register scripts in the startup/scripts folder if they are inside a Sub-folder?

I know I can place a script in Blender's startup/scripts folder and it will register when you open Blender, which is what I normally do. However, I have a lot of scripts so I tried putting them in a ...
1
vote
1answer
15 views

Create empty through script using a cube as origin (0)

It is possible to create an empty through a script but will have a fixed distance to a selected cube? So lets say my cube is at [3,5,6] I want to be able to select it run the script an the generated ...
1
vote
0answers
10 views

How get mouse position for a custom selection script in Blender 2.8/2.9? [closed]

I`m trying to make script that selects objects with the same property. Operator "bpy.ops.view3d.select" selects only in the zero position (0,0), and function "event.mouse_x" ...
2
votes
1answer
98 views

How to Update NodeSocketString Value inside a node group in a attribute node using python

I have an Attribute node inside a node group, and for the node group inputs, I have created a NodeSocketString, Using ...
1
vote
0answers
18 views

Python: Selecting objects in different scene results in EXCEPTION_ACCESS_VIOLATION crash when baking

Im trying to create a script that bakes the ambient occlusion of an object to a texture map. For optimal performance, I want only the selected objects to be part of the bake process. That's why I ...
0
votes
0answers
35 views

How to move the polygons of an object into other location by bmesh frame by frame? [duplicate]

How to move the polygons of an object into other location by bmesh frame by frame? I tried below way but failed. Is it possible to generate polygon movement animation effects like in Animation Nodes ...
1
vote
2answers
20 views

How can you set Blender's Theme Preset with python

How can you set Blender's Theme Preset with python? I'm don't mean customize a few colors, I'm talking about loading one of the existing presets. Is there a simple command I can run?
3
votes
1answer
17 views

How to access the Kemap settings Preferences (Spacebar Action, Select Mouse button, etc) with python?

I use a python script to set up some startup preferences like this: bpy.context.preferences.view.show_tooltips_python = True However, there is a particular set of preferences I don't know how to ...
0
votes
0answers
12 views

Console Error when Starting Blender: SetChannelMap - Is this Normal? What does this mean?

Here's an image of my console window that pops up right before Blender opens: Blender continues to run normally after, but the error still bugs me. And I didn't get the same error on my laptop. After ...
2
votes
1answer
35 views

How can I add a collection using Python?

I'm new to Blender. Tutorial information as recent as January this year appears to be out of date and I can't figure out how to create a new collection and add an object to it. The most recent ...
0
votes
0answers
17 views

Checking for selection mode

I want to do some task with checking for selection mode. For example: ...
1
vote
0answers
19 views

Renaming or reorder vertex groups of a mesh to match the names of a second mesh

I have two meshes which share similar vertex groups (positions), but they have different names and order. I want to reorder or rename the vertex groups from the first mesh to match the second one. The ...
2
votes
1answer
37 views

How can I store the name of selected objects in a text file?

I would like to create an automatic list of the objects that have been selected with the mouse click. So for example I have cube1, cube2, cube3, cube4. I select them in the following order cube3, ...
0
votes
0answers
10 views

Can I access the .blend file path during the first execution of bpy.app.handlers.save_pre()?

Here’s some context: My addon allows users to import several files, but the data would be referenced rather than saved as part of the .blend file. So I need to store the path to the imported file. I ...
0
votes
1answer
17 views

Python: deselect outliner elements

How can I deselect Text in the outliner? bpy.ops.object.select_all(action='DESELECT') will not work for this. I can just click with the mouse on Plane in the ...
1
vote
1answer
18 views

Add Range to Driver Expression

I'm trying to set up a driver for an object that uses an integer property from a panel in a custom addon as its data path, to basically control the visibility of the object within a range. So for ...
1
vote
1answer
32 views

Blender python script sets correct camera, but defaults to chosen animation frames camera on render

I am rendering using a python script that renders 5 view angles of an object. So 5 renders, each with a different camera. The code for one of these view angles is: ...

1
2 3 4 5
164