Linked Questions

1 vote
0 answers
285 views

How to assign materials to a text via Python [duplicate]

I want to assign different materials to a single text object via Python. This can be done manually by selecting the desired Material slot, typing away, choosing a different material slot and typing ...
tobkum's user avatar
  • 994
0 votes
1 answer
91 views

How to Assign Material to Object with Python? [duplicate]

How can I change the material of my object (Hand) with Python? I do not want to add a new material. I just want to assign an existing material.
BBlender's user avatar
24 votes
4 answers
28k views

Add Nodes to Material with Python

I have edited a script that creates some nodes, but the only problem is, it always created a new material. I want it to either add the nodes on the existing material, or a pre-defined material. Here ...
rioforce's user avatar
  • 2,062
12 votes
1 answer
21k views

Add material and apply Diffuse color via Python

This may be another simple question but I can't seem to find a straight answer. I am procedurally generating figures and as part of the last step I want to color the figure red. If I manually add a ...
switchup621's user avatar
9 votes
1 answer
10k views

Modify obj after import using python

I am trying to modify an object after importing it. This post is related to this question ...
Ross's user avatar
  • 267
4 votes
2 answers
8k views

How can I replace a material from Python?

I read this first to get an idea on assigning materials. How to assign a new material to an object in the scene from Python? I wrote a script to replace one material with another. It seems to work ...
Aiena's user avatar
  • 160
3 votes
2 answers
2k views

How to assign a material to a single face of a mesh using Python API

I have tried the following but the mat is not assigned to any of the faces. ...
Ignacio Alorre's user avatar
3 votes
1 answer
4k views

How to load an image from disc and assign it to a newly created image texture node?

I'm trying to load an image from jpeg file and to add the material to the cube using the following code: ...
Dini's user avatar
  • 31
5 votes
1 answer
3k views

How do I iterate over all selected objects and change a property on their materials?

import bpy for material_slot in bpy.data.objects['Cube'].material_slots: material_slot.material.show_transparent_back = False I have managed to access to the ...
pekkuskär's user avatar
4 votes
2 answers
3k views

Assign one material to multiple objects via Python

I am using ePMV Blender addon to import molecular structures into Blender. It generates multiple objects (protein sub-structures called helices, coils and strands) and it assigns a separate material ...
marcheenek's user avatar
0 votes
3 answers
4k views

How to assign a material to a mesh object with python?

Creating Materials using python is easy and it has a lot of answers on StackExchange. Now what I want to ask is - If I want that the material should only be added if the object (on which material ...
Rakesh choudhary's user avatar
5 votes
1 answer
1k views

Assign Material Slot to no material via python

I'd like to, in code, remove a material from a material slot without deleting that material slot (because deleting it would remove the connections between that material slot and the vertices). The ...
SamFall's user avatar
  • 312
1 vote
2 answers
4k views

Blender 2.8 Python : How Do I Find My Material Output Node (and assign displacement)

I am attempting to create a displacement node with an attached image, and connect that to the Main Material Output Node. I feel I understand how to create and connect these pieces (mostly) fine now. ...
WillSmithsRobot's user avatar
0 votes
2 answers
2k views

How can I turn nodes that made in shader editor to script? [duplicate]

I want to make a button and when I press it, it will apply the material I made, that mean the nodes. I try different way to type script but it wasn't work. ...
8N Films's user avatar
  • 173
2 votes
1 answer
2k views

How to get diffuse color of a material via Python?

Since I am used to code with Python in Maya I have trouble getting things to work in Blender. I want to do something specific based on the name of its material that is applied. But I am really ...
Lala_Ghost's user avatar
0 votes
1 answer
2k views

How to import a STL file using the file browser?

I'm trying to import a stl file manually via python. My code below is pretty straight forward, but I'm struggling with the following line. I'm not sure about the syntax and format of the arguments: <...
DrDress's user avatar
  • 563
1 vote
1 answer
1k views

How can I apply an image texture to a certain part of a mesh?

I have a mesh, with 16 faces, that I ultimately show in Blender Game Engine, and want to apply separate textures to the faces via a script. The reason behind this is I'm trying to show a detailed ...
DrZaphod's user avatar
  • 113
1 vote
1 answer
2k views

How to assign a color value to face (object) using python

I have the following two functions: ...
Michael's user avatar
  • 153
3 votes
1 answer
2k views

Getting the actual (not default) input value of a node group for a specific user

I've spent far too long googling for this answer. :) I have a Cycles shader node group called ProteinVR that I created using the node editor. It has two inputs: This same node group is used by ...
jdurrant's user avatar
0 votes
2 answers
1k views

Iterate through objects then parent and add material based on string search in names

I've imported a model from the BodyParts3D database (http://lifesciencedb.jp/bp3d/) It's made up of a huge number of .obj files. These have a name based on the anatomical structure/organ: My question ...
baroquedub's user avatar
1 vote
1 answer
1k views

Interacting with material_slot in python

I am working on a project with mesh created with photogrammetry (mainly). Once the mesh is imported, I would like to apply through scripts different materials before render them. But Sometimes, I use ...
ValiGrimO's user avatar
0 votes
1 answer
1k views

Append Materials Using Python [duplicate]

Trying to append a material from one blend file to another but not having any luck. I've tried two methods so far. Method 1: ...
Chris E Kinch's user avatar
0 votes
0 answers
863 views

How to add an emission node with a specific color to a material and add that material to an object? [duplicate]

So far I have seen this and this both which did not work for me. Currently I have: ...
Hakaishin's user avatar
  • 577
0 votes
0 answers
773 views

How to convert this vertex paint into a useable material (scripted)?

I have a single, the all-in-one mesh object created and then vertex-painted with a script. I can see the colors in vertex paint mode, but I haven't been able to successfully turn it into a renderable (...
uhoh's user avatar
  • 2,667
3 votes
0 answers
389 views

Example of creating and setting a Cycles material node with the Python API [duplicate]

I'm trying to set the properties of a Cycles material, which is linked to a Plane object, using the API. So far this is what I'...
Ajay T's user avatar
  • 115
1 vote
1 answer
153 views

How to assign a material to multiple faces with python? [duplicate]

How to assign a material to multiple faces with python? As shown in the following image, there is a cube, I subdivide one big face into 49 small faces, then I assign the green material to the 49 small ...
zwl1619's user avatar
  • 137
0 votes
0 answers
40 views

Add a created group in a node tree exploiting python [duplicate]

I have created a node tree in a different blend file, and I just need to add it as a group exploiting a script. In the following figure there is the "manual" procedure. I have tried to add ...
Carmine Buonagura's user avatar
0 votes
0 answers
20 views

Blender 2.9 - script how to add a material shader nodes tree? [duplicate]

In blender 2.9, I got a selected object and need to add a new material in a new slot with a script addon. I need some examples for doing a material shader nodes tree in 2.9 Ex: How to adding some ...
Ricky's user avatar
  • 69