@classmethod
	def layoutOrder( cls, parent, includeCustomWidgets = False, section = None, layoutName = "layout", rootSection = "" ) :

		items = parent.children( Gaffer.Plug )
		items = [ plug for plug in items if not plug.getName().startswith( "__" ) ]

		if includeCustomWidgets :
			if isinstance( parent, Gaffer.Node ) :
				metadataNames = Gaffer.Metadata.registeredNodeValues( parent )
			else :
				metadataNames = Gaffer.Metadata.registeredPlugValues( parent )
			for name in metadataNames :
				m = re.match( layoutName + ":customWidget:(.+):widgetType", name )
				if m and cls.__metadataValue( parent, name ) :
					items.append( m.group( 1 ) )

		itemsAndIndices = [ list( x ) for x in enumerate( items ) ]
		for itemAndIndex in itemsAndIndices :
			index = cls.__staticItemMetadataValue( itemAndIndex[1], "index", parent, layoutName )
			if index is not None :
				index = index if index >= 0 else sys.maxint + index
				itemAndIndex[0] = index

		itemsAndIndices.sort( key = lambda x : x[0] )

		if section is not None :
			sectionPath = section.split( "." ) if section else []
			itemsAndIndices = [ x for x in itemsAndIndices if cls.__staticSectionPath( x[1], parent, layoutName ) == sectionPath ]

		if rootSection :
			rootSectionPath = rootSection.split( "." if rootSection else [] )
			itemsAndIndices = [ x for x in itemsAndIndices if cls.__staticSectionPath( x[1], parent, layoutName )[:len(rootSectionPath)] == rootSectionPath ]

		return [ x[1] for x in itemsAndIndices ]
dataset/ETHPy150Open ImageEngine/gaffer/python/GafferUI/PlugLayout.py/PlugLayout.layoutOrder/original