def draw(self, panel=True, slider=True):

        if panel:
            #### Panels ######

            self.Panel = vizinfo.InfoPanel('',
                                           icon=False,
                                           parent=self.canvas,
                                           fontSize=18)  #Define main Panel#
            self.Panel.alpha(.8)  #set transparency
            self.rowBottom = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_CENTER,
                                          background=False,
                                          border=False,
                                          theme=self.blackTheme,
                                          spacing=30)  #Add rows to the panel#
            self.Panel.addSeparator(.8, padding=(10, 10))
            self.Panel.addItem(self.rowBottom)
            self.rowBottom.setTheme(self.blackTheme)
            self.Panel.getPanel().fontSize(22)
            self.Panel.setTheme(self.blackTheme)
            self.Panel.getPanel().font('Times New Roman')
            self.Panel.getPanel().fontSize(12)

        if slider:
            ### SLIDER ######
            self.Slider = self.rowBottom.addItem(viz.addProgressBar("0"))
            self.Slider.font('calibri')
            self.Slider.setScale(4, 2.4)
            self.Slider.message(str('%.2f' % (round(0)))[:1])
            viz.link(viz.CenterBottom, self.Panel, offset=(260, 250, 0))
            self.Slider.visible(viz.OFF)
            return self.Panel, self.rowBottom, self.Slider
        else:
            return self.Panel, self.rowBottom
def participantInfo():

    #Add an InfoPanel with a title bar
    participantInfo = vizinfo.InfoPanel('',
                                        title='Participant Information',
                                        align=viz.ALIGN_CENTER,
                                        icon=False)

    #Add name and ID fields
    textbox_nr = participantInfo.addLabelItem('NR', viz.addTextbox())
    participantInfo.addSeparator()
    textbox_id = participantInfo.addLabelItem('ID', viz.addTextbox())
    participantInfo.addSeparator()

    #Add submit button aligned to the right and wait until it's pressed
    submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'),
                                           align=viz.ALIGN_RIGHT_CENTER)
    yield viztask.waitButtonUp(submitButton)

    #Collect participant data
    exp.pp_nr = "%02d" % (int(textbox_nr.get()), )
    exp.pp_id = textbox_id.get()
    pr.pp_nr = exp.pp_nr
    pr.pp_id = exp.pp_id

    participantInfo.remove()
    def instruction_canvas_vr(self, fov_canvas):
        """
        Sets up a canvas for showing instructions in VR.

        Args:
            fov_canvas: field of view that the canvas should overlay

        """

        self.canvas = viz.addGUICanvas()

        # Reduce canvas FOV from default 50 to 40 ; fov ist wichtig, distance scheint nichts zu tun.
        self.canvas.setRenderWorldOverlay([1280, 720],
                                          fov_canvas,
                                          distance=10.0)
        viz.MainWindow.setDefaultGUICanvas(self.canvas)
        instruction_window = vizinfo.InfoPanel(text='Bitte warten...',
                                               title='Instruktionen',
                                               key=None,
                                               icon=False,
                                               align=viz.ALIGN_CENTER,
                                               fontSize=30,
                                               parent=self.canvas)

        return instruction_window
示例#4
0
def MainTask():
    """Top level task that controls the game"""

    # Display instructions and wait for key press to continue
    yield DisplayInstructionsTask()
    tracker = vizcam.addWalkNavigate(moveScale=2.0)
    tracker.setPosition([0, 2.5, 0])
    viz.link(tracker, viz.MainView)
    viz.mouse.setVisible(False)

    # Create panel to display trial results
    resultPanel = vizinfo.InfoPanel('',
                                    align=viz.ALIGN_CENTER,
                                    fontSize=25,
                                    icon=False,
                                    key=None)
    resultPanel.visible(False)

    # Reset score
    score = 0
    UpdateScore(score)
    sensors()
    found = True
    number = 0

    while found and number < 7:
        # Perform a trial
        found = False
        found = yield TrialTask()

        # Update score and display status text
        if found:
            score += 1
            UpdateScore(score)
            resultPanel.setText(TRIAL_SUCCESS)

        else:
            viztask.schedule(FadeToGrayTask())
            resultPanel.setText(TRIAL_FAIL)
            viz.mouse.setVisible(True)
            Run_function()

        #Display success/failure message
        resultPanel.visible(True)

        # Add delay before starting next trial
        yield viztask.waitTime(TRIAL_DELAY)
        resultPanel.visible(False)
        number += 1

    # Disable gray effect
    gray_effect.setEnabled(False)

    #Display results and ask to quit or play again
    resultPanel.setText(RESULTS.format(score, TRIAL_COUNT))
    resultPanel.visible(True)
    yield viztask.waitTime(5)
    resultPanel.visible(False)
    UpdateScore(10)
