MCPcopy Create free account
hub / github.com/carbonengine/trinity / PyPickParticle

Function PyPickParticle

trinity/Eve/EveSpaceScene_Blue.cpp:603–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601
602#if BLUE_WITH_PYTHON
603static PyObject* PyPickParticle( PyObject* self, PyObject* args )
604{
605 int x, y;
606 float constPickRadius;
607 PyObject* pyData;
608 PyObject* pyWorld;
609 PyObject* pyProj;
610 PyObject* pyView;
611 PyObject* pyViewport;
612 if( !PyArg_ParseTuple(
613 args,
614 "O!iiO!O!O!O!f",
615 Tr2RuntimeInstanceData::ClassType_()->mTypeObject,
616 &pyData,
617 &x,
618 &y,
619 &PyTuple_Type,
620 &pyWorld,
621 TriView::ClassType_()->mTypeObject,
622 &pyView,
623 TriProjection::ClassType_()->mTypeObject,
624 &pyProj,
625 TriViewport::ClassType_()->mTypeObject,
626 &pyViewport,
627 &constPickRadius ) )
628 {
629 return nullptr;
630 }
631
632 Matrix world;
633 if( !BlueExtractMatrix( pyWorld, &world.m[0][0], 16 ) )
634 {
635 PyErr_SetString( PyExc_TypeError, "Argument 4 needs to be a matrix" );
636 return nullptr;
637 }
638
639 Tr2RuntimeInstanceData* data = BluePythonCast<Tr2RuntimeInstanceData*>( pyData );
640 TriProjection* proj = BluePythonCast<TriProjection*>( pyProj );
641 TriView* view = BluePythonCast<TriView*>( pyView );
642 TriViewport* viewport = BluePythonCast<TriViewport*>( pyViewport );
643
644 if( data->GetData() == 0 )
645 {
646 return ToPython( -1 );
647 }
648
649 const Tr2VertexDefinition& def = data->GetLayout();
650 if( def.m_items.empty() )
651 {
652 return ToPython( -1 );
653 }
654
655 const char* positionStream = nullptr;
656
657 for( auto it = def.m_items.begin(); it != def.m_items.end(); ++it )
658 {
659 if( it->m_usage == Tr2VertexDefinition::POSITION && it->m_usageIndex == 0 )
660 {

Callers

nothing calls this directly

Calls 11

ToPythonFunction · 0.85
LengthSqFunction · 0.85
emptyMethod · 0.80
ScreenToProjectionMethod · 0.80
GetDataMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetTransformMethod · 0.45
GetCountMethod · 0.45
GetStrideMethod · 0.45

Tested by

no test coverage detected