void SceneEditorScreenMain::Input(DAVA::UIEvent *event)
{
    if(UIEvent::PHASE_KEYCHAR == event->phase)
    {
        if(IsKeyModificatorPressed(DVKEY_ALT))
        {
            int32 key = event->tid - DVKEY_1;
            if(0 <= key && key < 8)
            {
                BodyItem *iBody = FindCurrentBody();
                Entity *node = iBody->bodyControl->GetSelectedSGNode();
                EditorScene *editorScene = iBody->bodyControl->GetScene();
                editorScene->SetForceLodLayer(node, key);
            }
            else if(DVKEY_0 == event->tid)
            {
                EditorSettings::Instance()->Save();
            }
        }
        
        
        //ckecking help
        UITextField *tf = dynamic_cast<UITextField *>(UIControlSystem::Instance()->GetFocusedControl());
        UITextField *tf1 = dynamic_cast<UITextField *>(focusedControl);
        if(!tf && !tf1)
        {
            if((DVKEY_F1 == event->tid) || (DVKEY_H == event->tid))
            {
                if(helpDialog->GetParent())
                {
                    helpDialog->Close();
                }
                else
                {
                    helpDialog->Show();
                }
            }
            
            if(DVKEY_ESCAPE == event->tid)
            {
                if(materialEditor && materialEditor->GetParent())
                {
                    MaterialsTriggered();
                }
            }

        }
    }
}
Exemple #2
0
void SceneEditorScreenMain::Input(DAVA::UIEvent *event)
{
    if(UIEvent::PHASE_KEYCHAR == event->phase)
    {
        bool altIsPressed = InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_ALT);
        if(altIsPressed)
        {
            int32 key = event->tid - DVKEY_1;
            if(0 <= key && key < 8)
            {
                BodyItem *iBody = FindCurrentBody();
                SceneNode *node = iBody->bodyControl->GetSelectedSGNode();
                EditorScene *editorScene = iBody->bodyControl->GetScene();
                editorScene->SetForceLodLayer(node, key);
            }
            else if(DVKEY_0 == event->tid)
            {
//                for(int32 i = 0; i < bodies.size(); ++i)
//                {
//                    EditorScene *scene = bodies[i]->bodyControl->GetScene();
//                    scene->SetForceLodLayer(-1);
//                }
//                EditorSettings::Instance()->SetForceLodLayer(-1);
                EditorSettings::Instance()->Save();
            }
        }
        
        //ckecking help
        if (event->phase == UIEvent::PHASE_KEYCHAR)
        {
            UITextField *tf = dynamic_cast<UITextField *>(UIControlSystem::Instance()->GetFocusedControl());
            if(!tf)
            {
                if((DVKEY_F1 == event->tid) || (DVKEY_H == event->tid))
                {
                    if(helpDialog->GetParent())
                    {
                        helpDialog->Close();
                    }
                    else 
                    {
                        helpDialog->Show();
                    }
                }
            }
        }
    }
}