示例#5
0
def showMessage(msg):
	"""	Show a message in the virtual environment until keypress """
	
	message = vizinfo.InfoPanel(msg, align=viz.ALIGN_CENTER_CENTER, fontSize=22, icon=False, key=None)
	message.setPosition(.5, .5, mode=viz.RELATIVE)
	#hmd.addWindowMessage(message)
	yield viztask.waitKeyDown(' ')
	message.remove()
 def infoPanel(self, message):
     Panel2 = vizinfo.InfoPanel(message,
                                parent=self.canvas,
                                align=viz.ALIGN_CENTER,
                                fontSize=22,
                                icon=False,
                                title="Finished")
     Panel2.alpha(.8)
示例#7
0
def DisplayInstructionsTask():
    """Task that display instructions and waits for keypress to continue"""
    panel = vizinfo.InfoPanel(INSTRUCTIONS,
                              align=viz.ALIGN_CENTER,
                              fontSize=22,
                              icon=False,
                              key=None)
    yield viztask.waitKeyDown(' ')
    panel.remove()
示例#8
0
def getParticipantInfo():

    #Add an InfoPanel with a title bar
    participantInfo = vizinfo.InfoPanel('',
                                        title='Participant Information',
                                        align=viz.ALIGN_CENTER,
                                        icon=False)

    #Add name and ID fields
    textbox_last = participantInfo.addLabelItem('Last Name', viz.addTextbox())
    textbox_first = participantInfo.addLabelItem('First Name',
                                                 viz.addTextbox())
    textbox_id = participantInfo.addLabelItem('ID', viz.addTextbox())
    participantInfo.addSeparator(padding=(20, 20))

    #Add gender and age fields
    radiobutton_male = participantInfo.addLabelItem('Male',
                                                    viz.addRadioButton(0))
    radiobutton_female = participantInfo.addLabelItem('Female',
                                                      viz.addRadioButton(0))
    droplist_age = participantInfo.addLabelItem('Age Group', viz.addDropList())
    ageList = ['20-30', '31-40', '41-50', '51-60', '61-70']
    droplist_age.addItems(ageList)
    participantInfo.addSeparator(padding=(20, 20))

    #Add 2d 3D fields
    radiobutton_2D = participantInfo.addLabelItem('2D', viz.addRadioButton(1))
    radiobutton_3D = participantInfo.addLabelItem('3D', viz.addRadioButton(1))
    participantInfo.addSeparator(padding=(20, 20))

    #Add submit button aligned to the right and wait until it's pressed
    submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'),
                                           align=viz.ALIGN_RIGHT_CENTER)
    yield viztask.waitButtonUp(submitButton)

    #Collect participant data
    data = viz.Data()
    data.lastName = textbox_last.get()
    data.firstName = textbox_first.get()
    data.id = textbox_id.get()
    data.ageGroup = ageList[droplist_age.getSelection()]

    if radiobutton_male.get() == viz.DOWN:
        data.gender = 'male'
    else:
        data.gender = 'female'

    if radiobutton_2D.get() == viz.DOWN:
        data.environment = '2D'
    else:
        data.environment = '3D'

    participantInfo.remove()

    # Return participant data
    viztask.returnValue(data)
示例#9
0
def finalDemo():
    sky.remove()
    Panel.remove()
    piazza = viz.add('gallery.osgb')
    Panel2 = vizinfo.InfoPanel(
        "You may now take off the headset, Thank you for your participation",
        parent=canvas,
        align=viz.ALIGN_CENTER,
        fontSize=22,
        icon=False,
        title="Finished")
    Panel2.alpha(.8)
    navigationNode = viz.addGroup()
    viewLink = viz.link(navigationNode, viz.MainView)
    viewLink.preMultLinkable(hmd.getSensor())
    viewLink.setOffset([0, 1.8, 0])
    viz.link(viz.CenterBottom, Panel2, offset=(400, 230, 0))
