def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'grabber' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag&vizconnect.INIT_PREVIZGO: viz.setOption('viz.display.stencil',1) #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools from tools import grabber from tools import highlighter #VC: set some parameters usingPhysics = False highlightMode = tools.highlighter.MODE_OUTLINE placementMode = tools.placer.MODE_MID_AIR #VC: create the raw object rawTool[_name] = grabber.Grabber(usingPhysics=usingPhysics, usingSprings=usingPhysics, highlightMode=highlightMode, placementMode=placementMode, updatePriority=vizconnect.PRIORITY_ANIMATOR+3) #VC: init the mappings for the raw object if initFlag&vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag&vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['mouse_buttons'].getState()&viz.MOUSEBUTTON_LEFT:# make=Generic, model=Mouse Buttons, name=mouse_buttons, signal=Left Mouse Button tool.grabAndHold() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Grabber') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent(vizconnect.getAvatar('head_and_hand').getAttachmentPoint('r_hand')) #VC: return values can be modified here return None
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'grabber' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag&vizconnect.INIT_PREVIZGO: viz.setOption('viz.display.stencil',1) #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools from tools import grabber from tools import highlighter #VC: set some parameters usingPhysics = False highlightMode = tools.highlighter.MODE_OUTLINE placementMode = tools.placer.MODE_MID_AIR #VC: create the raw object rawTool[_name] = grabber.Grabber(usingPhysics=usingPhysics, usingSprings=usingPhysics, highlightMode=highlightMode, placementMode=placementMode, updatePriority=vizconnect.PRIORITY_ANIMATOR+3) #VC: init the mappings for the raw object if initFlag&vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag&vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['r_hand_input'].getState()&viz.MOUSEBUTTON_LEFT:# make=Generic, model=Mouse Buttons, name=r_hand_input, signal=Left Mouse Button tool.grabAndHold() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Grabber') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent(vizconnect.getAvatar('main_avatar').getAttachmentPoint('r_hand')) #VC: return values can be modified here return None
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'grabber' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.display.stencil', 1) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools from tools import grabber from tools import highlighter #VC: set some parameters usingPhysics = True highlightMode = tools.highlighter.MODE_OUTLINE placementMode = tools.placer.MODE_MID_AIR #VC: create the raw object rawTool[_name] = grabber.Grabber( usingPhysics=usingPhysics, usingSprings=usingPhysics, highlightMode=highlightMode, placementMode=placementMode, updatePriority=vizconnect.PRIORITY_ANIMATOR + 3) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Grabber') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getAvatar('main_avatar').getAttachmentPoint( 'r_hand')) #VC: return values can be modified here return None
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'proxy' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: create the raw object from tools import proxy rawTool[_name] = proxy.Proxy() #VC: init the mappings for the raw object if initFlag & vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['flystick_buttons'].isButtonDown( 0 ): # make=Generic, model=VRPN Buttons, name=flystick_buttons, signal=Button 0 tool.action1() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Proxy') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'r_hand')) #VC: return values can be modified here return None
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'proxy' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: create the raw object from tools import proxy rawTool[_name] = proxy.Proxy() #VC: init the mappings for the raw object if initFlag&vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag&vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['r_hand_input'].getState()&viz.MOUSEBUTTON_LEFT:# make=Generic, model=Mouse Buttons, name=r_hand_input, signal=Left Mouse Button tool.action1() if rawInput['r_hand_input'].getState()&viz.MOUSEBUTTON_RIGHT:# make=Generic, model=Mouse Buttons, name=r_hand_input, signal=Right Mouse Button tool.action2() if rawInput['r_hand_input'].getState()&viz.MOUSEBUTTON_MIDDLE:# make=Generic, model=Mouse Buttons, name=r_hand_input, signal=Middle Mouse Button tool.action3() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Proxy') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent(vizconnect.getAvatar('main_avatar').getAttachmentPoint('r_hand')) #VC: set the name of the default vizconnect.setDefault('tool', 'proxy') #VC: return values can be modified here return None
def show(): """Function used to add/show/enable non vizard resources. This is necessary to supply context switching between multiple, demos or scripts. """ for proxyWrapper in vizconnect.getToolsWithMode('Proxy'): grabberTool = vizconnect.getTool('grabber_tool_based_on_' + proxyWrapper.getName()).getRaw() # for proxies: set obj, function, action index proxyWrapper.getRaw().setCallback(grabberTool, grabberTool.grabAndHold, 1) vp.add(vizconnect.getDisplay()) resetMovedObjects(playAudio=False)
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'grabber' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.display.stencil', 1) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools from tools import grabber from tools import highlighter #VC: set some parameters usingPhysics = True highlightMode = tools.highlighter.MODE_OUTLINE placementMode = tools.placer.MODE_MID_AIR #VC: create the raw object rawTool[_name] = grabber.Grabber( usingPhysics=usingPhysics, usingSprings=usingPhysics, highlightMode=highlightMode, placementMode=placementMode, updatePriority=vizconnect.PRIORITY_ANIMATOR + 3) #VC: init the mappings for the raw object if initFlag & vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['flystick'].isButtonDown( 0 ): # make=ART, model=Flystick, name=flystick, signal=Button 0 tool.grabAndHold() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Grabber') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'r_hand')) #VC: initialize a new tool _name = 'laser_pointer' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set some parameters displayDistance = True #VC: create the raw object from tools import laser_pointer rawTool[_name] = laser_pointer.LaserPointer( displayDistance=displayDistance, updatePriority=vizconnect.PRIORITY_ANIMATOR + 3) #VC: init the mappings for the raw object if initFlag & vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['flystick'].isButtonDown( 5 ): # make=ART, model=Flystick, name=flystick, signal=Button 5 tool.shoot() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Laser Pointer') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'r_hand')) #VC: set the name of the default vizconnect.setDefault('tool', 'grabber') #VC: return values can be modified here return None
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'proxy' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: create the raw object from tools import proxy rawTool[_name] = proxy.Proxy() #VC: init the mappings for the raw object if initFlag & vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals def update(tool): if rawInput['flystick'].isButtonDown( 0 ): # make=ART, model=Flystick, name=flystick, signal=Button 0 tool.action1() if rawInput['flystick'].isButtonDown( 1 ): # make=ART, model=Flystick, name=flystick, signal=Button 1 tool.action2() if rawInput['flystick'].isButtonDown( 2 ): # make=ART, model=Flystick, name=flystick, signal=Button 2 tool.action3() if rawInput['flystick'].isButtonDown( 3 ): # make=ART, model=Flystick, name=flystick, signal=Button 3 tool.action4() if rawInput['flystick'].isButtonDown( 4 ): # make=ART, model=Flystick, name=flystick, signal=Button 4 tool.action5() if rawInput['flystick'].isButtonDown( 5 ): # make=ART, model=Flystick, name=flystick, signal=Button 5 tool.action() rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Proxy') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'r_hand')) #VC: initialize a new tool _name = 'laser_pointer' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools.laser_pointer #VC: set some parameters displayDistance = True showEndNode = True distanceMetric = tools.laser_pointer.DISTANCE_METERS #VC: create the raw object endNode = None if showEndNode else viz.addGroup() rawTool[_name] = tools.laser_pointer.LaserPointer( displayDistance=displayDistance, updatePriority=vizconnect.PRIORITY_ANIMATOR + 3, endNode=endNode, distanceMetric=distanceMetric) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Laser Pointer') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'l_hand')) #VC: set the name of the default vizconnect.setDefault('tool', 'proxy') #VC: return values can be modified here return None
def initTools(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawTool = vizconnect.getRawToolDict() #VC: initialize a new tool _name = 'grabber' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.display.stencil', 1) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools from tools import grabber from tools import highlighter #VC: set some parameters usingPhysics = False highlightMode = tools.highlighter.MODE_OUTLINE placementMode = tools.placer.MODE_MID_AIR #VC: create the raw object rawTool[_name] = grabber.Grabber( usingPhysics=usingPhysics, usingSprings=usingPhysics, highlightMode=highlightMode, placementMode=placementMode, updatePriority=vizconnect.PRIORITY_ANIMATOR + 3) #VC: init the mappings for the raw object if initFlag & vizconnect.INIT_MAPPINGS: #VC: per frame mappings if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME: #VC: get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: set the update function which checks for input signals #def update(tool): #if rawInput['joystick'].isInMode('super') and rawInput['joystick'].isButtonDown(4):# make=Generic, model=Joystick, name=joystick, signal=Button 4 #tool.grab() #rawTool[_name].setUpdateFunction(update) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Grabber') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getTool(_name).setParent( vizconnect.getTracker('ppt_rhand')) #VC: initialize a new tool _name = 'grabber2' if vizconnect.isPendingInit('tool', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.display.stencil', 1) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: initialization code needed by the parameters import tools from tools import grabber from tools import highlighter #VC: set some parameters usingPhysics = True highlightMode = tools.highlighter.MODE_OUTLINE placementMode = tools.placer.MODE_MID_AIR #VC: create the raw object rawTool[_name] = grabber.Grabber( usingPhysics=usingPhysics, usingSprings=usingPhysics, highlightMode=highlightMode, placementMode=placementMode, updatePriority=vizconnect.PRIORITY_ANIMATOR + 3) #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addTool(rawTool[_name], _name, make='Virtual', model='Grabber') #VC: set the name of the default vizconnect.setDefault('tool', 'grabber') #VC: return values can be modified here return None