"""
NAME: Rename selected input ports
ICON: Icons/SceneGraphView/soloLocal256.png
DROP_TYPES:
SCOPE:
This is an example script for - "Renaming connection ports within nodes with Python"
After the user has selected their desired nodes, using this tool will set their
inputPorts to an increment of 'shot'
"""

import os
from Katana import KatanaFile


selectedNodes = NodegraphAPI.GetAllSelectedNodes()

for node in selectedNodes:
    inputPorts = node.getInputPorts()
    
    for inputs in inputPorts:
        index= inputs.getIndex()
        name = node.getInputPortByIndex(index).getName()    
        node.renameInputPort(name,('Shot'+repr(index+1)))
