Esempio n. 1
0
void QtMainWindow::SetupMainMenu()
{
    QtMainWindowHandler *actionHandler = QtMainWindowHandler::Instance();

    QAction *actionSceneGraph = ui->dockSceneGraph->toggleViewAction();
    QAction *actionProperties = ui->dockProperties->toggleViewAction();
    QAction *actionLibrary = ui->dockLibrary->toggleViewAction();
	QAction *actionReferences = ui->dockReferences->toggleViewAction();
    QAction *actionToolBar = ui->mainToolBar->toggleViewAction();
    QAction *actionCustomColors = ui->dockCustomColors->toggleViewAction();
	QAction *actionVisibilityCheckTool = ui->dockVisibilityTool->toggleViewAction();
	QAction *actionHangingObjects = ui->dockHangingObjects->toggleViewAction();
	QAction *actionSetSwitchIndex = ui->dockSetSwitchIndex->toggleViewAction();
	QAction *actionParticleEditor = ui->dockParticleEditor->toggleViewAction();
	QAction *actionParticleEditorTimeLine = ui->dockParticleEditorTimeLine->toggleViewAction();
    QAction *actionSceneInfo = ui->dockSceneInfo->toggleViewAction();
	QAction *actionSceneTree = ui->dockSceneTree->toggleViewAction();
	QAction *actionConsole = ui->dockConsole->toggleViewAction();

    ui->menuView->addAction(actionSceneInfo);
    ui->menuView->addAction(actionToolBar);
    ui->menuView->addAction(actionLibrary);
    ui->menuView->addAction(actionProperties);
	ui->menuView->addAction(actionReferences);
    ui->menuView->addAction(actionSceneGraph);
    ui->menuView->addAction(actionCustomColors);
	ui->menuView->addAction(actionVisibilityCheckTool);
	ui->menuView->addAction(actionParticleEditor);
	ui->menuView->addAction(actionParticleEditorTimeLine);
	ui->menuView->addAction(actionHangingObjects);
	ui->menuView->addAction(actionSetSwitchIndex);
	ui->menuView->addAction(actionSceneTree);
	ui->menuView->addAction(actionConsole);

    ui->menuView->insertSeparator(ui->actionRestoreViews);
    ui->menuView->insertSeparator(actionToolBar);
    ui->menuView->insertSeparator(actionProperties);


    actionHandler->RegisterDockActions(ResourceEditor::HIDABLEWIDGET_COUNT,
                                       actionSceneGraph,
                                       actionProperties, actionLibrary, actionToolBar,
									   actionReferences, actionCustomColors, actionVisibilityCheckTool, 
									   actionParticleEditor, actionHangingObjects, actionSetSwitchIndex, actionSceneInfo);


    ui->dockProperties->hide();
    
    
    //CreateNode
    actionHandler->RegisterNodeActions(ResourceEditor::NODE_COUNT,
                                       ui->actionLandscape,
                                       ui->actionLight,
                                       ui->actionServiceNode,
                                       ui->actionCamera,
                                       ui->actionImposter,
                                       ui->actionParticleEmitter,
                                       ui->actionUserNode,
									   ui->actionSwitchNode,
									   ui->actionParticleEffectNode
                                       );
    connect(ui->menuCreateNode, SIGNAL(triggered(QAction *)), actionHandler, SLOT(CreateNodeTriggered(QAction *)));

    
    //TODO: need enable flag in future
    ui->actionHeightMapEditor->setCheckable(false);
    ui->actionTileMapEditor->setCheckable(false);
    //ENDOFTODO
    
    //Viewport
    connect(ui->menuViewPort, SIGNAL(triggered(QAction *)), actionHandler, SLOT(ViewportTriggered(QAction *)));
    actionHandler->RegisterViewportActions(ResourceEditor::VIEWPORT_COUNT,
                                           ui->actionIPhone,
                                           ui->actionRetina,
                                           ui->actionIPad,
                                           ui->actionDefault
                                       );

	//Edit Options
	connect(ui->actionUndo, SIGNAL(triggered()), actionHandler, SLOT(UndoAction()));
	connect(ui->actionRedo, SIGNAL(triggered()), actionHandler, SLOT(RedoAction()));
	actionHandler->RegisterEditActions(ResourceEditor::EDIT_COUNT, ui->actionUndo, ui->actionRedo);

    //View Options
    connect(ui->actionShowNotPassableLandscape, SIGNAL(triggered()), actionHandler, SLOT(ToggleNotPassableTerrain()));

    ui->actionReloadPoverVRIOS->setData(GPU_POWERVR_IOS);
    ui->actionReloadPoverVRAndroid->setData(GPU_POWERVR_ANDROID);
    ui->actionReloadTegra->setData(GPU_TEGRA);
    ui->actionReloadMali->setData(GPU_MALI);
    ui->actionReloadAdreno->setData(GPU_ADRENO);
    ui->actionReloadPNG->setData(GPU_UNKNOWN);
	connect(ui->menuTexturesForGPU, SIGNAL(triggered(QAction *)), actionHandler, SLOT(ReloadMenuTriggered(QAction *)));
    actionHandler->RegisterTextureGPUActions(GPU_FAMILY_COUNT + 1, ui->actionReloadPoverVRIOS, ui->actionReloadPoverVRAndroid,
                                             ui->actionReloadTegra, ui->actionReloadMali, ui->actionReloadAdreno, ui->actionReloadPNG);

	//Modifications Options
	connect(ui->actionModifySelect, SIGNAL(triggered()), actionHandler, SLOT(ModificationSelect()));
	connect(ui->actionModifyMove, SIGNAL(triggered()), actionHandler, SLOT(ModificationMove()));
	connect(ui->actionModifyRotate, SIGNAL(triggered()), actionHandler, SLOT(ModificationRotate()));
	connect(ui->actionModifyScale, SIGNAL(triggered()), actionHandler, SLOT(ModificationScale()));
	connect(ui->actionModifyPlaceOnLandscape, SIGNAL(triggered()), actionHandler, SLOT(ModificationPlaceOnLand()));
	connect(ui->actionModifySnapToLandscape, SIGNAL(triggered()), actionHandler, SLOT(ModificationSnapToLand()));
	connect(ui->actionModifyReset, SIGNAL(triggered()), actionHandler, SLOT(OnResetModification()));

	actionHandler->RegisterModificationActions(ResourceEditor::MODIFY_COUNT,
											   ui->actionModifySelect,
											   ui->actionModifyMove,
											   ui->actionModifyRotate,
											   ui->actionModifyScale,
											   ui->actionModifyPlaceOnLandscape,
											   ui->actionModifySnapToLandscape);

	//Reference
	connect(ui->applyReferenceSuffixButton, SIGNAL(clicked()), this, SLOT(ApplyReferenceNodeSuffix()));
	
	connect(ui->actionAddActionComponent, SIGNAL(triggered()), actionHandler, SLOT(AddActionComponent()));
	connect(ui->actionRemoveActionComponent, SIGNAL(triggered()), actionHandler, SLOT(RemoveActionComponent()));

	connect(ui->actionSetShadowColor, SIGNAL(triggered()), actionHandler, SLOT(SetShadowColor()));

	connect(ui->menuDynamicShadowBlendMode, SIGNAL(aboutToShow()), this, SLOT(MenuDynamicShadowBlendTriggered()));
	connect(ui->actionDynamicBlendModeAlpha, SIGNAL(triggered()), actionHandler, SLOT(SetShadowBlendAlpha()));
	connect(ui->actionDynamicBlendModeMultiply, SIGNAL(triggered()), actionHandler, SLOT(SetShadowBlendMultiply()));

	actionHandler->MenuViewOptionsWillShow();
}
Esempio n. 2
0
bool LandscapeEditorBase::Input(DAVA::UIEvent *touch)
{
	Vector2 point;
	bool isIntersect = GetLandscapePoint(touch->point, point);
    
    point.x = (int32)point.x;
    point.y = (int32)point.y;
    
	landscapePoint = point;
	UpdateCursor();
	
    if(INVALID_TOUCH_ID == touchID || touchID == touch->tid)
    {
        if(UIEvent::BUTTON_1 == touch->tid)
        {
            inverseDrawingEnabled = InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_ALT);
            
            if(UIEvent::PHASE_BEGAN == touch->phase)
            {
                touchID = touch->tid;
                if(isIntersect)
                {
                    prevDrawPos = Vector2(-100, -100);
                    InputAction(touch->phase, isIntersect);
                }
                return true;
            }
            else if(UIEvent::PHASE_DRAG == touch->phase)
            {
                InputAction(touch->phase, isIntersect);
                if(!isIntersect)
                {
                    prevDrawPos = Vector2(-100, -100);
                }
                return true;
            }
            else if(UIEvent::PHASE_ENDED == touch->phase || UIEvent::PHASE_CANCELLED == touch->phase)
            {
                touchID = INVALID_TOUCH_ID;
                
                if(isIntersect)
                {
                    InputAction(touch->phase, isIntersect);
                    prevDrawPos = Vector2(-100, -100);
                }
                return true;
            }
        }
    }
    
    if(UIEvent::PHASE_KEYCHAR == touch->phase)
    {
        if(DVKEY_Z == touch->tid && InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_CTRL))
        {
            UndoAction();
            return true;
        }
        if(DVKEY_Z == touch->tid && InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_SHIFT))
        {
            RedoAction();
            return true;
        }
    }
    
    return false;
}