示例#10
0
文件: gem.py 项目: dgo721/averno
 def __init__(self, gem, gempos, escena, sound):
     print "ESCENA-2", escena
     self.gem = viz.addChild(gem, scene=escena)
     self.gem.setScale(2.5, 2.5, 2.5)
     self.gem.setPosition(gempos[0], gempos[1])
     self.sensorGem = vizproximity.addBoundingBoxSensor(self.gem,
                                                        scale=[6, 4, 6])
     self.chimesound = sound
     self.canvas = viz.addGUICanvas()
     self.canvas.alignment(viz.ALIGN_CENTER)
     viz.MainWindow.setDefaultGUICanvas(self.canvas)
     self.info = vizinfo.InfoPanel('AVERNO',
                                   align=viz.ALIGN_RIGHT_TOP,
                                   icon=False)
     self.info.setTitle('Ejemplo')
     self.info.setPanelVisible(False)
     self.canvas.setRenderWorld([600, 500], [3, viz.AUTO_COMPUTE])
     self.canvas.setPosition([
         self.gem.getPosition()[0],
         self.gem.getPosition()[1] + 0.5,
         self.gem.getPosition()[2]
     ])
     self.canvas.setEuler(0, 0, 0)
示例#11
0
### Fade-to-gray-efect , ! Not operationalized in this study !###
gray_effect = BlendEffect(None, GrayscaleEffect(), blend=0.0)
gray_effect.setEnabled(False)
vizfx.postprocess.addEffect(gray_effect)


def FadeToGrayTask():
    gray_effect.setBlend(1)
    gray_effect.setEnabled(True)
    yield viztask.waitCall(gray_effect.setBlend,
                           vizact.mix(viz.BLACK, viz.WHITE, time=1.0))


#### Panels ######
canvas = viz.addGUICanvas()  # Create canvas for display UI to user
Panel = vizinfo.InfoPanel('', icon=False, parent=canvas,
                          fontSize=18)  #Define main Panel#
Panel.alpha(.8)  #set transparency
rowBottom = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_CENTER,
                         background=False,
                         border=False,
                         theme=blackTheme,
                         spacing=30)  #Add rows to the panel#
Panel.addSeparator(.8, padding=(10, 10))
Panel.addItem(rowBottom)
rowBottom.setTheme(blackTheme)
#Panel.getPanel().fontSize(22)
Panel.setTheme(blackTheme)
Panel.getPanel().font('Times New Roman')
Panel.getPanel().fontSize(12)

### SLIDER ######
示例#12
0
import vizshape
import vizinput
import vizinfo
import vizproximity

env = viz.addEnvironmentMap('sky.jpg')
viz.clearcolor(viz.SKYBLUE)

viz.mouse.setScale(100, 2)  # 100x movement speed, 2x rotation speed
viz.move([10, 10, 10])  # i think this sets the starting position to 10,10,10

karnak = viz.addChild('KarnakFBX.fbx')
viz.setMultiSample(4)
viz.go()
vizshape.addAxes()
info = vizinfo.InfoPanel("Let get started")

sensorAvatar1 = vizproximity.Sensor(vizproximity.Box(
    [3170, 160, 3051], center=[3123.10181, 160.43307, -7414.27441]),
                                    source=karnak)
sensorAvatar2 = vizproximity.Sensor(vizproximity.Box(
    [749, 741, 1439], center=[11489.54081, 447.63779, -2581.69801]),
                                    source=karnak)
sensorAvatar3 = vizproximity.Sensor(vizproximity.Box(
    [1400, 422, 1400], center=[3854.15869, 375.59055, -1661.75696]),
                                    source=karnak)
sensorAvatar4 = vizproximity.Sensor(vizproximity.Box(
    [8555, 811, 6949], center=[6046.80322, 334.64569, 189.79089]),
                                    source=karnak)

