message: Enable generation from material nodes
  Remove conversion of material nodes to surface shader nodes now that material nodes are supported.
diff: @@ -108,14 +108,12 @@ def main():
  shadergen.setUnitSystem(unitsystem)
  genoptions.targetDistanceUnit = 'meter'
  - # Look for shader nodes
  - shaderNodes = mx_gen_shader.findRenderableElements(doc, False)
  - if not shaderNodes:
  - materials = doc.getMaterialNodes()
  - for material in materials:
  - shaderNodes += mx.getShaderNodes(material, mx.SURFACE_SHADER_TYPE_STRING)
  - if not shaderNodes:
  - shaderNodes = doc.getNodesOfType(mx.SURFACE_SHADER_TYPE_STRING)
  + # Look for renderable nodes
  + nodes = mx_gen_shader.findRenderableElements(doc, False)
  + if not nodes:
  + nodes = doc.getMaterialNodes()
  + if not nodes:
  + nodes = doc.getNodesOfType(mx.SURFACE_SHADER_TYPE_STRING)
  pathPrefix = ''
  if opts.outputPath and os.path.exists(opts.outputPath):
  @@ -125,17 +123,11 @@ def main():
  print('- Shader output path: ' + pathPrefix)
  failedShaders = ""
  - for shaderNode in shaderNodes:
  - # Material nodes are not supported directly for generation so find upstream
  - # shader nodes.
  - if shaderNode.getCategory() == 'surfacematerial':
  - shaderNodes += mx.getShaderNodes(shaderNode, mx.SURFACE_SHADER_TYPE_STRING)
  - continue
  -
  - shaderNodeName = shaderNode.getName()
  - print('-- Generate code for node: ' + shaderNodeName)
  - shaderNodeName = mx.createValidName(shaderNodeName)
  - shader = shadergen.generate(shaderNodeName, shaderNode, context)
  + for node in nodes:
  + nodeName = node.getName()
  + print('-- Generate code for node: ' + nodeName)
  + nodeName = mx.createValidName(nodeName)
  + shader = shadergen.generate(nodeName, node, context)
  if shader:
  # Use extension of .vert and .frag as it's type is
  # recognized by glslangValidator
  @@ -166,17 +158,17 @@ def main():
  errors = validateCode(filename, opts.validator, opts.validatorArgs)
  if errors != "":
  - print("Validation failed for shader: ", shaderNodeName)
  - print("-------------------------")
  - print('Error log: ', errors)
  - print("-------------------------")
  - failedShaders += (shaderNodeName + ' ')
  + print("--- Validation failed for node: ", nodeName)
  + print("----------------------------")
  + print('--- Error log: ', errors)
  + print("----------------------------")
  + failedShaders += (nodeName + ' ')
  else:
  - print("Validation passed for shader: ", shaderNodeName)
  + print("--- Validation passed for node:", nodeName)
  else:
  - print("Validation failed for shader: ", shaderNodeName)
  - failedShaders += (shaderNodeName + ' ')
  + print("--- Validation failed for node:", nodeName)
  + failedShaders += (nodeName + ' ')
  if failedShaders != "":
  sys.exit(-1)
  