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.

31
votes
0answers
1k views

Custom trackpad pan/zoom/rotate behavior add-on

I'm trying to write an addon to customize the trackpad panning, zoomimg, and rotating gestures, but can't find a way to read the actual trackpad parameters for position and so on. The properties in ...
13
votes
0answers
478 views

Property Panel Custom Popup Menu when user presses hotkey over an input field

is it possible to trigger this kind of menu: in the property panel when I press a hotkey over a button/input field? I want to specifically,when the user presses a specific hotkey when over an input ...
11
votes
0answers
283 views

How to make a dynamically expanding menu in Blender?

Say we want to navigate a tree structure without knowing all the data ahead of time, is it possible to do this in Blender? For example, a menu which dynamically loaded a directory hierarchy from the ...
8
votes
0answers
184 views

Blender on Windows is skipping python script. (brenda on windows)

We've been using Brenda for quite some time now for rendering architectural stills. Since our editing stations are doing nothing at night, I started making a desktop app that allows you to pick jobs ...
8
votes
0answers
2k views

How to create macro/record actions while modeling

I'd like to record my actions and create a macro. I've tried allready two things: 1) copying actions from Info panel and pasting them to text aditor. Then adding the lines: ...
7
votes
0answers
190 views

How to call original operator from operator's override?

I would like to amend functionality of an existing operator with a condition check and then "proceed" with the original operator (if condition check allows it). It is essentially what is done in ...
6
votes
0answers
85 views

how to configure facility wide configuration files

We'd like to integrate Blender into our pipeline. With other software packages, we usually have cascading configurations: facility (eg configuring temp folders and common plugins) project (eg project ...
5
votes
0answers
308 views

PyOpenGL and VBO Indexes

Long story short, I'm trying to do a modal handler that draws using OpenGL into the viewport. Immediate mode through BGL works fine, but is dog slow. I tried using VBOs through BGL but there seems to ...
5
votes
0answers
319 views

Viewport widgets with draw handler

Is it possible to create viewport widgets with draw handler? I have an operator which produces simple mesh geometry, I use operator redo properties panel to edit the result as shown in animation ...
5
votes
0answers
157 views

Killing Blender processes

So I'm currently using Java's ProcessBuilder to run Blender Python scripts for rendering in the background and that's working fine. However, I would also like to abort Blender at any time, and unless ...
4
votes
0answers
121 views

ATOM : setup blender python environment in my IDE

Anyone using atom here for developing blender addon etc ? How can i setup the blender environment (autocomplete, lib access etc) in Atom ? Tried to googling it but can't found any help. Some tutorial ...
4
votes
0answers
1k views
4
votes
0answers
84 views

What do all of the mode enums mean?

What do all the various mode constants in blender operators documentation do? bpy.ops.object.duplicate(linked=False, mode='TRANSLATION') - Duplicate selected objects Parameters: ...
4
votes
0answers
152 views

Is there a low level alternative for bpy.ops.object.convert(target='CURVE')?

