Questions about DirectX exporter

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

pachesantiago
Posts: 5
Joined: Sat Sep 22, 2012 2:51 am

Questions about DirectX exporter

Postby pachesantiago » Sat Sep 22, 2012 2:57 am

Hy everyone. I got a quick question.
Does anyone knows in wich order does the exporter map the materials to subsets?
I want to create a shader in my engine in the place of the materials. For that i need to know to wich material does each subset "points"
For example, I export a model with two materials, material "A" and "B".
How do I know where's the material "A". is in subset 0, or in 1 ?
Thanks in advance.
Fusion Games Studio - A dream today, a game tomorrow

pachesantiago
Posts: 5
Joined: Sat Sep 22, 2012 2:51 am

Postby pachesantiago » Sun Sep 23, 2012 2:25 am

I'm still with this. Anyone?
Fusion Games Studio - A dream today, a game tomorrow

pachesantiago
Posts: 5
Joined: Sat Sep 22, 2012 2:51 am

Postby pachesantiago » Mon Sep 24, 2012 12:10 am

If anyone care, I solve it. It orders them in the creation order. Blender appears to do that too to selections.
Fusion Games Studio - A dream today, a game tomorrow

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Mon Sep 24, 2012 9:34 pm

object materials are organized in material slots, and the slot order as seen in material tab is kept.

If you access materials via python like bpy.data.materials, their numerical order is alphabetically:

bpy.data.materials[0].name -> "1_second"
bpy.data.materials[1].name -> "2_first"

material "2_first" was created first, "1_second" later. The order (0, 1, ...) in bpy.data.materials changes with material names.
I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest