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
Пример #2
0
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
Пример #6
0
def init():
    """Code for one time initialization routine."""
    # add grabber tools based on proxy tools
    for proxyWrapper in vizconnect.getToolsWithMode('Proxy'):
        grabberTool = tools.grabber.HandGrabber(
            usingPhysics=False,
            usingSprings=False,
            placementMode=tools.placer.MODE_DROP_DOWN)

        name = 'grabber_tool_based_on_' + proxyWrapper.getName()
        grabberWrapper = vizconnect.addTool(raw=grabberTool,
                                            name=name,
                                            make='Virtual',
                                            model='Grabber')
        # parent the grabber wrapper to the proxy's parent
        grabberWrapper.setParent(proxyWrapper)

        grabberTool.setItems(grabbableItems)

    viz.callback(viz.getEventID('RESET_THE_LOFT_LAYOUT'),
                 lambda e: resetMovedObjects())
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
Пример #9
0
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