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
21 views

Is there Way to Cover Surface this Ways not Working Very well { Fill/Grid Fill/Beautify Faces } take match more time to solve

My Problem is Fill Around holes and used all ways but not Working as I wish , manual Editing take More time
0
votes
0answers
17 views

Change 3d viewport to othrogonal in python [duplicate]

I would like to change the 3d viewport to orthogonal from a python script. From the key mapping I found this command "view3d.view_persportho". I always find it tricky when I have to mess ...
1
vote
0answers
93 views

How to hide a panel that appears twice?

I'm making an addon where I added a panel to a popover button. See the following example: Here we can see (in image number 2) a popover button in Shadows. This panel is shown only on this button. I ...
0
votes
1answer
22 views

Removing objects from collection with script works but gives an error

I'm sorry in advance if my script looks really messy and not optimised, it's my first time using python or a dev language for that matters. I've tried to setup a script that, among other things, ...
2
votes
1answer
35 views

How to focus a property field in an Operator dialog by default (v2.91)

This existing question has some answers that attempt to make a property field focused when it appears, but none of them seem to work in 2.91. If you run the code below, you will see that the field is ...
1
vote
1answer
43 views

Blender scripting: How to change texture color

I'm trying to create a picture in Blender using only Python/scripting (no animation). I have a model loaded in and I can change it's base color using active_material.diffuse_color but now I want to ...
0
votes
2answers
87 views

Blender 2.8+, How to execute an operator in another window?

Some operators are global. Some are not. Transform for example is bound to the window where it gets executed in. As an example let's say i want to perform the ...
0
votes
0answers
36 views

How do I run a script after renaming a collection or object in the Outliner?

I'm not a programmer. I want to write a script to make my work in Blender 2.91.0 easier. How do I run a script after renaming a collection or object in the Outliner? For example, I entered the name of ...
1
vote
1answer
37 views

How to add the properties dynamically by using bpy.types.CollectionProperty?

I'm trying to create an add-on which changes the number of bpy.types.BoolProperty dynamically along with the context by using bpy.props.CollectionProperty. But, Blender will crash when I changes the ...
0
votes
1answer
51 views

Toggle UI from python

I am trying to toggle fullscreen and 3dview sidebar panels from python (shortcut 'shift+alt+space' and 'n' respectively). I found these commands, but I can't get them to work: ...
0
votes
0answers
30 views

why bgl meshes flip when nothing is selected?

As described in API the following script will create a mesh from active object using bgl module: ...
1
vote
1answer
27 views

Blender displays the wrong X-relosution for JPEGs,

A bit of context first, I setup a Node group that helps me scale textures to real world scale. So I use the images DPI or PPM for this. Thus I scripted the inputs for the Node groups to automatically ...
0
votes
0answers
31 views

How to Import Blender 3D Models into Webots

I am having trouble importing a Blender 3D Model into Webots. Currently, I am using Blender 2.79 and the most updated version of Webots. I am attempting to import the default cube model, but I am ...
1
vote
1answer
26 views

Saving objects' coordinates as RGBA

I need to save multiple objects' location in XYZ as RGBA data on an image. The colors should match that of blender in metric, so if I move the object up 105.4 centimeters in blender, the color should ...
1
vote
0answers
18 views

Where can I find context commands for every line

I'm fairly new to blender scripting and I'm having some trouble figuring out the context in which every command must be to work. My code looks like this: ...
0
votes
0answers
15 views

Saving multiple objects' location + rotation in RGBA [duplicate]

I recently asked a question in here, and wanted to ask a new one, as it was very convoluted, and I now know what I need to know. I need to save multiple objects' location in XYZ as RGBA data on an ...
2
votes
1answer
93 views

draw_callback_px in specified area

Using the Python code below which draws the text and shape shown in these screenshots, I want to clip the graphics outside the red box shown in my second image so it is not drawn. Goal: ...
0
votes
0answers
12 views

How to get cache name with a script

I have a script that needs to get an object's cache name. Basically this: I have tried with ...
0
votes
0answers
25 views

How to add faces following a curve?

Im trying to add a faces in a curve ,but i want to add in every points of control of my NURB curve and these faces should have the same normal that my points of control. How to do that in a script ? <...
0
votes
1answer
25 views

Function that prints the location of all the vertices of an active object

I want to write a function that prints the location of all of the vertices of an active object. I have a Cube and I want to print out the location of the 8 vertices of the cube. I started doing this ...
1
vote
1answer
37 views

Is there any Property in the bpy.props which can take multiple lines of text?

The idea I want to implement is to have some kind of StringProperty in the UI so the user could enter multiple lines of text into it which then could be used as a ...
2
votes
0answers
40 views

Create texture image from mesh location

I'm stuck on an issue, that I hope some of you can help me with. I'm trying to create 4 texture images, that hold XYZ values (+more) for a mesh. The problem is that I'm not 100% how it should be saved,...
1
vote
1answer
51 views

operator error when open a new file

The operator work correctly when I call it. But report error when I open a new file. ...
1
vote
1answer
29 views

Get operator command from context menu?

Here is what I need to do: I need to add a button to this context menu (the one you get when you right click on any button): like the one I added here at the bottom. I am using this code from the ...
2
votes
2answers
84 views

Program slider to control camera aperture with python

I'm very new to scripting in blender, and I'm making an addon to simplify the depth of field process in Blender. I would like to put a slider in my ui panel to control the camera's aperture. I think I ...
0
votes
0answers
25 views

