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.

0
votes
1answer
28 views

How to make local objects link mantain their hierachy in Blender 2.8 python?

Is there a way to maintain hierarchy objects after we Make Local several linked objects the scene ? I notice that if we try Make Local the parent object, the child will be put outside the parent, in ...
0
votes
0answers
25 views

How to create ui button in panel

How to create ui button in panel like this
0
votes
1answer
24 views

With python align text to camera

I want to add a text to an object, soft of like a label. The thing is, when I do it with python, view_align=True doesn't work. The text keeps it's original orientation. I'm not writing a plugin or ...
0
votes
0answers
10 views

How to retrieve contact forces from impulse in Blender?

I am working on retrieving contact forces during a simulation in Blender, I wonder to know is it possible to retrieve contact forces from collision impulses calculated by Blender and if yes, I wonder ...
0
votes
0answers
13 views

how to access Speed Control `speed_factor` when *Stretch to input strip length* is set?

i have a Image-Sequence in the VSE. then applied an Speed Control effect on top. if i use the pythonconsole to check the value of the effect strip that is called <...
0
votes
1answer
39 views

Getting blender camera fov or focal length from the unity3d camera fov

I'm trying to match the fov of blender camera with unity 3d camera fov. Basically i want to calculate blender's camera FOV or focal length, given the fov of unity3d camera. Please help.
0
votes
2answers
51 views

How can I export and import ID property as json? (to make preset file)

I think it should be simple, but could not find correct way ore related document then hope to know way. Now I have active armature as "amt" , and it have many ID properties for shape keys and drive ...
0
votes
1answer
28 views

How to display VSE image-strip filename as overlay?

Is it possible to show the Filename of the current frame of a Image-Strip in the VSE as overlay text?
2
votes
0answers
31 views

How to get coordinates of special vertices in an animated mesh with Python?

I try to get the positions of special vertices while animating. I only found quastions about positions of special vertices in one frame or positions of all vertices in an animation. But I need the ...
0
votes
0answers
43 views

Problems creating a mirror transform operator

I am fairly new to Blender Python. I am trying to code a mirror transform that leaves the selected objects mirrored with its scale applied and its normals facing outside after the mirror transform ...
0
votes
0answers
27 views

Rotoscope Animation to 3D

here's what I wanted to do: I'm manually rotoscoping a 4 seconds animation. I'm only tracing black lines over transparent background (png format) I had a script in processing that read images and ...
0
votes
1answer
64 views

How to display and use operator properties in a custom UI panel?

For example, as you can see in the keymap preferences, there are operators that have properties, like this Smooth Vertices: With this little code ...
0
votes
2answers
26 views

How can I access (read/write) a mesh object's index vi Python?

I would like to retrieve from python the index of an object -- the same index that you get when using an Object info node in shader nodes. I have a reference to ...
1
vote
1answer
49 views

How to customize a material without duplicating it?

I know how to share a material among different objects, customizing it by using the ObjectInfo node. I want do something similar but replacing the ...
0
votes
1answer
33 views

What context does save_as need?

I'm trying to save a texture using save_as, because I want to use the optional Copy parameter. I'm using this code: ...
0
votes
1answer
22 views

Installing pip for Blender and GDAL

I'm trying to configure gdal within blender using the information here: https://github.com/domlysz/BlenderGIS/wiki/How-to-install-GDAL. I already have blender totally configured and the correct gdal ....
0
votes
0answers
36 views

Blender trows an error like this RuntimeError: register_class(…):, missing bl_rna attribute from 'type' instance (may not be registered)

I dont know why this script is not working. Pls help. Below is the full code. Thx # Blender AddOn NoSlide (c) 2015 grgr # # This Addon integrates into the NLA-editor. # Its purpose is to prevent e.g....
0
votes
0answers
16 views

GPU and Multi-CPU computations in Python in Blender 2.8+ with Cycles

Greetings beautiful Blender community, Is there a way to force certain sets of computations to occur on certain devices? For example code to parallelize, consider: ...
2
votes
1answer
43 views

Different behaviour in script compared to Python Console

I'm running a script in Blender 2.79b to save 2D proyections of a 3D face model with annotated facial landmarks, I apply random transformations to the mesh and the landmarks, render the mesh and save ...
0
votes
0answers
20 views

bmesh.ops.dissolve_limit trouble about “delimit” option with set in 2.79

I checked the api for this but I have to say that what I'm looking for is poorly documented: Limited dissolve have 5 options with multiple selection blender 2.79 : Normal, Material,Seam, Sharp, UVs in ...
0
votes
0answers
18 views

How to get and convert Blender 3d viewport to curve data [duplicate]

Searched a lot in python api of bgl and gpu modules. Is there a way to get curves (lines) separated by types of shading from camera projection of 3d Viewport gpengl? For example on image bleow ...
3
votes
1answer
73 views

Blender 2.8 can no longer import module from Textblock

