#NEWLINE# def toggleFootstepWidget( displayPoint , view , useHorizontalWidget = False ) : #NEWLINE# #INDENT# ( obj , _ ) = vis . findPickedObject ( displayPoint , view ) #NEWLINE# if ( not obj ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# name = obj . getProperty ( 'Name' ) #NEWLINE# if ( name in ( 'footstep widget' , 'footstep widget frame' ) ) : #NEWLINE# #INDENT# om . removeFromObjectModel ( om . findObjectByName ( 'footstep widget' ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# match = re . match ( '^step (\\d+)$' , name ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# stepIndex = int ( match . group ( 1 ) ) #NEWLINE# existingWidget = om . findObjectByName ( 'footstep widget' ) #NEWLINE# if existingWidget : #NEWLINE# #INDENT# previousStep = existingWidget . stepIndex #NEWLINE# om . removeFromObjectModel ( existingWidget ) #NEWLINE# if ( previousStep == stepIndex ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# footMesh = shallowCopy ( obj . polyData ) #NEWLINE# footFrame = transformUtils . copyFrame ( obj . getChildFrame ( ) . transform ) #NEWLINE# if useHorizontalWidget : #NEWLINE# #INDENT# rpy = [ 0.0 , 0.0 , transformUtils . rollPitchYawFromTransform ( footFrame ) [ 2 ] ] #NEWLINE# footFrame = transformUtils . frameFromPositionAndRPY ( footFrame . GetPosition ( ) , np . degrees ( rpy ) ) #NEWLINE# #UNINDENT# footObj = vis . showPolyData ( footMesh , 'footstep widget' , parent = 'planning' , alpha = 0.2 ) #NEWLINE# footObj . stepIndex = stepIndex #NEWLINE# frameObj = vis . showFrame ( onFootWidgetChanged , 'footstep widget frame' , parent = footObj , scale = 0.2 ) #NEWLINE# footObj . actor . SetUserTransform ( frameObj . transform ) #NEWLINE# footObj . setProperty ( 'Color' , obj . getProperty ( 'Color' ) ) #NEWLINE# frameObj . setProperty ( 'Edit' , True ) #NEWLINE# rep = frameObj . widget . GetRepresentation ( ) #NEWLINE# rep . SetTranslateAxisEnabled ( 2 , False ) #NEWLINE# rep . SetRotateAxisEnabled ( 0 , False ) #NEWLINE# rep . SetRotateAxisEnabled ( 1 , False ) #NEWLINE# frameObj . widget . HandleRotationEnabledOff ( ) #NEWLINE# walkGoal = om . findObjectByName ( 'walking goal' ) #NEWLINE# if walkGoal : #NEWLINE# #INDENT# walkGoal . setProperty ( 'Edit' , False ) #NEWLINE# #UNINDENT# def onFootWidgetChanged( frame ) : #NEWLINE# #INDENT# footstepsDriver . onStepModified ( ( stepIndex - 1 ) , frame ) #NEWLINE# #UNINDENT# frameObj . connectFrameModified ( onFootWidgetChanged ) #NEWLINE# return True