self.shader = material.shader
if self.render_mode=='EXTERNAL' and not self.technique:
- raise Exception("Missing technique with external rendering mode")
+ raise Exception("Invalid configuration on material {}: No technique for external rendering".format(self.name))
elif self.render_mode=='CUSTOM' and not self.shader:
- raise Exception("Missing shader with custom rendering mode")
+ raise Exception("Invalid configuration on material {}: No shader for custom rendering".format(self.name))
out_node = None
for n in material.node_tree.nodes:
break
if not out_node:
- raise Exception("No material output node found")
+ raise Exception("No output node found on material {}".format(self.name))
surface_node, _ = get_linked_node_and_socket(material.node_tree, out_node.inputs["Surface"])
if not surface_node:
if self.render_mode=='BUILTIN':
- raise Exception("Empty material can't use builtin rendering mode")
+ raise Exception("Invalid configuration on material {}: Empty material with builtin rendering".format(self.name))
return
elif surface_node.type=='BSDF_PRINCIPLED':
self.type = "pbr"
color.set_from_input(material.node_tree, surface_node.inputs["Color"])
else:
- raise Exception("Unsupported surface node type "+surface_node.type)
+ raise Exception("Unsupported surface node type {} on material {}".format(surface_node.type, self.name))
sampler_settings = None
for p in self.properties:
if sampler_settings is None:
sampler_settings = settings
elif settings!=sampler_settings:
- raise Exception("Conflicting sampler settings in material textures")
+ raise Exception("Material {} has conflicting texture sampler settings".format(self.name))
def create_property(self, *args):
prop = None
if m.material_atlas and m.shader==shader:
materials.append(m)
- mat_map = MaterialAtlas(materials)
-
- return mat_map
+ return MaterialAtlas(materials)