(Note: Somebody asked there nearly the same question as me and got a very nice answer. However, this was to convert an object to a mesh. I have exactly the same context as this person but I want to ...
4
votes
0answers
283 views

What's the recommended method of circumventing infinite recursion with the scene_update_post handler?

I am writing a Blender addon that stores extra information inside a mesh (as custom vertex data layers). The information in these extra layers needs to be recalculated whenever the mesh changes. More ...
4
votes
0answers
234 views

How to bring the context “back” after running read_homefile()?

When I run import bpy bpy.ops.wm.read_homefile() and then I replace the above with this (in the same text data block) ...
4
votes
0answers
1k views

Real time script execution

Trying to make a modelling tool that can update geometry in the 3D view as the user interacts with the scene. To do this the script needs to loop continuously so it can check for changes caused by the ...
4
votes
0answers
267 views

How to update image preview(icon)?

I have a UIList with a property that uses the preview icon of an image as its icon. It works, but it doesn't update, unless the icon is updated somewhere else first, i.e. in the texture paint slots or ...
4
votes
0answers
305 views

get radius of mesh primitive

I would like to ask whether there is a way of getting the radius of a sphere (mesh primitive) after it has been added. In other words, does Blender somehow distinguish between different shapes? What ...
4
votes
0answers
134 views

Mesh Extra Objects - operator panel is empty when using api instead of gui

I am using the Add Mesh Extra Objects Add-on. If I add a regular solid via gui I can set stuff in the operator panel like source, size, vertex truncation, ... If I use ...
4
votes
0answers
463 views

How to get cycles bake progress in Python?

I can bake to textures using bpy.ops.object.bake(). But because this function waits until completion, I then use this: ...
4
votes
0answers
51 views

Find the largest piece in UV-editor in Blender 2.73

Is there any way of finding the largest UV-section in the UV-editor without manually comparing each piece next to each other? I want to select the piece that is the largest on either X, Y, or both ...
4
votes
0answers
458 views

Adding sliders from UI to pie menu

I've seen some sliders working in pie menus but the one I'm trying to add to my pie script isn't showing up. Its the 'autosmooth normals' slider from the Object Data tab, under Normals (in the ...
4
votes
0answers
186 views

Hide filter options in UIList

I want the UIList to not show the filter options (inkl. the plus button). I've use following flag: self.use_filter_show = False The flag disables the filters ...
4
votes
0answers
120 views

How to know when object are deleted?

I use blender as a network client. I'm able to know when objects are updated (via handlers). But I would like to notify the server when a object (or mesh, animation, etc.) are removed, how can I do ...
4
votes
0answers
375 views

Save screenshot (bge) without writing to disk

This is a little odd but I need to save a screen-shot as an array (numpy array for eg) without writing to disk. The idea here is to create and then call the array once per frame in an external script ...
4
votes
0answers
459 views

Blender and MBdyn

I was looking for aerodynamic simulation possibilities in blender and after some research landed to this page: http://blenderartists.org/forum/showthread.php?139557-Multibody-Dynamic-Simulation-...
4
votes
0answers
667 views

Converting an obj sequence to a .bobj fluid sim cache?

I'm wondering if there is any way to accomplish turning an obj sequence exported from realflow into a .bobj fluid cache that I could then trick blender into loading as a native fluid sim cache. So far ...
3
votes
0answers
20 views

Getting Color Values Produced by Dynamic Paint

I am having trouble with the python code to get the colors of vertices when using Dynamic Paint. If I try painting a cube using the Vertex Paint mode I can get the rgb values of the vertices using the ...
3
votes
0answers
193 views

Add a Texture to an Object using Python and Blender 2.8

i have trouble to get a script working within Blender 2.8. The following function work perfectly for me in Blender 2.79, but not in 2.8. ...
3
votes
0answers
51 views

How to set the path for userpref.blend file?

After compiling Blender as a Python module I realized that userpref.blend does not exist in ~/.config/blender/2.79/config. I ...
3
votes
0answers
41 views

Setting particle color with generated m x n image texture

I have a large particle system in which the particles (stars) are colored according to a generated image texture. The image texture was originally 119,617 wide and 1 px high. No matter what I did, ...
3
votes
0answers
65 views

How to access Normal and Tangential force values of objects during physics simulation?

I have a couple of soft body objects that collide with each other as shown below. My goal is to get information on the Normal and Tangential forces for the selected shape. I wonder, is it possible to ...
3
votes
0answers
166 views

What is the fastest way to get pixel data out of the camera?

I'm trying to speed up a script that has to generate a black and transparent object (those are the only two RGBA colors), and use the pixel data coming from pictures of it shot from multiple angles. ...
3
votes
0answers
339 views

PythonScript to load data as colored point-cloud

Background I want to render 3D points with color information for scientific visualization. I have several hundred thousands of points up to 2 million. For each point I have [xyz] coordinates and two ...
3
votes
0answers
511 views

A working guidance for building blender as bpy python module?

There are informations on how to build a bpy python module from blender source but, it does not work (for me) using Ubuntu x64 16.04LTS. We need a working guidance !? Building it up with: https://...
3
votes
0answers
194 views

Getting the results of a rigid body simulation via Python

I'm trying to run a physics simulation with a single rigid body (cylinder) launched randomly on a flat surface. I want to know using python on which side (or edge) did the cylinder land. The ultimate ...
3
votes
0answers
53 views

How can I access the values set via normals_split_custom_set()?

I use a variety, of, methods to set the loop normals but want to read them to do some raycasting. I thought I had to call calc_normals_split() then match up ...
3
votes
0answers
174 views

Drawing mathematical functions using the Blender API - drawing a line

I want to represent the line y = 4x + 2. I suppose it has something to do with a function in python that gives pairs of values x-y and another that matches the ...
3
votes
0answers
306 views

I want to convert my Diffuse Shaders to Principled Shaders

I just barely imported a scene from an .obj file, but all 83 materials defaulted to Diffuse Shaders of various colors. To make for a faster workflow, could I use a python script of some sort to ...
3
votes
0answers
181 views

Camera pose estimation by matching edges

I've a camera at known location and rotation from where an image of a model is rendered (Top left of the figure). The camera is randomly translated and rotated to a very close unknown location and ...
3
votes
0answers
76 views

Help with understanding the addon enable process in blender

I’m trying to make our add-on work when its enabled from blender starting up (safe as enabled in user prefs). But for some reason this doesn’t work. It works fine when enabled after blender has ...
3
votes
0answers
131 views

Update viewport after toggle of cycles shadows for all objects

I wrote this little script to toggle the visibility of the shadows of all objects. It works quite well, but at the end of the script, I'd like to update the viewport. I tried the "hack" with the ...
3
votes
0answers
89 views

Is there a good way to visualize progress for the end user?

I'm currently working on an addon that renders animations at many different angles. Think isometric sprites. Currently Blender just hangs while it's doing its work. Is there a loading bar, or some ...
3
votes
0answers
654 views

Controll cube with arduino + mpu6050

So i have an arduino with an mpu6050 attached to it. It is currently set up to send the raw data from the imu sensor to my computer. I would like to use this data to control a cube in blender with ...
3
votes
0answers
96 views

procedural texture with varied coverage

I want to generate textures with varied coverage, namely, the percentage of filled pixels varies. From the coding perspective, we could achieve this using quad-tree, i.e., subdivide the image into ...
3
votes
0answers
95 views

Accessing objects and properties in Blender: what's the best practice?

I'm writing a python script that is about to reduce the vertex count of some meshes in accordance with some custom rules (for technical uses, for example, parallel edges must remain parallel and so on)...
3
votes
0answers
456 views

Python Script Cycles Samples setting not respected

I have a script for rendering files, but I am not able to figure out how to set the samples per tile and have that value be used. My script is: ...
3
votes
0answers
83 views

How to run an update function only at the end of tweaking a slider

Properties have a nifty little update=function parameter which is run every time the property changes. This is very useful, but when used on a slider in the UI, ...
3
votes
0answers
271 views

export paper model in multiple pages

Link below gives a pepakura 3d model unwrap Python script by Adam Dominec (Thank you to him). Is there a way to export or have it in multiple page format, so printing becomes easy? paper model