Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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).

1
vote
1answer
4 views

Access a property in python from a menu

I tried to answer a question on blenderartists from what I already know, and then it was pointed out to me that I should be able to use the property directly in the panel menu instead of creating the ...
0
votes
0answers
8 views

How to I render this .wrl using the python api (bpy)

I have been trying to render this wrl files like this one using this code: ...
0
votes
0answers
8 views

Remote debugging of Blender python scripts: Set breakpoints are ignored

I intend to remote debug Blender python scripts. For an extremely simple test I have a directory D:\test\ in which I saved a Blender 2.79 file named remote_debug_test.blend. This Blender file has a ...
2
votes
0answers
20 views

Why does bpy.ops.object.mode_set(mode='EDIT') switch to the Object Mode when executed?

I wrote a python script that modifies an existing blender armature that I have and some of these modifications include some commands that are only possible in Edit Mode. I know that depending on what ...
0
votes
0answers
15 views

Drivers / Constraints resourses usage

I'm trying to optimize the rig of a cartoon creature, and this rig has really large amount of bones (more than 400) to have all the abilities according to the plot. I have IK/FK chains, Stretch To ...
0
votes
0answers
13 views

Blender crashes when running import .x3D python script

I got a problem when running a python script in blender. My script is supposed to import a .x3d file, do some basic stuff with it, render, close, and open the next .x3d (The final goal is to build an ...
0
votes
0answers
14 views

How to change property after mouse release

I have a custom property of the type bpy.props.FloatProperty , that has a update=update_function . then I have that mapped to a row.prop() with slider=True. Now for better and predictable user ...
1
vote
1answer
16 views

Aligning empty object with Bezier curve point using Python

I'm using a Bezier curve to generate a shape. Once I'm happy with the shape I process it with a script I wrote. Among other things it adds 2 empty objects: one at the start of the curve, one at the ...
0
votes
0answers
29 views

How to update Blender's naming index thing (.001, .002, etc.) after joining objects

I've been trying to reuse certain parts of code as functions in my bpy scripts. But that means that the same bmesh will be created as 'my_bmesh.001' the next time I run that function. To deal with ...
0
votes
1answer
23 views

Using Python loop to attach empty to each bone in Armature

I'm stuck at the part of my loop where the empty gets constrained to the bone. I don't know how to refer to the bones and empties I want to constrain since their names vary as the loop runs. Here's ...
0
votes
0answers
19 views

Hotkey to go DIRECTLY to vertex, edge, face edit mode?

As a long time user of other prominent 3d software, I'm used to being able to be in object mode and press 1 hotkey to go directly to vertex, edge, or face mode. I'm using 2.8 and love it, but for ...
0
votes
2answers
36 views

Delete all materials that aren't assigned to a face?

Ok, I have several models that because various joining and un joining, have material slots that are there, but not assigned to any faces. Im exporting and would like these gone but there are too many ...
0
votes
0answers
27 views

Is Blender going to optimize RTX cores?

Right now blender can be used with RTX cards but they are not as optimized and are not using the RTX cores to there full extent. Will this change, am i wrong? If anyone has info on how this new tech ...
0
votes
0answers
10 views

Getting/Accessing/Assign the actual (not default) value of a node socket that is linked to another socket

How can I get or access the actual (not default) value of a node socket in blender 2.80 or 2.79? This post is similar to this which provides an image to explain the problem as well. J. Bakker ...
0
votes
0answers
25 views

Creating polygon from vertices alorithm

Is there somebody who can describe a theory behind creating quads from pointcloud(vertices) in blender python ? Is the only way to check length betweeen vertices like: (theory) ...
1
vote
0answers
18 views

bpy.ops.object.scale_clear(clear_delta=false) (the alt-s command in 3d view) lowers ram usage?

One of my projects has a script that creates thousands of objects every time it runs and even though it deleted the old objects there's still a ram build-up over time. For example, just now it hit ...
0
votes
1answer
28 views

set random active face in python without toggle mode

In python how can I set random active Face in edit mode without toggle the Object/Edit Mode ? For example re code in this answer can you also automatically set an active face again from the script to ...
0
votes
0answers
14 views

How select Material Slot with one active face in python

hello guys i have a problem by selecting the material slot. when selecting the material slot, has no active Face... how can i make him select an active Face under the selected Faces ?
2
votes
1answer
20 views

Problem with a simple physic simulation using python scripting

I am very new at blender and I want to make a simple simulation in blender. I used boolean operation to model the bowl-like shape. And I dropped the cube into the bowl. When I play the simulation via ...
0
votes
1answer
53 views

Deselect Neighbours Faces

is it possible in blender v2.70 or with a python function deselect neighbours faces, so that they are alone ? i'll upload a picture to understand what I mean. I hope it's doable.
0
votes
0answers
20 views

How can I stop my Blender script from eating my entire computer's memory?

I'm working on a project that loads a bunch of 3D models (around 100 models) into a scene, exports a render, then deletes all the models and loads in 100 fresh models into a new scene, then dumps them,...
1
vote
0answers
34 views

Generating Grease Pencil drawing Blender 2.8

is there a way to use the edges of a model or the object itself and converting that into a grease pencil line, or a curve to grease pencil by using a script?
0
votes
3answers
37 views

How can I check face selection in edit mode

How can I check if the mesh in edit mode has polygons (Faces) selected or not via Python? I use Blender v2.79. I am working on a face selection check for a tool. If no polygons are selected in the ...
0
votes
0answers
31 views

Setting TRS on an edit bone? Can an edit bone have a non-unit scale?

My understanding is that the local-to-parent TRS for a bone in the rest pose is determined by the head/tail/roll of its edit bone T is determined by the difference between its head and its parent's ...
0
votes
1answer
27 views

Python to show one of objects by choosing

I have a question about Python. By the way, I'm a beginner of English and Python. I have a script to show Toruses from an imported txt file containing center coordinates. Thanks to this website, it ...
0
votes
1answer
14 views

Blender Python: How to activate the Auto Refresh in a imported sequence on Image Editor?

I'm developing a way to import DICOM slices on Blender. All works well, but I'm with dificults to activate the Auto Refresh after import the sequence: I really read a lot of examples and the ...
1
vote
1answer
35 views

Python Join Objects

I'm completly new to Blender. I currently work on a project which could utilize Blender for Beveling. To get in touch with blender I first played around with the programm itself and then tried to ...
0
votes
1answer
14 views

Is there any way to make multiple objects convex hulls?

Is there a way to make multiple objects become convex hulls using python and applying the operator to all selected objects?
1
vote
0answers
23 views

How do I create an enumproperty dropdown menu that shows up in Blender 2.8?

I'm trying to get my addon and its categories and dropdown menus to show up in blender 2.8 like this: Simple Asset Manager , but can't seem to get anything to show up, I updated some of the code which ...
0
votes
0answers
28 views

Blender 2.8 Panel Placement

I am writing an add-on for Blender 2.8 and I would like it to appear in the render context of the properties panel. The following does not work as I expected. ...
2
votes
1answer
29 views

How to write drivers to be copied and pasted between objects' modifiers?

I have assigned a script-expression driver to a field in a modifier. The expression is a function of properties of the object to which the modifier is assigned, extracted as Single Property variables. ...
0
votes
2answers
35 views

non-linear scaling of STL-files along the Z-Axis

I have an STL that is about 400mm in Z. I would like it to scale for example 2% for the first 100mm and 1% the rest of the 300mm. This should work for objects that are shorter than 400mm but still ...
0
votes
1answer
30 views

Return the current release of blender on command line

Is there a way to poll the blender download website to return the current release candidates paths for blender. At the time of this writing there is a release for both 2.79 and 2.80 so i would like a ...
1
vote
1answer
33 views

Scripting: Converting Text object to Mesh object fails due to incorrect context (2.78)

I'm new to scripting in Blender, but after extensive googling and searching through the API, I've created the following script to create an empty scene (my default scene has no cube, light or camera ...
0
votes
0answers
9 views

Is there some way of working with another blend file in a script without losing changes or history in the current file?

I have the following script, which saves the open file to a new one, deletes all but the selected objects, then re-opens the original file (the real script does more than this!) This serves its ...
2
votes
1answer
19 views

Pause in relationships and constraints

I want to talk about relationships between (for example) two bones. There are two bones (A and B), bone B has a Cconstraint, bone A is the target of that Constraint. Let the Constraint be "Child Of". ...
0
votes
0answers
16 views

Incorrect context .poll

Do you have any idea how to make this piece of code working? I keep getting this error when trying to execute the unused data-blocks: RuntimeError: Operator bpy.ops.outliner.orphans_purge.poll() ...
0
votes
0answers
22 views

Conversion of orientation quaternion from ROS / Quaternions.online to Blender

I have an issue using quaternions that are coming from ROS. I have already seen this post (How to use quaternions coming from ros?) but I am unable to comment since I do not have enough reputation yet....
1
vote
0answers
15 views

Code works in Console, not as registered Operator

I made a scene with a cube and a sphere. The sphere has a "displace" modifier on it, which I want to apply while having the cube (or nothing at all) selected. Executing the following lines one by one ...
0
votes
0answers
12 views

Reloading Blender During Looping

After spamming you here many times with the proper way to purge data I've read the source file for purging orphan data and it seems they reload modules to purge orphan data. Now loading and reloading ...
1
vote
1answer
49 views

Why do I have the 2.80 API on blender 2.79

When I compare the latest blender api to the 2.79b API (based on the current link from https://docs.blender.org/api/), I see that the ...
0
votes
4answers
50 views

Delete object by location

How can I do something like, bpy.ops.object.select(object at location x,y,z) bpy.ops.object.delete()
1
vote
0answers
17 views

Import STL and render image

I am not very familiar with blender, more of a python programmer trying to use blender headless. I want to import an STL to a scene and render an image from different angles. So I botched a code ...
0
votes
1answer
24 views

Setting constraint influence in Python behaves differently inside vs outside 'If' statement?

The code snippet below contains a block code; running once in the global scope, and once inside the else branch of a condition: ...
1
vote
1answer
22 views

Cursor location accessing methods

Can you provide me with different methods, or at least one, for accessing the vector of cursor location? I need anything but the one described in this line of code: ...
2
votes
0answers
37 views

Select pass mode via python script

I want to change the value of "Pass" type inside the "UV/Image Editor" area as shown on image. The default "Pass" value is "Combined" and I want to change the value to other available types with ...
1
vote
1answer
32 views

Given location(x,y,z), check if object exists at that position

As the title says, I want to be able to check a location for the existence of an object. I'm randomly filling a space with objects and want to make sure I'm not placing an object somewhere that is ...
0
votes
0answers
19 views

How to change the font size of a row inside a script via blender python

Hi Blender Python users, This is a super simple question but I can't seem to find the answer anywhere. Does anyone know how to change the size of a font inside of a panel row. For example say I ...
0
votes
0answers
34 views

Purge Orphan Data

The third time I ask for a practical solution to purge data of a running code and (keep the code running after) and no one good solution worked for my case. I guess I don't get it at one part or ...
1
vote
0answers
24 views

How to register bpy.types.INFO_MT_mesh_add.append(addMenu) blender 2.80

I have this add-on which works fine in 2.79 but not in 2.80 I don't know how to register this code. bpy.types.INFO_MT_mesh_add.append(addMenu) When I try it ...