@@ -1320,6 +1320,25 @@ def has3DOutputAttribute(self):
13201320 if attr .enabled and attr .isOutput and hasSupportedExt :
13211321 return True
13221322 return False
1323+
1324+ def _countForLoop (self ):
1325+ """
1326+ Return in how many ForLoop nodes this node is.
1327+ """
1328+ count = 0
1329+ # Access to the input attributes of the node
1330+ for attr in self ._attributes :
1331+ if attr .isInput and attr .isLink :
1332+ # Access to the attribute connected to the input attribute
1333+ srcAttr = attr .getLinkParam ()
1334+ # If the srcAttr is a ListAttribute, it means that the node is in a ForLoop
1335+ if isinstance (srcAttr .root , ListAttribute ) and srcAttr .type == attr .type :
1336+ # Access the countForLoop of the node of the ListAttribute
1337+ count = srcAttr .root .node .countForLoop + 1
1338+ if srcAttr .root .isInput :
1339+ count = count - 1 if count > 1 else 1
1340+ return count
1341+
13231342
13241343
13251344 name = Property (str , getName , constant = True )
@@ -1373,6 +1392,9 @@ def has3DOutputAttribute(self):
13731392 hasSequenceOutput = Property (bool , hasSequenceOutputAttribute , notify = outputAttrEnabledChanged )
13741393 has3DOutput = Property (bool , has3DOutputAttribute , notify = outputAttrEnabledChanged )
13751394
1395+ countForLoopChanged = Signal ()
1396+ countForLoop = Property (int , _countForLoop , notify = countForLoopChanged )
1397+
13761398class Node (BaseNode ):
13771399 """
13781400 A standard Graph node based on a node type.
0 commit comments