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
0answers
2 views

ReferenceError: StructRNA of type Object has been removed between modal and execute

I want to create locator and move it with my mouse, and eventually correct its position with floatProperty. But I get error in execute : ReferenceError: StructRNA of type Object has been removed What ...
0
votes
0answers
15 views

How to “Hide a Collection in viewport” but not “Disable in Viewport” via script in Python

Hi Blender coders and artists. I am updating one of my add-ons for Blender 2.8 and have run into some issues finding the appropriate way to hide a collection that is added to my scene. I want to ...
0
votes
0answers
7 views

Property set/get example for operator needed [duplicate]

Still trying to wrap a property into my Addon where I can dynamically control the values of the resulting variable. Take the default operator_mesh_add example and alter the definition of the width ...
0
votes
0answers
6 views

Save Backups to Subdirectory

Is there a way to set the backup directory for Blender 2.8? Previously, I used the addon from this question, but it is deprecated for 2.8. Has a builtin way been implemented?
0
votes
1answer
15 views

Is there a python command to package all the files in an existing .blend without it being opened?

I was wondering if there was a python command that packs existing .blend files, without having to open them. For example having a folder full of 3d models with textures, videos , music, inside, I was ...
0
votes
0answers
4 views

is there a way to see what bone a object is parented to in bpy?

I have a need to unparent -> apply scales to objects -> reparent however the objects are parented to armature bones, making the 'reparent' part tricky. is there a way in bpy to find out what bone a ...
0
votes
0answers
19 views

Blender property update [duplicate]

I am building an operator, which has multiple properties. One of the things I would like to do is update the min/max and update attributes of the property on-demand. I understand that I can create a ...
0
votes
0answers
11 views

Python: How to pan and scale GizmoGroup with background

I have coded a custom GizmoGroup to manipulate the effects strip in the VSE visually. It works in principle, but unfortunately I can't line up the gizmo with the picture, because the gizmo ignores any ...
0
votes
2answers
28 views

How do a create a foldout UI panel?

I have an add-on with rather a lot of UI options and am trying to find a way to clean it up so that not all the options need to be shown at once. I've noticed that some of the default tools have ...
1
vote
0answers
14 views

Object has an attribute “polygons” but with no polygons?

I am new to bpy and I am wondering why although my object has an attribute "polygons", obj.data.polygons actually has no ...
0
votes
0answers
14 views

How would I make a pluggin to toggle subd surfaces on and off and add the sub modifier to the stack? [duplicate]

I was wondering how I would be able to script a plugin that would toggle subd surfaces preview if it has a sudb modifier on. It would also be helpful that if the selected object doesn't have a subd ...
1
vote
0answers
12 views

sending Data or Values to linked Objects in Blender 2.80 / 2.81

