XML Schema for Fragment Graphs

The following is an XML schema which defines the XML format used for fragment graphs registered with MFragmentManager. This schema can be used to validate the XML for fragment graph definitions. Valid XML is necessary, but is not a sufficient condition for a fragment graph to function correctly in the Maya fragment shader system.

See 6.3 XML file for fragment graph for phong1 for an example XML file of the fragment graph for a shading network rooted at phong1.

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:element name="fragment_graph">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
    <xs:element name="keyword" type="KeywordType" minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="fragments" type="FragmentListType" />
    <xs:element name="connections" type="ConnectionListType" />
    <xs:element name="properties" type="PropertiesListType" />
    <xs:element name="values" type="ValuesListType" />
    <xs:element name="outputs" type="OutputsListType" />
   </xs:sequence>
   <xs:attribute name="name" type="xs:string" use="required" />
   <xs:attribute name="ref" type="xs:string" use="required" />
   <xs:attribute name="class" type="xs:string" use="required" fixed="FragmentGraph" />
   <xs:attribute name="version" type="xs:float" use="required" />
   <xs:attribute name="feature_level" type="xs:integer" />
  </xs:complexType>
 </xs:element>

 <xs:complexType name="KeywordType">
  <xs:attribute name="value" type="xs:string" use="required" />
 </xs:complexType>

 <xs:complexType name="FragmentListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="fragment_ref">
    <xs:complexType>
     <xs:attribute name="name" type="xs:string" use="required" />
     <xs:attribute name="ref" type="xs:string" use="required" />
    </xs:complexType>
   </xs:element>
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="ConnectionListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="connect">
    <xs:complexType>
     <xs:attribute name="from" type="xs:string" use="required" />
     <xs:attribute name="to" type="xs:string" use="required" />
     <xs:attribute name="name" type="xs:string" />
    </xs:complexType>
   </xs:element>
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="PropertiesListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="float" type="PropertyType" />
   <xs:element name="float2" type="PropertyType" />
   <xs:element name="float3" type="PropertyType" />
   <xs:element name="float4" type="PropertyType" />
   <xs:element name="target" type="PropertyType" />
   <xs:element name="texture1" type="PropertyType" />
   <xs:element name="texture2" type="PropertyType" />
   <xs:element name="texture3" type="PropertyType" />
   <xs:element name="textureCube" type="PropertyType" />
   <xs:element name="world" type="PropertyType" />
   <xs:element name="bool" type="PropertyType" />
   <xs:element name="int" type="PropertyType" />
   <xs:element name="int2" type="PropertyType" />
   <xs:element name="int3" type="PropertyType" />
   <xs:element name="int4" type="PropertyType" />
   <xs:element name="color" type="PropertyType" />
   <xs:element name="colorAlpha" type="PropertyType" />
   <xs:element name="float4x4" type="PropertyType" />
   <xs:element name="string" type="PropertyType" />
   <xs:element name="stringArray" type="PropertyType" />
   <xs:element name="countedObject" type="PropertyType" />
   <xs:element name="object" type="PropertyType" />
   <xs:element name="struct" type="PropertyType" />
   <xs:element name="camera" type="PropertyType" />
   <xs:element name="effectInstance" type="PropertyType" />
   <xs:element name="effectInstanceArray" type="PropertyType" />
   <xs:element name="sampler" type="PropertyType" />
   <xs:element name="simpleMesh" type="PropertyType" />
   <xs:element name="pointStream" type="PropertyType" />
   <xs:element name="lineStream" type="PropertyType" />
   <xs:element name="triStream" type="PropertyType" />
   <xs:element name="undefined" type="PropertyType" />
   <xs:element name="renderer" type="PropertyType" />
   <xs:element name="enum" type="PropertyType" />
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="PropertyType">
  <xs:attribute name="name" type="xs:string" use="required" />
  <xs:attribute name="ref" type="xs:string" use="required" />
  <xs:attribute name="semantic" type="xs:string" />
  <xs:attribute name="flags" type="xs:string" />
 </xs:complexType>

 <xs:complexType name="ValuesListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="float" type="ValueType" />
   <xs:element name="float2" type="ValueType" />
   <xs:element name="float3" type="ValueType" />
   <xs:element name="float4" type="ValueType" />
   <xs:element name="color" type="ValueType" />
   <xs:element name="colorAlpha" type="ValueType" />
   <xs:element name="bool" type="ValueType" />
   <xs:element name="int" type="ValueType" />
   <xs:element name="int2" type="ValueType" />
   <xs:element name="int3" type="ValueType" />
   <xs:element name="int4" type="ValueType" />
   <xs:element name="float4x4" type="ValueType" />
   <xs:element name="string" type="ValueType" />
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="ValueType">
  <xs:attribute name="name" type="xs:string" use="required" />
  <xs:attribute name="value" type="xs:string" use="required" />
 </xs:complexType>

 <xs:complexType name="OutputsListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="float" type="OutputType" />
   <xs:element name="float2" type="OutputType" />
   <xs:element name="float3" type="OutputType" />
   <xs:element name="float4" type="OutputType" />
   <xs:element name="target" type="OutputType" />
   <xs:element name="texture1" type="OutputType" />
   <xs:element name="texture2" type="OutputType" />
   <xs:element name="texture3" type="OutputType" />
   <xs:element name="textureCube" type="OutputType" />
   <xs:element name="world" type="OutputType" />
   <xs:element name="bool" type="OutputType" />
   <xs:element name="int" type="OutputType" />
   <xs:element name="int2" type="OutputType" />
   <xs:element name="int3" type="OutputType" />
   <xs:element name="int4" type="OutputType" />
   <xs:element name="color" type="OutputType" />
   <xs:element name="colorAlpha" type="OutputType" />
   <xs:element name="float4x4" type="OutputType" />
   <xs:element name="string" type="OutputType" />
   <xs:element name="stringArray" type="OutputType" />
   <xs:element name="countedObject" type="OutputType" />
   <xs:element name="object" type="OutputType" />
   <xs:element name="struct" type="OutputType" />
   <xs:element name="camera" type="OutputType" />
   <xs:element name="effectInstance" type="OutputType" />
   <xs:element name="effectInstanceArray" type="OutputType" />
   <xs:element name="sampler" type="OutputType" />
   <xs:element name="simpleMesh" type="OutputType" />
   <xs:element name="pointStream" type="OutputType" />
   <xs:element name="lineStream" type="OutputType" />
   <xs:element name="triStream" type="OutputType" />
   <xs:element name="undefined" type="OutputType" />
   <xs:element name="renderer" type="OutputType" />
   <xs:element name="enum" type="OutputType" />
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="OutputType">
  <xs:attribute name="name" type="xs:string" use="required" />
  <xs:attribute name="ref" type="xs:string" use="required" />
 </xs:complexType>

</xs:schema>