Author Topic: Get input parameter group?  (Read 77 times)

I'd need to get the group name an input parameter belongs to (for instance in Tile Sampler, size related parameters are into a Size group etc.), but I don't find this in the SD API documentation. Anyone knows a way to get this? Thanks.

There doesn't appear to be a higher level function to retrieve the group from the property, but there's still a way.

Example for your current graph:
Code: [Select]
for prp in graph.getProperties(sdproperty.SDPropertyCategory.Input):
    group = graph.getPropertyAnnotationValueFromId(prp, 'group')  # Docs: sbs::compositing::input
    if group:
        print('{}: {}'.format(prp.getId(), group.get()))

Example for a node:
Code: [Select]
graph = node.getReferencedResource()
for prp in graph.getProperties(sdproperty.SDPropertyCategory.Input):
    group = graph.getPropertyAnnotationValueFromId(prp, 'group')  # Docs: sbs::compositing::input
    if group:
        print('{}: {}'.format(prp.getId(), group.get()))


Docs

sbs::compositing::input

../Allegorithmic/Substance Designer/resources/documentation/pythonapi/html/pythonapi/modules/sbs_compositing.html?highlight=group
Last Edit: November 08, 2019, 04:12:21 pm

Thanks a lot NevTD, it works perfectly, I was not accustomed to this part of the doc, indeed it contains valuable information!
Just for info in the code we can avoid a loop using SDGraph.getPropertyFromId() if we know the property id.