I work a lot with linked data and library objects or linked collections. Is it possible to send values or variables between the different hierachical structures. So for example: SCENEFILE (var = ...
1
vote
0answers
13 views

Why doesn't my character animation script work?

I have tried in several ways that my character make the animation to move with python and sprites that I have, but at the time of running does absolutely nothing, the strange thing is that in my first ...
0
votes
1answer
17 views

Timer that can interact with context.object?

i'd like to create a timer that can interract with the active object. every time the active object is not the same as the object in my pointer prop it automatically replace pointer object with the ...
0
votes
0answers
23 views

Why does “material_index” return zeros?

I am new to bpy and I am wondering why the values material_index returns are all zeros. This is the code I am using: ...
0
votes
0answers
23 views

Blender 2.8 create mesh via script

I need to create a mesh by reading a custom file format. I have a list of vertices, faces and uvs. So far I am able to create a mesh with vertices and faces with the following script: ...
0
votes
0answers
38 views

Blender script render

I am trying to programmatically generate and render a Blender scene with blender --background --python foo.py. The rendered image and the reference image is ...
-1
votes
0answers
13 views

Addon should stop after 90 Days of Activations [duplicate]

Is it possible to get a timer in a script, to terminate the function after 90 days? Probably also giving different IDs to avoid simple reactivation? Is there any way to do something like a 3month ...
-2
votes
0answers
51 views

Terminate addon after 30 days

is it possible to "kill" a addon 30 days after activating? So, if you activate it, 30 days later in realtime it is not functional anymore? but i dont think this is possible, becs he could literally ...
0
votes
1answer
26 views

X AND Y Directions in this Script

I got this script, which adds a slider in a tab for rotating Z axis. i also want to rotate X and Y, so the user can adjust all of them. how i can add these two axis to this code: Thank you very ...
0
votes
1answer
17 views

Processing when ModalOperator has already been executed

I want to make an add-on using the Timer of ModalOperator. I want to prevent the same ModalOperator from running if the ModalOperator was already running. What should I do now? https://github.com/...
0
votes
1answer
24 views

Add-On Dev: Button that simply calls a Function?

I apologize for the volume of questions. I tried searching for this, but came up with nothing related. When building an operator window (or panel for that matter), is there any way to setup a simple ...
0
votes
1answer
15 views

Error when activating add-on

I made the following add-on by the test and tried it with Blender2.8. ...
0
votes
1answer
15 views

Error activating Addon | Rotation Settings in Panel

i have tried everything to get this running, and it is, kinda. So - what this script do: It export wireframes from 3D models with 1 button click. That works fine, but i want the rotations settings ...
0
votes
1answer
15 views

Add-On Dev: Operator Window - Open/Close events?

I've read in several places that its not safe to rely on constructors for types derived from Blender objects, such as property groups. But now I am creating a pop-up window with an operator class (...
0
votes
0answers
14 views

Simple Python script not moving objects away from center

Warning: I am a complete noob at Python Scripting :P What I want to achieve is that all of the selected objects are moved away from the center randomly, so I have created a simple script that (should)...
0
votes
0answers
23 views

v2.79 - Exported .py errors

i tried to export my .py and want to upload it as addon. the script works perfect, but when i try to import it as addon i get these errors:
0
votes
0answers
9 views

Blender 2.8 re-map an animation from object 1 to object 2

I've found a series of post related to accessing the animation / bone data using python. My use case is converting some BVH to a character rigged in Mixamo. I can't get started right when attempting ...
0
votes
0answers
14 views

Setting Object to location with python

i have setted my camera to this position: ...
0
votes
0answers
12 views

How to draw inputs from node group in layout panel

How can I access the node group input sliders in layout panel my test script is this ...
0
votes
0answers
19 views

Is it possible to scale individual particles in x, y OR z dimension using python?

I have a particle system made of a lot of objects, and i need a way to scale each particle of a variable extent in ONE dimension only (x,y or z). Is it possible in blender 2.8?
-1
votes
0answers
23 views

Python - Changing File format to match everytime

is it possible to make a python script for setting a 3D file on a size like the camera and center it? so when i hit render it is always in the middle? This would be great if something could work with ...
0
votes
1answer
20 views

Direct Path for Desktop without Usernames for Blender 2.79

thanks for the help on my last question. Now, i want to export to the desktop path of users, without knowing the username. I try to explain Export on Desktop ...
0
votes
1answer
37 views

How to set Freestyle line set setting using python?

I want to make a blender script, to export wireframes. Honestly I dont have much knowledge on the python thing so I only copied some code from the window over the gui and filled it in a text document....
0
votes
1answer
22 views

Reset Blender scene to default state

I have a script that generates scenes after each iteration is completed I delete all the mesh properties but still not all the data has been deleted. Is there any convenient way to reset blender ...
1
vote
0answers
13 views

Converting a lattice in to mesh, best way to connect the edges?

I am writing a script to convert a lattice into a poly mesh. I was wondering if there is a better optimized way to create the edges the way I am doing in the code below: import bpy import bmesh from ...
0
votes
0answers
11 views

Setting a custom UI that controls an object’s appearance?

Blender Python (overall Python) noob here. I’ve got my UI setup but how do I make my custom enumproperty change the mix node’s factor to change the objects’ color. Also, how do I show/hide objects ...
1
vote
0answers
6 views

How to get the correct area of each triangle of a tessellated (scaled) cube using the Python API?

When I add a cube to the scene with dimensions 2x2x2, and run cube_obj.data.calc_loop_triangles() followed by ...
0
votes
0answers
7 views

How to move object along a vector that does not align with an axis?

This seems like a simple thing, but I can't work it out with the code. Overall I want to move an object along the surface of a plane of unknown direction. First I get the normal vector of the plane,...
0
votes
1answer
11 views

Traceback error when attempting to add a reference or background image in 2.8

I'm at Level 3 - Part 1 of BlenderGuru's Beginner Tutorial for 2.8 and I'm receiving the following error when I attempt to add a reference image: ...
1
vote
1answer
18 views

Python: Create GizmoGroup for VSE (Video Sequence Editor)

I am currently trying to create a gizmo for the transform effect in Blender's VSE (2.8). However, I can't seem to get it to work. In fact, even though I call window_manager.gizmo_group_type_ensure() ...
0
votes
0answers
13 views

Add-On Dev: Non-property members for Blender classes

I just learned a very crucial Python concept that is very easy to miss when you blissfully learn things on your own instead of reading instructive material (like an intelligent person): That variables ...
0
votes
0answers
18 views

Retrieve Ray Tracer data

I need to be able to, given a scene in Cycles, extract the values of direct lighting intensity and angle of incidence for every light ray that hits a mesh. The final goal is to use these values to ...
-1
votes
0answers
28 views

Python and different languages [on hold]

All my python coding is in English, however if German users change Blender into German, my python will not work. Is this something being developed?
0
votes
0answers
8 views

How do I change the vertex color layer limit? (2.79)

I am very new to anything scripting so bare with me. I am trying to create a script that exports out a ply sequence with a different baked vertex color per frame of the sequence. I did some ...
0
votes
0answers
14 views

When print () is executed in ModalOperator, where is it printed? [duplicate]

I executed print ("test") with Blender's PythonConsle. print("test") Then "test" was printed in the Console as shown in the image below. However, I wrote code ...
0
votes
0answers
9 views

How can I get material information in camera views by pixels?

What I want to do I want to get material property value by per pixel from the camera view. Camera view I want to get a those value. Question How to get objects and linked material information in ...
1
vote
0answers
14 views

how to display an image in blender UI with python?

is it possible to display an image within the blender UI interface ? let say that i want to display a 500x500px image in the N panel in layout.box().column(), how ...
0
votes
1answer
27 views

How to get around bpy.ops.object.material_slot_assign ()?

Faced with a problem that causes crash Blender 2.80. For automation I created a script from a sequence of actions which works great if I run it in the blender console window, or if i Run Script in a ...
1
vote
0answers
11 views

How to create a “linked copy” scene in Python without using ops?

I'm trying to figure out how to create a new scene which is a "linked copy" from Python without relying on context/ops. The ops version would involve setting the type to ...