Questions tagged [scripting]

Questions concerning scripting in Blender using the Python programming language. Also use this tag for questions about scripting in OSL (Open Shading Language).

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

How do I use blenders python .transform.rotate() snapping function

I just want to use this python script to snap the rotation of a plane to another plane. ...
3
votes
0answers
21 views

Object Picker Modal Operator?

I saw this question this morning and i'm also quite interested in a Picker modal operator, so I did tinker a bit and achieve a somewhat beginning of a working code but I encountered some problems ...
2
votes
0answers
22 views

Can I create buttons in a blender panel with big icons?

I'm creating a panel with several buttons that start modal operators. I'm finding the default UI layout creates very small icons that are hard to see, even if the source image is rather large. Is ...
2
votes
1answer
35 views

How to pick an object before operator execution? (object picker/pointer ux?)

I have an operator that needs an object in order to work, but here's the trick, it is required to use some sort of picker GUI in order to select the object first before execution() (instead of using ...
0
votes
0answers
10 views

How to delete a face using BMESH.OPS? (SOLVED)

Sorry if the question is asked before, but I tried using the examples I found on StackExchange and it still didn't give me the right mesh. I am trying to create a tube that has a shape of cylinder at ...
0
votes
0answers
7 views

How to make object appear in certain frame (scripting)? [duplicate]

Im learning how to use scripting in blender. I would like to know how could I make a certain object to appear only in a certain frame. I have been searching this for a long time and I still can´t ...
1
vote
1answer
21 views

Draw in a region not found in space type

I'd like to create a footer where there's no "FOOTER" bl_region_type for example in the 3D view, it seems impossible to do in python? is this hardcoded in C++? ...
2
votes
1answer
25 views

Getting edges of the camera's view on the scene XY plane

I need to place objects randomly into a scene so that they are consistently within the camera's view. I have a script which randomly places a perspective camera pointed at ...
0
votes
0answers
13 views

How is a WorkSpaceTool supposed to know when the user has selected a different tool?

I'm writing a WorkSpaceTool that starts a modal operator to do its work. I need to be able to detect the user switching to a different tool so that I can stop my operator. How would I do this?
1
vote
1answer
24 views

Why can't I add pip to the version of Python that comes with Blender 2.91.2?

Short version: I need to install external modules for use within Blender, but can't for the reasons given below. I'm on macOS 10.14.3 with Blender 2.91.2, which includes Python 3.7. I want to be able ...
1
vote
0answers
18 views

How to set custom icon for WorkSpaceTool?

I'm trying to create my own WorkSpaceTool and give it a custom icon to distinguish it from the other tool icons. I've used bpy.utils.previews before to load icons ...
2
votes
0answers
32 views

How to create a dynamic UI-list similar to the outliner

I'm currently trying to create sort of a "navigation" UI list with the parent/child concept like the outliner or any classic folder navigation. But I'm stuck at the part where I need my ...
1
vote
0answers
20 views

Render to a Python list

I'm trying to get my renders to output to a python list or NumPy array. Currently, I'm doing this by rendering the image to disk (with a script), then using a separate python script to read the image ...
1
vote
0answers
23 views

Fake User for all animations on selected object

