Questions tagged [python]

Python is an object-oriented programming language. In Blender, it is used as a general purpose scripting language and to create add-ons to extend Blender's functionality.

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

I get AttributeError:'Mesh' object has no attribute 'subdiv_prop'

I have the below addon installed in Blender 3.3. I get AttributeError:'Mesh' object has no attribute 'subdiv_prop' on line 137 when I click the 'Project Image' button. How do I resolve this? ...
  • 93
0 votes
1 answer
8 views

Invoke function before closing script (Ctrl + C)

I'm running a local server using http.server like this: ...
  • 337
0 votes
0 answers
9 views

How to select the surface and import png image to it?

I want have the multiple png images that I want to apply them to a predefined 3d object template. This can easily be done by choosing the option shown in the image attached and then select the .png ...
0 votes
0 answers
9 views

Why does my new n Pannel UI ALWAYS get called misc? [closed]

I've been following a few tutorials about creating custom UI's in python, and every time I create one, the UI pannel just gets named "misc". I've changed the bl_label and bl_catagory and it ...
0 votes
0 answers
13 views

My blender script crashes on running

I'm new to all of this and I tried creating a script that redo's certain actions on converting and editing a model in 1 click. It currently seems to just always crash near the end and I got no clue ...
0 votes
0 answers
16 views

Override only specific UIList context menu

I would like to override UIList's context menu with a custom menu, but only for one specific UIList, that I am adding in my addon. For the rest already present UIlists in Blender I wanna keep the ...
0 votes
0 answers
24 views

Creating a 3D terrain programmatically

I'm new to Blender and can't find an answer to my question anywhere. Before, I assume that it simply couldn't be done, but I'm asking now just to make sure: Can I create a 3D Terrain with Google Maps ...
0 votes
0 answers
18 views

how to display Modifier panel visible in N-panel?

I want to display the modifier panel in the Npanel, I have achieved the panel like this, but I cant't display the added modifiers: This is my code: ...
  • 1
0 votes
0 answers
2 views

Load VDB via python

I'm trying to find how I would load in a VDB via python. Is it possible to do this without ops? Some sort of analogous function to D.images.load()
  • 1,244
0 votes
0 answers
12 views

Call Substance Sampler from Blender [closed]

Could it be possible to call Substance Sampler(SS) from Blender. From what I know , you can run python scripts in SS. The idea is: make a new panel in Blender press a button to import a photo of a ...
  • 1
0 votes
0 answers
10 views

How to get the session UUID of the collection in blender 3.3 to make_override_library() operator

I am a developer of a pipeline manager for a studio. When switching to blender version 3.3, it turned out that the bpy.ops.object.make_override_library() operator ...
0 votes
0 answers
13 views

How can I go to edit mode of any of selected object using python?

I want to go to the edit mode of the FONT object and change it from text to ...
  • 224
0 votes
1 answer
12 views

Cannot create library override

I'm trying to create a library override after linking objects into my scene like this: ...
  • 337
0 votes
0 answers
14 views

Getting the error: You are using pip version 21.2.4; however, version 22.2.2 is available

I already tried to upgrade the pip version but it says it is the 22.2.2 version. Warning text: WARNING: You are using pip version 21.2.4; however, version 22.2.2 is available. You should consider ...
0 votes
0 answers
12 views

Color space of GLSL shader

This is the color (1/255, 1/255, 1/255) of the built-in shader ...
  • 3,238
0 votes
1 answer
19 views

Basic Custom Property Cannot Be Animated

I must be doing something horribly wrong, and am hoping someone can help! I am trying to write a basic panel that allows for some access to NLA Strip params (namely use strip time and strip time) as ...
1 vote
2 answers
42 views

Convert between 3 variable rotation and 2 variable rotation

I think this may be more of a math question than a blender question, but I'm trying to do it with python in blender, so I'll start here. I work with a small theatre and am trying to use blender to do ...
0 votes
0 answers
11 views

How to move object across rendered image but do not change rotation from camera's view