# Michael's additions
示例#13
0
    def __init__(self, enable=False, hotkey=viz.KEY_F12):
        
        self._enable = enable
        self._hotkey = hotkey
        self._next_screenshot = 1
        self._points = []
        
        # Visualization parameters
        self.GRID_COLOR = [1, 1, 1]
        self.DEBUG_ALPHA = 0.6
        self.LABEL_SCALE = 0.05
        self.VALUE_SCALE = 0.015
        self.MARKER_SIZE = 0.05
        self.HUD_POS = [0.4, 0.3, 1] # Works for Vive / Vive Pro

        # SteamVR devices
        self.hmd = {}
        self.controllers = {}
        self.trackers = {}
        self.lighthouses = {}
        self.nodes = {}

        # Set up scene objects
        self._root = viz.addGroup()
        self._obj = []
        self._obj.append(vizshape.addGrid((100, 100), color=self.GRID_COLOR, pos=[0.0, 0.001, 0.0], parent=self._root))
        self._obj.append(vizshape.addAxes(pos=(0,0,0), scale=(0.5, 0.5, 0.5), parent=self._root))
        
        # Set up possible marker objects
        self._markers = {'sphere_red': vizshape.addSphere(radius=self.MARKER_SIZE / 2, color=viz.RED, parent=self._root),
                         'sphere_green': vizshape.addSphere(radius=self.MARKER_SIZE / 2, color=viz.GREEN, parent=self._root),
                         'sphere_blue': vizshape.addSphere(radius=self.MARKER_SIZE / 2, color=viz.BLUE, parent=self._root),
                         'sphere_yellow': vizshape.addSphere(radius=self.MARKER_SIZE / 2, color=viz.YELLOW, parent=self._root),
                         'cube_red': vizshape.addCube(size=self.MARKER_SIZE, color=viz.RED, parent=self._root),
                         'cube_green': vizshape.addCube(size=self.MARKER_SIZE, color=viz.GREEN, parent=self._root),
                         'cube_blue': vizshape.addCube(size=self.MARKER_SIZE, color=viz.BLUE, parent=self._root),
                         'cube_yellow': vizshape.addCube(size=self.MARKER_SIZE, color=viz.YELLOW, parent=self._root)
        }
        for marker in self._markers.keys():
            self._markers[marker].visible(False)

        # Note: X/Z axis rays moved up (y) by 1 mm to avoid z-fighting with the ground plane
        self._obj.append(addRayPrimitive(origin=[0,0.001,0], direction=[1, 0.001, 0], color=viz.RED, parent=self._root))   # x
        self._obj.append(addRayPrimitive(origin=[0,0.001,0], direction=[0, 0.001, 1], color=viz.BLUE, parent=self._root))  # z
        self._obj.append(addRayPrimitive(origin=[0,0,0], direction=[0, 1, 0], color=viz.GREEN, parent=self._root)) # y
        
        # Set up UI
        txt = 'Hotkeys:\nS - Save collected points data\nC - Clear point data\nL - Toggle Lighthouse rays\nX - Export debug scene\n\n'
        txt += 'Controller Buttons:\nTrigger - place point axes\nA - Save point data\nB - Take screenshot'
        self._ui = vizinfo.InfoPanel(txt, icon=True, align=viz.ALIGN_RIGHT_TOP, title='SteamVR Debug Tool')
        self._ui.renderToEye(viz.RIGHT_EYE)
        self._ui.addSeparator()
        self._obj.append(self._ui)

        # Register key callbacks
        self._callbacks = []
        self._callbacks.append(vizact.onkeydown('s', self.savePoints))
        self._callbacks.append(vizact.onkeydown('c', self.clearPoints))
        self._callbacks.append(vizact.onkeydown('l', self.showLighthouseRays, viz.TOGGLE))
        self._callbacks.append(vizact.onkeydown('x', self.saveDebugScene))

        self.findDevices()
        self.enable(self._enable)
        self._hotkey_callback = vizact.onkeydown(self._hotkey, self.enable, viz.TOGGLE)
        self._ui_callback = vizact.onupdate(viz.PRIORITY_LINKS+1, self._updateUI)
        print('* SteamVR Debug Overlay initialized.')
示例#14
0
viz.go()

# Setup keyboard/mouse tracker
tracker = vizcam.addWalkNavigate(moveScale=2.0)
tracker.setPosition([0, 1.8, 0])
viz.link(tracker, viz.MainView)
viz.mouse.setVisible(False)
viz.collision(viz.ON)

viz.MainView.setPosition([4, 0, 2])
gallery = viz.addChild('gallery.osgb')

#-----------Info panel set up--------------------
import vizinfo
#Add info panel to display messages to participant
instructions = vizinfo.InfoPanel(icon=False, key=None)
#------------------------------------------------

#-----------Sensor creation----------------------
import vizproximity
target = vizproximity.Target(viz.MainView)

viewPath = []
inTime = 0

MainViewApproaches = 0
sensor1 = vizproximity.Sensor(
    vizproximity.RectangleArea([3, 1], center=[-4, 0.375]), None)
sensor2 = vizproximity.Sensor(
    vizproximity.RectangleArea([2.25, 2.25], center=[-4, 2.5]), None)
