class Material:
def __init__(self, material):
self.name = material.name
+ self.type = None
self.properties = {}
self.render_mode = material.render_mode
surface_node, _ = get_linked_node_and_socket(material.node_tree, out_node.inputs["Surface"])
if not surface_node:
- raise Exception("Material has no surface node")
+ if self.render_mode=='BUILTIN':
+ raise Exception("Empty material can't use builtin rendering mode")
+ return
elif surface_node.type!='BSDF_PRINCIPLED':
raise Exception("Unsupported surface node type "+surface_node.type)
+ self.type = "pbr"
+
base_color = self.properties["base_color"] = MaterialProperty((0.8, 0.8, 0.8, 1.0))
metalness = self.properties["metalness"] = MaterialProperty(0.0)
roughness = self.properties["roughness"] = MaterialProperty(0.5)