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 concerning scripting in Blender using the Python programming language. Also use this tag for questions about scripting in OSL (Open Shading Language).

2
votes
1answer
17 views

Transform Vertices by Matrix around Custom Point

I need to scale the vertices to 0 around the median point as here. Should get something like this I use Mathutils and multiply the Matrix.Scale(as Axis I take the average of all vertex normal) by ...
0
votes
0answers
14 views

How to get cursor location to update with redo using a Python script?

I am trying to toggle restoring the cursor location using redo, but it isn't working as expected. Any help? ...
0
votes
0answers
9 views

Blender Python script to rotate and render each frame

I'm making a script to rotate an object which in turn rotates a camera around a model and renders each frame of its animation as a png file. I've never coded in python before so I'd really appreciate ...
1
vote
1answer
24 views

How to zoom vertically in Sequencer with Python?

I know with ctrl + middle mouse button I can zoom vertically, but how do I do this in python?
2
votes
1answer
32 views

Decimate only “bad” objects in a scene

I'm working for a company and they have to optimize 3d scenes to be rendered in virtual reality. The problem is that the people who are modeling the scenes are really bad at doing that. I've seen ...
0
votes
1answer
24 views

Accessing keys() of objectcollection in custom menu

So, I was creating a custom menu (in 3dview) of active greasepencil colors, for switching between them when coloring my 2d animation, I wrote a script which was to invoke the ...
0
votes
0answers
5 views

Calling bpy.ops.wm.revert_mainfile() operator multiple times in one script

I have a script which iterates over objects in the scene. Each iteration removes the rigid body property from the given object (bpy.ops.rigidbody.object_remove()), ...
1
vote
1answer
18 views

Changing MakeHuman mesh vertices by scripting

how can I change the mesh in MakeHuman from script? For example, I want to change the geometry of the nose, given that I have the desired coordinates values of the nose vertices, how can I assign ...
0
votes
1answer
27 views

How would I go about making a gallery screen for my props?

I'm fairly new to blender, and I'm not a coder at all (willing to try) I've created these blender mesh props and I want to create a way to display them for a project- how would I go about this?
1
vote
1answer
37 views

How do I split the edges on all objects in a scene with a script?

I want to create a script that opens a blender file and splits the edges of all objects in it, perhaps ignoring those that are specified as smooth. This is for a custom renderer that takes in blend ...
0
votes
1answer
20 views

objects.delete doesn't remove completely

I have this part of code in my script: ...
1
vote
1answer
19 views

Installing Python 3.6 on any version of Blender

I am trying to install Python 3.6 on any of the recent versions of Blender. I cannot use Python 3.5 because I need to use the python package mne. Upgrading to Python 3.7 as in Blender 2.8 results in a ...
2
votes
1answer
29 views

Blender crashes when assigning materials from script - is it a bug?

I wrote a script. In one part of the script, there is this line: base_object.data.materials.append (changeable_material) Whenever I try to run the script, Blender ...
1
vote
1answer
25 views

How to apply transformations to an object using the world matrix?

I'm taking a computer graphics course. In one assignment I had to check if a matrix transformation maps points to another set of points I thought that the best way to learn how this was to use ...
1
vote
0answers
17 views

Extract face data from polygons

I'm trying to extract face data from a blender file. I extracted vertices using bpy.data.objects["Main:Body"].data.vertices, and then in a ...
0
votes
1answer
21 views

Select faces with crossing normals

I'm working on a geology surface model, and I'm trying to find an automated way to identify cracks, rifts or crevasses. One way I thought of is to identify faces with normals crossing at a certain ...
1
vote
0answers
7 views

Animation in blender: How to link restrict visibility with restrict viewport rendering [duplicate]