sensor3 = vizproximity.Sensor(
def participantInfo():
    #Add an InfoPanel with a title bar
    participantInfo = vizinfo.InfoPanel('',
                                        title='Participant Information',
                                        align=viz.ALIGN_CENTER,
                                        icon=False)

    #Add ID field
    textbox_id = participantInfo.addLabelItem('ID', viz.addTextbox())
    participantInfo.addSeparator(padding=(10, 10))

    #Add eye height field
    textbox_EH = participantInfo.addLabelItem('Eye Height (m)',
                                              viz.addTextbox())
    participantInfo.addSeparator(padding=(10, 10))

    #Add age field
    textbox_age = participantInfo.addLabelItem('Age', viz.addTextbox())
    participantInfo.addSeparator(padding=(10, 10))

    #Add gender field
    radiobutton_male = participantInfo.addLabelItem('Male',
                                                    viz.addRadioButton(0))
    radiobutton_female = participantInfo.addLabelItem('Female',
                                                      viz.addRadioButton(0))
    radiobutton_other = participantInfo.addLabelItem('Non-Binary',
                                                     viz.addRadioButton(0))
    participantInfo.addSeparator()

    #Add units field
    radiobutton_feet = participantInfo.addLabelItem('Feet',
                                                    viz.addRadioButton(1))
    radiobutton_meters = participantInfo.addLabelItem('Meters',
                                                      viz.addRadioButton(1))
    participantInfo.addSeparator()

    #Add submit button aligned to the right and wait until it's pressed
    submitButton = participantInfo.addItem(viz.addButtonLabel('Submit'),
                                           align=viz.ALIGN_RIGHT_CENTER)
    yield viztask.waitButtonUp(submitButton)

    #Collect participant data
    global data
    data = viz.Data()
    data_id = textbox_id.get()
    data_EH = textbox_EH.get()
    data_age = textbox_age.get()

    if radiobutton_male.get() == viz.DOWN:
        data.gender = 'm'
    elif radiobutton_female.get() == viz.DOWN:
        data.gender = 'f'
    else:
        data.gender = 'nb'

    if radiobutton_feet.get() == viz.DOWN:
        data.units = 'ft'
    else:
        data.units = 'm'

    participantInfo.remove()

    global IDNum
    IDNum = int(data_id)
    print IDNum
    global age
    age = float(data_age)
    global EHNum
    EHNum = float(data_EH)
    print age
    print EHNum
    print data.gender
    print data.units
示例#16
0
import viz
import vizshape
import time
import mmserver
import vizinfo

print "Time in seconds since the epoch: %s" % time.time()

viz.go()

grid = vizshape.addGrid()
panel1 = vizinfo.InfoPanel("""This is a test of the info panel""",
                           align=viz.ALIGN_CENTER,
                           fontSize=50,
                           icon=False,
                           key=None)

#time.sleep(3)

#viz.visible(0)
    def participant_info():
        """
        Query the participant for basic data.

        Questions to select experimental condition and control type of the experimental condition.

        Returns: the queried data as a viz.data object

        """

        participant_info = vizinfo.InfoPanel('', title='Participant Information', align=viz.ALIGN_CENTER, icon=False)

        # query control style droplist; Create a drop-down list
        drop_control_style = participant_info.addLabelItem('Choose control style', viz.addDropList())
        items = ['dk2 head & right hand', 'mouse and keyboard'] # 'mouse and keyboard', 'joystick', 'dk2 head only', 'dk2 head wiimote',
        drop_control_style.addItems(items)

        # Add name and ID fields of maze configurations
        drop_maze_config = participant_info.addLabelItem('Choose maze configuration', viz.addDropList())
        items2 = ['auto', 'baseline', 'training', 'I', 'L', 'Z', 'U']#, 'T', '+']  # Add a list of items.
        drop_maze_config.addItems(items2)

        # Add name and ID fields of experimental condition
        drop_maze_run = participant_info.addLabelItem('Choose maze run', viz.addDropList())
        items2 = ['auto', '1', '2', '3']
        drop_maze_run.addItems(items2)

        participant_info.addSeparator(padding=(10, 10))

        textbox_id = participant_info.addLabelItem('ID', viz.addTextbox())
        textbox_age = participant_info.addLabelItem('Age', viz.addTextbox())
        textbox_handedness = participant_info.addLabelItem('Handedness', viz.addTextbox())
        textbox_vision = participant_info.addLabelItem('Vision', viz.addTextbox())
        textbox_cap_size = participant_info.addLabelItem('Cap size', viz.addTextbox())
        textbox_neck_size = participant_info.addLabelItem('Neck size', viz.addTextbox())
        textbox_labelscheme = participant_info.addLabelItem('Electrode Labelscheme', viz.addTextbox())

        participant_info.addSeparator(padding=(10, 10))

        # Add gender and age fields
        radiobutton_male = participant_info.addLabelItem('Male', viz.addRadioButton(2))
        radiobutton_female = participant_info.addLabelItem('Female', viz.addRadioButton(2))

        participant_info.addSeparator(padding=(10, 10))

        # Add submit button aligned to the right and wait until it's pressed
        submit_button = participant_info.addItem(viz.addButtonLabel('Submit'), align=viz.ALIGN_CENTER)
        yield viztask.waitButtonUp(submit_button)

        # Collect participant data
        data = viz.Data()
        data.id = textbox_id.get()
        data.age = textbox_age.get()
        data.handedness = textbox_handedness.get()
        data.vision = textbox_vision.get()
        data.cap_size = textbox_cap_size.get()
        data.neck_size = textbox_neck_size.get()
        data.labelscheme = textbox_labelscheme.get()

        if radiobutton_male.get() == viz.DOWN:
            data.sex = 'male'
        else:
            data.sex = 'female'

        # Find the index of the current selection. Find the selection itself.
        data.control_style = drop_control_style.getItems()[drop_control_style.getSelection()]
        data.maze_config = drop_maze_config.getItems()[drop_maze_config.getSelection()]
        data.maze_run = drop_maze_run.getItems()[drop_maze_run.getSelection()]

        participant_info.remove()

        # Return participant data
        viztask.returnValue(data)
示例#18
0
ground.collidePlane(bounce = 0, friction = 0.01)   # Make collideable plane 

#get table for experiment
table = viz.addChild( 'table.wrl' )
table.setPosition([9,0.5,15])
table.collideBox( node='Leg1', bounce = 0, friction = 1 )
table.collideBox( node='Leg2', bounce = 0, friction = 1 )
table.collideBox( node='Leg3', bounce = 0, friction = 1 )
table.collideBox( node='Leg4', bounce = 0, friction = 1 )
table.collideBox( node='Top', bounce = 0, friction = 0 )
viz.phys.enable()

#set up UI

import vizinfo
info = vizinfo.InfoPanel('R: ready, Space: start, A: reset',title='setting') 
title = viz.addText3D('Drop  Jump  Simulator',pos=[12.4,3.4,18], euler=[90,0,0])
title.scale([0.58,0.58,0.58])
title.font('Comic Sans MS')
startmenu = viz.addText3D('Please keep surrounding clear.\n\n  Make sure you are standing\n near the center of the platform.\n\n Press R when get ready!',pos=[12.4,2.5,18], euler=[90,0,0])
startmenu.scale([0.4,0.4,0.4])
startmenu.font('Comic Sans MS')
text3D = viz.addText(' Ready',pos=[13.8,1.4,16], euler=[90,0,0])
text3D.font('Calibri')

#set up the Avatar
experimenter = viz.addAvatar('vcc_female.cfg')
head = experimenter.getBone('Bip01 Head')
cameraPoint = experimenter.getBone('Bip01 Spine1')
neck = experimenter.getBone('Bip01 Neck')
global calfR, calfL
示例#19
0
TERMINATED_THEME = viz.Theme()
TERMINATED_THEME.backColor = viz.YELLOW_ORANGE
TERMINATED_THEME.borderColor = viz.RED
TERMINATED_THEME.textColor = viz.BLUE
TERMINATED_THEME.inactiveTextColor = viz.BLUE

RUNNING_THEME = viz.Theme()
RUNNING_THEME.backColor = viz.GREEN
RUNNING_THEME.borderColor = viz.RED
RUNNING_THEME.textColor = viz.BLACK
RUNNING_THEME.inactiveTextColor = viz.BLUE

viz.go(viz.FULLSCREEN)

bigform = vizinfo.InfoPanel()
viz.clearcolor(viz.SLATE)
#create main RAM FORM
RAMFORM = vizinfo.InfoPanel(text='',
                            title="PROCESS QUEUE(RAM)",
                            align=viz.ALIGN_LEFT_TOP,
                            icon=False,
                            window=viz.MainWindow)
RAMFORM.alpha(0)
RAMFORM.getTitleBar().alpha(1)

#GUI QUEUE OF PROCESSES
tenprocessesbox = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_TOP,
                               margin=False,
                               border=False,
                               spacing=1)
