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 ...
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 ...
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: $...
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: <...
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.
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 ...
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 ...
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 ...
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 ...
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,
...
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 ...
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 ...
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 ...
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, ...
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
...
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 ...
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)
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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, ...
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, ...
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.
...
4
votes
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scripting × 6258python × 4665
add-on × 651
mesh × 326
animation × 322
interface × 322
rendering × 243
objects × 243
game-engine × 200
materials × 192
node-editor × 186
operator × 185
properties × 175
modeling × 161
modifiers × 161
transforms × 144
export × 140
import × 130
bmesh × 127
drivers × 120
3d-view × 115
uv × 106
armature × 102
camera × 101
command-line × 101