New answers tagged scripting
1
vote
How do you reuse an operator with different variables? "Object has no attribute" error when I try
Here is an example:
...
0
votes
How to lock the always on top subinterface when run a operator
Finally I thought of a way, share if you have a new one.
The idea is when you start your modal, run a empty modal to all subwindow.
And remove them when finished.
...
0
votes
Accepted
Add text information directly to the viewport for 5 sec
You can check if the operator is running and the handler has been added
Remove the text after 5 sec or MOUSEMOVE
...
3
votes
Accepted
How can I add a library override to a non-API custom property from a linked file with Python?
Change the value of non-api-defined library overridable custom property via Python
...
1
vote
Time since last function call
I haven't found a function like that yet. Here is a working variant using the time module. We get the current time in ms and store it in the operator attribute.
...
3
votes
Accepted
How can I instantiate a Simulation Zone input / output node's socket via python?
You need to access state_items on the simulation output node:
...
2
votes
direction perpendicular to screen
You need to simply extrude in the direction of the camera, in geometry nodes it would look this way:
In Python the only tricky part is to calculate the position of the viewport camera:
...
5
votes
Accepted
3
votes
Accepted
KeyError: 'bpy_prop_collection[key]: key "View Layer" not found' when launching blender with external script
Notice that the error appears before it reads the blend file. That is because your command should specify the blend file first and then the python script argument like this:
...
0
votes
Changing the size of the box by the user
To make objects configurable you need to write custom JavaScript code using B4W API. But I don't recommend using Blend4Web at all, since it was deprecated long ago. For a modern and much simpler ...
1
vote
Accepted
How to get the path to an image that the user chooses
Run a function after user selects the filepath
...
1
vote
3
votes
Accepted
Control Blending Mode of the Color Mix node through the custom driver
You can use usual workflow: right-click a field and choose "Copy as a New Driver", and right-click another field and choose "Paste Driver". The value to be used is the index of the ...
0
votes
Hard ops smart apply menu is missing
I just had to switch to Object Mode. Then the Operations > Smart Apply option is displayed.
1
vote
How to run custom script (via python) after use "delete object" or "rename object"
For my purposes, I'll use this for now:
...
1
vote
Accepted
0
votes
TypeError: Element-wise multiplication: not supported between 'Matrix' and 'Vector'
If @ or * that doesn't solve it, make sure you have imported mathutils AFTER bpy in your python file.
thus:
import bpy
import mathutils
1
vote
I want to remove the console display that appears when reloading a script
A search in the folder of the VSCODE function with the word
Reloading:
in the folder \startup folder,
the print function ...
3
votes
Accepted
Automatic actions after starting addon?
Addons are first loaded in a restricted Context where no view_layer exists that's why you get thrown that error. Instead, you can execute your script within a ...
1
vote
Accepted
How do I get the output of the Join Strings node in python?
Right now only way to take string from geometry nodes evaluation process is to read name of geometry attributes. Exactly, with length limit.
2
votes
Trouble debugging this script (loop through non-manifold verts on one mesh and find index of closest edge on a different mesh) - any tips
Here is the corrected code for line 44:
location = v.co
This is because BMesh/BMVert does not use the location attribute. It uses co, which stands for coordinates.
Top 50 recent answers are included
Related Tags
scripting × 6459python × 4818
add-on × 679
interface × 335
mesh × 331
animation × 329
rendering × 250
objects × 245
operator × 209
game-engine × 201
materials × 197
node-editor × 190
properties × 183
modeling × 168
modifiers × 168
transforms × 147
export × 140
import × 139
bmesh × 132
drivers × 131
3d-view × 122
uv × 108
vertices × 108
camera × 107
command-line × 107