Adding portal methods

parent 99d43b46
......@@ -108,14 +108,14 @@ static struct PyMethodDef va_methods[] =
{ "get_listener_real_world_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_real_world_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "load_scene", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "is_scene_loaded", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_scene_info", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_portal_ids", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_portal_name", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_portal_name", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_portal_state", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_portal_state", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "load_scene", ( PyCFunction ) va_load_scene, METH_FASTCALL, va_no_doc },
{ "is_scene_loaded", ( PyCFunction ) va_is_scene_loaded, METH_FASTCALL, va_no_doc },
{ "get_scene_info", ( PyCFunction ) va_get_scene_info, METH_FASTCALL, va_no_doc },
{ "get_portal_ids", ( PyCFunction ) va_get_portal_ids, METH_FASTCALL, va_no_doc },
{ "get_portal_name", ( PyCFunction ) va_get_portal_name, METH_FASTCALL, va_no_doc },
{ "set_portal_name", ( PyCFunction ) va_set_portal_name, METH_FASTCALL, va_no_doc },
{ "get_portal_state", ( PyCFunction ) va_get_portal_state, METH_FASTCALL, va_no_doc },
{ "set_portal_state", ( PyCFunction ) va_set_portal_state, METH_FASTCALL, va_no_doc },
{ "get_rendering_modules", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_rendering_module_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
......
......@@ -1506,7 +1506,7 @@ static PyObject* va_get_signal_source_infos( PyObject*, PyObject* )
{
CVASignalSourceInfo& oInfo( voInfos[ i ] );
PyObject* pInfo = Py_BuildValue( "{s:s,s:s,s:s,s:s,s:i,s:s}",
"id", SaveStringToUnicodeConversion(oInfo.sID).c_str(),
"id", SaveStringToUnicodeConversion( oInfo.sID ).c_str(),
"name", SaveStringToUnicodeConversion( oInfo.sName ).c_str(),
"state", SaveStringToUnicodeConversion( oInfo.sState ).c_str(),
"type", SaveStringToUnicodeConversion( oInfo.sType ).c_str(),
......@@ -1668,7 +1668,124 @@ static PyObject* va_set_signal_source_parameters( PyObject*, PyObject** ppArgs,
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
CVAStruct oParameters = ConvertPythonDictToVAStruct( pParameters );
g_pVANetClient->GetCoreInstance()->SetSignalSourceParameters( sSignalSource, oParameters );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_load_scene( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "filepath", NULL };
static _PyArg_Parser _parser = { "s:load_scene", _keywords, 0 };
char* pcPath = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcPath ) )
return NULL;
g_pVANetClient->GetCoreInstance()->LoadScene( std::string( pcPath ) );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_is_scene_loaded( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
return PyBool_FromLong( g_pVANetClient->GetCoreInstance()->IsSceneLoaded() );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_scene_info( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
// Not implemented in IVACore, yet
CVASceneInfo oInfo = g_pVANetClient->GetCoreInstance()->GetSceneInfo();
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_portal_ids( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
std::vector< int > viIDs;
g_pVANetClient->GetCoreInstance()->GetPortalIDs( viIDs );
PyObject* pIDList = PyList_New( viIDs.size() );
for( Py_ssize_t i = 0; i < PyList_GET_SIZE( pIDList ); i++ )
PyList_SetItem( pIDList, i, PyLong_FromLong( viIDs[ i ] ) );
return pIDList;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_portal_name( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_portal_name", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyUnicode_FromString( SaveStringToUnicodeConversion( g_pVANetClient->GetCoreInstance()->GetPortalName( iID ) ).c_str() );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_portal_name( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "name", NULL };
static _PyArg_Parser _parser = { "is:set_portal_name", _keywords, 0 };
long iID = -1;
char* pcName = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pcName ) )
return NULL;
std::string sName = pcName ? std::string( pcName ) : "";
g_pVANetClient->GetCoreInstance()->SetPortalName( iID, sName );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_portal_state( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_portal_state", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyFloat_FromDouble( g_pVANetClient->GetCoreInstance()->GetPortalState( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_portal_state( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "name", NULL };
static _PyArg_Parser _parser = { "id:set_portal_state", _keywords, 0 };
long iID = -1;
double dState = -1.0f;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &dState ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetPortalState( iID, dState );
return Py_None;
VAPY_CATCH_RETURN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment