1
$\begingroup$

How do I add a new custom property to a material of an object in my Python script? In an earlier version it was possible to use

bpy.context.object.active_material.gltf_double_sided = True

but I guess in Blender 2.81a it is not supported, the script fails on this line. Unfortunately, the API documentation is very, confusing. Is there something like, e.g.

bpy.context.object.active_material.data['gltf_double_sided'] = True

(btw, the line above does not work)

$\endgroup$
1
$\begingroup$

The answer is:

bpy.types.Material.gltf_double_sided = bpy.props.BoolProperty()
bpy.context.object.active_material.gltf_double_sided = True

And it works.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.