just downloaded todays Blender 2.8 build and it seems I can no longer import a function from another Textblock. Works well on a build from April 5th (haven't updated since then). This simple example ...
1
vote
0answers
18 views

How to get UV stretching (angle or area colors) with Python without looking at viewport?

I know how to view the UV stretching by angle or area in the viewport. However, I want to write a script by which I can determine if a UV island results in a red, yellow or green stretch to correct it ...
0
votes
0answers
15 views

bmesh.ops.dissolve_limit not work fine?

I tried to emulate "limited dissolve" with bmesh, but it behaves differently from the various parameters in blender 2.79, delimit mode (in 2.79 with integer value and in 2.8 with string) Result by "...
0
votes
0answers
10 views

How to rotate a bone with serial input using python

How do i rotate a bone having a serial input. I figured out how to do it with an object but i want to rotate a single bone in an armature. thanks for the help in advance.
0
votes
1answer
48 views

How use Integer / string in EnumPropery items

I have EnumProperty, and i need an integer number when i select my "Mode" Now i have: item = ( ('Mode 1', "Mode 1", ""), ('Mode 2', "Mode 2","")) but i ...
0
votes
0answers
23 views

Normal values not changing while chang normal in bmesh obje

I am using blender 2,79 and blender API to edit my mesh. Following is the my code.. ...
0
votes
1answer
34 views

How can a I read and update the keyframe value of a material node in Blender 2.8 via Python?

This question/answer (Control Cycles material nodes and material properties in Python) has been very useful, so I know now how to enter a keyframe for a given material node using ...
1
vote
1answer
54 views

How to get absolute file path for linked texture image?

I am writing a custom export script for blender and need to copy the textures from the materials texture slots to another location. I am using shutil for copyfile: ...
0
votes
1answer
21 views

what other option in python keymap line for 'PRESS'?

I'm noob in this thing so I don't exactly know how to ask this. so there is this line in a phyton script that responsible for setting key combination that will trigger the 'script', in this case is ...
1
vote
1answer
17 views

Deleting temporary mesh after extracting data

When extracting data via temporary mesh, like this: mesh = object.to_mesh(bpy.context.scene, apply_modifiers=True, settings='RENDER') Do I need to delete this ...
0
votes
0answers
19 views

Where should my add-on save its presets .txt file?

I created a script that saves all my Property Groups in some callable text files, it works fine, for now the path is ...
0
votes
0answers
9 views

Add randomness to dashed freestyle line?

Is there a way to add some randomness to the lengths and gaps of a dashed freestyle line? Maybe some combo of modifiers I missed or a simple script? I'm close to the effect I want, but need to ...
0
votes
0answers
28 views

Blender script concatenating names not replacing name

I am trying to use blender script to replace the name of a mesh. Instead of replacing the name it is concatenating them, for example ...
2
votes
2answers
69 views

Install pip and packages from within Blender OS independently

This question relates to installing pip from within Blender without the need to open a terminal outside Blender. This allows for more user friendliness and pip calls from within an add-on (as opposed ...
0
votes
1answer
29 views

Run modal operator while tool is selected

For my addon in blender 2.8 I need to have a modal operator running while my custom tool in the new toolbar is selected, or at least know when it is selected/deselected so that I can invoke/stop a ...
1
vote
0answers
14 views

Decrease motion speed by proximity

I have an object controlled with motion actuator and need to decrease the speed on all axes as it gets closer to another object with certain property. How do i achieve this?
1
vote
3answers
53 views

Compute directional lamp for direction

Given a randomized euler rotation of (x1,y1,z1) of a sun lamp object, how do we compute whether the final light ray will be pointing 'down' in negative z worldspace or up? Essentially, I am looking ...
0
votes
1answer
48 views

Python: How to Export All the UV Layouts in Blender

Can anyone confirm this script works in 2.79b? (I can't use 2.8 at the moment) The script is supposed to export the UV layouts of all selected meshes at once to a specific folder, but I'm no coder, ...
0
votes
1answer
13 views

How to access per-face UV assignment via API

In Blender 2.79, how can I find the per-face UV image associated with a given face? Essentially what I want to do is this (pseudocode): ...
3
votes
1answer
55 views

Are Blender 2.79 and Python 3.7.X Compatible?

Blender 2.79 Reports its Python version as 3.5.3 Is the mix of Python 3.7.X and Blender 2.79 compatible? What steps should be taken? What is the estimated time for these steps? I am not seeking to ...
2
votes
1answer
32 views

Vector Math to Determine Gravity Path

I need to code a function that basically traces the path a sphere would roll when placed on a triangulated terrain. The image below shows the problem, but I haven't got a clue how to work with vectors ...
1
vote
2answers
86 views

How to get a Center Point from multiple Vertex Locations?

tl;dr: I just want to create some curve guides along those middle points of vertex groups but with a script. I am new to Python in Blender and I can't seem to find how to do this. So far, I managed ...
1
vote
1answer
26 views

bmesh.ops method to get Loose vertices / edges and delete from that list?

I read all the api about bmesh.ops, but not find and not have idea to get loose edge/vertices , someone knows something about it, I don't even find examples to get ...
0
votes
0answers
18 views

How to activate a panel in the tool shelf via Python? [duplicate]

In Python, I want to create operators to switch to some of the tool shelf panels that I use frequently. How can I do this? The idea is to assign keyboard shortcuts to these operators so that I can ...
0
votes
0answers
24 views

Change operator parameters in custom modal operator

How to change the settings of another operator in a modal operator. I used undo to cancel the steps but it seems to me that this is not the best way. ...
0
votes
1answer
18 views

Blender_icons_update.py - SVG icon generation to DAT file issue

I have been trying to run the python blender_icons_update.py blender_icons.svg command from command prompt in the \release\datafiles folder, but without any luck. I get these errors: ...
0
votes
0answers
31 views

Need help with creating a custom material node with python

I'm trying to make a custom node in python, and I've been able to make the input and output sockets, but I have no idea how to connect the input float values to the output float values. I've already ...
0
votes
0answers
30 views

Way for save or store by StringProperty (Preset) all the class PropertyGroup

I'm writing a script, now I'd like to understand how these properties can be saved, the properties are stored in a class PropPerSet(bpy.types.PropertyGroup), I put ...
2
votes
2answers
48 views

Display Value of a nodes RGB input in a panel

I have a Mix RGB node and want to display the input in a normal panel in the UI. I can show the color widget by using layout.prop(input,"default_value"), but what I ...