if l.material_slots:
material = l.material_slots[0].material
if material:
- if material.material_map:
- tech_res = resources["material_map_{}.tech".format(os.path.splitext(material.technique)[0])]
+ if material.render_mode=='EXTERNAL':
+ tech_name = material.technique
+ elif material.material_map:
+ tech_name = "material_map_{}.tech".format(os.path.splitext(material.technique)[0])
else:
- tech_res = resources[material.name+".tech"]
+ tech_name = material.name+".tech"
else:
- tech_res = resources["stub.tech"]
+ tech_name = "stub.tech"
- if tech_res.name!=prev_tech:
+ if tech_name!=prev_tech:
if material and material.render_mode=='EXTERNAL':
lod_st.append(Statement("technique", material.technique))
else:
- lod_st.append(obj_res.create_reference_statement("technique", tech_res))
- prev_tech = tech_res.name
+ lod_st.append(obj_res.create_reference_statement("technique", resources[tech_name]))
+ prev_tech = tech_name
if i>0:
st = Statement("level_of_detail", i)