I am trying to write a blender script that moves an object in across a rendered image. The object will appear to rotate, but is it possible to make the object appear the same even moving it across the ...
  • 1
1 vote
1 answer
24 views

Is there in Python to check if the tools collapsible menu is open/closed?

I'm trying to see if there is a way for me to get a boolean value for the tools menu being opened or closed. I know you can see a few toggle options using something like console.toggle() but I wasn't ...
1 vote
0 answers
19 views

Is it possible to create a driver for the driver modifier? [duplicate]

So, I created such a driver, I applied several modifiers to it and ran into a problem, I need some parameters of my modifiers to change in sync, roughly speaking I would like to create a driver for ...
  • 11
2 votes
1 answer
42 views

How to keep the same zoom level?

How do I keep the same zoom level such that the image resolution is always the same? i.e. when I change the viewport size the zoom level should stay the same for example if this is my view: when I ...
  • 337
0 votes
0 answers
13 views

Render starts before script finishes

I am attempting to run a script in -background (headless) mode to generate an image from an addon. This script works in the GUI script window. When I run it with -b, I get no errors but the render ...
2 votes
1 answer
67 views

How can I get the value of a property at a specific key frame?

I have a pretty basic scene where a light's power goes from 3000 to 0, keyframed at frame 0 and 80. How can I use python to retrieve the value of the 'Power' property at any specific frame? I know I ...
0 votes
0 answers
8 views

Blender does not show UI

I would like to know why this code does not show any of the check-boxes.. is there any misspelling or something like that I looked at this for at least one hour and I do not know where the bug could ...
0 votes
0 answers
5 views

bpy_post_install fails with missing folder for scripts

I get this error while using post install Blender 2.82 (sub 7) There is a script folder in /usr/share/blender bpy has been installed using pip OS:Mint 20.3 ...
0 votes
0 answers
8 views

Wait for screen_full_area to complete

First I'm trying to make blender window go into maximised mode Then I'm trying to make the VIEW_3D area to go into Full screen Area and then make the camera fit ...
  • 337
0 votes
1 answer
11 views

Use data from selected object in python scripting

In this picture I have a cube selected and in the transform panel you can see the cube's data, such as location and rotation. Is there a way to use the data of this selected object, like the x-...
  • 56
0 votes
0 answers
10 views

Python Select 2 materials on an object and link mix node to 2 color ramps and a noiseand link that each Material's base color

I have one object in a scene and I want to select 2 materials from that object and swap in a procedural camo made from noise and color ramps. I has able to do the operation on one material, but when I ...
  • 11
0 votes
0 answers
10 views

Group objects using notepad file of objects to group

I want to group some of the objects in a large Blender file. I would like to list the objects to be grouped in a notepad file which is saved in the same location as the blender file. Example test case ...
0 votes
1 answer
14 views

I got "RuntimeError: Operator bpy.ops.mesh.select_mode.poll() failed, context is incorrect"

I would like to use this method, but I totally stucked. A.py ...
  • 5
0 votes
0 answers
10 views

Do something when an enumerator is changed

When I choose an option for one of my enumators in my script, I can tell from the "info" space that there is a command: bpy.context.scene.[name].[name of enumerator] = '[option]' I want to ...
  • 56
0 votes
0 answers
15 views

Add vertices at the intersection between 1/2 circles and another mesh

I want to add vertices at the intersection of two objects. Some 1/2 circles and a mesh in shape of dome. I tried to use "mathutils.geometry.intersect_line_plane" but i dont known to use it. ...
0 votes
0 answers
10 views

fullscreen after changing workspace

I'm trying to change my workspace then make the VIEW_3D in that workspace fullscreen, using this as a reference this is what I've come up with so far: ...
  • 337
3 votes
1 answer
32 views

clearing parents and keep transform in python for thousands of objects

I am currently using the "parent clear" operator with the 'CLEAR_KEEP_TRANSFORM' type to clear transformations when dealing with tens of thousands of objects (see below), but unfortunately, ...
0 votes
1 answer
19 views

