Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenFlipper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
7d032d02
Commit
7d032d02
authored
Feb 26, 2019
by
Jan Möbius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial documentation for python interface
parent
d217c6b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
8 deletions
+61
-8
Documentation/DeveloperHelpSources/.python-scripting.docu.kate-swp
...tion/DeveloperHelpSources/.python-scripting.docu.kate-swp
+0
-0
Documentation/DeveloperHelpSources/Interfaces.docu
Documentation/DeveloperHelpSources/Interfaces.docu
+8
-0
Documentation/DeveloperHelpSources/mainpage.docu
Documentation/DeveloperHelpSources/mainpage.docu
+1
-1
Documentation/DeveloperHelpSources/python-scripting.docu
Documentation/DeveloperHelpSources/python-scripting.docu
+12
-2
PythonInterpreter/PythonTypeConversions.hh
PythonInterpreter/PythonTypeConversions.hh
+40
-5
No files found.
Documentation/DeveloperHelpSources/.python-scripting.docu.kate-swp
deleted
100644 → 0
View file @
d217c6b9
File deleted
Documentation/DeveloperHelpSources/Interfaces.docu
View file @
7d032d02
...
...
@@ -207,6 +207,13 @@ This page shows interfaces for other operations.
Interface to call functions across plugins ( \ref RPCInterfacePage )
\n
\subpage pythonInterfacePage
\n
\image html ScriptInterface.png
\n
For plugins which provide python scriptable functions ( \ref pythonInterfacePage )
\n
\subpage scriptInterfacePage
\n
\image html ScriptInterface.png
...
...
@@ -214,6 +221,7 @@ Interface to call functions across plugins ( \ref RPCInterfacePage )
For plugins which provide scriptable functions ( \ref scriptInterfacePage )
\n
\subpage pluginConnectionInterfacePage
\n
\image html PluginConnectionInterface.png
...
...
Documentation/DeveloperHelpSources/mainpage.docu
View file @
7d032d02
...
...
@@ -21,7 +21,7 @@
* - \subpage dataFlow "Dataflow"
* - \subpage options "Command line options and config files"
* - \subpage scripting
* - \subpage python_scripting
"OpenFlipper Scripting with python"
* - \subpage python_scripting
*
* \subpage misc
* - \ref changelog
...
...
Documentation/DeveloperHelpSources/python-scripting.docu
View file @
7d032d02
/*!
\page python
-
scripting OpenFlipper Python Scripting and Batch Mode
\page python
_
scripting OpenFlipper Python Scripting and Batch Mode
\section python_scripting_batch_mode OpenFlipper Batch mode with python
OpenFlipper can be started in batch mode without a graphical user interface by providing "-b"
...
...
@@ -10,5 +10,15 @@
or graphical functionality will be loaded. You can see on the command line (when "-c" is given),
which plugins are activated and which are skipped in batch mode.
\section python_scripting_datattypes DataTypes
\subsection python_scripting_matrixtype Matrix4x4 data type
The Matrix4x4T type used in the C++ code is mapped from python. Details can be found here:
\subpage python_scripting_matrix4x4_type
\subsection python_scripting_vectortype 3 Dimensional vector type
The Vector type used in the C++ code is mapped from python. Details can be found here:
\subpage python_scripting_vector_type
*/
PythonInterpreter/PythonTypeConversions.hh
View file @
7d032d02
...
...
@@ -96,7 +96,23 @@ namespace pybind11 { namespace detail {
};
}}
// namespace pybind11::detail
/** \page python_scripting_vector_type Vector data type used for python scripting
*
* The matrix type Vector is mapped to python to handle Vector operations.
*
* The integrated conversion can map the C++ Vector type to and from a tuple, a list or a numpy array.
* The preferred choice is the numpy array. Tuple and list have to contain 3 elements. A numpy array
* has to have a dimension of 1, with 3 elements.
*
* Creating a matrix in python is the done like in the following example:
* \code
* import numpy as np
*
* vector = np.array([1.0,0.0,0.0]);
* \endcode
*
* The conversion from C++ to python will always create a numpy array on the python side.
*/
namespace
pybind11
{
namespace
detail
{
template
<
>
struct
type_caster
<
Vector
>
{
public:
...
...
@@ -192,7 +208,24 @@ namespace pybind11 { namespace detail {
};
}}
// namespace pybind11::detail
/** \page python_scripting_matrix4x4_type Matrix4x4 data type used for python scripting
*
* The matrix type Matrix4x4 is mapped to python to handle matrix operations.
*
* The integrated conversion can map the C++ Matrix4x4 type to and from a tuple, a list or a numpy array.
* The preferred choice is the numpy array. Tuple and list have to contain 16 elements. A numpy array
* has to have a dimension of 2, with 4x4 elements. All data is assumed to be given column major. Therefore
* the first for elements define the first column and so on.
*
* Creating a matrix in python is the done like in the following example:
* \code
* import numpy as np
*
* matr = np.array( [[1.0,0.0,0.0,0.0],[0.0,1.0,0.0,0.0],[0.0,0.0,1.0,0.0],[0.0,0.0,0.0,1.0]])
* \endcode
*
* The conversion from C++ to python will always create a numpy array on the python side.
*/
namespace
pybind11
{
namespace
detail
{
template
<
>
struct
type_caster
<
Matrix4x4
>
{
public:
...
...
@@ -235,7 +268,8 @@ namespace pybind11 { namespace detail {
PyFloat_AsDouble
(
PyList_GetItem
(
source
,
11
)),
PyFloat_AsDouble
(
PyList_GetItem
(
source
,
12
)),
PyFloat_AsDouble
(
PyList_GetItem
(
source
,
13
)),
PyFloat_AsDouble
(
PyList_GetItem
(
source
,
14
))};
PyFloat_AsDouble
(
PyList_GetItem
(
source
,
14
)),
PyFloat_AsDouble
(
PyList_GetItem
(
source
,
15
))};
/* Now convert into a C++ Matrix4x4 */
value
=
Matrix4x4
(
convert
);
...
...
@@ -257,11 +291,12 @@ namespace pybind11 { namespace detail {
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
7
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
8
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
9
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
0
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
1
0
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
11
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
12
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
13
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
14
))
};
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
14
)),
PyFloat_AsDouble
(
PyTuple_GetItem
(
source
,
15
))};
/* Now convert into a C++ Matrix4x4 */
value
=
Matrix4x4
(
convert
);
...
...
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