0

enter image description here

I would like to make one of my objects transparent in the 3D Viewport. When I look around I get tons of answers - all different, and some of them a lot more complicated than others and also older from versions of Blender. I can't get any of them to work. I just want the simplest way to make anything transparent; like descreasing the alpha channel or checking an x-ray parameter or something like that. Any ideas?

I tried bpy.context.active_object.show_transparent=True but I'm sure what it does, but it seems like what I want.

Here are some of the links I found:

Duarte Farrajota Ramos
  • 59,425
  • 39
  • 130
  • 187
DrDress
  • 563
  • 4
  • 19

1 Answers1

2

One option is to set the alpha value (fourth component) of Material.diffuse_color:

float array of 4 items in [0, inf], default (0.8, 0.8, 0.8, 0.8)

import bpy

Get the object in context

obj = bpy.context.object

Get the active material

mat = obj.active_material

Set the alpha value of the diffuse color

mat.diffuse_color = (0.0 , 0.0 , 1.0 , 0.7)

enter image description here

brockmann
  • 12,613
  • 4
  • 50
  • 93
DrDress
  • 563
  • 4
  • 19