示例#20
0
import json
import vizact
import struct
import array
import math

viz.splashScreen(
    'C:\Users\Gelsey Torres-Oviedo\Desktop\VizardFolderVRServer\Logo_final.jpg'
)
viz.go(viz.FULLSCREEN  #run world in full screen
       )
time.sleep(2)  #show off our cool logo, not really required but cool
global messagewin
messagewin = vizinfo.InfoPanel('',
                               align=viz.ALIGN_CENTER_TOP,
                               fontSize=60,
                               icon=False,
                               key=None)

#messagewin.visible(0)
#set target tolerance for stride length
global targetXl
targetXl = 0.50646
global targetXr
targetXr = 0.54477
global targetUl
targetUl = 0.50646
global targetUr
targetUr = 0.54477

global targettol
示例#21
0
import viz
import viztask
import vizact
import vizinfo
import vizproximity
import vizshape

info = vizinfo.InfoPanel("")
info.visible(viz.OFF)

示例#22
0
import viz
import vizinfo
import vizinput

from config import *
#from projectFunctions import *

viz.go()

phase = 1
endPhase = 10

currentPhase = "Phase " + str(phase)
command = ""

instructionPanel = vizinfo.InfoPanel(currentPhase, fontSize=40)
separator = instructionPanel.addSeparator()
additionalInfo = instructionPanel.addLabelItem(command, viz.addText(""))
additionalInfo.label.color(viz.BLUE)