I have created an assembly sequence and the viewport visibility of the components have been restricted along the animation. BUT I forgot to retrict the viewport visibility as well :( Now I would like ...
1
vote
1answer
33 views

F12/devtools like JavaScript in browsers

I'm mostly a JavaScript developer and I enjoy to explore objects and quickly write new source code via F12/devtools in browsers like Chrome/Firefox. The browsers even allow to set breakpoints and ...
1
vote
1answer
26 views

Soft body collisions give missing cache error

Sounds like I'm having the same issue as this question (Missing cache error) but since that has no answers, I figured I'd post this question with a working example of my issue. I have a bunch of ...
0
votes
1answer
61 views

How to run physics simulation frame-by-frame using Blender's Python API?

In my scene, I drag some of the objects and move them around while the physics is running (Alt+A). This means that the physical interactions could be quite different every time I do start the physics (...
0
votes
0answers
11 views

Automatically generate UV from command line or script [on hold]

I have 3D facial model (.obj file) that come from a 3D camera. However, the file is missing UV's. Is it possible with some sort of command-line option or a script to auto-generate the UV's for such ...
3
votes
1answer
56 views

How to join two areas using python?

I'm working on a script which should add a trim mode to the sequencer. The preview area is split into two preview areas, until the trimming has finished and the two areas are joined again, but I can't ...
0
votes
1answer
27 views

Permission Errror

when I try to export my objects via a python script: ...
1
vote
1answer
49 views

Save every object in scene as individual .blend files via python?

There is an excellent example here: https://blender.stackexchange.com/a/63000/37272 which saves all objects as .fbx files, but how do I get the script to save to .blend files instead? EDIT: This line ...
0
votes
0answers
16 views

How to convert pose bone's global position to bone's location or bone's matrix?

When I try to set pose bone's head in keyframe, I knew that the bone's head is just read only, so I have to convert the bone's head to bone's location or matrix, after searching a lot of information,I ...
0
votes
1answer
29 views

How to write a script that executes a list of commands only if a specific object is already inside the scene: Easy question I think!

I was wondering how to write a conditional in a script so that a list of commands runs only if an object IS NOT inside the blender scene currently. For example if "Cube" is already in the scene I ...
1
vote
0answers
13 views

Mark seam and clear seam in one button

I have been looking for a way to do this for a long time (mark_seam (True\False) and mark_sharp (True\False)) with one button in ...
0
votes
1answer
36 views

How to find out which modes (object, edit, weight paint, pose etc) is activated using Blender's Python API?

There are buttons for switching to object mode, edit mode, pose mode and others. How to make sure which of these modes is active using Blender's Python API? Any information would help! Preferably with ...
3
votes
2answers
65 views

How to use Python script to generate many lines in Blender and then animate line color and thickness?

I'm very new to Blender and to writing Python scripts for Blender. For the project I'm working on, I'd like to be able to create 10,000+ straight lines (see image below) and animate them so that their ...
1
vote
1answer
58 views

How to make a curve path from scratch given a list of (x, y, z) points?

I want to move a soft body object in my scene on a path (curve path). For the path, I want to make it myself from scratch. I basically have a Python List containing (x, y, z) points and want to create ...
0
votes
1answer
24 views

Apply transforms to all objects

I'm importing a .obj file(s) from another software that results in changes in scale and location. I don't want to have select all objects individually and apply scale and location changes. I've tried ...
1
vote
0answers
14 views

Active object crease listener [duplicate]

Is there a way to attach a listener to the active object in such way that whenever I change the crease value of any edge, it fires a custom function? Thanks guys
0
votes
1answer
17 views

Creating a resizable selection cursor in Python

I'm writing a tool that would allow me to modify meshes within a circle of certain radius. I'd like to be able to change this radius with a mouse wheel, just like with proportional editing tool: Here'...
0
votes
1answer
19 views

How to select last imported object with console?

I'm writing a script for fast importing with CSV file. There's a lot of things, like location, scale and quaternion rotation. Problem with the location I've already solved, but scale and rotation are ...
0
votes
1answer
21 views

Set player position

Ex. You want to move your character to coordinate 0,-10,1 but you don't want to add location normally. When you touch an item, i want to SET the position to those coordinates. The motion actuator can'...
1
vote
1answer
39 views

How to code a working Pie Menu for Sequencer?

How to code a working Pie Menu for the Sequencer? There has been coded pie menus for most elements in Blender, but not the Sequencer. I found this example, but it is not working for me. Nothing ...
1
vote
1answer
36 views

Massive import with CSV file [duplicate]

I have exported game archive with all objects. I also have CSV file with all their details, such as model name, location, rotation (XYZW). How do I import CSV file, and make blender read it and put ...
0
votes
0answers
17 views

break up complex mesh into many simple meshes for collision mask in unity

I downloaded a very complex house / mansion model fromonine, and I want it to now work with unity. As many know, if I simply put a mesh collider on this huge complex house mesh in unity, things ...
0
votes
0answers
19 views

Blender crash when import sklearn

I am working script Python in addons blender ".config/blender/2.79/scripts/addons/..". In the script, I want to import 'sklearn' (from sklearn.cluster import KMeans)...
0
votes
0answers
7 views

Get dopesheet selection

I'd like to make a script that sets the start and end frames of my rendering frame range to equal the frames I've selected in my dopesheet editor, I.e. if I have a selection of frames ranging from ...
0
votes
0answers
21 views

How to know if an object is translating, rotating and/or scaling

In python, is there any simple way to know when an object is having a transformation (location, rotation and/or scale)? The only heavy way I found is to create an object list and to compare the ...
1
vote
1answer
18 views

Event key for “TAB” and “TAB + shift” on add-on modal?

I am finalizing a Blender add-on and I have an issue on the modal part with 2 events triggered by TAB or TABSHIFT. Here is the actual code: ...
0
votes
1answer
29 views

Solid primitive cube in script

I am writing a script for applying a particle system on Blender. In the options I want to set a solid primitive cube as the duplicate object, however I can't figure out how to do it without creating a ...
1
vote
1answer
21 views

RuntimeError and TypeError when trying to call wm.event_timer_add

I'm currently working on a script for blender and I used the Modal Timer Template. The problem is that one line is constantly giving me errors. Here the source code: ...
1
vote
1answer
32 views

Why does my rendered object appear too big compared to object taken with real camera?

When I try to render a cube it appears too big compared to an image taken with a real camera and to the opencv method projectPoints. My setup I have a box and film it with a camera. A motion ...
2
votes
0answers
56 views

How to check if optional function parameter is set

I want to append some code to the bpy.app.handlers.render_post operator. But I need to know whether the bpy.ops.render.render() ...
0
votes
1answer
29 views

How do I name a selected group via python script

Hi python/blender users, I was wondering if anyone knows a simple python command that allows me to rename the selected group. I am working on a script that requires a renaming mid operator. I found ...
1
vote
3answers
49 views

Area of bottom polygons using obj.to_mesh post modifier but without applying it

First of all, I'm quite new to python so please bear with me if I'm asking dumb questions. I've seen similar questions answered but still can't get where I want. Say we have an active object in the ...
1
vote
1answer
44 views

“Failed to find Grease Pencil data to draw into” when using 'bpy.ops.gpencil.draw()'

I am in blender 2.79b. I would want to draw grease pencil lines by feeding in the points_list calculated in a programatic manner. When used in "Poly" mode, this ...
0
votes
0answers
31 views

Error using subprocess to call blender

This different from Calling Blender From Python Script in that it concentrates on a different part of the code which results in different error messages. It is also a more clearly stated problem. I ...