How to rename node group output Sockets?
Syndaryl opened this issue · 4 comments
I've tested a few different approaches, but I can't figure out how to rename the output Sockets of node groups. I'm currently getting nodegroups with Socket names like Result, Result, Result, Result, Result, Result and when you have 4 different Float sockets in there, that's not helpful :D
I have an example
class Bbox:
def __init__(self, vSize: Vector, magnitude: FloatDistance, wWidth: FloatDistance, wHeight: FloatDistance, vWidth: Int, vHeight: Int):
#def __init__(vSize):
self.boxSize = vSize
self.magnitude = magnitude
self.wHeight = wHeight
self.wWidth = wWidth
self.vWidth = vWidth
self.vHeight = vHeight
@tree("bbox to grid")
def bbox_to_grid(maxVec: Vector, minVec: Vector, width: Int, height: Int) -> Bbox:
boxSize = maxVec - minVec
magnitude = vector_math(operation=VectorMath.Operation.LENGTH, vector=boxSize)
wWidth = math(operation=Math.Operation.WRAP, value=(width, 100.0, 0.0))
wHeight = math(operation=Math.Operation.WRAP, value=(height, 100.0, 0.0))
bbox = Bbox(boxSize, magnitude, wWidth, wHeight, width+1, height+1)
return (boxSize,magnitude,wWidth,wHeight, width+1, height+1) # try returning a Tuple -- anonymous Sockets
return bbox # try returning an object -- no Sockets
return { "boxSize": boxSize, "magnitude": magnitude, "wWidth": wWidth, "wHeight": wHeight, "width": width+1, "height": height+1 } # try returning a dictionary - returns the Dictionary keys as anonymous String Sockets
This example is kinda garbage, just to demonstrate the question.
Great suggestion. Currently the name is hardcoded to “Result”.
I like your API suggestion of using a dict
.
Implemented in #4. You can see the documentation for tree function outputs here: https://carson-katri.github.io/geometry-script/pr-preview/pr-4/api/basics/tree-functions.html#group-output
Let me know if this covers your use case.
First, thank you very much for the quick turn-around time!
Second, yes, this covers my use case exactly. Perfect, thank you!