def nextPhase(phaseCommand):
    global testPhase, currentPhase, endPhase, instructionPanel, additionalInfo, separator
    testPhase = testPhase + 1
    if testPhase > endPhase:
        testPhase = 0
    currentPhase = "Phase " + str(testPhase)
    instructionPanel.setText(currentPhase)
    #additionalInfo.setText(phaseCommand);

    instructionPanel.removeItem(additionalInfo)
示例#23
0
#Escenario1
mine = viz.addChild(model['mundo1'], scene = viz.Scene1)
gem = viz.addChild(item['gem'], scene = viz.Scene1)
gem.setScale(2.5,2.5,2.5)
gem.setPosition(10,5)
btn_regresa = viz.addButtonLabel("regresar", scene = viz.Scene1)
btn_regresa.setPosition(0.9,0.1)

rock = viz.addChild(item['gem'], scene = viz.Scene1)
rock.setScale(2.5,2.5,2.5)
rock.setPosition(-30,4)

canvas = viz.addGUICanvas()
canvas.alignment(viz.ALIGN_CENTER)
viz.MainWindow.setDefaultGUICanvas(canvas)
info = vizinfo.InfoPanel('AVERNO', align=viz.ALIGN_RIGHT_TOP, icon=False)
info.setTitle( 'Ejemplo' )
info.setPanelVisible(False)
#canvas.setRenderWorldOverlay([600,500],50,3)
canvas.setRenderWorld([600,500],[3,viz.AUTO_COMPUTE])
canvas.setPosition([-30,5,2])
canvas.setEuler(0,0,0)

vizact.onbuttonup(btn_regresa, returntoMenu)

#################################################################
#################################################################

#Escenario2
mine2 = viz.addChild(model['mundo2'], scene = viz.Scene2)
gem2 = viz.addChild(item['gem'], scene = viz.Scene2)
示例#24
0
viz.MainWindow.clearcolor([0, 0, 150])

# allows mouse to rotate, translate, and zoom in/out on object
pivotNav = vizcam.PivotNavigate()

viz.phys.enable()

c = Alley()

import viz
import vizmat

viz.go()

import vizinfo
vizinfo.InfoPanel()

#Declare some constants
GRID_WIDTH = 6
GRID_HEIGHT = 6
SPACING = 1.1
MAX_BALLS = 20
MIN_POWER = 5
MAX_POWER = 10

#We need to enable physics
viz.phys.enable()

balls = []

for x in range(MAX_BALLS):
示例#25
0
"""  
Left mouse button draws.  
Right mouse button clears the drawing.  
Middle mouse button changes color.  
Mouse movements control viewpoint orientation.  
Arrow Keys control viewpoint position.  
"""

import viz
import vizshape
import vizinfo

vizinfo.InfoPanel(align=viz.ALIGN_LEFT_BOTTOM)

viz.setMultiSample(4)
viz.fov(60)
viz.go()

piazza = viz.add('piazza.osgb')
arrow = vizshape.addArrow(length=0.2, color=viz.RED)

from tools import pencil

tool = pencil.Pencil()


# update code for pencil
def update(tool):

    state = viz.mouse.getState()
    if state & viz.MOUSEBUTTON_LEFT:
示例#26
0
import viztask
import vizshape
import viznet
import vizinfo
import time

#viz.window.setFullscreenMonitor(2)
viz.go()
view = viz.MainView
view.setPosition([0, 10, 3.5])
view.setEuler(45, 90, 0)

myNetwork = viz.addNetwork('Simon-Dell')
VRPNhost = 'SimonR-PC'

info = vizinfo.InfoPanel('monitoring', align=viz.ALIGN_CENTER, icon=False)