Access custom attribute on each object to assign color

So I am trying to color the spheres on my animation by using the custom attribute I assigned as obj["my_data"]["color"] and by using the value node on the material window. However ...
2
votes
1answer
33 views

Why are the normals of this primitive circle pointing upwards, and how to reset them? [duplicate]

Using Blender 2.8, when creating a primitive circle using the API like this: ...
3
votes
2answers
140 views

Auto-set parameters when panel opens

I would like to set various parameters when I open a panel. By parameter I mean toggling the bounds for an object or changing object.display_type etc. Is there a python way of calling some code (...
1
vote
1answer
53 views

How can I check which of my collections are hidden in viewport?

Using this part of code... for collection in bpy.data.collections: print(collection.name, ' - ', collection.hide_viewport) ...I am trying to check which of my ...
2
votes
2answers
130 views

How to add BOID brain settings to a particle system via python script?

I am trying to use a script to add some rules to the boid brain of a particle system and the operators on website here, https://docs.blender.org/api/current/bpy.ops.boid.html, don't seem to be doing ...
0
votes
0answers
11 views

PySerial Context for Modal Operator

I am trying to get Arduino to operate with Blender, via PySerial. The example codes I found didn't operate on a loop while also working alongside Blenders normal functioning (responsive blender UI) so ...
0
votes
0answers
19 views

Adding button to the top bar results in two buttons and not only one [duplicate]

i add button to top of the bar but two buttons are added. how can i fix this problem d ...
0
votes
1answer
22 views

Generating, Selecting, and Unwrapping an Item Added to an Existing Mesh (Python Script)

I've got a script that draws a bunch of individual items onto the same object, and I need to generate a UV map for each item right after it's drawn before moving on to the next one. My current code ...
2
votes
2answers
123 views

How to track the state of a window toggle with python?

With bpy I can call the following function: bpy.ops.wm.window_fullscreen_toggle() But how can I track the state of the toggle so that I avoid unnecessary calls to ...
0
votes
1answer
68 views

Exception Access Violation when trying to add face to new Facemap

Beginner Python scripter here, upon running my operator Blender crashes, inspecting the crashlog just yields an EAV as described. The crash appears to happen at the ...
0
votes
0answers
22 views

Enumerating Images used by BSDF Node Tree

I'm trying to enumerate and export all images used by all materials in a given .blend project and associating them with named slots / channels used by BSDFs. My problem is determining which images are ...
1
vote
0answers
51 views

how to make a cylinder with several segments, from a csv file

I'm new to Blender, even more so in the scripts. I'm trying to make a cylinder (x,y,z variables) that contains several segments, these are controlled by a .csv file, where I get the depth. These ...
1
vote
1answer
43 views

Can we use the poll() required operations without a context

I was trying to use Blender from external python console using RPC. I was able to establish the connections and some basic operations. But, I cannot change the mode of an object, it is showing ...
0
votes
0answers
38 views

What are these UI buttons?

What are these button called? I can't find them anywhere in the documentation or else online. Do they belong to a region/space/category? Can they be customized via scripts like making panels?
1
vote
0answers
39 views

object.matrix_world doesn't update correctly

I'm using a function to render thumbnails of some grease pencils, and in order to frame it well, i use the object.matrix_world to get the world coordinates of my points. ...
1
vote
1answer
27 views

Reset text field to default when starting Blender

Is there a way of reseting a text field every time Blender is initiated, saved or before closing? I want to create a password field for an Addon and I don't want it's value to be saved alongside the ...
0
votes
0answers
40 views

How to catch and respond to a scene addition event?

My add-on uses a number of dynamically registered panels, created and configured per scene. It needs to refresh/rebuild itself whenever the scene changes to represent the data in the active scene. I'm ...
0
votes
0answers
6 views

How to retrieve all face angles and check for certain values? [duplicate]

I am currently trying to run some tests of my mesh before using it for finite element analysis. I would like to check if any faces have any angles (between their edges) that are below 20 or over 150 ...
0
votes
0answers
36 views

Depth of Field with object copies/instances

My scene has a 3D array of cubes, and the camera is looking at one of the corners: I want to apply a depth of field such that the closest corner cube is in focus, while the cubes in the background ...
0
votes
1answer
42 views

Find opposite angle range in radians

Building on this question here I have the range, in radians, of an angle formed by three points on a 2d plane and need to find the opposite range as shown here as range2: The function I am using (...
0
votes
0answers
21 views
0
votes
1answer
14 views

TypeError: MESH_OT_add_triangle.is_property_set(“location”) not found

I get this error when I add a mesh object to my scene, but I don't know what it means: ...
1
vote
0answers
55 views

Delete Children Automatically

Is there a way to automatically delete children when the parent is deleted? By automatically I mean that you don't do any selection (or other action) of the children prior to selecting and deleting ...
0
votes
0answers
11 views

Is there a way to set up a Annotatable Xsheet?

Wondering if anyone knows a plug in that for blender that would do something like this or how hard it would be to make one, Basically I was thinking to myself I would love to be able to mark the dope ...
1
vote
0answers
26 views

set shader properties by mesh face index/position in ply file

I'm trying to set color and other properties of a shader dependent on the specific face of an imported mesh. To make the problem a little bit less abstract, I'll give you the background: I did physics ...

1 2 3
4
5
95