[Blendigo 3.4.9.4] Define external material with python

Announcements, requests and support regarding the Blender Indigo export script
Post Reply
3 posts • Page 1 of 1
sowly
Posts: 4
Joined: Fri Dec 06, 2013 5:08 am

[Blendigo 3.4.9.4] Define external material with python

Post by sowly » Thu Jan 23, 2014 2:39 am

Hello everyone,

I have a question about some command in Python to define material to use in Indigo. I search in old topics but no one seems to use Python for Blendigo.

Here's my issue. I active an object and create a material for it, then I make that material a Indigo external material to use a .igm file with that command :

Code: Select all

bpy.types.indigo_material.type = 'external'
I thought it would just change the type of the active object but it turns out that all the other objects of the scene become external materials. I don't want that.

Did you guys know how to define a Indigo material and affect it to an object with python ?

I tried to do that :

Code: Select all

new_mat = bpy.types.indigo_material
new_mat.type = 'external'
But then my problem is that I can't find how to affect the material to my object.

Hope somebody can help me ! :)
Thanks already,
Sowly

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: [Blendigo 3.4.9.4] Define external material with python

Post by fused » Sat Jan 25, 2014 1:56 am

Hi sowly,

materials automatically use the use the Indigo material properties when the Indigo renderer is set.

To create a material and set the type to external, try this:

Code: Select all

import bpy
import os

# Appends a material to an objects material list.
def applyMaterial(ob, mat):
    me = ob.data
    me.materials.append(mat)

# Make new material.
new_mat = bpy.data.materials.new('sowly\'s material')

# Apply material to currently selected object.
applyMaterial(bpy.context.object, new_mat)

# Set indigo material type to external.
new_mat.indigo_material.type = 'external'

# Set external materials filename.
new_mat.indigo_material.indigo_material_external.filename = 'C:/Users/Yves/Downloads/SturdyRock.igm'
Hope this helps :)

sowly
Posts: 4
Joined: Fri Dec 06, 2013 5:08 am

Re: [Blendigo 3.4.9.4] Define external material with python

Post by sowly » Sat Jan 25, 2014 2:00 am

Oh, I didn't think of that, I'll try this !

Thanks fused, I'll tell you if it works for me.

Post Reply
3 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 37 guests