import maya.cmds as cmds

####		XGEN DESCRIPTIONS	-	RENDER ONLY		#####

def main():
	xGen = getXgen()
	setVisibility(xGen)


def getXgen():
	node = cmds.ls(selection = True)
	children_nodes = cmds.listRelatives(allDescendents=True, type='xgmSplineDescription')
	
	if not children_nodes:
		print("No XGEN")
		children_nodes = []
	else:
		print("XGEN Splines found")
	return(children_nodes)
	
def setVisibility(xGen):

	current = 0
	for i in xGen:
		currentNodeVisibility = str(xGen[current]) + ".visibility"
		currentNodeLodVisibility = str(xGen[current]) + ".lodVisibility"
		print(currentNodeVisibility)
		cmds.setAttr(currentNodeVisibility, 1)
		cmds.setAttr(currentNodeLodVisibility, 0)
		current += 1


if __name__ == "__main__":
	main()
