parameters: (ioPipeAndViewsState)
return_statement: return doUpdate
docstring: if the pipe (or imageset maybe) is in interactive mode, check for the
       trigger which will cause a read-and-update of the state.  Provides
       control to skip interaction when it is not enabled, the default case.
       Allows for a wait for an interaction trigger of N tries at M seconds
       per try, mainly to deal with situations where images are being 
       rendered quickly.  Eventually may be altered to help deal with cases
       where we want to keep re-rendering with changed pipeline states
       until we are happy and then let the simulation return to operation
docstring_summary: if the pipe (or imageset maybe) is in interactive mode, check for the
       trigger which will cause a read-and-update of the state.  Provides
       control to skip interaction when it is not enabled, the default case.
       Allows for a wait for an interaction trigger of N tries at M seconds
       per try, mainly to deal with situations where images are being 
       rendered quickly.  Eventually may be altered to help deal with cases
       where we want to keep re-rendering with changed pipeline states
       until we are happy and then let the simulation return to operation
docstring_tokens: if the pipe ( or imageset maybe ) is in interactive mode check for the trigger which will cause a read - and - update of the state . Provides control to skip interaction when it is not enabled the default case . Allows for a wait for an interaction trigger of N tries at M seconds per try mainly to deal with situations where images are being rendered quickly . Eventually may be altered to help deal with cases where we want to keep re - rendering with changed pipeline states until we are happy and then let the simulation return to operation
function: def HandleUserInteractionIfEnabled(ioPipeAndViewsState):
    """if the pipe (or imageset maybe) is in interactive mode, check for the
       trigger which will cause a read-and-update of the state.  Provides
       control to skip interaction when it is not enabled, the default case.
       Allows for a wait for an interaction trigger of N tries at M seconds
       per try, mainly to deal with situations where images are being 
       rendered quickly.  Eventually may be altered to help deal with cases
       where we want to keep re-rendering with changed pipeline states
       until we are happy and then let the simulation return to operation"""
    if PhactoriDbg():
      myDebugPrint3("HandleUserInteractionIfEnabled entered\n")
    if ioPipeAndViewsState.mInteractionEnabled == False:
      return False
  
    if SmartGetLocalProcessId() != 0:
      return False
    #else:
      #do parallel stuff to receive info
  
  
    #check for trigger.  Only update if trigger file is incremented
    doUpdate = False
    triggerTestCount = 0
  
    while doUpdate == False and \
        triggerTestCount < ioPipeAndViewsState.mInteractionTriggerTries:
      if PhactoriDbg():
        myDebugPrint3("testing for trigger: " + str(triggerTestCount) + \
            " of " + str(ioPipeAndViewsState.mInteractionTriggerTries) + "\n")
      triggerTestCount += 1
      try:
        inFile = open('PhactoriInteractionTrigger.txt', 'rb')
        userTrigger = json.load(inFile)
        inFile.close()
        userTrigger = convertJsonUnicodeToStrings(userTrigger)
      except:
        if PhactoriDbg():
          myDebugPrint3("error dealing with PhactoriInteractionTrigger.txt\n")
        return
  
      if 'InteractionTriggerCounter' not in userTrigger:
        if PhactoriDbg():
          myDebugPrint3("no InteractionTriggerCounter in \
              PhactoriInteractionTrigger.txt\n")
      else:
        testTriggerCount = userTrigger['InteractionTriggerCounter']
        if testTriggerCount != ioPipeAndViewsState.mInteractionTriggerCounter:
          ioPipeAndViewsState.mInteractionTriggerCounter = testTriggerCount
          doUpdate = True
  
      if doUpdate == False:
        import time
        time.sleep(ioPipeAndViewsState.mInteractionTriggerSleep)
  
    if doUpdate:
      if PhactoriDbg():
        myDebugPrint3("update triggered, doing update\n")
      UpdatePipeAndViewsStateFromUserA(ioPipeAndViewsState,
          "PhactoriJsonSettings.txt")
      if 'InteractionState' in userTrigger:
        if userTrigger['InteractionState'] == 'RepeatWithPausedSimulation':
          ioPipeAndViewsState.mInteractionRepeatPauseSim = True
        else:
          ioPipeAndViewsState.mInteractionRepeatPauseSim = False
      else:
        ioPipeAndViewsState.mInteractionRepeatPauseSim = False
  
    if PhactoriDbg():
      myDebugPrint3("HandleUserInteractionIfEnabled returning\n")
    return doUpdate
function_tokens: def HandleUserInteractionIfEnabled ( ioPipeAndViewsState ) : if PhactoriDbg ( ) : myDebugPrint3 ( "HandleUserInteractionIfEnabled entered\n" ) if ioPipeAndViewsState . mInteractionEnabled == False : return False if SmartGetLocalProcessId ( ) != 0 : return False #else: #do parallel stuff to receive info #check for trigger.  Only update if trigger file is incremented doUpdate = False triggerTestCount = 0 while doUpdate == False and triggerTestCount < ioPipeAndViewsState . mInteractionTriggerTries : if PhactoriDbg ( ) : myDebugPrint3 ( "testing for trigger: " + str ( triggerTestCount ) + " of " + str ( ioPipeAndViewsState . mInteractionTriggerTries ) + "\n" ) triggerTestCount += 1 try : inFile = open ( 'PhactoriInteractionTrigger.txt' , 'rb' ) userTrigger = json . load ( inFile ) inFile . close ( ) userTrigger = convertJsonUnicodeToStrings ( userTrigger ) except : if PhactoriDbg ( ) : myDebugPrint3 ( "error dealing with PhactoriInteractionTrigger.txt\n" ) return if 'InteractionTriggerCounter' not in userTrigger : if PhactoriDbg ( ) : myDebugPrint3 ( "no InteractionTriggerCounter in \
              PhactoriInteractionTrigger.txt\n" ) else : testTriggerCount = userTrigger [ 'InteractionTriggerCounter' ] if testTriggerCount != ioPipeAndViewsState . mInteractionTriggerCounter : ioPipeAndViewsState . mInteractionTriggerCounter = testTriggerCount doUpdate = True if doUpdate == False : import time time . sleep ( ioPipeAndViewsState . mInteractionTriggerSleep ) if doUpdate : if PhactoriDbg ( ) : myDebugPrint3 ( "update triggered, doing update\n" ) UpdatePipeAndViewsStateFromUserA ( ioPipeAndViewsState , "PhactoriJsonSettings.txt" ) if 'InteractionState' in userTrigger : if userTrigger [ 'InteractionState' ] == 'RepeatWithPausedSimulation' : ioPipeAndViewsState . mInteractionRepeatPauseSim = True else : ioPipeAndViewsState . mInteractionRepeatPauseSim = False else : ioPipeAndViewsState . mInteractionRepeatPauseSim = False if PhactoriDbg ( ) : myDebugPrint3 ( "HandleUserInteractionIfEnabled returning\n" ) return doUpdate