How to remove a timer left over from a crashed script using the python console

Based on this question I asked, if my script crashes while I'm debugging sometimes the modal timer gets left running in the background (I think that's what it is). This causes it's thread to keep a ...
  • 1,565
0 votes
1 answer
9 views

How to change window size from script?

I'm trying to set my window to full screen/maximised mode How do I achieve this via script? I tried this answer but it's obviously for windows operating system whereas I'm using Ubuntu 22.04.1 LTS
  • 337
0 votes
1 answer
14 views

How to make camera fit viewport in fullscreen mode?

I'm trying to get my camera to fit the entire viewport (home button) in fullscreen mode and this is what I've come up with so far: ...
  • 337
2 votes
0 answers
29 views

BVHTree.overlay doesn't register polygons that are coplanar?

I created two default cubes, and offset one of them by 2m, so that they 'touch' perfectly. Running the following code returns an empty list: ...
0 votes
0 answers
18 views

Keyframing a pose asset in Python

I want to apply and keyframe a pose asset. The first part of applying a pose was described in this answer. However, I am not sure how to keyframe the action. This is my code: ...
  • 51
0 votes
1 answer
23 views

How to get the property name and its value in ShaderNode?

1.For ShaderNodeValToRGB, how can I get color_ramp on the node by Python API suppose I do not know it is ShaderNodeValToRGB? I want to automatically get the ShaderNodeValToRGB and its property ...
0 votes
0 answers
16 views

How to redirect a PointerProperty to Object when the owner is Linked

I'have a pointer to object initialized on an armature like this: bpy.types.Armature.myPointer = bpy.props.PointerProperty(type = bpy.types.Object) When I link the ...
  • 75
0 votes
2 answers
22 views

Create Rotation Matrix With Given Vectors

I have a set of 3 vectors defined by vertices: Vector1 - (x0, y0, z0), (x1, y1, z1) Vector2 - (x0, y0, z0), (x2, y2, z2) Vector3 - (x0, y0, z0), (x3, y3, z3) I want to create a rotation matrix from ...
0 votes
1 answer
14 views

Adding Noise Texture Node to Material Using Python

I am trying to create a Noise Texture Node on a material, but nothing is working from the examples I have found. I have an existing material and just need to add the node to my material graph. I have ...
  • 11
0 votes
0 answers
10 views

Multiple Object Copies from API

new to blender (not new to python) and I am developing an add-on. I originally (following the docs) had: ...
0 votes
0 answers
11 views

Write material nodes to a text file [duplicate]

I am looking for a way to write out all the material nodes in a material to a text file, preferably using Python. I need this info for a weird pipeline for another app. Any ideas or existing add-ons ...
  • 1
1 vote
1 answer
27 views

RuntimeError: Operator bpy.ops.object.convert.poll() failed, context is incorrect

I'm trying to use bpy.ops.object.convert(target='MESH') in Blender 3.3 to apply all modifiers. Unfortunately, I get the error in the title and I don't get what's ...
  • 11
1 vote
1 answer
35 views

Python: for a given edge, create a circle, which radius is this edge

I'm working on an add-on to automate the generation of a specific 3D model. I have to add circles which centers must be at the ends of selected edges. The radius of each circle must be the length of ...
0 votes
0 answers
12 views

Correctly Using Matplotlib with Blender

I have installed additional python modules in BLENDER. I am testing whether I could run the following Script within BLENDER https://scikit-image.org/docs/dev/_downloads/...
0 votes
0 answers
16 views

Binding commands in Transform Modal

Hello and thank you for taking a look at this. So first part to understanding my issue is knowing I'm a 3D artist used to the modeling workflow in Autodesk Maya. In attempting to transition to blender,...
  • 1
0 votes
1 answer
24 views

region_3d.view_distance not updating until next modal event

The code below runs a modal operator that gets the region_3d.view_distance and prints it out. If you run it you'll notice that the ...
  • 1,565

1
2 3 4 5
230