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
1answer
16 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 ...
0
votes
0answers
13 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 ...
4
votes
2answers
1k views

Rotate UV by specific angle e.g. 30deg in Python script in backgroud mode

I am trying to figure out how to rotate UVs in mesh while Blender is in Background mode without windows, so some parts are not accessible. Right now I am using ...
1
vote
0answers
11 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
34 views
+50

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 ...
2
votes
1answer
165 views

Setup bones on cloth sim so that you can transfer it to Unity via FBX export

So, I would like to have this happen with a script for each vertice of an object: I just couldn't to make it work :/ Except only some parts of it (scripts found from everywhere). Building blocks: Add ...
1
vote
1answer
198 views

Passing variables in IntProperty constructors ignores changes in the variable when creating more instances using CollectionProperty.add()?

Sorry if the title is unclear. I'm working on an addon which involves a UI with a list of IntProperties. I need to be able to add and remove elements from that list on the fly, and I want the min/max ...
1
vote
0answers
16 views

Locked track Camera error

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?
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 ...
1
vote
1answer
19 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 ...
0
votes
0answers
27 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
45 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: ...
1
vote
1answer
95 views

Python change of bone rotation is not update when export .bvh file

I want to write a function using python to modify the rotation_euler a bone in a frame, the next bones in that frame and the next frame it will automatically update under this change. Can anyone give ...
0
votes
1answer
24 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
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 ...
1
vote
1answer
29 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
1answer
193 views

Script/API - Snap selection to grid, but only one axis

by script I can do a snap-to-grid of the selected vertices: bpy.context.space_data.grid_scale = 0.125 bpy.ops.view3d.snap_selected_to_grid() But I need to ...
1
vote
0answers
21 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
12 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 ...
2
votes
2answers
1k views

How to set a random value for multiple shape keys?

My question is related to my previous asked one: How to set a specific value for multiple shape keys? I have about 300 shapekeys and want to set the random value for all of them . How to do it using ...
6
votes
2answers
803 views

How to disable/enable multiple shapekeys visibility?

I have over 300 shapekeys added to my mesh. How can I disable and enable the visibility for all of them using scripting?
2
votes
1answer
45 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 ...
-3
votes
0answers
23 views
2
votes
1answer
276 views

Segmentation Fault when calling bpy.ops.render.render (script using Blender as a Python Module on Mac)

I am using Blender as Python Module on Mac and now attempting to create a scene programmatically and take a screenshot of what the camera sees but I am getting a "Segmentation Fault: 11" when running ...
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 ...
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 ...
4
votes
1answer
98 views

What does the use_local_location mean for bones

To test this, I run a test to show the difference of use local location or not. C.object.data.bones['upperArm.R'].use_local_location = False C.object.data.bones['upperArm.R']....
1
vote
1answer
151 views

Mesh is Grey after adding an Image/Texture to a material

I need some help making a mesh colorful. The image I add to a material does not show up on my mesh. A snippet of the code is below ...
0
votes
1answer
20 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: ...
23
votes
3answers
11k views

Is there a way to restart a modified addon?

I'm currently twiddling with an old addon and insert some print statements for debugging. Currently I'm restarting Blender each time to see the new messages. Is there a way to 'refresh' an already ...
2
votes
1answer
78 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
1answer
169 views

How to import a STL file using the file browser?

I'm trying to import a stl file manually via python. My code below is pretty straight forward, but I'm struggling with the following line. I'm not sure about the syntax and format of the arguments: <...
1
vote
1answer
39 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
1answer
21 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
30 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
votes
0answers
25 views

How powerful is Blender Scripting? [closed]

I am thinking of creating a physics simulation for human body, skin, cloth, etc. It's a bit of a pet peeve of mine, and I'm currently not very serious about it. The goal is to create an environment ...
8
votes
4answers
12k views

How to open system console to get output from Blender on Mac OS 10?

Noobie here. Should I open Mac terminal and cd to /Applications/Blender/ which is where my Blender app is? Doesn't seem to work for me trying to run script from Text screen in Blender. I guess there ...
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\...
0
votes
1answer
87 views

propagate a predefined python surface over time

I created in Python a script that models a circular wave on a plane cf blend file with script python at the link: https://drive.google.com/open?id=1CaVfRsN_fSqrb2ogYf-WeEMR1hy9S2EQ What I have to ...
2
votes
1answer
195 views

Python: create adaptives Suffix

i want to know how to create adaptive suffix, that are "content aware" of the situation, to avoid erasing object that have the same names. i think that this is a classic use of python, could someone ...
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
34 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 : ...
2
votes
0answers
698 views

BMesh Grid Fill doesn't work on closed edge loop

I've been trying to automate the task of deleting the ngon cap on the end of a cylinder and replacing it with quads using the Grid Fill tool. Something similar to this: I'm using this script: <...
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....
2
votes
2answers
20 views
3
votes
2answers
1k views

Calculate points on a Nurbs curve without converting to mesh

I found this question: Getting the list of points that describe a Curve without converting to mesh But I would like to do the same for a Nurbs curve. This Nurbs curve consists of a lot of splines and ...

1
2 3 4 5
95