Allow Python scripts to use currently selected cases (#6906)

* #6891 Python : Make sure python scripts can be launched from context menu
* #6891 Python : Make currentScriptCaseId a general scripting feature
This commit is contained in:
Magne Sjaastad
2020-11-04 04:27:05 -05:00
committed by GitHub
parent cfccd6e943
commit 51359a0cda
8 changed files with 77 additions and 59 deletions

View File

@@ -29,16 +29,26 @@ using namespace rips;
//--------------------------------------------------------------------------------------------------
Status RiaGrpcProjectService::GetCurrentCase( ServerContext* context, const rips::Empty* request, rips::CaseRequest* reply )
{
RimGridView* view = RiaApplication::instance()->activeGridView();
if ( view )
int scriptCaseId = RiaApplication::instance()->currentScriptCaseId();
if ( scriptCaseId != -1 )
{
RimCase* currentCase = view->ownerCase();
if ( currentCase )
reply->set_id( scriptCaseId );
return Status::OK;
}
else
{
RimGridView* view = RiaApplication::instance()->activeGridView();
if ( view )
{
reply->set_id( currentCase->caseId() );
return Status::OK;
RimCase* currentCase = view->ownerCase();
if ( currentCase )
{
reply->set_id( currentCase->caseId() );
return Status::OK;
}
}
}
return Status( grpc::NOT_FOUND, "No current case found" );
}