Author Topic: pysbs - sbsenum input node enumerations unavailable?  (Read 6199 times)

I'm writing a check tool for a collection of in-house checks our SBS' need to be pushed through before being published.
One of these checks needs to maintain a consistent in-house nomenclature for all input and output node identifiers.

I have this working for the output nodes via Pysbs...
Code: [Select]
if graph.SBSGraph.getGraphOutputs[0].hasUsage(sbsenum.UsageEnum.BASECOLOR): stuff...

However, I can't get this to work with Input nodes as there is no equivalent input dictionary.

The docs for SBSParamInput points back to sbsenum.UsageEnum, but sbsenum.UsageEnum doesn't have any methods for image input maps (normalWS, position etc.).

What do I need to do to build an input specific UsageEnum object to use with .hasUsage?


Docs: (.hasUsage) (.UsageEnum) (.UsageEnum)

Last Edit: June 12, 2018, 12:56:45 am

Can anyone please chime in?
It's been months and the issue still exists.

Pysbs doesn't seem to let us create usages for inputs like curvature and position.

Code: [Select]
class graph.graph.createInputNode(aUsages) has the following requirements:
aUsages (dictionary {UsageEnum : ComponentsEnum}, optional) – usage of this output

This requirement can't be fulfilled for some input nodes, since the entries don't exist in class sbsenum.UsageEnum

It used to be possible to get the SBSUsage object via SBSCompNode.getUsage() and change the mName value, but now that method appears to be deprecated.

Is there a work around for this?
How can the node usages be queried?


I'm sorry for your inconvenience. We'll make sure custom inputs are supported in the next release.

My workaround for the issue looks like this:

from pysbs import context
from pysbs import sbsgenerator
from pysbs import sbsenum
sbs_context = context.Context()

sbsDoc = sbsgenerator.createSBSDocument(sbs_context,

aGraph = sbsDoc.getSBSGraph(aGraphIdentifier='Composite')
input_node = aGraph.createInputNode(aIdentifier='Test',
input_param = aGraph.getInput('Test')
usages = input_param.getUsages()
usages[0].mName = 'banana'

The usage is set on the input_param on the graph rather than the actual input node.

Thanks David. This workaround is exactly what I need to continue.

We'll make sure custom inputs are supported in the next release.
Just to clarify, are you referring to the SBSUsage.mName value override as a 'custom input' or will the fix involve adding the missing inputs in the getUsages dicitonary?
Because I'm only using the mName override as a workaround, since I have no other way to set the usage for an input node as 'curvature' or 'position'.

The real fix will accept non-standard input usages (i.e you'll provide a string instead of an sbsenum.UsageEnum). Yhere is an issue with the API for creating inputs at this point.

What I'm showing in my code example is a workaround to solve any emergencies for now, hopefully you'll be able to pass a string in directly in the next release.

That sounds even better. Thanks for the help!