First of all, I'm not too familiar with python. What I'd like to happen, is that for the selected object/objects, it should get their animations and set their use_fake_user = True (due to bone ...
1
vote
0answers
18 views

Locked track Camera error [closed]

Locked track object to camera x axis is very strange When camera is on z axis(rotation) x axis of cube turn up Is python can change it?
1
vote
1answer
28 views

How to recalculate bone transforms/constraints to originate from armature origin point?

I'm trying to make an export script, and I need all the exported bones to be positioned at the armature's origin point. The trouble is that I would like to be able to position the bones anywhere in ...
1
vote
1answer
23 views

Cancel addon registering

I am developing an add-on, which only works if some specific conditions are satisfied (e.g. some other add-on is installed). Hence, I want the user to be unable to register this add-on if the ...
2
votes
1answer
67 views

What is the coding alternative for double edge loop select?

Suppose I want to select the entire mesh boundary. Alt + RMB on a boundary edge would select one edge loop (left image), while Alt + double RMB yields the desired result (right image). How would I ...
1
vote
0answers
9 views

How to position a GreasePencil Stroke via scripting?

I am trying to automate blinking animation via scripting. I can move grease pencil objects, but I need to move a stroke inside a layer (I am using masking, so I can't convert the strokes into ...
0
votes
1answer
28 views

Get parent from a collection that's already in a collection

Im really struggling with what seems to be an easy task, however Im not able to make this work. I need to get the parent inside of a collection that's already in a collection, with the code im using <...
1
vote
1answer
32 views

How to get the base dimensions of an object (ignoring all of it's modifiers)?

I'm trying to code a function that gets the base dimensions of an object that has multiple modifiers applied. Sure, I can turn all the modifiers off, get the dimensions and then re-enable everything, ...
3
votes
1answer
35 views

Strange size when creating a cube using bpy.ops.mesh.primitive_cube_add

Just starting with scripting in Blender, and the simplest thing seems to not work as I would expect. I copied the code that creates the standard cube and repeated it, with a z scale factor of 4. I ...
1
vote
0answers
23 views

Rotation Euler in Constraints python

Transformation constrain have an Euler mode in Blender 2.9. I need it in Blender 2.79. Thank you in advance! https://developer.blender.org/rBS18d4ad5a59d32922f9d70b0412da0c830baceb17
1
vote
0answers
15 views

msgbus.subscribe_rna() to an operator?

I'm trying to find a way to get notified by the operator bpy.ops.object.transform_apply() so every time my users are applying an object scale I can re-calculate it's square_area property. But I have a ...
0
votes
0answers
15 views

Add-on hierarchy

I am trying to create a family of add-ons, all of which use the same asset library. That means, all add-ons will use the same path to the asset library, and I want the user to specify that path only ...
0
votes
0answers
14 views

visual studio code bmesh gives weird error

i started making scripts in visual studio code for blender a few weeks ago but i ran into a weird problem, when trying to use bmesh specifically bm = bmesh.new() it ...
1
vote
1answer
55 views

Use location and rotation 0,0,0 for all exported meshes

I would like to know how can I modify the location of the 3d model that I'm exporting without modifying the original one, I'm using this code: ...
-3
votes
0answers
23 views

How to make the player move meant and AI in blender? [closed]

Im working on a game called Leviathan Realms
2
votes
1answer
48 views

How to create cylinder with varying radius at different height

My goal is to create a imperfect cylinder with a script, where some randomness is added to the radius of the cylinder at certain intervals. I am very new to blender unfortunately, and am lost at the ...
1
vote
0answers
12 views

Blender Python Object Transform operations - return values / Thread lock?

I recently stumbled upon the following problem of the data/context object API layer. If one changes object values which are accessed by the scripting with ...
2
votes
1answer
83 views

How to convert rotation_axis_angle to euler or quaternion via Python?

For my script I need to get the same result that Array modifier produces with Object Offset. In particular, I need to calculate rotation difference between two objects' rotations despite their ...
0
votes
0answers
29 views

Collapse/Hide appended collection in Outliner through python

I'm appending some collection from other blend file using bpy.data.libraries.load(filepath, link=False). I want to collapse all collection after appending is done. ...
1
vote
1answer
23 views

Change all metallic value with python [duplicate]

I have a bunch of metallic materials that use the Principled BDSF, and I need to change all of them from a metallic value of 10 to a metallic value of 1. Can this be done using a script?
2
votes
2answers
31 views

Edit Many Materials at Once [Insert a Group in all materials node chain]

The Situation: I'm creating a flying photo effect of hundreds of photos, using a particle system. I've created a custom group that includes lowering transparency based on camera distance, so as you ...
1
vote
0answers
22 views

Numpad Buttons Panel

A question arose recently regarding the numpad. Below is the code that produces panel shown in the image Have used a 3 column column flow and added the extra row and column with double sized keys. ...
1
vote
1answer
25 views

This script can't run twice, why?

Blender ver 2.83 LTS. Whenever I tried to run this script twice, it came out an error: ERROR (bke.lib_id): C:\b\buildbot-worker-windows\windows_lts_283\blender.git\source\blender\blenkernel\intern\...
1
vote
1answer
43 views

Driver using self does not update location in render only

I am writing a driver in blender 2.91.2 to simulate a spacecraft's Reaction Control System thrusters based on the movement of a parent object, without having to manually adjust and keyframe each "...
1
vote
0answers
21 views

Why does my Curve turn black? (only happens without bpy.ops)

I'm creating a curve without bpy.ops but the previously created curve turns black for some reason. Toggling in and out of Edit Mode fixes the issue but that seems kinda silly. EDIT: I reported this ...
1
vote
1answer
35 views

Simple Addon 50 lines - Crash blender - what I do bad?

I start to learn Python and Blender. But can't figure out what I do bad here. The code is : ...
0
votes
1answer
39 views

Way to temporarily draw a uv grid over blender meshes?

I have a scene where all of the objects have a material assigned to them. However, it would be useful if I could temporarily assign them a special material which simply a texture map of a grid square....
0
votes
1answer
21 views

Script to Insert Keyframe for Fluid “effector_settings.use_effector” property

I have added a cube as an Effector to a fluid sim. I want to use a script to insert a keyframe for the 'Use Effector' property (see image) Here is what i've got so far: ...
1
vote
0answers
17 views

Find vertex position on an edge loop (python)

I have a list of vertices that make up an edge loop (the edge of a rectangle with multiple subdivisions, in this case.) I also know which vertices are at the start and end of the loop. What method can ...
1
vote
0answers
23 views

Looping Repeatable Hotkey with Python

I've been studying this Dual Functionality question and trying to get something similar going, however for a slightly different need. I'm trying to create a hotkey that is repeatable, and cycles ...
1
vote
0answers
19 views

How to have a keymap work in object mode and edit mode? [duplicate]

I've created an operator that uses a keymap to activate it. While it works in object mode, it is not being called in edit mode. Is there a way to get this to run in edit mode too? ...
1
vote
0answers
43 views

How to remove a certain operator? [duplicate]

In short my question is how can I remove/delete an panel/class/operator which: a. I don't know the full name b. and I don't know where it is stored in Blender system. In other words, how I can undo a ...
3
votes
1answer
93 views

randomly distribute objects over a plane

I have a number of different objects (e.g. cube, cylinder, monkey, furniture, etc) which I would like to distribute randomly over a plane/surface (the floor in this case) without having any ...
0
votes
0answers
7 views

How to load image in GPU Shader Module and don't let user access them

I want to display the icons in 3Dviewport in my addon with this module, the problem is the user can access the icons in Image Editor. How to prevent user to access these icons in blender? ...
2
votes
2answers
22 views

Script calculated multiple times on frame

I have a simple script like this: ...
1
vote
1answer
27 views

Add confirm upon release event to a custom shortcut

I've changed shortcut for pan 3D view to spacebar + mouse movement and it works fine because at the bottom of the shortcut edit window there's a View3D Move Modal section that allowed me to tell ...
1
vote
1answer
20 views

How to have a script run from a keypress? [duplicate]

I'm trying to get keymaps working in my script, but it's not working. I want grid size of the current view3D to double if I press Ctrl-LeftArrow and halve if I press Ctrl-RightArrow. Right now I'm ...

1
2 3 4 5
95