Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
VAPython
Commits
78cc75e5
Commit
78cc75e5
authored
Aug 24, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Adding portal methods
parent
99d43b46
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/vasingleton.cpp
View file @
78cc75e5
...
...
@@ -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_implement
ed
,
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_implemen
te
d
,
METH_FASTCALL
,
va_no_doc
},
{
"set_portal_state"
,
(
PyCFunction
)
va_
not_implemen
te
d
,
METH_FASTCALL
,
va_no_doc
},
{
"load_scene"
,
(
PyCFunction
)
va_
load_scene
,
METH_FASTCALL
,
va_no_doc
},
{
"is_scene_loaded"
,
(
PyCFunction
)
va_
is_scene_load
ed
,
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_sta
te
,
METH_FASTCALL
,
va_no_doc
},
{
"set_portal_state"
,
(
PyCFunction
)
va_
set_portal_sta
te
,
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
},
...
...
src/vasingletonmethods.hpp
View file @
78cc75e5
...
...
@@ -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.0
f
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
iID
,
&
dState
)
)
return
NULL
;
g_pVANetClient
->
GetCoreInstance
()
->
SetPortalState
(
iID
,
dState
);
return
Py_None
;
VAPY_CATCH_RETURN
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment