To ensure that your script handles multiple class parameters without overwriting each other and executes correctly, you need to accumulate the results for each class parameter and avoid reassigning the result list. Here's an updated script that ensures the attributes for each class are correctly added to the final result:
r = [] node = kwargs['node'] inputs = node.inputs() number_casts = node.evalParm("number_casts") if inputs and inputs[0]: geo = inputs[0].geometry() if geo: #遍历每个属性类别 for i in range(1, number_casts + 1): c = node.parm('class'+str(i)).evalAsString() if c == 'detail': attrs = geo.globalAttribs() elif c == 'primitive': attrs = geo.primAttribs() elif c == 'point': attrs = geo.pointAttribs() else: # vertex attrs = geo.vertexAttribs() for a in attrs: r.extend([a.name(), a.name()]) return r