Create Compound Port

# The following is an example on how to create new ports on a compound.
import ufe
import lookdevx as lx

if not shadingContainer:
    raise Exception('This example requires a shading container i.e., a MaterialX document or a USD '
                    'material. Check the other examples to see how to create one.')

# Create a compound.
compound = lx.createCompound(shadingContainer)

# Create an input port.
inputPort = ufe.Attributes.attributes(compound).addAttribute("inputs:foo", ufe.Attribute.kColorFloat3)
outputPort = ufe.Attributes.attributes(compound).addAttribute("outputs:bar", ufe.Attribute.kFloat)
print(f'Created input: {ufe.PathString.string(inputPort.sceneItem().path())}.{inputPort.name}')
print(f'Created output: {ufe.PathString.string(outputPort.sceneItem().path())}.{outputPort.name}')

# Available data-types are:
# - ufe.Attribute.kBool
# - ufe.Attribute.kInt
# - ufe.Attribute.kUInt
# - ufe.Attribute.kFloat
# - ufe.Attribute.kDouble
# - ufe.Attribute.kString
# - ufe.Attribute.kColorFloat3
# - ufe.Attribute.kColorFloat4
# - ufe.Attribute.kFilename
# - ufe.Attribute.kEnumString
# - ufe.Attribute.kInt3
# - ufe.Attribute.kFloat2
# - ufe.Attribute.kFloat3
# - ufe.Attribute.kFloat4
# - ufe.Attribute.kDouble3
# - ufe.Attribute.kMatrix3d
# - ufe.Attribute.kMatrix4d
# - ufe.Attribute.kGeneric