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
38 views

Script/API - Snap selection to grid, but only one axis

by script I can do a snap-to-grid of the selected vertices: bpy.context.space_data.grid_scale = 0.125 bpy.ops.view3d.snap_selected_to_grid() But I need to ...
1
vote
0answers
12 views

Moving an armature over [-pi,+pi] radians

I am working with robots, ROS and MORSE simulator. And I have a problem when I tried to control a robot simulated in MORSE using ROS. As MORSE is based on BGE, I am asking here my question. My robot ...
2
votes
1answer
23 views

Setting the correct Python data_path for vertex motion?

I am currently using Blender 2.80, and am attempting to follow along with the tutorial at this link on animating mesh objects (https://medium.com/@behreajj/creative-coding-in-blender-a-primer-...
0
votes
0answers
11 views

Activate keying set [Python]

I am trying to dynamically animate the scaling of an object. To achive this I try to set an active keying set (docs here). However this not specify the available types. I tried it with ...
0
votes
0answers
9 views

How to test `Panel.draw()` implementation?

I am trying to create automated tests for my addon and calculate coverage. As tests are meant to be automated I run Blender in headless mode (with --background ...
1
vote
0answers
15 views

How to get bpy.data.is_dirty updating when changes are done by script?

My addon relies on checking bpy.data.is_dirty. This seems to work fine in interactive mode, however when I tried adding automated tests for my addon I have faced ...
0
votes
0answers
12 views

Python: Delaunay creating extra faces

I'm writing a script that utilises the GIS addon which has a delaunay function to create a 2.5D TIN out of a set of points. The problem I'm having is that some of these TINs will generate extra faces (...
1
vote
0answers
126 views

Update function for NodeSocket?

How do I set a callback for socket input change (value or link change) when having a custom node? I have a socket defined like: ...
0
votes
0answers
13 views

Save keymap_items[].active after reload blender

I have an addon that disables conflicting hotkeys. After rebooting the blender hotkeys are turned on again, even if the user has clicked Save Preferences. addon https://github.com/Darcvizer/...
0
votes
1answer
14 views

how to bisect_plane with use_fill = True in Blender 2.79 using python?

I need to cut mesh in 2 pieces using filling cutted edge. But there is no parameter use_fill in bisect_plane in blender 2.79. I have a function that make cut: ...
1
vote
1answer
41 views

How to build Blender as Python module? [duplicate]

I'm on a Linux Ubuntu 18.04.1 LTS System. As the title states I was unable to find any precise documentation how to build blender as Python Module for uses in scripts. If anyone can help me I'd ...
0
votes
0answers
10 views

How to detect event in modifier panel?

I would like to be able to detect when a key is pressed in the modifiers panel. Is it possible ? If yes how can I do ? Thanks a lot.
0
votes
0answers
14 views

Context is incorrect Blender

I am working on a project to extrude a model. After importing an SVG file and joined every edge as one object I need to extrude the object. When trying to run this line ...
0
votes
1answer
30 views

How can I bind viewport display display as wireframe (wire) to a hotkey?

I'm trying to hotkey Blender's function of a mesh object in the viewport to be displayed as a wireframe (the one that can be found in the Object --> Viewport Display tab --> Display as wire). I need ...
1
vote
1answer
46 views

bpy.ops.transform.rotate ignores pivot point

I want to use python to rotate a vertices selection in edit mode, around the pivot point (z-axis constrained). The following command does not work as intented. It rotates the mesh but not around the ...
0
votes
0answers
14 views

How to check from the script that modal operator is running?

Or at least it would be great if there is any way to know that modal operator was cancelled
0
votes
0answers
33 views

Objcet has no mesh data to be used for ray casting

When I try to do a ray_cast in object mode, I get an error “Object has no mesh data to be used for ray casting” I tried to fix it with following the steps: ...
0
votes
0answers
14 views

startup file changed help me [duplicate]

by mistake, I changed the startup file and instead of the cube there are two cylinders and the camera view is also changed. So, how can I reset the settings so that it again shows cube?? I have tried ...
1
vote
0answers
9 views

turn 'only render' on, play animation, turn 'only render' off when done playing

I'd like to set up a python script that will turn 'show only render' on play animation then upon stopping (or esc), stop the animation and turn 'show only render' off. Ideally this would work for ...
0
votes
0answers
13 views

How to import .py dictionary with hex tags as new materials in grease pencil (Blender 2.8)

I'm wondering if possible to reference dictionary in a .py file & how to import as individual new materials in a grease pencil object. Dictionary content below. Exported with gimp. naming ...
1
vote
1answer
21 views

BPy set keyframe by active object only? [closed]

i have a tiny problem to set a keyframe by active object only in python console. my problem is now i have in "Object Mode" any objects select, and i try to set a keyframe by a active object (Cube) ...
2
votes
1answer
69 views

Change edge information display in Blender 2.80 with python

I am currently porting my personal addons to Blender 2.8 and this used to work fine in 2.79: ...
0
votes
1answer
29 views

How to write python to show Toruses from an imported txt file containing center coordinates

I have a question about Python. By the way, I'm beginner of Python and English. I wrote a script showing Toruses from an imported txt file containing center coordinates, but I got an error at ...
0
votes
1answer
16 views

BMesh and boolean operation

I create a BMesh using some vertices like this: ...
0
votes
0answers
15 views

Automate setup of bone constraints with script? [duplicate]

I have a few hundred bones in an armature that I want to add some constraints in pose mode to make the bones follow anther armature with the same bone structure. To do it all by hand is tedious and I ...
0
votes
0answers
13 views

Objects added via API merged together

When I add objects (primitives in this example) via bpy.ops.mesh.primitive_(box|plane|cylinder)_add at random places, not every object gets appended to the bpy.data....
2
votes
2answers
64 views

Is it possible to create custom Camera projection volume modes?

To clarify, I was talking with a friend and we started to wonder if there were camera modes beyond orthographic and perspective. As an example, one that defined its edges not with a cuboid or frustum, ...
1
vote
1answer
37 views

Set the Rotation (in Quaternion WXZY which is calculated by two vectors) of a bone using API 2.7.9

Details of the problem: I already have two vectors A and B (A is converted to B by a certain rotation), and I can now calculate the quaternion of its rotation. Also insert a bone in the blender so ...
0
votes
1answer
32 views

Problem with changing the current area type

Hey when executing this code it works perfectly the first part of it ...
0
votes
0answers
26 views

Make the tire spin in BGE

I already model a car for my racing game.I want to make the tire spin without seperating the tire from the car. im using blender 2.79b
0
votes
1answer
63 views

Blender 2.8, API, select_set( action = “SELECT”) TypeError

According to Blender 2.8 WIKI API changes, the following script is now obsolete: bpy.context.object.select = True replaced with: ...
2
votes
1answer
252 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 ...
0
votes
0answers
12 views

Python: Varying List of Frames Rendered from NLA Strips

I got an animation which is split up in 7 different NLA-Tracks. I want to render specific frames from each NLA-Track from 8 different views and almost got it working. In the code below I'd like the ...
1
vote
1answer
53 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 ...
-1
votes
1answer
82 views

Python: Why doesn't my code work?

I am on using Blender 2.8 Beta. In this code, I am creating a particle system for the active object, and the particles are the rest of the selection. ...
1
vote
0answers
16 views

Custom script folder without editing files?

I'm trying to get Blender to launch with a custom script folder, is it possible without editing the preferences or files? I'm in a company considering making a very slow phase out of Autodesk ...
1
vote
1answer
16 views

How to shift foward actions using python

I have two sequential actions, and I want to shift them both foward. I can list the actions with bpy.data.actons, but I don't know how to modify them.
0
votes
1answer
24 views

Rendering same scene multiple times? (changed by frame change handler)

This is a follow-up question to my previous post. After a certain learning period I was able to produce the generated scenes I wanted. It looks similar to this gif (credit to @batFINGER): In short: ...
0
votes
2answers
37 views

Access Grid of 3D View with Python

Is there a way to access the grid of the current 3D View and snap the mouse cursor to the grid. Or if snaping is not supported, get the grid interesections so that I can draw points just to these ...
1
vote
0answers
26 views

Internal “get/set” function of property?

Here is my test code and picture: ...
2
votes
1answer
53 views

Draw 3D with Python more in front

I have an addon with that I draw in 3d space (lines). The vertices are where I click with the mouse cursor. I use the region_2d_to_location to get a point from the mouse coordinates in 3d space. But ...
0
votes
0answers
31 views

python 3.6 on blender 2.8

Is it possible to have python 3.6 on blender 2.8 version. I am working on project and want to use blender with external modules but those module are not supported by python 3.7 yet.
0
votes
2answers
51 views

API: how to iterate over a planes vertices row-by-row, column-by-column

assume a simple plane 10x10 vertices. I'd like to access the planes vertices in an ordered manner according to its structure (and not the vertice' positions in space which may be random). I start with ...
0
votes
0answers
31 views

Blender uv stitch operator problem

I am trying to execute the stitch operator but it works only in gui when trying to execute it from a command line it doesn't run the operator here is a code snippet that i have now : ...
0
votes
2answers
65 views
1
vote
1answer
78 views

Linting Blender Python in VSCode

I use Visual Studio Code (VSCode) as a dev environment for Blender addons. I installed the ms-python.python extension, and enabled the language server for ...
1
vote
0answers
20 views

python: select a tab in the Tool Shelf

I'm trying to activate a specific tab in the tool shelf from a script. The idea being that my add-on would setup an "enhanced/tailored" environment for the user when certain button is clicked. Is ...
0
votes
0answers
9 views

Cancelling script-execution w. invoke_confirm()

I'm quite new to both python and blender-scripting, but I've done a lot of scripting in other contexts. I'm getting my feet wet in blender-python with a script that lets you render in the background ...
0
votes
1answer
21 views

How to use mathutils.noise.hetero_terrain?

I am not sure what I am missing, but all I get is a value of 1 on every return.. ...
0
votes
0answers
30 views

How to read a current value of the Cycles material node and write it to file?

For each object of the scene (there are a lot of them) I use a single material. I need to use the Python script to read the current value of the Color output of the Color Ramp node and write it into ...