Ejemplo n.º 1
0
    def initMainToolBar(self, fields):

        from director import viewcolors

        app = fields.app
        toolBar = app.addToolBar('Main Toolbar')
        app.addToolBarAction(toolBar, 'Python Console', ':/images/python_logo.png', callback=app.showPythonConsole)
        toolBar.addSeparator()

        terrainModeAction = fields.app.addToolBarAction(toolBar, 'Camera Free Rotate', ':/images/camera_mode.png')

        lightAction = fields.app.addToolBarAction(toolBar, 'Background Light', ':/images/light_bulb_icon.png')


        app.addToolBarAction(toolBar, 'Reset Camera', ':/images/reset_camera.png', callback=applogic.resetCamera)

        def getFreeCameraMode():
            return not applogic.getCameraTerrainModeEnabled(fields.view)

        def setFreeCameraMode(enabled):
            applogic.setCameraTerrainModeEnabled(fields.view, not enabled)

        terrainToggle = applogic.ActionToggleHelper(terrainModeAction, getFreeCameraMode, setFreeCameraMode)

        viewBackgroundLightHandler = viewcolors.ViewBackgroundLightHandler(fields.viewOptions, fields.gridObj,
                                lightAction)

        return FieldContainer(viewBackgroundLightHandler=viewBackgroundLightHandler, terrainToggle=terrainToggle)
Ejemplo n.º 2
0
        cameraview.imageManager)
    openniDepthPointCloud.addToView(view)
    om.addToObjectModel(openniDepthPointCloud,
                        parentObj=om.findObjectByName('sensors'))

if useGrid:
    grid = vis.showGrid(view, color=[0, 0, 0], alpha=0.1)
    grid.setProperty('Surface Mode', 'Surface with edges')

app.setBackgroundColor([0.3, 0.3, 0.35], [0.95, 0.95, 1])

viewOptions = vis.ViewOptionsItem(view)
om.addToObjectModel(viewOptions, parentObj=om.findObjectByName('sensors'))

viewBackgroundLightHandler = viewcolors.ViewBackgroundLightHandler(
    viewOptions, grid,
    app.getToolsMenuActions()['ActionToggleBackgroundLight'])
if not useLightColorScheme:
    viewBackgroundLightHandler.action.trigger()

if useHands:
    handcontrolpanel.init(lHandDriver, rHandDriver, robotStateModel,
                          robotStateJointController, view)
else:
    app.removeToolbarMacro('ActionHandControlPanel')

if useFootsteps:
    footstepsPanel = footstepsdriverpanel.init(footstepsDriver,
                                               robotStateModel,
                                               robotStateJointController,
                                               irisDriver)