| 2973 | } |
| 2974 | |
| 2975 | static ToolMode DetermineToolMode(EditorTypes::Tool type) { |
| 2976 | const Mouse& mouse = Input::Instance()->getMouse(); |
| 2977 | const Keyboard& keyboard = Input::Instance()->getKeyboard(); |
| 2978 | |
| 2979 | switch (type) { |
| 2980 | case EditorTypes::ROTATE: |
| 2981 | if (mouse.mouse_down_[Mouse::LEFT]) { |
| 2982 | return ROTATE_SPHERE; |
| 2983 | } else { |
| 2984 | return ROTATE_CIRCLE; |
| 2985 | } |
| 2986 | case EditorTypes::TRANSLATE: |
| 2987 | if (mouse.mouse_down_[Mouse::LEFT]) { |
| 2988 | return TRANSLATE_CAMERA_PLANE; |
| 2989 | } else if (KeyCommand::CheckDown(keyboard, KeyCommand::kNormalTransform, KIMF_LEVEL_EDITOR_GENERAL)) { |
| 2990 | return TRANSLATE_FACE_NORMAL; |
| 2991 | } else { |
| 2992 | return TRANSLATE_FACE_PLANE; |
| 2993 | } |
| 2994 | case EditorTypes::SCALE: |
| 2995 | if (mouse.mouse_down_[Mouse::LEFT]) { |
| 2996 | return SCALE_WHOLE; |
| 2997 | } else if (KeyCommand::CheckDown(keyboard, KeyCommand::kNormalTransform, KIMF_LEVEL_EDITOR_GENERAL)) { |
| 2998 | return SCALE_NORMAL; |
| 2999 | } else { |
| 3000 | return SCALE_PLANE; |
| 3001 | } |
| 3002 | default: |
| 3003 | LOG_ASSERT(false); |
| 3004 | return TRANSLATE_CAMERA_PLANE; |
| 3005 | } |
| 3006 | } |
| 3007 | |
| 3008 | static bool GetTranslationBasis(vec3 clicked_point, vec3 clicked_normal, |
| 3009 | Basis* basis, const Object* object_, const Box& box_, ToolMode tool_mode) { |
no outgoing calls
no test coverage detected