8 votes
Accepted

Python: Server and Client in Blender

Here I have configured one instance of Blender to run the server script using Blender 3.4, and another instance to run the client script using Blender 3.3.1, but you can use any or the same versions ...
Harry McKenzie's user avatar
8 votes

Mathutils not available

We have to tell ChatGPT to read the docs! ;-) It's import mathutils, not bpy.mathutils... But worse, the methods you need, are ...
Sietse Brouwer's user avatar
8 votes
Accepted

can cos() function have more variety in terms of animation movement?

Goal 1: Move the min/max point up/down of a cos function Assume you want to move first minimum point -1 on t = pi, then the function of t in (0, pi) be $1.5*cos x-0.5$ Simair, the second function: $...
X Y's user avatar
  • 5,327
7 votes

How can I start a driver at a specific frame?

If you don't want a sudden jerk in your driver, then subtract the starting frame and clamp the value: top driver: frame/500 if frame > 30 else 0 bottom driver: <...
Markus von Broady's user avatar
7 votes
Accepted

Indent Guideline in Text Editor

An addon is doing that. You can find it here. It seems to work well in 4.0.
lemon's user avatar
  • 53.4k
6 votes
Accepted

Set the distance of all selected objects to another object to be the same

You can do this with a Shrinkwrap constraint. Select one of your objects give it the constraint, and adjust the projection direction and distance as you like: Here, I'm copying the constraint to the ...
Robin Betts's user avatar
  • 74k
6 votes
Accepted

Is there a way of implementing an arithmetic progression with geometry nodes?

Well, I would say this is a useful solution: The principle simply relies on Duplicate Elements and Accumulate Field. First I ...
quellenform's user avatar
  • 33.6k
6 votes
Accepted

Should I delete/comment all the asserts in my code when my addon is finished?

Assertions are a feature specifically designed to allow to easily disable the checks in the production code. You can do so by compiling your Python code to a .pyc ...
Markus von Broady's user avatar
6 votes

How can I fully select a collection using python with blue highlight?

Each outliner area has individual selection (blue highlight). But only one active collection as seen below (gray highlight on icon). If you press F2 in any one ...
JayReigns's user avatar
  • 151
5 votes

How to calculate speed/detect movement per frame?

About the 1st .blend file I think the problem is that the Cube object itself is the target of its own variables. The result of dumping the values of the variable from the function, ...
tetii's user avatar
  • 1,730
5 votes
Accepted

How to clear all bpy.app.timers from previous script execution?

Thanks to @HikariTW for the current workaround, which is to save the function pointer of the timer callback into an attribute appended to the bpy module, albeit ...
Harry McKenzie's user avatar
5 votes
Accepted

Why doesn't area.tag_refresh() refresh the area?

The solution is already in the question, but for future reference I will post it as an 'official' answer. After setting pixels of an image, an img_bpy.update() is ...
Sietse Brouwer's user avatar
5 votes

How can I invert image colors with the Python API?

According to this page https://docs.blender.org/api/current/bpy.context.html there are only two possible values for "Image Context": edit_image and ...
RussCoder's user avatar
  • 211
5 votes
Accepted

Getting and using the selected Color Attribute

I can confirm this is a bug introduced in Blender 3.2. I'll file a bug report (edit: done). In the meantime, if you want to continue using the vertex_colors API, ...
scurest's user avatar
  • 9,496
5 votes

How to listen to 3d cursor changes in Blender script?

Message Bus (bpy.msgbus) https://docs.blender.org/api/current/bpy.msgbus.html ...
X Y's user avatar
  • 5,327
5 votes
Accepted

How can I add a custom Menu entry to the topbar of the 3D viewport?

Sure. One of the great things about Blender is that it's open source and its UI is written in Python. So you can just right-click on any of the Topbar menus and choose Edit Source to see how it's ...
Martynas Žiemys's user avatar
5 votes
Accepted

Python: How can I know the position of a modifier in the stack?

Blender's collections don't support indexing (although support could be added). So the simplest way is to convert to a list: index = list(ob.modifiers).index(mod) ...
ideasman42's user avatar
5 votes
Accepted

Where to find bpy name lists for scripting?

I don't know of a list of every possible name of UI element. But there are some lists for some elements. For example: Space Type Items — Blender Python API You can also easily identify things in ...
L0Lock's user avatar
  • 14.8k
5 votes
Accepted

How to dissolve "Reroute" nodes with python?

You could search the node tree for nodes of type REROUTE and then check their input and output socket paths and reconnect them while deleting the reroute node, since there is no direct way to dissolve ...
Harry McKenzie's user avatar
5 votes

Generate non-overlapping spheres having different diameters in a cube

This is a tough question. There are many strategies possible to remove overlapping, all with their pros and cons. You could simply remove all overlapping spheres in a second pass and be happy with ...
taiyo's user avatar
  • 3,294
5 votes

How to draw a specific color with gpu shader

Actually you can, see edit below. As @Harry McKenzie suggested, you can't. Let me make this plausible by some observations. I changed your script a little to produce all grey tones from 0-1 with a ...
taiyo's user avatar
  • 3,294
5 votes
Accepted

Accessing C pointers to vertices in Blender's Python API

The ctypes module can create a C-compatible array from a Python list of Vertex objects. But you can also just take the pointer of the first vertex ...
Harry McKenzie's user avatar
5 votes

Is there a way of implementing an arithmetic progression with geometry nodes?

If I've read you right, to achieve the final effect, (if not the internal logic,) you could just implement some adjusted variation of this: using the sum of X and Y coordinates as a threshold: If ...
Robin Betts's user avatar
  • 74k
4 votes
Accepted

To select the vertex at the highest point on the z-axis in edit mode

You can copy this Python script and paste it into the Text Editor within Scripting Tab. Then select the object and press Run Script button. It will automatically ...
Harry McKenzie's user avatar
4 votes

How to trigger a script after completing object transform?

Here is a script that will trigger when I move an object in the 3d View ...
james_t's user avatar
  • 5,072
4 votes
Accepted

Geometry Nodes: How to connect two sets of points with the same Index using Bezier-curve?

How can I create multiple Bezier-curves between the two sets of point with one node? So, that it would not depend on the number of points. A Grid is perfect for ...
Kuboå's user avatar
  • 8,540
4 votes

Set the distance of all selected objects to another object to be the same

Alternate version with Geometry Nodes: Set a Vertex Group: Instance along that Vertex Group by converting it to a Curve: The diamond shaped 'Selection' Node can be set in the Modifiers Properties, ...
Aubrey's user avatar
  • 981
4 votes
Accepted

Changing addon folder name

Changing the folder name shouldn't cause any issue. The issue you are having is that Blender is trying to look for an addon in a folder that doesn't exist anymore. But if you look in your screenshot, ...
L0Lock's user avatar
  • 14.8k
4 votes
Accepted

Print Enum Value

One approach to achieve your goal is by accessing the data via the bl_rna of your enum variable. ...
Ratt's user avatar
  • 2,016
4 votes

Modifying single-object Python script to execute on all selected objects

...
X Y's user avatar
  • 5,327

Only top scored, non community-wiki answers of a minimum length are eligible