# Setup VRPN
vrpn = viz.add('vrpn7.dle')
head = vrpn.addTracker('Tracker0@' + VRPNhost, 9)
body = vrpn.addTracker('Tracker0@' + VRPNhost, 10)
tracker = vrpn.addTracker('Tracker0@' + VRPNhost, 4)
head.swapPos([1, 2, -3])
head.swapQuat([-1, -2, 3, 4])
body.swapPos([1, 2, -3])
body.swapQuat([-1, -2, 3, 4])

ground = viz.add('ground.osgb')
target_1 = vizshape.addCylinder(height=3, radius=0.02)
target_1.color(viz.RED)
target_1.setPosition([0, 0, 0])
import vizhtml

viz.go()
viz.cam.setHandler(vizcam.KeyboardCamera())
viz.phys.enable()
viz.MainView.setPosition(-4, 1, -3)
viz.MainView.setEuler(30, 0, 0)

ground = viz.add('tut_ground.wrl')
viz.clearcolor([.5, .6, 1])
lab = viz.add('Living_Lab_Blinds_V2.OSGB', scale=[0.002] * 3)
lab.setPosition([0, 0.258, 5])

#Pagina de test: http://localhost:8080/vizhtml/custom_handler/
# Display form submitted message on screen
info = vizinfo.InfoPanel('')

code = """
<html>
<head>
    <title>vizhtml Custom Handler Example</title>
</head>
<body onload="document.the_form.message.focus();">
<img src='ball.jpg'>
<form name="the_form" method="post">
    <table>
        <tr>
            <td>Frame Number:</td>
            <td>{frame}</td>
        </tr>
        <tr>
示例#28
0
    def __init__(self, mTitle = ''):
                
        # add info panel
        self.panel = vizinfo.InfoPanel('')
        self.panel.visible(viz.OFF)
        
        self.themes  = {}
        
        # add separator
        self.panel.addSeparator()
        
        # used for distance tracking
        self.lastPos            = None
        self.distTravelled      = 0
        
        # set standard panel theme
        stdTh = viz.Theme()
        stdTh.borderColor       = ( 0.0, 0.5, 0.0 )
        stdTh.backColor         = ( 1.0, 1.0, 1.0 )
        stdTh.highBackColor     = ( 0.5, 0.5, 0.5 )
        stdTh.highTextColor     = ( 0.0, 0.0, 0.0 )
        stdTh.textColor         = ( 0.0, 0.0, 0.0 )
        self.themes["standard"] = stdTh
                               
        # start with green theme
        self.panel.getPanel().setTheme(self.themes["standard"])
        
        # add text
        self.line1 = self.panel.addItem(viz.addText(' '))
        self.line1.setEncoding(viz.ENCODING_UTF8)
        
        self.line2 = self.panel.addItem(viz.addText(' '))
        self.line2.setEncoding(viz.ENCODING_UTF8)
        
        # add progress bar to show time elapsing for current order
        # add separator
        self.panel.addSeparator()
        self.progBar       = self.panel.addItem(viz.addProgressBar(''))
        self.progBar.scale(0,0)
        self.progBar.visible(viz.OFF)
        self.progBarEvtHdl = None # handle to progress bar update event
        self.tEst          = None # estimated time to get parcel
        
        self.line3 = self.panel.addItem(viz.addText(' '))
        self.line3.setEncoding(viz.ENCODING_UTF8)
                
        # get icon images
        self.iconTxs = {}
        iconFiles    = glob.glob( os.path.join(ct.PATH_TO_ICONS, '*.jpg') ) # each folder corresponds to one character
        p = re.compile(r"_[a-z]*\d_") # e.g. look for .*_bakery1_.*
        for cTex in iconFiles:
            m    = p.search(cTex)
            iKey = cTex[m.span(0)[0]+1 : m.span(0)[1]-1] # take only bakery1 as key
            self.iconTxs[iKey] = viz.addTexture(cTex)
    
        # add quad
        self.texQuad = viz.addTexQuad(size=0)
        self.qNode   = self.panel.addItem(self.texQuad) # add quad to panel
        #self.qNode   = self.panel.addItem('Delivery Target', self.texQuad) # add quad to panel        
         
                
        # add right panel
        self.panel2 = vizinfo.InfoPanel('', align=viz.ALIGN_RIGHT_TOP)
        self.panel2.visible(viz.OFF)

        # start with green theme
        self.panel2.getPanel().setTheme(self.themes["standard"])

        # add text to right panel
        self.line1r   = self.panel2.addItem(viz.addText(' '))
        self.line1r.setEncoding(viz.ENCODING_UTF8)
        self.texQuadR = viz.addTexQuad(size=0)
        self.qNodeR   = self.panel2.addItem(self.texQuadR) # add quad to panel