| 12 | |
| 13 | #if BLUE_WITH_PYTHON |
| 14 | static PyObject* PyPickPointAndObject( PyObject* self, PyObject* args ) |
| 15 | { |
| 16 | Tr2PrimitiveScene* pThis = BluePythonCast<Tr2PrimitiveScene*>( self ); |
| 17 | |
| 18 | PyObject* pyProjection = NULL; |
| 19 | PyObject* pyView = NULL; |
| 20 | PyObject* pyViewport = NULL; |
| 21 | |
| 22 | int x, y; |
| 23 | if( !PyArg_ParseTuple( args, "iiOOO", &x, &y, &pyProjection, &pyView, &pyViewport ) ) |
| 24 | return NULL; |
| 25 | |
| 26 | TriProjection* projection = NULL; |
| 27 | if( !BlueExtractArgument( pyProjection, projection, 3 ) ) |
| 28 | { |
| 29 | return NULL; |
| 30 | } |
| 31 | |
| 32 | TriView* view = NULL; |
| 33 | if( !BlueExtractArgument( pyView, view, 4 ) ) |
| 34 | { |
| 35 | return NULL; |
| 36 | } |
| 37 | |
| 38 | TriViewport* viewport = NULL; |
| 39 | if( !BlueExtractArgument( pyViewport, viewport, 5 ) ) |
| 40 | { |
| 41 | return NULL; |
| 42 | } |
| 43 | |
| 44 | ITr2PickableScene::PickResults results; |
| 45 | results.components = ITr2PickableScene::PICK_OBJECT | ITr2PickableScene::PICK_POSITION; |
| 46 | results.object = NULL; |
| 47 | |
| 48 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 49 | pThis->PickObject( renderContext, x, y, projection, view, viewport, results ); |
| 50 | |
| 51 | if( results.object ) |
| 52 | { |
| 53 | PyObject* result = PyTuple_New( 2 ); |
| 54 | PyTuple_SET_ITEM( result, 0, PyOS->WrapBlueObject( results.object ) ); |
| 55 | PyTuple_SET_ITEM( result, 1, Py_BuildValue( "(fff)", results.position.x, results.position.y, results.position.z ) ); |
| 56 | return result; |
| 57 | } |
| 58 | |
| 59 | Py_INCREF( Py_None ); |
| 60 | return Py_None; |
| 61 | } |
| 62 | #endif |
| 63 | |
| 64 |
nothing calls this directly
no test coverage detected