diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml new file mode 100644 index 00000000..8b474bd8 --- /dev/null +++ b/.github/workflows/build_docs.yml @@ -0,0 +1,45 @@ +name: Build, zip and upload documentation for release + +on: + release: + types: + - created + - edited + workflow_dispatch: # This allows manual triggering + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 # Replace with your desired Python version + + - name: Install dependencies + run: | + cd docs/sphinx/ + pip install -r source/requirements.txt # Replace with your project's requirements file + + - name: Build Sphinx documentation + run: | + mkdir build/ + sphinx-build -b html -a -E source/ build/ # Replace with your documentation source and build directories + + - name: Zip Documentation + run: | + # Create a zip file of the documentation + cd build/ + zip -r SofaPython3_${{ steps.branch_name.outputs.branch_name }}_docs.zip . + + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: | + SofaPython3_${{ steps.branch_name.outputs.branch_name }}_docs.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2d706522..10a125c9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ __pycache__/ *.pyc *.so -docs/stubs -docs/sphinx/build/ -docs/sphinx/source/*/_autosummary* +docs/sphinx/build/* +docs/sphinx/source/*/generated +docs/sphinx/source/*/*/generated +docs/sphinx/source/*/*/*/generated diff --git a/.readthedocs.yml b/.readthedocs.yml index 3c7c248f..98e3f480 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,16 +9,10 @@ version: 2 sphinx: configuration: docs/sphinx/source/conf.py -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - -# Optionally build your docs in additional formats such as PDF -formats: - - pdf - -# Optionally set the version of Python and requirements required to build your docs -python: - version: 3.7 - install: - - requirements: docs/sphinx/source/requirements.txt +build: + os: "ubuntu-22.04" + commands: + - mkdir --parents $READTHEDOCS_OUTPUT/html/ + - wget https://github.com/sofa-framework/SofaPython3/releases/download/release-v23.06/SofaPython3_v23.06_docs.zip + - unzip SofaPython3_v23.06_docs.zip + - cp --recursive build/html/* $READTHEDOCS_OUTPUT/html/ diff --git a/CMakeLists.txt b/CMakeLists.txt index acf920de..aa2c3df5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.12) -project(SofaPython3 VERSION 20.12.00) +project(SofaPython3 VERSION 24.12.00) find_package(Sofa.Config REQUIRED) diff --git a/Plugin/src/SofaPython3/Prefab.cpp b/Plugin/src/SofaPython3/Prefab.cpp index a71f8c28..7a2534cc 100644 --- a/Plugin/src/SofaPython3/Prefab.cpp +++ b/Plugin/src/SofaPython3/Prefab.cpp @@ -68,7 +68,6 @@ void Prefab::reinit() doReInit(); - /// Beurk beurk beurk sofa::simulation::node::init(this); execute(sofa::core::visual::visualparams::defaultInstance()); } diff --git a/bindings/Modules/src/SofaPython3/SofaBaseTopology/Module_SofaBaseTopology.cpp b/bindings/Modules/src/SofaPython3/SofaBaseTopology/Module_SofaBaseTopology.cpp index 9b6a2dcb..f208d106 100644 --- a/bindings/Modules/src/SofaPython3/SofaBaseTopology/Module_SofaBaseTopology.cpp +++ b/bindings/Modules/src/SofaPython3/SofaBaseTopology/Module_SofaBaseTopology.cpp @@ -32,10 +32,12 @@ namespace sofapython3 PYBIND11_MODULE(SofaBaseTopology, m) { + m.doc() = "Implements some topology component (Regular and SparseGridTopology)"; + sofa::component::topology::container::grid::init(); moduleAddRegularGridTopology(m); moduleAddSparseGridTopology(m); } -} // namespace sofapython3 \ No newline at end of file +} // namespace sofapython3 diff --git a/bindings/Modules/src/SofaPython3/SofaConstraintSolver/Module_SofaConstraintSolver.cpp b/bindings/Modules/src/SofaPython3/SofaConstraintSolver/Module_SofaConstraintSolver.cpp index ac27655d..15961fa4 100644 --- a/bindings/Modules/src/SofaPython3/SofaConstraintSolver/Module_SofaConstraintSolver.cpp +++ b/bindings/Modules/src/SofaPython3/SofaConstraintSolver/Module_SofaConstraintSolver.cpp @@ -26,6 +26,8 @@ namespace sofapython3 PYBIND11_MODULE(SofaConstraintSolver, m) { + m.doc() = "Implements the solver for constraint problems"; + moduleAddConstraintSolver(m); } diff --git a/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_LinearSpring_doc.h b/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_LinearSpring_doc.h index ed42155b..f27cb06f 100644 --- a/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_LinearSpring_doc.h +++ b/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_LinearSpring_doc.h @@ -24,12 +24,13 @@ namespace sofapython3::doc::SofaDeformable { static auto LinearSpringClass = R"( -A LinearSpring between two objects, specified by indices on a topology. +A linear spring connecting pair of nodes of two different objects )"; static auto LinearSpringInit = R"( Create a linear spring from indices and spring parameters. + :param index1: Index of the point on object 1. :param index2: Index of the point on object 2. :param springStiffness: Stiffnes k of the spring (f = -k*x -d*v) @@ -39,6 +40,7 @@ Create a linear spring from indices and spring parameters. :param enabled: If set to false, no force will be calculated for this spring :return: A linear spring of type Sofa.SofaDeformable.LinearSpring + )"; } // sofapython3::doc::SofaDeformable diff --git a/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_SpringForceField.cpp b/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_SpringForceField.cpp index a21480e5..2dfce9ef 100644 --- a/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_SpringForceField.cpp +++ b/bindings/Modules/src/SofaPython3/SofaDeformable/Binding_SpringForceField.cpp @@ -47,7 +47,9 @@ void bindSpringForcefield(py::module& m) { // create a python binding for the c++ class SpringForceField from SofaDeformable // no init binding, because creation should be done via node.addObject("SpringForceField") - std::string type_name = sofa::helper::NameDecoder::getTypeName(); + std::string type_name = SpringForceField::GetClass()->className+"_"+ + DataType::Name(); + py::class_> s (m, type_name.c_str(), sofapython3::doc::SofaDeformable::SpringForceFieldClass); diff --git a/bindings/Modules/src/SofaPython3/SofaDeformable/Module_SofaDeformable.cpp b/bindings/Modules/src/SofaPython3/SofaDeformable/Module_SofaDeformable.cpp index 01cdb194..0fc446e8 100644 --- a/bindings/Modules/src/SofaPython3/SofaDeformable/Module_SofaDeformable.cpp +++ b/bindings/Modules/src/SofaPython3/SofaDeformable/Module_SofaDeformable.cpp @@ -30,6 +30,8 @@ namespace sofapython3 PYBIND11_MODULE(SofaDeformable, m) { + m.doc() = "Implements linear springs between objects"; + moduleAddLinearSpring(m); moduleAddSpringForceField(m); } diff --git a/bindings/Modules/src/SofaPython3/SofaGL/Module_SofaGL.cpp b/bindings/Modules/src/SofaPython3/SofaGL/Module_SofaGL.cpp index 426e93be..b302bf80 100644 --- a/bindings/Modules/src/SofaPython3/SofaGL/Module_SofaGL.cpp +++ b/bindings/Modules/src/SofaPython3/SofaGL/Module_SofaGL.cpp @@ -29,6 +29,8 @@ namespace sofapython3 PYBIND11_MODULE(SofaGL, m) { + m.doc() = "Exposes the rendering API using OpenGL"; + moduleAddDrawToolGL(m); } diff --git a/bindings/Sofa/package/PyTypes/Vec3.py b/bindings/Sofa/package/PyTypes/Vec3.py index d98b1a45..ab0eeb2d 100644 --- a/bindings/Sofa/package/PyTypes/Vec3.py +++ b/bindings/Sofa/package/PyTypes/Vec3.py @@ -29,7 +29,7 @@ class Vec3(numpy.ndarray): def __new__(cls, *args): """ Vec3 constructor expects zero, one or three arguments. - Examples: + Example: >>> v = Vec3() >>> print(v) @@ -125,7 +125,7 @@ def normalize(self, *args): def translate(self, *args): """ Function translate of class Vec3 expects one or three arguments. Note that you can also use the '+' and '-' operators. - Examples: + Example: >>> v = Vec3([0.,0.,0.]) >>> v.translate(1.) @@ -209,7 +209,7 @@ def rotateFromAxisAngle(self, axis, angle): def scale(self, *args): """ Function scale of class Vec3 expects one or three arguments. Note that you can also use the '*' and '/' operators. - Examples: + Example: >>> v = Vec3([1.,2.,3.]) >>> v.scale(2.) diff --git a/bindings/Sofa/package/PyTypes/__init__.py b/bindings/Sofa/package/PyTypes/__init__.py index 9c7156d5..1e3f0558 100644 --- a/bindings/Sofa/package/PyTypes/__init__.py +++ b/bindings/Sofa/package/PyTypes/__init__.py @@ -1,11 +1,8 @@ """ Data types ------------------------ +---------- -.. autosummary:: - Sofa.Types.RGBAColor - Sofa.Types.Vec3 """ from .Vec3 import * -from .RGBAColor import * \ No newline at end of file +from .RGBAColor import * diff --git a/bindings/Sofa/package/__init__.py b/bindings/Sofa/package/__init__.py index 8b4a62b2..83722d6a 100644 --- a/bindings/Sofa/package/__init__.py +++ b/bindings/Sofa/package/__init__.py @@ -1,8 +1,7 @@ """ -Package containing the binding for the core of Sofa -------------------------------------------------- +All SOFA key components supported by the SOFA consortium -Example of use: +Example: .. code-block:: python import Sofa.Core @@ -17,14 +16,6 @@ Sofa.Simulation.init(n) Sofa.Simulation.print(n) -Submodules: - .. autosummary:: - :toctree: _autosummary - - Sofa.Core - Sofa.Simulation - Sofa.Types - Sofa.Helper """ import sys @@ -255,14 +246,18 @@ def getSofaFormattedStringFromException(e): def sofaExceptHandler(type, value, tb): global oldexcepthook - """This exception handler, convert python exceptions & traceback into more classical sofa error messages of the form: - Message Description - Python Stack (most recent are at the end) - File file1.py line 4 ... - File file1.py line 10 ... - File file1.py line 40 ... - File file1.py line 23 ... - faulty line + """This exception handler converts python exceptions & traceback into classical SOFA error messages + + Message: + + .. code-block:: text + + Python Stack (most recent are at the end) + File file1.py line 4 ... + File file1.py line 10 ... + File file1.py line 40 ... + File file1.py line 23 ... + """ h = type.__name__ @@ -294,18 +289,26 @@ def pyType2sofaType(v): def msg_error(target, message): + """API emitting error messages + """ frameinfo = inspect.getframeinfo(inspect.currentframe().f_back) Sofa.Helper.msg_error(target, message, frameinfo.filename, frameinfo.lineno) def msg_info(target, message): + """API emitting information messages + """ frameinfo = inspect.getframeinfo(inspect.currentframe().f_back) Sofa.Helper.msg_info(target, message, frameinfo.filename, frameinfo.lineno) def msg_warning(target, message): + """API emitting warning messages + """ frameinfo = inspect.getframeinfo(inspect.currentframe().f_back) Sofa.Helper.msg_warning(target, message, frameinfo.filename, frameinfo.lineno) def msg_deprecated(target, message): + """API emitting deprecation messages + """ frameinfo = inspect.getframeinfo(inspect.currentframe().f_back) Sofa.Helper.msg_deprecated(target, message, frameinfo.filename, frameinfo.lineno) diff --git a/bindings/Sofa/package/prefab.py b/bindings/Sofa/package/prefab.py index b43f7e72..c25a9028 100644 --- a/bindings/Sofa/package/prefab.py +++ b/bindings/Sofa/package/prefab.py @@ -1,53 +1,56 @@ +""" +Prefabs are python templates for a SOFA scene +""" + import Sofa.Core import inspect import os class Prefab(Sofa.Core.RawPrefab): - """ - Special Node to make reusable procedural objects in Sofa. - --------------------------------------------------------- - Inherit from this class to create your own Prefab. What makes Prefab special is that they - have a set of special data named prefabParameters. When any of prefabParameter is changed the prefab - is completely recreated by calling the onParameterChanged method so the scene graph is always kept synchronized - with the parameter's content. + def __init__(self, *args, **kwargs): + """ + Prefabs are python templates for a SOFA scene - To specify the prefabParameters, it is possible to provide in the class a list of dictionaries containing the 3 required fields ("name", "type", "help") - and one optional field ("default"). + They allow to simplify the design of a simulation by using pre-structured and reusable python script. + Inherit from this class to create your own Prefab. What makes Prefab special is that they + have a set of special data named prefabParameters. When any of prefabParameter is changed the prefab + is completely recreated by calling the onParameterChanged method so the scene graph is always kept synchronized + with the parameter's content. - The same syntax can be used to also add prefab's data. + To specify the prefabParameters, it is possible to provide in the class a list of dictionaries containing the 3 required fields ("name", "type", "help") + and one optional field ("default"). - Example of use: - .. code-block:: python + The same syntax can be used to also add prefab's data. - import Sofa.Core + Example: + .. code-block:: python - class Foo(Sofa.Core.Prefab): - prefabParameters = [{ 'name': 'n', 'type': 'int', 'help': 'number of repetition, 'default': 1}, - {'name': 'message', 'type': 'string', 'help': 'message to display', 'default': ''}] + import Sofa.Core - myAttribute = 0 + class Foo(Sofa.Core.Prefab): + prefabParameters = [{ 'name': 'n', 'type': 'int', 'help': 'number of repetition, 'default': 1}, + {'name': 'message', 'type': 'string', 'help': 'message to display', 'default': ''}] - def __init__(self, *a, *k): - Sofa.Core.Prefab.__init__(self, *a, **k) + myAttribute = 0 - def init(self): - myAttribute += 1 - for i in range(0, self.n.value): - print(self.message.value) + def __init__(self, *a, *k): + Sofa.Core.Prefab.__init__(self, *a, **k) - n = Sofa.Core.Node() - n.addChild(Foo(name="aFooPrefab", n=42, message="hello universe!")) + def init(self): + myAttribute += 1 + for i in range(0, self.n.value): + print(self.message.value) - Prefab has protected the following additional keywords: - - "name": the name of the prefab instance - - "parent" and "parents": can't be used together, they set the context of the prefab, - thus allowing paths resolution for Prefab parameters whose arguments are passed as link paths (strings). parents (with an '-s') sets multi-node contexts + n = Sofa.Core.Node() + n.addChild(Foo(name="aFooPrefab", n=42, message="hello universe!")) + Prefab has protected the following additional keywords: + - "name" = the name of the prefab instance + - "parent" and "parents" = can't be used together, they set the context of the prefab, thus allowing paths resolution for Prefab parameters whose arguments are passed as link paths (strings). parents (with an '-s') sets multi-node contexts + """ - """ - def __init__(self, *args, **kwargs): Sofa.Core.RawPrefab.__init__(self, *args, **kwargs) frame = inspect.currentframe().f_back frameinfo = inspect.getframeinfo(frame) diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseCamera_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseCamera_doc.h index a989499d..f0916e43 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseCamera_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseCamera_doc.h @@ -24,10 +24,9 @@ namespace sofapython3::doc::baseCamera { static auto baseCameraClass = R"( - Camera is an API dedicated to the control of the Camera in SOFA. - - :Example of use: + API dedicated to the control of the Camera in SOFA + Example: .. code-block:: python import Sofa.Core @@ -47,7 +46,7 @@ static auto baseCameraClass = ctrl+x to move backward, ctrl+d to translate on the right, ctrl+q to translate on the left. The code for this example is available in the folder examples under the name BaseCamera.py of the SofaPython3 GitHub repository. - .. image:: ../../../../../images/baseCamera.gif + .. image:: ../../../../../../docs/sphinx/source/images/baseCamera.gif :alt: Example of a controller for a BaseCamera :align: center :height: 250pt diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp index d2861715..521f7911 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp @@ -34,7 +34,7 @@ using namespace sofa::core::objectmodel; namespace sofapython3 { void moduleAddBaseContext(py::module& m) { - py::class_> c (m, "BaseContext"); + py::class_> c (m, "BaseContext", "Base class for Context classes, storing shared variables and parameters"); py::enum_(c, "SearchDirection") .value("SearchUp", BaseContext::SearchDirection::SearchUp) diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData_doc.h index 347d1f72..31385d2e 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData_doc.h @@ -24,7 +24,7 @@ namespace sofapython3::doc::baseData { static auto BaseDataClass = R"( - The purpose of a data is to store the attributs of your component. + Public attribute of a Component (C++ class) visible and accessible to the user (read/write) :Create a data field: diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseLink_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseLink_doc.h index 1fb70d62..5ada31e4 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseLink_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseLink_doc.h @@ -24,11 +24,12 @@ namespace sofapython3::doc::baseLink { static auto baseLinkClass = R"( + Connection created between Data instances of two different Components + A Link allows you to access a sofa component from another one anywhere in the simulation graph. In your scene creation file, it usually appear as : input=@../component. - :Example of use: - + Example: .. code-block:: python import Sofa.Core diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp index 2759c530..201f7be0 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp @@ -37,7 +37,7 @@ using namespace sofa::core::topology; namespace sofapython3 { void moduleAddBaseMeshTopology(py::module& m) { - py::class_> c (m, "BaseMeshTopology"); + py::class_> c (m, "BaseMeshTopology", "API providing all topology-related functions"); /// register the BaseMeshTopology binding in the downcasting subsystem PythonFactory::registerType([](sofa::core::objectmodel::Base* object) diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject_doc.h index ccdcfb23..884a4330 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject_doc.h @@ -24,15 +24,14 @@ namespace sofapython3::doc::baseObject { static auto Class = R"( - The class object is a base class for simulation components. + Base class for components which can be added in a simulation An object defines a part of the functionnality in the simulation (stores state data, specify topology, compute forces, etc). Each simulation object is related to a context, which gives access to all available external data. It is able to process events, if listening enabled (default is false). - :Example of use: - + Example of use: .. code-block:: python import Sofa.Core diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Base_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Base_doc.h index 76a37638..07e2b624 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Base_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Base_doc.h @@ -24,18 +24,21 @@ namespace sofapython3::doc::base { static auto BaseClass = R"( - Sofa.Core.Base is the root of the Sofa class Hierarhcy + Base class of the scene graph hierarchy + All objects are in-heriting from this one. )"; static auto getName = R"( Return the name of the entity + :rtype: string )"; static auto setName = R"( Set the name of this object + :param n :type n: string )"; @@ -43,6 +46,7 @@ static auto setName = static auto setNameCounter = R"( Set the name of this object, adding an integer counter + :param n :param counter :type n: string @@ -56,28 +60,34 @@ static auto getClass = static auto findData = R"( - Find a data field given its name. - Return NULL if not found. + Find a data field given its name + If more than one field is found (due to aliases), only the first is returned. + :param name :type name: string - :return: the data field + :return: the data field or None )"; static auto getLinkPath = R"( - returns the path name as a parsable string. - eg: - if object.getPathName() is "/child1/object" - then the linkPath is @"/child1/object" + Returns the path name as a parsable string + + .. code-block:: python + + # prints @"/child1/object" if getPathName() is "/child1/object" + print(object.linkPath) + )"; static auto getPathName = R"( - returns the path name as a string. + Returns the path name as a string + .. code-block:: python + a = Sofa.Core.Node("root") - b.addObject("Camera", name="camera") + b = a.addObject("Camera", name="camera") b.getPathName() # should returns "/root/camera" - ``` + )"; static auto setDataValues = R"( @@ -97,20 +107,22 @@ static auto getLoggedMessagesAsString = static auto countLoggedMessages = R"( - Returns the number of messages in the object's logs. + Returns the number of messages in the object's logs )"; static auto clearLoggedMessages = R"( - Remove all logged messages in the object's logs. + Remove all logged messages in the object's logs )"; static auto findLink = R"( - Find a link given its name. + Find a link given its name + Return NULL if not found. If more than one link is found (due to aliases), only the first is returned. + :param name: the name of the link :type name: string :return: the link @@ -119,13 +131,16 @@ static auto findLink = static auto getLinks = R"( Accessor to the vector containing all the links of this object + :return: A vector containing the links )"; static auto addData = R"( - Create a data field, then adds it to the base. + Create a data field, then adds it to the base + Note that this method should only be called if the field was not initialized with the initData method + :param self: the base itself :param name: the name of the data to be added :param value: the value from which the data can be created @@ -142,8 +157,8 @@ static auto addData = static auto addLink = R"( - Create a Link to a SOFA component and adds it to the base. - Note that this method should only be called if the field was not initialized with the initLink method + Create a Link to a SOFA component and adds it to the base + :param self: the base itself :param name: the name of the link to be added :param value: the value from which the data can be created (either a pathname or a SofaBase) @@ -152,22 +167,29 @@ static auto addLink = :type name: string :type value: object :type help: string + + This method should only be called if the field was not initialized with the initLink method + )"; static auto addDataInitialized = R"( - Add a data field. - Note that this method should only be called if the field was not initialized with the initData method + Add a data field + :param self: the base itself :param d: the data to be added :type self: Base* :type d: object + + This method should only be called if the field was not initialized with the initData method + )"; static auto getData = R"( - Get the data field given its name. + Get the data field given its name + :param self: :param s: :type self: Base& diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ContactListener_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ContactListener_doc.h index ccc79184..5f9e1d6f 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ContactListener_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ContactListener_doc.h @@ -24,9 +24,9 @@ namespace sofapython3::doc::contactListener { static auto contactListenerClass = R"( - ContactListener is an API dedicated to the monitoring of two collision models. + Component dedicated to the monitoring of the collision information between models - :Example of use: + Example: .. code-block:: python @@ -37,11 +37,7 @@ static auto contactListenerClass = root = Sofa.Core.Node("root") model1 = root.addObject("TriangleCollisionModel") model2 = root.addObject("PointCollisionModel") - listener = root.addObject( - "ContactListener", - collisionModel1=model1.getLinkPath(), - collisionModel2=model2.getLinkPath(), - ) + listener = root.addObject("ContactListener", collisionModel1=model1.getLinkPath(), collisionModel2=model2.getLinkPath()) print(listener.getNumberOfContacts()) print(listener.getDistances()) )"; diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Context.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Context.cpp index e1536f12..05058a71 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Context.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Context.cpp @@ -29,7 +29,7 @@ namespace py { using namespace pybind11; } namespace sofapython3 { void moduleAddContext(py::module& m) { - py::class_> (m, "Context"); + py::class_> (m, "Context", "Implementation of BaseContext, storing all shared parameters in Datas"); } } // namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller.cpp index 2161031f..2b4684ea 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller.cpp @@ -104,7 +104,7 @@ void moduleAddController(py::module &m) { BaseObject, py_shared_ptr> f(m, "Controller", py::dynamic_attr(), - sofapython3::doc::controller::Controller); + sofapython3::doc::controller::controllerClass); f.def(py::init([](py::args& /*args*/, py::kwargs& kwargs) { diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller_doc.h index 374ac899..34e9bdbc 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Controller_doc.h @@ -22,8 +22,9 @@ namespace sofapython3::doc::controller { -static auto Controller = R"( - An Interface for user interaction on SOFA Components. +static auto controllerClass = + R"( + Overridable class for user interaction on SOFA Components It can catch events to trigger actions, such as onAnimateBeginEvent, onAnimateEndEvent or onPythonScriptEvent. A new custom controller class needs to be defined to use a controller in a script, diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataDict_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataDict_doc.h index ba937ae2..dd0d9082 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataDict_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataDict_doc.h @@ -24,13 +24,13 @@ namespace sofapython3::doc::dataDict { static auto Class = R"( - DataDict exposes the data of a sofa object in a way similar to a normal python dictionnary. + Exposes the data of a sofa object in a way similar to a normal python dictionnary - :Example: + Example: .. code-block:: python for k,v in anObject.__data__.items(): - print("Data name :"+k+" value:" +str(v))) + print("Data name :"+k+" value:" +str(v))) )"; static auto keys = @@ -44,11 +44,11 @@ static auto values = static auto items = R"( Expose the data, both the key and the value of each item. - :Example: + Example: .. code-block:: python for k,v in anObject.__data__.items(): - print("Data name :"+k+" value:" +str(v))) + print("Data name :"+k+" value:" +str(v))) )"; } @@ -57,7 +57,7 @@ namespace sofapython3::doc::dataDictIterator { static auto Class = R"( - Iterator reimplemented to fit dataDict. + Iterator reimplemented to fit dataDict )"; } diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataEngine_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataEngine_doc.h index 239dbff9..25e3c899 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataEngine_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataEngine_doc.h @@ -24,7 +24,7 @@ namespace sofapython3::doc::dataengine { static auto DataEngine = R"( - DataEngine is a class that computes a set of Data outputs from a set of Data inputs. + Class computing a set of Data outputs from a set of Data inputs It is a trampoline class that enables python implementations of the C++ sofa::core::DataEngine class diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField_doc.h index ea26f123..123f781e 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField_doc.h @@ -23,7 +23,7 @@ namespace sofapython3::doc::forceField { static auto forceFieldClass = R"( - An overridable class to create your own customized force field. + Overridable class to create your own customized force field )"; static constexpr const char* assembleKMatrix = R"( diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_LinkPath_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_LinkPath_doc.h index 8f026a55..a67b62d5 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_LinkPath_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_LinkPath_doc.h @@ -23,13 +23,14 @@ namespace sofapython3::doc::linkpath { static auto linkpath = - R"( - Hold a linkpath to an object or a data. - Example of use: - node.addObject("MechanicalObject", name="o") + R"doc( + Hold a linkpath to an object or a data + + Example: + node.addObject('MechanicalObject", name='o') node.addObject(position=node.o.position.linkpath) - str(node.o.linkpath) # prints LinkPath("@/o.position") - repr(node.o.linkpath) # prints "@/o.position" - )"; + str(node.o.linkpath) # prints LinkPath('@/o.position') + repr(node.o.linkpath) # prints '@/o.position' + )doc"; } diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mass_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mass_doc.h index f513a7fb..0d475cbe 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mass_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mass_doc.h @@ -23,7 +23,7 @@ namespace sofapython3::doc::mass { static auto massClass = R"( - Mass is an API dedicated to the control of a mass in SOFA. + Component defining the mass of an object )"; static constexpr const char* assembleMMatrix = R"( diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node.cpp index dda992d1..c1381049 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node.cpp @@ -613,7 +613,7 @@ void moduleAddNode(py::module &m) { /// typing system. py::class_>(m, "BaseNode"); + py_shared_ptr>(m, "BaseNode", "Base class for simulation node"); py::class_> diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_NodeIterator.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_NodeIterator.cpp index c10da1c1..e8c96915 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_NodeIterator.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_NodeIterator.cpp @@ -32,7 +32,7 @@ namespace sofapython3 { void moduleAddNodeIterator(py::module &m) { - py::class_ d(m, "NodeIterator"); + py::class_ d(m, "NodeIterator", "Iterator on nodes"); d.def("__getitem__", [](NodeIterator& d, size_t index) -> py::object { diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node_doc.h index 3f971926..10a341a5 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node_doc.h @@ -32,7 +32,7 @@ static auto Class = The different simulated objects are described in separate nodes, and different representations of a same object can be done in different sub-nodes. - Example of use: + Example: .. code-block:: python import Sofa.Core @@ -53,7 +53,7 @@ static auto Class = The child nodes, components and parents can be accessed using generator attributes. - Example of use: + Example: .. code-block:: python # ... @@ -67,8 +67,9 @@ static auto Class = Accessing children or object from the current node is easy thanks to the generalized access API. - Example of use: - .. code-block:: python + + Example: + .. code-block:: python # ... n = Sofa.Core.Node("MyNode") @@ -84,7 +85,6 @@ static auto Class = # fast access. n["child1.child2.dofs.position"] - )"; static auto init = R"( @@ -114,36 +114,43 @@ static auto initSofa = static auto addKwargs = R"( Add an prefab, - example: - def Cube(parentNodes, name="Cube"): - cube = parentNode.addChild(name) - cube.addObject("MechanicalObject") - return cube - node.add(Cube, name="MyCube"") + Example: + .. code-block:: python + + def Cube(parentNodes, name="Cube"): + cube = parentNode.addChild(name) + cube.addObject("MechanicalObject") + return cube + + node.add(Cube, name="MyCube"") + )"; static auto addObjectKwargs = R"( Add an object. - Detect the implemented interfaces and add the object to the corresponding lists. - :param self: the node itself - :param type: type of the object - :param kwargs - :type self: Sofa.Simulation.Node* - :type type: string& - :type kwargs: kwargs& + + :param component_type: the Sofa component's type name to add + :type component_type: str + + :param kwargs: additional keyword arguments + :type kwargs: dict + + :rtype: the created :class: Sofa.Core.Object + )"; static auto addObject = R"( - Add an object. - Detect the implemented interfaces and add the object to the corresponding lists. - :param self: the node itself - :param object: the object to be added - :type self: Sofa.Simulation.Node& - :type object: Sofa.Simulation.BaseObject* + Add an existing sofa object. + + :param component: The Sofa component + :type component: :class: Sofa.Core.Object + + :rtype: the added :class: Sofa.Core.Object + )"; static auto createObject = @@ -165,19 +172,16 @@ static auto getObject = R"( Get a sofa component hold by a node. - :param n - :param name + :param name: :type n: Sofa.Simulation.Node :type name: string :return: the component with 'name', None otherwise .. note:: - The extra arguments allowed in the SofaPython (warning=True/False) binding are not supported SofaPython3. + + The extra arguments allowed in the SofaPython (warning=True/False) binding are not supported SofaPython3. .. code-block:: python - # SofaPython2: - if node.getObject("MyObject",warning=False): - pass # SofaPython3: if node.getObject("MyObject") != None: @@ -188,30 +192,31 @@ static auto getObject = if "MyObject" in node.objects: pass - )"; -static auto addChildKwargs = - R"( - Add a child node - :param self: the node itself - :param name: name of the child to be added - :param kwargs - :type self: Sofa.Simulation.Node* - :type name: string& - :type kwargs: kwargs& - :rtype: Sofa.Simulation.Node )"; -static auto addChild = - R"( - Add a child node +static auto addChildKwargs = R"( + Add a new node as a child - :param self : the node itself - :param child : the child to be added - :type self: Sofa.Simulation.Node* - :type child: Sofa.Simulation.Node* - :rtype: Sofa.Simulation.Node - )"; + :param name: name of the child node to be added + :type name: str + + :param kwargs: Extra parameters passed to the created Sofa.Node + :type kwargs: dict + + :rtype: the created :class: Sofa.Simulation.Node + +)"; + +static auto addChild = R"( + Add an existing node as child + + :param node: the node to be added + :type node: :class: Sofa.Simulation.Node + + :rtype: the added :class: Sofa.Simulation.Node + +)"; static auto createChild = R"( @@ -222,8 +227,8 @@ static auto getChild = R"( Get the child of a node. - :param n - :param name + :param n: + :param name: :type n: Sofa.Simulation.Node :type name: string :return: the child with 'name', None otherwise @@ -234,9 +239,9 @@ static auto removeChild = Remove a child of a node. :param self: the node itself :param n: the child to remove - :type self: Sofa.Simulation.Node& - :type n: Sofa.Simulation.Node& - :Examples: + :type self: Sofa.Simulation.Node + :type n: Sofa.Simulation.Node + Example: >>> node1.removeChild(node2) )"; @@ -247,7 +252,7 @@ static auto removeChildWithName = :param name: the name of the child to remove :type n: Sofa.Simulation.Node& :type name: string - :Examples: + Example: >>> node1.removeChild("nameNode2") )"; @@ -266,7 +271,7 @@ static auto getPathName = static auto getLinkPath = R"( Get the link of the current node - :param node + :param node: :type node: Sofa.Simulation.Node* )"; @@ -276,7 +281,7 @@ static auto children = The returned object is a iteratable featuring the following operations: len, remove_at, __contains__, get_at - :Example: + Example: >>> n = Sofa.Core.Node("MyNode") >>> n.addChild("child1") >>> for child in n.children: @@ -293,7 +298,7 @@ static auto parents = The returned object is a iteratable featuring the following operations: len, remove_at, __contains__, get_at - :Example: + Example: >>> n = Sofa.Core.Node("parent1") >>> c = n.addChild("child1") >>> for parent in c.parents: @@ -309,7 +314,7 @@ static auto objects = The returned object is a iteratable featuring the following operations: len, remove_at, __contains__, get_at - :Example: + Example: >>> n = Sofa.Core.Node("MyNode") >>> n.addObject("MechanicalObject", name="object1") >>> n.addObject("MechanicalObject", name="object2") diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory.cpp index 71dbfe45..1d85042d 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory.cpp @@ -172,8 +172,7 @@ void moduleAddObjectFactory(py::module &m) { py::class_ factory (m, "ObjectFactory", sofapython3::doc::objectmodel::ObjectFactoryClass); - py::class_ entry(m, "ClassEntry", - sofapython3::doc::objectmodel::ClassEntryClass); + py::class_ entry(m, "ClassEntry", sofapython3::doc::objectmodel::ClassEntryClass); entry.def_property_readonly("className", &className); entry.def_property_readonly("aliases", &aliases); entry.def_property_readonly("description", &description); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory_doc.h index db569fb0..35f84283 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ObjectFactory_doc.h @@ -23,7 +23,7 @@ namespace sofapython3::doc::objectmodel { static auto ObjectFactoryClass = R"( - Main class used to register and dynamically create objects. + Class used to register and dynamically create objects It uses the Factory design pattern, where each class is registered in a map, and dynamically retrieved given the type name. @@ -33,9 +33,7 @@ static auto ObjectFactoryClass = )"; static auto ClassEntryClass = - R"( - Record storing information about a class - )"; + R"(Record storing information about a class)"; static auto ObjectFactory_getEntry = R"( diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PointSetTopologyModifier.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PointSetTopologyModifier.cpp index 04b1ca2e..a02d3621 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PointSetTopologyModifier.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PointSetTopologyModifier.cpp @@ -37,7 +37,7 @@ using namespace sofa::core::topology; namespace sofapython3 { void moduleAddPointSetTopologyModifier(py::module& m) { - py::class_> c(m, "PointSetTopologyModifier"); + py::class_> c(m, "PointSetTopologyModifier", "Topology modifications associated to a set of points"); /// register the PointSetTopologyModifier binding in the downcasting subsystem PythonFactory::registerType([](sofa::core::objectmodel::Base* object) { diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Prefab.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Prefab.cpp index c55bc18f..dfdd2cc3 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Prefab.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Prefab.cpp @@ -72,7 +72,7 @@ void Prefab_Trampoline::doReInit() void moduleAddPrefab(py::module &m) { py::class_>(m, "BasePrefab"); + py_shared_ptr>(m, "BasePrefab", "Base class for prefabs (for more see Sofa.prefab)"); py::class_> c (m, "Topology"); + py::class_> c (m, "Topology", "Compatibility topology class (against BaseMeshTopology)"); } } // namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer.cpp index 611233a7..0fbf95c4 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer.cpp @@ -291,7 +291,7 @@ void moduleAddDataContainer(py::module& m) void moduleAddDataContainerContext(py::module& m) { - py::class_ wa(m, "DataContainerContextManager"); + py::class_ wa(m, "DataContainerContextManager", "Container managing context data"); wa.def("__enter__", [](DataContainerContext& wa) { wa.data->beginEditVoidPtr(); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer_doc.h index 8b4b8c5e..3d5c41b9 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataContainer_doc.h @@ -24,7 +24,7 @@ namespace sofapython3::doc::datacontainer { static auto Class = R"( - Classic python container implemented for SOFA data fields. + Classic python container implemented for SOFA data fields )"; diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataLink.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataLink.cpp index 6b8ac694..9ad4932b 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataLink.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataLink.cpp @@ -60,14 +60,14 @@ py::str DataLink::__repr__() void moduleAddDataLink(py::module &m) { - py::class_> l(m, "PrefabLink"); + py::class_> l(m, "PrefabLink", "Link to a prefab"); l.def(py::init()); l.def(py::init()); l.def(py::init()); l.def("getTargetBase", &getTargetBase); l.def("getTargetPath", &getTargetPath); - py::class_> d(m, "DataLink"); + py::class_> d(m, "DataLink", "Stores the connection between two object of type Data"); PythonFactory::registerType("DataLink", [](BaseData* data) -> py::object { return py::cast(reinterpret_cast(data)); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataString.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataString.cpp index e9109828..692510e0 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataString.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataString.cpp @@ -74,7 +74,7 @@ py::object DataString::__getitem__(const py::size_t index) void moduleAddDataString(py::module& m) { - py::class_> s(m, "DataString"); + py::class_> s(m, "DataString", "Data of type string"); PythonFactory::registerType("DataString", [](BaseData* data) -> py::object { return py::cast(reinterpret_cast(data)); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataVectorString.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataVectorString.cpp index a9465645..f6e590a1 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataVectorString.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Data/Binding_DataVectorString.cpp @@ -67,7 +67,7 @@ py::object DataVectorString::__getitem__(const py::size_t index) void moduleAddDataVectorString(py::module& m) { - py::class_> s(m, "DataVectorString"); + py::class_> s(m, "DataVectorString", "Data of type vector"); PythonFactory::registerType("DataVectorString", [](BaseData* data) -> py::object { return py::cast(reinterpret_cast(data)); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp index 546bb435..e68ec871 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp @@ -60,47 +60,43 @@ namespace sofapython3 PYBIND11_MODULE(Core, core) { core.doc() = R"doc( - Scene components - ----------------------- + Contains the general object hierarchy and data structures - Core components - ^^^^^^^^^^^^^^^ + A SOFA simulation is referred as a "scene". A scene contains several object. Each object is implemented as the + aggregation of components. Groups of component are grouped and organized logically using a specific container called + Node. Nodes are hierarchically organized in a scene graph. + For more, see the `SOFA lexicography `_. - .. autosummary:: - :toctree: _autosummary/_autosummary + Commonly used classes: - Sofa.Core.Data - Sofa.Core.Link - Sofa.Core.Node - Sofa.Core.RawPrefab - Sofa.Core.Object - Sofa.Core.Camera + .. autosummary:: + :nosignatures: - Overridable components - ^^^^^^^^^^^^^^^^^^^^^^ + Node + Object + Controller + ForceFieldVec3d + Data - .. autosummary:: - :toctree: _autosummary/_autosummary + Example: + .. code-block:: python - Sofa.Core.Controller - Sofa.Core.ForceField - Sofa.Core.DataEngine + import Sofa.Core + # Create a new node + n = Sofa.Core.Node("MyNode") - Utilitary classes - ^^^^^^^^^^^^^^^^^ + # Create a new node + n = Sofa.Core.Node("MyNode"") + # Add a child node name 'Node2' + n.addChild("Node2") - .. autosummary:: - :toctree: _autosummary/_autosummary + # Add a mechanical component to MyNode + n.addObject("MechanicalObject", name="dofs") + + Sofa.Simulation.init(root) + Sofa.Simulation.print(root) - Sofa.Core.DataDict - Sofa.Core.DataDictIterator - Sofa.Core.DataContainer - Sofa.Core.DataString - Sofa.Core.DataVectorString - Sofa.Core.LinkPath - Sofa.Core.NodeIterator - #Sofa.Core.WriteAccessor )doc"; moduleAddPythonScriptEvent(); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_MessageHandler.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_MessageHandler.cpp index 61af509f..9c4d5c5a 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_MessageHandler.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_MessageHandler.cpp @@ -85,7 +85,9 @@ namespace sofapython3 void moduleAddMessageHandler(py::module &m) { - py::class_ f(m, "MessageHandler", py::dynamic_attr()); + py::class_ f(m, "MessageHandler", py::dynamic_attr(), "Manages and processes messages"); + + m.doc() = "Manages the message API"; f.def(py::init([]() { diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_Vector.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_Vector.cpp index ef4768bc..b6f18975 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_Vector.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_Vector.cpp @@ -47,11 +47,12 @@ PYBIND11_MAKE_OPAQUE(std::vector); template void declareVector(py::module &m, const std::string &typestr) { std::string std_pyclass_name = std::string("StdVector") + typestr; - auto v = py::bind_vector>(m, std_pyclass_name); + std::string std_pyclass_doc = std::string("Standard vector of ") + typestr; + auto v = py::bind_vector>(m, std_pyclass_name, std_pyclass_doc.c_str()); std::string pyclass_name = std::string("Vector") + typestr; - - py::class_> (m, pyclass_name.c_str(), v); + std::string pyclass_doc = std::string("Vector of ") + typestr; + py::class_> (m, pyclass_name.c_str(), v, pyclass_doc.c_str()); } namespace sofapython3 { @@ -69,4 +70,4 @@ void moduleAddVector(py::module &m) { declareVector(m, "BaseData"); } -} /// namespace sofapython3 \ No newline at end of file +} /// namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Helper/Submodule_Helper.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Helper/Submodule_Helper.cpp index 85d11514..19f33fb4 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Helper/Submodule_Helper.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Helper/Submodule_Helper.cpp @@ -110,45 +110,43 @@ PYBIND11_MODULE(Helper, helper) sofa::helper::init(); helper.doc() = R"doc( - Utility functions - ----------------------- - The 'info' messages are emitted *only* when the object.printLog is - set to True. - - Examples: - - .. code-block:: python - - msg_info("something bad happens") - msg_info(sofaObject, "something bad happens") - msg_info(sofaNode, "something bad happens") - msg_info(emitting_file, emitting_loc, "something bad happens") - msg_info(sofaObject, "something bad happens", emitting_file, emitting_loc) - msg_info(sofaNode, "something bad happens", emitting_file, emitting_loc) - - Notes: - The way the message are printed depends on the application. - Messages can be routed the console, log files, GUI or ignored. - - .. autosummary:: - Sofa.Helper.msg_info - Sofa.Helper.msg_warning - Sofa.Helper.msg_error - Sofa.Helper.msg_deprecated - Sofa.Helper.msg_fatal + Allows to create vectors of different types, or to print messages + + SOFA provides a fully feature messaging system allowing to emit messages. + The way the message are printed depends on the application. Messages can be routed the console, log files, + GUI or ignored. + + There are several kind of messages. + + The 'info' messages are emitted *only* when the object.printLog is set to True. + The 'warning' messages are emitted when the object want the user to be informed. + The 'error' messages are emitted when the object cannot perform as expected. + The 'deprecated' messages are indicating that some feature are now deprecated and thus be fixed as soon as possible. + In general we provide updates tips with deprecated messages. + + Example: + .. code-block:: python + + msg_error("something bad happens") + msg_error(sofaObject, "something bad happens") + msg_warning(sofaNode, "something happens that sofaNode must be award of") + msg_warning(emitting_file, emitting_loc, "something bad happens at given location") + msg_info(sofaObject, "something happens", emitting_file, emitting_loc) + msg_info(sofaNode, "something happens", emitting_file, emitting_loc) + )doc"; helper.def("msg_info", [](py::args args) { MESSAGE_DISPATCH(msg_info); }, - R"(Emit an info message from python.)" + R"(Emit an info message from python)" ); helper.def("msg_warning", [](py::args args) { MESSAGE_DISPATCH(msg_warning); }, - R"(Emit a warning message from python.)"); + R"(Emit a warning message from python)"); helper.def("msg_error", [](py::args args) { MESSAGE_DISPATCH(msg_error); }, - R"(Emit an error message from python.)"); + R"(Emit an error message from python)"); helper.def("msg_deprecated", [](py::args args) { MESSAGE_DISPATCH(msg_deprecated); }, - R"(Emit a deprecated message from python.)"); + R"(Emit a deprecated message from python)"); helper.def("msg_fatal", [](py::args args) { MESSAGE_DISPATCH(msg_fatal); }, - R"(Emit a fatal error message from python.)"); + R"(Emit a fatal error message from python)"); moduleAddMessageHandler(helper); moduleAddVector(helper); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp index 28acf918..fd4710b4 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp @@ -61,25 +61,36 @@ PYBIND11_MODULE(Simulation, simulation) simulation.def("print", [](Node* n){ sofa::simulation::node::print(n); }, sofapython3::doc::simulation::print); simulation.def("animate", [](Node* n, SReal dt=0.0){ sofa::simulation::node::animate(n, dt); },sofapython3::doc::simulation::animate); - simulation.def("init", [](Node* n){ sofa::simulation::node::initRoot(n); }, sofapython3::doc::simulation::init); - simulation.def("initVisual", [](Node* n){ n->getVisualLoop()->initStep(sofa::core::visual::VisualParams::defaultInstance()); }); + simulation.def("init", [](Node* n){ sofa::simulation::node::init(n); }, sofapython3::doc::simulation::init); + simulation.def("initVisual", [](Node* n){ n->getVisualLoop()->initStep(sofa::core::visual::VisualParams::defaultInstance()); }, sofapython3::doc::simulation::initVisual); simulation.def("reset", [](Node* n){ sofa::simulation::node::reset(n); }, sofapython3::doc::simulation::reset); - simulation.def("load", [](const std::string & name) { + + simulation.def("load", [](const std::string & name) + { sofa::simulation::Node::SPtr node = sofa::simulation::node::load(name); return node ? py::cast(node.get()) : py::none(); }, sofapython3::doc::simulation::load); - simulation.def("unload", [](Node* n){ + + simulation.def("unload", [](Node* n) + { auto& memcache = getObjectCache(); sofa::simulation::node::unload(n); memcache.clear(); - }, sofapython3::doc::simulation::unload); - simulation.def("animateNSteps", [](Node *n, int n_steps, SReal dt=0.0){ + }, sofapython3::doc::simulation::unload); + + simulation.def("animateNSteps", [](Node *n, int n_steps, SReal dt=0.0) + { for (int i = 0; i < n_steps; i++) { sofa::simulation::node::animate(n, dt); //Execute one timestep. If dt is 0, the dt parameter in the graph will be used } }, sofapython3::doc::simulation::animateNSteps, py::arg("root_node"), py::arg("n_steps") = 1, py::arg("dt") = 0.0); - simulation.def("updateVisual", [](Node* n){ sofa::simulation::node::updateVisual(n); }); + + simulation.def("updateVisual", [](Node* n) + { + sofa::simulation::node::updateVisual(n); + }, sofapython3::doc::simulation::updateVisual); + simulation.def("initTextures", [](Node* n) { sofa::simulation::node::initTextures(n); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation_doc.h b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation_doc.h index 93a21d91..19f6c806 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation_doc.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation_doc.h @@ -23,12 +23,10 @@ namespace sofapython3::doc::simulation { static auto Class = R"( - Controlling a simulation - ------------------------ - Main controller of the scene. - It defines how the scene is inited at the beginning, and updated at each time step. + Defines how the scene is inited at the beginning, and updated at each time step + It derives from Base in order to use smart pointers and model the parameters as Datas, - which makes their edition easy in the GUI. + which makes their edition easy in the GUI Example: @@ -41,57 +39,64 @@ static auto Class = n = Sofa.Core.Node("MyNode") Sofa.Simulation.init(n) Sofa.Simulation.print(n) - - Functions: - - .. autosummary:: - Sofa.Simulation.animate - Sofa.Simulation.init - Sofa.Simulation.print - Sofa.Simulation.reset - Sofa.Simulation.load - Sofa.Simulation.unload - Sofa.Simulation.animateNSteps )"; static auto print = R"( - Print all objects in the graph. + Print all objects in the graph )"; static auto init = R"( - Initialize the objects. + Initialize the objects + )"; + +static auto initVisual = + R"( + Initialize the textures and other graphical resources )"; static auto animate = R"( - Execute one timestep. If dt is 0, the dt parameter in the graph will be used. + Execute one timestep + If dt is 0, the dt parameter in the graph will be used. :param dt: the duration of the step. + )"; static auto reset = R"( - Reset to initial state. + Reset to initial state )"; static auto load = R"( - Load a scene from a file. + Load a scene from a file + :param filename: name of the file to be loaded - :param reload: default to false. It signals if the scene is being reloaded or loaded for - the first time. + :param reload: default to false. It signals if the scene is being reloaded or loaded for the first time. :param sceneArgs: default to an empty vector. Contains the arguments of the scene. + )"; static auto unload = R"( - Unload a scene from a Node. + Unload a scene from a Node )"; static auto animateNSteps = R"( - Advance the simulation by one time step (by default). + Advance the simulation by one time step (by default) n_steps: specifies number of steps to advance the simulation by. The simulation visual is not updated between steps. Default is 1. dt: specifies the time delta between two simulation steps. Default is 0 -> uses the dt from the simulation node. )"; + +static auto updateVisual = + R"( + Update the Visual Models: triggers the Mappings + )"; + +static auto initTextures = + R"( + Initialize the textures + )"; } diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Types/Binding_BoundingBox.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Types/Binding_BoundingBox.cpp index a56fb9c3..787c37f5 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Types/Binding_BoundingBox.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Types/Binding_BoundingBox.cpp @@ -36,6 +36,10 @@ void moduleAddBoundingBox(py::module& m) { py::class_, sofa::core::objectmodel::BaseData, std::unique_ptr, pybind11::nodelete> > bbox(m, "BoundingBox"); + bbox.doc() = R"doc( + A box in 3D space. + )doc"; + bbox.def("getMin", [](sofa::Data& bbox) { py::list list; list.append(bbox.getValue().minBBox()[0]); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Types/Submodule_Types.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Types/Submodule_Types.cpp index be65bed8..e79aa174 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Types/Submodule_Types.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Types/Submodule_Types.cpp @@ -34,13 +34,7 @@ PYBIND11_MODULE(Types, types) sofa::defaulttype::init(); types.doc() = R"doc( - Default data types - ------------------------------- - - .. autosummary:: - Sofa.Types.BoundingBox - ... - + Defines SOFA types (BoundingBox) )doc"; moduleAddBoundingBox(types); diff --git a/bindings/Sofa/tests/Core/ForceField.py b/bindings/Sofa/tests/Core/ForceField.py index 32cc388f..7f412cbc 100644 --- a/bindings/Sofa/tests/Core/ForceField.py +++ b/bindings/Sofa/tests/Core/ForceField.py @@ -41,6 +41,7 @@ def createParticle(node, node_name, use_implicit_scheme, use_iterative_solver): def rssffScene(use_implicit_scheme=True, use_iterative_solver=True): node = Sofa.Core.Node("root") + node.addObject('DefaultAnimationLoop') node.addObject("RequiredPlugin", name="Sofa.Component.StateContainer") node.addObject("RequiredPlugin", name="Sofa.Component.LinearSolver") node.addObject("RequiredPlugin", name="Sofa.Component.ODESolver") diff --git a/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter.cpp b/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter.cpp index 2fb309b8..32f0f51d 100644 --- a/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter.cpp +++ b/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter.cpp @@ -41,9 +41,9 @@ void moduleAddSTLExporter(py::module &m) return py::cast(dynamic_cast(object)); }); - py::class_> p(m, "STLExporter"); + py::class_> p(m, "STLExporter", sofapython3::doc::SofaExporter::STLExporter::docstring); - p.def("write", &STLExporter::write, sofapython3::doc::SofaExporter::STLExporter::write::docstring); + p.def("write", &STLExporter::write); } } // namespace sofapython3 diff --git a/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter_doc.h b/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter_doc.h index b894027c..fbd67c76 100644 --- a/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter_doc.h +++ b/bindings/SofaExporter/src/SofaExporter/Binding_STLExporter_doc.h @@ -20,18 +20,18 @@ #pragma once -namespace sofapython3::doc::SofaExporter::STLExporter::write + +namespace sofapython3::doc::SofaExporter::STLExporter { static auto docstring = R"( Exports an STL file - --------------------------------------- Will export a binary or ascii file depending on the binary flag of STLExporter Will auto-number the exported files - Example of use: + Example: .. code-block:: python import Sofa diff --git a/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter.cpp b/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter.cpp index dd4f820d..b9dcdfae 100644 --- a/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter.cpp +++ b/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter.cpp @@ -39,12 +39,9 @@ void moduleAddVisualModelOBJExporter(py::module &m) return py::cast(dynamic_cast(object)); }); - py::class_> p(m, "VisualModelOBJExporter"); + py::class_> p(m, "VisualModelOBJExporter", sofapython3::doc::SofaExporter::VisualModelOBJExporter::docstring); - p.def("write", &VisualModelOBJExporter::write, sofapython3::doc::SofaExporter::VisualModelOBJExporter::write::docstring); - - SOFA_ATTRIBUTE_DISABLED("v21.12", "PR#2505", "The OBJExporter class has been renamed in VisualModelOBJExporter.") - py::class_> p_deprecated(m, "OBJExporter"); + p.def("write", &VisualModelOBJExporter::write); } } // namespace sofapython3 diff --git a/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter_doc.h b/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter_doc.h index 37d89770..0b3ee458 100644 --- a/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter_doc.h +++ b/bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter_doc.h @@ -20,17 +20,16 @@ #pragma once -namespace sofapython3::doc::SofaExporter::VisualModelOBJExporter::write { +namespace sofapython3::doc::SofaExporter::VisualModelOBJExporter { static auto docstring = R"( - Exports an OBJ file - --------------------------------------- + Export all VisualModels of a simulation with the .obj format Will export a binary or ascii file depending on the binary flag of VisualModelOBJExporter Will auto-number the exported files - Example of use: + Example: .. code-block:: python import Sofa diff --git a/bindings/SofaExporter/src/SofaExporter/Module_SofaExporter.cpp b/bindings/SofaExporter/src/SofaExporter/Module_SofaExporter.cpp index 154583ca..91db0d86 100644 --- a/bindings/SofaExporter/src/SofaExporter/Module_SofaExporter.cpp +++ b/bindings/SofaExporter/src/SofaExporter/Module_SofaExporter.cpp @@ -29,22 +29,12 @@ namespace sofapython3 PYBIND11_MODULE(SofaExporter, m) { m.doc() = R"doc( - Binding for the SofaExporter plugin - ----------------------------------- + Export in STL or OBJ from from a SOFA simulation - Provides python bindings for the SofaExporter module + Example: + .. code-block:: python - Example of use: - - .. code-block:: python - - import SofaExporter - - .. autosummary:: - :toctree: _autosummary/_autosummary - - SofaExporter.STLExporter - SofaExporter.VisualModelOBJExporter + import SofaExporter )doc"; diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_BaseGui.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_BaseGui.cpp index 35186198..cc0d6717 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_BaseGui.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_BaseGui.cpp @@ -30,7 +30,7 @@ using sofa::simulation::Node; void moduleAddBaseGui(py::module& m) { - py::class_> baseGUI(m, "BaseGUI"); + py::class_> baseGUI(m, "BaseGUI", "Base class defining all methods each GUI must implement"); /* * Sofa.Gui.BaseGUI.SetBackgroundImage diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp index c7869e51..caf882f7 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp @@ -32,7 +32,7 @@ namespace sofapython3 { void moduleAddGuiManager(py::module& m) { - py::class_ guiManager(m, "GUIManager"); + py::class_ guiManager(m, "GUIManager", "Class managing the GUI creation, closing and its properties"); /* * Sofa.Gui.GUIManager.ListSupportedGUI diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp index 048133a9..486a0354 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp @@ -53,12 +53,11 @@ namespace sofapython3 { PYBIND11_MODULE(Gui, m) { m.doc() = R"doc( - Sofa.Gui - ----------------------- - - Example of use: + Controls the graphical user interface + Example: .. code-block:: python + import Sofa.Gui supported_gui = Sofa.Gui.GUIManager.ListSupportedGUI(",") @@ -69,10 +68,6 @@ PYBIND11_MODULE(Gui, m) { Sofa.Gui.GUIManager.MainLoop(root) Sofa.Gui.GUIManager.closeGUI() - - .. automodule:: Gui - :toctree: _autosummary - :members: )doc"; #ifdef HAS_GUI_QT diff --git a/bindings/SofaRuntime/package/__init__.py b/bindings/SofaRuntime/package/__init__.py index c8954853..19de08ba 100644 --- a/bindings/SofaRuntime/package/__init__.py +++ b/bindings/SofaRuntime/package/__init__.py @@ -1,10 +1,13 @@ -""" -SofaRuntime package ------------------------ +"""Control of the application runtime + + Example: + .. code-block:: python + import SofaRuntime + SofaRuntime.importPlugin("Sofa.Component.LinearSolver") """ -from .SofaRuntime import * +from SofaRuntime.SofaRuntime import * import Sofa @@ -26,13 +29,6 @@ Sofa.msg_error("SofaRuntime", 'numpy is mandatory for SofaPython3') sys.exit(1) -try: - import scipy -except ModuleNotFoundError as error: - Sofa.msg_warning("SofaRuntime",str(error)) - Sofa.msg_warning("SofaRuntime", "scipy is strongly recommended for SofaPython3") - pass - # Keep a list of the modules always imported in the Sofa-PythonEnvironment try: __SofaPythonEnvironment_importedModules__ @@ -43,9 +39,9 @@ # e.g. plugin's modules defined from c++ __SofaPythonEnvironment_modulesExcludedFromReload = [] - def unloadModules(): - """ call this function to unload python modules and to force their reload + """ Call this function to unload python modules and to force their reload + (useful to take into account their eventual modifications since their last import). """ @@ -59,13 +55,19 @@ def unloadModules(): ################################################################ def formatStackForSofa(o): - """ format the stack trace provided as a parameter into a string like that: - in filename.py:10:functioname() - -> the line of code. - in filename2.py:101:functioname1() - -> the line of code. - in filename3.py:103:functioname2() - -> the line of code. + """ Format the stack trace provided as parameter + + The parameter is converted into a string like that + + .. code-block:: text + + in filename.py:10:functioname() + -> the line of code. + in filename2.py:101:functioname1() + -> the line of code. + in filename3.py:103:functioname2() + -> the line of code. + """ ss='Python Stack: \n' for entry in o: @@ -75,14 +77,14 @@ def formatStackForSofa(o): def getStackForSofa(): - """returns the current stack with a "informal" formatting. """ + """Returns the current stack with a "informal" formatting """ ## we exclude the first level in the stack because it is the getStackForSofa() function itself. ss=inspect.stack()[1:] return formatStackForSofa(ss) def getPythonCallingPointAsString(): - """returns the last entry with an "informal" formatting. """ + """Returns the last entry with an "informal" formatting """ ## we exclude the first level in the stack because it is the getStackForSofa() function itself. ss=inspect.stack()[-1:] @@ -90,7 +92,7 @@ def getPythonCallingPointAsString(): def getPythonCallingPoint(): - """returns the tupe with closest filename & line. """ + """Returns the tupe with closest filename and line """ ## we exclude the first level in the stack because it is the getStackForSofa() function itself. ss=inspect.stack()[1] tmp=(os.path.abspath(ss[1]), ss[2]) @@ -101,22 +103,27 @@ def getPythonCallingPoint(): ###################### EXCEPTION HANDLING (NECESSARY?) ###################### ############################################################################# -def sendMessageFromException(e): +def getSofaFormattedStringFromException(e): + """Function handling exception using `sofaFormatHandler()` (python stack)""" exc_type, exc_value, exc_tb = sys.exc_info() - sofaExceptHandler(exc_type, exc_value, exc_tb) - + return sofaFormatHandler(exc_type, exc_value, exc_tb) def sofaFormatHandler(type, value, tb): - global oldexcepthook - """This exception handler, convert python exceptions & traceback into more classical sofa error messages of the form: - Message Description - Python Stack (most recent are at the end) - File file1.py line 4 ... - File file1.py line 10 ... - File file1.py line 40 ... - File file1.py line 23 ... - faulty line + """This exception handler forwards python exceptions & traceback + + Example of formatting: + + .. code-block:: text + + Python Stack (most recent are at the end) + File file1.py line 4 ... + File file1.py line 10 ... + File file1.py line 40 ... + File file1.py line 23 ... + """ + global oldexcepthook + s="\nPython Stack (most recent are at the end): \n" for line in traceback.format_tb(tb): s += line @@ -124,21 +131,28 @@ def sofaFormatHandler(type, value, tb): return repr(value)+" "+s -def getSofaFormattedStringFromException(e): +def sendMessageFromException(e): + """Function handling exception using `sofaExceptHandler()` (SOFA format)""" exc_type, exc_value, exc_tb = sys.exc_info() - return sofaFormatHandler(exc_type, exc_value, exc_tb) + sofaExceptHandler(exc_type, exc_value, exc_tb) + def sofaExceptHandler(type, value, tb): - global oldexcepthook - """This exception handler, convert python exceptions & traceback into more classical sofa error messages of the form: - Message Description - Python Stack (most recent are at the end) - File file1.py line 4 ... - File file1.py line 10 ... - File file1.py line 40 ... - File file1.py line 23 ... - faulty line + """This exception handler converts python exceptions & traceback into classical SOFA error messages + + Message: + + .. code-block:: text + + Python Stack (most recent are at the end) + File file1.py line 4 ... + File file1.py line 10 ... + File file1.py line 40 ... + File file1.py line 23 ... + """ + global oldexcepthook + h = type.__name__ if str(value) != '': diff --git a/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Module_SofaRuntime.cpp b/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Module_SofaRuntime.cpp index a964ed17..db70b874 100644 --- a/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Module_SofaRuntime.cpp +++ b/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Module_SofaRuntime.cpp @@ -94,24 +94,7 @@ static std::vector getCategories(const std::string& className) /// The first parameter must be named the same as the module file to load. PYBIND11_MODULE(SofaRuntime, m) { - - m.doc() = R"doc( - Expose aspect specific to the application/runtime - ------------------------------------------------- - - .. autosummary:: - :toctree:_autosummary/_autosummary - - SofaRuntime.importPlugin - - - Example of use: - .. code-block:: python - - import SofaRuntime - SofaRuntime.importPlugin("Sofa.Component.LinearSolver") - - )doc"; + m.doc() = R"doc(Control of the SofaRuntime)doc"; // Add the plugin directory to PluginRepository const std::string& pluginDir = Utils::getExecutableDirectory(); diff --git a/bindings/SofaTypes/package/__init__.py b/bindings/SofaTypes/package/__init__.py index 02238b8f..2db0a8d6 100644 --- a/bindings/SofaTypes/package/__init__.py +++ b/bindings/SofaTypes/package/__init__.py @@ -1,7 +1,6 @@ """ -SofaType package ------------------------ +Defines all DataTypes for vector and matrices (Vec and Mat) """ -from .SofaTypes import * \ No newline at end of file +from .SofaTypes import * diff --git a/constants/__init__.py b/constants/__init__.py index 51462ddf..62bc550b 100644 --- a/constants/__init__.py +++ b/constants/__init__.py @@ -1,17 +1,10 @@ """ -Constants library ------------------ -Library for an easier keyboard interaction +Constant library for an easier keyboard interaction. -Submodules: - .. autosummary:: - Sofa.constants.Key - Sofa.constants.KeyCode - -:Example of use: - The following scene creates a Controller that will print a custom message in the command line when a key is pressed, - using constants from Sofa.constants.Key +Example: +The following scene creates a Controller that will print a custom message in the command line when a key is pressed, +using constants from Sofa.constants.Key .. code-block:: python @@ -62,9 +55,9 @@ def onKeypressedEvent(self, event): def onKeyreleasedEvent(self, event): print("You released a key!") - def createScene(rootNode): - rootNode.addObject(KeyPressedController(name = "MyController")) - return rootNode + def createScene(rootNode): + rootNode.addObject(KeyPressedController(name = "MyController")) + return rootNode """ diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4e8bd795..a80613a6 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -2,11 +2,11 @@ project(Documentation) set(DOCUMENTATION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/index.rst - ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/Compilation.rst - ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/Contributing.rst - ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/SofaPlugin.rst - ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/SofaModule.rst - ${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/CustomModule.rst + #${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/Compilation.rst + #${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/Contributing.rst + #${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/SofaPlugin.rst + #${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/SofaModule.rst + #${CMAKE_CURRENT_SOURCE_DIR}/sphinx/source/menu/CustomModule.rst ) add_custom_target(${PROJECT_NAME} SOURCES ${DOCUMENTATION_FILES}) diff --git a/docs/make-stub.sh b/docs/make-stub.sh deleted file mode 100755 index b0054424..00000000 --- a/docs/make-stub.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -## Generate the stubs for the C plugins for code inspection tools or sphinx/readthedocs. -## To make stubs: https://github.com/sizmailov/pybind11-stubgen with patch from SofaDefrost. -#export PYTHONPATH=/home/bruno/dev/sofa/build/lib/site-packages/ -pybind11-stubgen -o stubs Sofa -pybind11-stubgen -o stubs SofaRuntime -cp -r stubs $PYTHONPATH -rm -rf sphinx\-stubs/* -mv stubs/Sofa-stubs sphinx\-stubs/Sofa -mv stubs/SofaRuntime-stubs sphinx\-stubs/SofaRuntime -find sphinx\-stubs -name '*.pyi' -exec sh -c 'mv "$0" "${0%.pyi}.py"' {} \; - - diff --git a/docs/sphinx-stubs/Sofa/Core/__init__.pyi b/docs/sphinx-stubs/Sofa/Core/__init__.pyi deleted file mode 100644 index 99e88bc0..00000000 --- a/docs/sphinx-stubs/Sofa/Core/__init__.pyi +++ /dev/null @@ -1,1760 +0,0 @@ -""" - Scene components - ----------------------- - - Core components - ^^^^^^^^^^^^^^^ - - .. autosummary:: - :toctree: _autosummary/_autosummary - - Sofa.Core.Data - Sofa.Core.Link - Sofa.Core.Node - Sofa.Core.RawPrefab - Sofa.Core.Object - Sofa.Core.Camera - - Overridable components - ^^^^^^^^^^^^^^^^^^^^^^ - - .. autosummary:: - :toctree: _autosummary/_autosummary - - Sofa.Core.Controller - Sofa.Core.ForceField - Sofa.Core.DataEngine - - - Utilitary classes - ^^^^^^^^^^^^^^^^^ - - .. autosummary:: - :toctree: _autosummary/_autosummary - - Sofa.Core.DataDict - Sofa.Core.DataDictIterator - Sofa.Core.DataContainer - Sofa.Core.DataString - Sofa.Core.DataVectorString - Sofa.Core.NodeIterator - #Sofa.Core.WriteAccessor - """ -import Sofa.Core -import typing -import numpy -_Shape = typing.Tuple[int, ...] - -__all__ = [ - " - Record storing information about a class - ", - "Base", - "BaseContext", - "BaseMeshTopology", - "BaseNode", - "BasePrefab", - "Camera", - "ContactListener", - "Context", - "Controller", - "Data", - "DataContainer", - "DataContainerContextManager", - "DataDict", - "DataDictIterator", - "DataEngine", - "DataLink", - "DataString", - "DataVectorString", - "ForceFieldRigid2d", - "ForceFieldRigid3d", - "ForceFieldVec1d", - "ForceFieldVec2d", - "ForceFieldVec3d", - "Link", - "Node", - "NodeIterator", - "Object", - "ObjectFactory", - "PrefabLink", - "RawPrefab", - "Topology" -] - - -class - Record storing information about a class - (): - @property - def aliases(self) -> None: - """ - :type: None - """ - @property - def authors(self) -> None: - """ - :type: None - """ - @property - def className(self) -> None: - """ - :type: None - """ - @property - def dataAlias(self) -> None: - """ - :type: None - """ - @property - def defaultTemplate(self) -> None: - """ - :type: None - """ - @property - def description(self) -> None: - """ - :type: None - """ - @property - def license(self) -> None: - """ - :type: None - """ - @property - def locations(self) -> None: - """ - :type: None - """ - @property - def targets(self) -> None: - """ - :type: None - """ - @property - def templates(self) -> None: - """ - :type: None - """ - pass -class Base(): - """ - Sofa.Core.Base is the root of the Sofa class Hierarhcy - All objects are in-heriting from this one. - - """ - def __getattr__(self, arg0: str) -> object: ... - def __setattr__(self, arg0: str, arg1: object) -> None: ... - @staticmethod - def addData(*args, **kwargs) -> typing.Any: - """ - Create a data field, then adds it to the base. - Note that this method should only be called if the field was not initialized with the initData method - :param self: the base itself - :param name: the name of the data to be added - :param value: the value from which the data can be created - :param help: help message that describes the data to be created - :param group: the group the data belongs to - :param type: the type of the data - :type self: object - :type name: string - :type value: object - :type help: string - :type group: string - :type type: string - - - - Add a data field. - Note that this method should only be called if the field was not initialized with the initData method - :param self: the base itself - :param d: the data to be added - :type self: Base* - :type d: object - - """ - @staticmethod - def addLink(*args, **kwargs) -> typing.Any: - """ - Create a Link to a SOFA component and adds it to the base. - Note that this method should only be called if the field was not initialized with the initLink method - :param self: the base itself - :param name: the name of the link to be added - :param value: the value from which the data can be created (either a pathname or a SofaBase) - :param help: help message that describes the link to be created - :type self: object - :type name: string - :type value: object - :type help: string - - """ - def clearLoggedMessages(self) -> object: - """ - Remove all logged messages in the object's logs. - - """ - def countLoggedMessages(self) -> object: - """ - Returns the number of messages in the object's logs. - - """ - @staticmethod - def findData(*args, **kwargs) -> typing.Any: - """ - Find a data field given its name. - Return NULL if not found. - If more than one field is found (due to aliases), only the first is returned. - :param name - :type name: string - :return: the data field - - """ - @staticmethod - def findLink(*args, **kwargs) -> typing.Any: - """ - Find a link given its name. - Return NULL if not found. - If more than one link is found (due to aliases), only the first is returned. - :param name: the name of the link - :type name: string - :return: the link - - """ - @staticmethod - def getClass(*args, **kwargs) -> typing.Any: - """ - Return the class of the object - - """ - def getClassName(self) -> str: - """ - Get the name of the class of the Base. - - """ - def getData(self, arg0: str) -> object: - """ - Get the data field given its name. - :param self: - :param s: - :type self: Base& - :type s: string - :return: the first data found of this name - - """ - def getDataFields(self) -> list: - """ - Accessor to the vector containing all the fields of this object - :return: A vector containing the data fields - - """ - def getDefinitionSourceFileName(self) -> str: - """ - Returns the name of the file that contains the object definition. - """ - def getDefinitionSourceFilePos(self) -> int: - """ - Returns the line number where the object is defined. - """ - def getInstanciationFileName(self) -> str: - """ - Returns the line number where the object is instanciatiated. - """ - def getInstanciationSourceFilePos(self) -> int: - """ - Returns the line number where the object is instanciatiated. - """ - def getLinks(self) -> list: - """ - Accessor to the vector containing all the links of this object - :return: A vector containing the links - - """ - def getLoggedMessagesAsString(self) -> object: - """ - Returns a single string with all the messages logged in the internal buffer of a sofa object. - Return empty string if there is no messages. - - """ - def getName(self) -> str: - """ - Return the name of the entity - :rtype: string - - """ - def getPathName(self) -> str: ... - def getTemplateName(self) -> str: - """ - Get the name of the template of the Base. - - """ - def setDataValues(self, **kwargs) -> object: - """ - Set values for a the given data field, multiple pairs of args are allowed. - - """ - def setDefinitionSourceFileName(self, arg0: str) -> None: - """ - set the name of the file that contains the object definition. - """ - def setDefinitionSourceFilePos(self, arg0: int) -> None: - """ - Set the line number where the object is defined. - """ - def setInstanciationSourceFileName(self, arg0: str) -> None: - """ - Set the line number where the object is instanciatiated. - """ - def setInstanciationSourceFilePos(self, arg0: int) -> None: - """ - Set the line number where the object is instanciatiated. - """ - def setName(self, arg0: str) -> None: - """ - Set the name of this object - :param n - :type n: string - - """ - pass -class BaseContext(Base): - class SearchDirection(): - """ - Members: - - SearchUp - - Local - - SearchDown - - SearchRoot - - SearchParents - """ - def __eq__(self, other: object) -> bool: ... - def __getstate__(self) -> int: ... - def __hash__(self) -> int: ... - def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... - def __int__(self) -> int: ... - def __ne__(self, other: object) -> bool: ... - def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... - @property - def name(self) -> str: - """ - :type: str - """ - @property - def value(self) -> int: - """ - :type: int - """ - Local: Sofa.Core.BaseContext.SearchDirection # value = - SearchDown: Sofa.Core.BaseContext.SearchDirection # value = - SearchParents: Sofa.Core.BaseContext.SearchDirection # value = - SearchRoot: Sofa.Core.BaseContext.SearchDirection # value = - SearchUp: Sofa.Core.BaseContext.SearchDirection # value = - __members__: dict # value = {'SearchUp': , 'Local': , 'SearchDown': , 'SearchRoot': , 'SearchParents': } - pass - def __str__(self) -> str: - """ - Get a string representation of the context. - """ - def canChangeSleepingState(self) -> bool: - """ - Whether the context can change its sleeping state or not - """ - def getAnimate(self) -> bool: - """ - Animation flag - """ - def getDt(self) -> float: - """ - Simulation timestep - """ - @staticmethod - def getGravity(*args, **kwargs) -> typing.Any: - """ - Gravity in local coordinates - """ - @staticmethod - def getMass(*args, **kwargs) -> typing.Any: - """ - Mass - """ - @staticmethod - def getMechanicalState(*args, **kwargs) -> typing.Any: - """ - Mechanical Degrees-of-Freedom - """ - @staticmethod - def getMeshTopology(*args, **kwargs) -> typing.Any: - """ - Mesh Topology (unified interface for both static and dynamic topologies) - """ - @staticmethod - def getMeshTopologyLink(*args, **kwargs) -> typing.Any: - """ - Mesh Topology (unified interface for both static and dynamic topologies) - """ - def getRootContext(self) -> BaseContext: - """ - Get the root context of the graph - """ - @staticmethod - def getState(*args, **kwargs) -> typing.Any: - """ - Mechanical Degrees-of-Freedom - """ - def getTime(self) -> float: - """ - Simulation time - """ - @staticmethod - def getTopology(*args, **kwargs) -> typing.Any: - """ - Topology - """ - def isActive(self) -> bool: - """ - The Context is active - """ - def isSleeping(self) -> bool: - """ - Sleeping state of the context - """ - def setActive(self, arg0: bool) -> None: - """ - State of the context - """ - def setAnimate(self, arg0: bool) -> None: - """ - Animation flag - """ - def setChangeSleepingState(self, arg0: bool) -> None: - """ - Sleeping state change of the context - """ - def setDt(self, arg0: float) -> None: - """ - Simulation timestep - """ - @staticmethod - def setGravity(*args, **kwargs) -> typing.Any: - """ - Gravity in local coordinates - """ - def setSleeping(self, arg0: bool) -> None: - """ - Sleeping state of the context - """ - Local: Sofa.Core.BaseContext.SearchDirection # value = - SearchDown: Sofa.Core.BaseContext.SearchDirection # value = - SearchParents: Sofa.Core.BaseContext.SearchDirection # value = - SearchRoot: Sofa.Core.BaseContext.SearchDirection # value = - SearchUp: Sofa.Core.BaseContext.SearchDirection # value = - pass -class BaseMeshTopology(Base): - def getEdge(self, index: int) -> typing.List[int[2]]: ... - def getEdgesInTetrahedron(self, index: int) -> typing.List[int[6]]: - """ - Returns the set of edges adjacent to a given tetrahedron. - """ - def getLocalEdgesInTetrahedron(self, index: int) -> typing.List[int[2]]: - """ - Returns for each index (between 0 and 5) the two vertex indices that are adjacent to that edge. - """ - def getNbEdges(self) -> int: ... - def getNbHexahedra(self) -> int: ... - def getNbLines(self) -> int: ... - def getNbPoints(self) -> int: ... - def getNbQuads(self) -> int: ... - def getNbTetrahedra(self) -> int: ... - def getNbTetras(self) -> int: ... - def getNbTriangles(self) -> int: ... - def getTetrahedron(self, index: int) -> typing.List[int[4]]: - """ - Returns the vertices of Tetrahedron at index. - """ - pass -class BaseNode(Base): - pass -class Context(BaseContext, Base): - pass -class Object(Base): - """ - The class object is a base class for simulation components. - - An object defines a part of the functionnality in the simulation - (stores state data, specify topology, compute forces, etc). - Each simulation object is related to a context, which gives access to all available external data. - It is able to process events, if listening enabled (default is false). - - :Example of use: - - .. code-block:: python - - import Sofa.Core - import SofaRuntime - SofaRuntime.importPlugin("SofaComponentAll") - - root = Sofa.Core.Node("root") - root.addObject("MechanicalObject", name="obj") # Add a common Sofa object - root.obj # Access the object - root.obj.name # Access the name of the object - root.obj.position.value # Access the position of the object - - - """ - def __getitem__(self, arg0: str) -> object: - """ - gets an item using its path (path is dot-separated, relative to the object - it's called upon & ONLY DESCENDING (no ../): - - This method lifts most ambiguities when accessing a node, object or data - from a path relative to self. - - examples: - ------------ - - root["node1.node2.object1.value"] - - In the example above, node1 and node2 can be inferred as being nodes without performing any checks. - object1 can be a node or an object, but cannot be a datafield nor a link - value can be a node or an object (if object1 is a node), or must be a data (if object1 is an object) - - """ - def addSlave(self, arg0: Object) -> None: - """ - Add a slave to the master BaseObject. - :param slave: the slave to be added. - :type slave: BaseObject - - """ - def bwdInit(self) -> None: - """ - Initialization method called at graph creation and modification, during bottom-up traversal. - - """ - def cleanup(self) -> None: - """ - Called just before deleting this object - Any object in the tree bellow this object that are to be removed will be removed only after this call, - so any references this object holds should still be valid. - - """ - @staticmethod - @typing.overload - def computeBBox(*args, **kwargs) -> typing.Any: - """ - Bounding Box computation method. - Default to empty method. - - - - Bounding Box computation method. - Default to empty method. - - """ - @typing.overload - def computeBBox(self) -> None: ... - def getAsACreateObjectParameter(self) -> str: - """ - Return the full path name of this baseObject with an extra prefix '@' - :rtype: string - - """ - def getCategories(self) -> object: - """ - Return the list of categories the current object belongs to. - :rtype: list - - """ - def getContext(self) -> object: - """ - Return the conext of the baseObject. - :rtype: BaseContext - - """ - def getLinkPath(self) -> str: - """ - Return the link of the baseObject - :param self: the baseObject itself - :type self: baseObject - :rtype: string - - - - Return the full path name of this baseObject with an extra prefix '@' - :rtype: string - - """ - def getMaster(self) -> object: - """ - Return the master of the baseObject. - :rtype: BaseObject - - """ - def getPathName(self) -> str: - """ - Return the full path name of this baseObject - :rtype: string - - """ - def getSlaves(self) -> list: - """ - Return the slaves of the baseObject. - :rtype: list - - """ - def getTarget(self) -> object: - """ - Return the target (plugin) that contains the current baseObject. - :rtype: string - - """ - def init(self) -> None: - """ - Initialization method called at graph creation and modification, during top-down traversal.Initialize data. - - """ - def reinit(self) -> None: - """ - Update method called when variables used in precomputation are modified. - - """ - def reset(self) -> None: - """ - Reset to initial state. - To save the initial state, see storeResetState(). - - """ - def setSrc(self, arg0: str, arg1: Object) -> None: - """ - Set a source Object and parses it to collect dependent Data. - - """ - def storeResetState(self) -> None: - """ - Save the initial state for later uses in reset() - - """ - pass -class ContactListener(Object, Base): - """ - ContactListener is an API dedicated to the monitoring of two collision models. - - :Example of use: - - .. code-block:: python - - import Sofa.Core - import SofaRuntime - SofaRuntime.importPlugin("SofaComponentAll") - - root = Sofa.Core.Node("root") - model1 = root.addObject("TriangleCollisionModel") - model2 = root.addObject("PointCollisionModel") - listener = root.addObject( - "ContactListener", - collisionModel1=model1.getLinkPath(), - collisionModel2=model2.getLinkPath(), - ) - print(listener.getNumberOfContacts()) - - """ - pass -class Node(BaseNode, Context, BaseContext, Base): - """ - A Node stores other nodes and components. - - A simulation in SOFA is described as a scene with an intrinsic generalized hierarchy. - A scene is composed of nodes organized as a tree or as a Directed Acyclic Graph (DAG). - The different simulated objects are described in separate nodes, and different representations - of a same object can be done in different sub-nodes. - - Example of use: - .. code-block:: python - - import Sofa.Core - - # Create a new node - n = Sofa.Core.Node("MyNode") - - # Create a new node - n = Sofa.Core.Node("MyNode"") - # Add a child node name 'Node2' - n.addChild("Node2") - - # Add a mechanical component to MyNode - n.addObject("MechanicalObject", name="dofs") - - Sofa.Simulation.init(root) - Sofa.Simulation.print(root) - - The child nodes, components and parents can be accessed using generator attributes. - - Example of use: - .. code-block:: python - - # ... - n = Sofa.Core.Node("MyNode") - for child in n.children: - print(child.name) - - for parent in n.parents: - print(parent.name) - - - Accessing children or object from the current node is easy thanks to the generalized access - API. - Example of use: - .. code-block:: python - - # ... - n = Sofa.Core.Node("MyNode") - c1 = n.addChild("child1") - c2 = n.addChild("child2") - c2.addObject("MechanicalObject", name="dofs") - - # retrieve the node child1/child2 from the 'n' node. - n.child1.child2 - - # retrieve the child1/child2/dofs.position position data field from 'n' - n.child1.child2.dofs.position - - # fast access. - n["child1.child2.dofs.position"] - - - """ - def __getattr__(self, arg0: str) -> object: ... - def __getitem__(self, arg0: str) -> object: ... - @typing.overload - def __init__(self) -> None: - """ - Initialize the components of this node and all the nodes which depend on it. - :rtype: Sofa.Simulation.Node - - - - Initialize the components of this node and all the nodes which depend on it. - - :param name: Name of the node to be created - :type name: string - :rtype: Sofa.Simulation.Node - - """ - @typing.overload - def __init__(self, name: str) -> None: ... - def add(self, arg0: object, **kwargs) -> object: - """ - Add an prefab, - example: - def Cube(parentNodes, name="Cube"): - cube = parentNode.addChild(name) - cube.addObject("MechanicalObject") - return cube - - node.add(Cube, name="MyCube"") - - """ - @typing.overload - def addChild(self, arg0: Node) -> Node: - """ - Add a child node - :param self: the node itself - :param name: name of the child to be added - :param kwargs - :type self: Sofa.Simulation.Node* - :type name: string& - :type kwargs: kwargs& - :rtype: Sofa.Simulation.Node - - - - Add a child node - - :param self : the node itself - :param child : the child to be added - :type self: Sofa.Simulation.Node* - :type child: Sofa.Simulation.Node* - :rtype: Sofa.Simulation.Node - - """ - @typing.overload - def addChild(self, arg0: str, **kwargs) -> object: ... - @typing.overload - def addObject(self, arg0: Object) -> object: - """ - Add an object. - Detect the implemented interfaces and add the object to the corresponding lists. - :param self: the node itself - :param type: type of the object - :param kwargs - :type self: Sofa.Simulation.Node* - :type type: string& - :type kwargs: kwargs& - - - - Add an object. - Detect the implemented interfaces and add the object to the corresponding lists. - :param self: the node itself - :param object: the object to be added - :type self: Sofa.Simulation.Node& - :type object: Sofa.Simulation.BaseObject* - - """ - @typing.overload - def addObject(self, arg0: str, **kwargs) -> object: ... - def createChild(self, arg0: str, **kwargs) -> object: - """ - Deprecated, see addChild - - """ - def createObject(self, arg0: str, **kwargs) -> object: - """ - Deprecated, see addObject - - """ - def detachFromGraph(self) -> None: - """ - Remove the current node from the graph: depending on the type of Node, it can have one or several parents. - - """ - def getAsACreateObjectParameter(self) -> str: - """ - Get the link of the current node - :rtype: string - - """ - def getChild(self, arg0: str) -> object: - """ - Get the child of a node. - - :param n - :param name - :type n: Sofa.Simulation.Node - :type name: string - :return: the child of the same name - - """ - def getForceField(self, arg0: int) -> object: - """ - Get the force field of a node, given an index. - :param index: index of the force field - :type index: unsigned int. - - """ - def getLinkPath(self) -> str: - """ - Get the link of the current node - :param node - :type node: Sofa.Simulation.Node* - - """ - def getMass(self) -> object: - """ - Get the mass of the node - - """ - def getMechanicalMapping(self) -> object: - """ - Get the mechanical mapping of the node. - - """ - def getMechanicalState(self) -> object: - """ - Get the mechanical state of the node. - - """ - def getPathName(self) -> str: - """ - Get the path name of the current node - :rtype: string - - """ - def getRoot(self) -> object: - """ - Get the root node of the current node. - :rtype: Sofa.Simulation.BaseNode* - - """ - def getRootPath(self) -> str: - """ - Return the path from this node to the root node - - """ - def init(self) -> None: - """ - Initialize the components of this node and all the nodes which depend on it. - (beware this is not the python __init__, this is sofa's init()) - - :param self: the node to initialize - :type self: Sofa.Simulation.Node& - :rtype: Sofa.Simulation.Node - - """ - def isInitialized(self) -> bool: - """ - Checks if the node has been initialized - :return: true if it has been initialized - - """ - def moveChild(self, arg0: BaseNode, arg1: BaseNode) -> None: - """ - Move a node from another node. - :param child: the node to be moved - :param prevParent: the previous parent of the node to be moved - :type child: Sofa.Simulation.Node - :type prevParent: Sofa.Simulation.Node - - """ - @typing.overload - def removeChild(self, arg0: Node) -> None: - """ - Remove a child of a node. - :param self: the node itself - :param n: the child to remove - :type self: Sofa.Simulation.Node& - :type n: Sofa.Simulation.Node& - :Examples: - >>> node1.removeChild(node2) - - - - Remove a child of a node. - :param n: the node itself - :param name: the name of the child to remove - :type n: Sofa.Simulation.Node& - :type name: string - :Examples: - >>> node1.removeChild("nameNode2") - - """ - @typing.overload - def removeChild(self, arg0: str) -> object: ... - def removeObject(self, arg0: Object) -> None: - """ - Remove an object - :param object: the object to be removed - :type object: BaseObject - - """ - def sendEvent(self, arg0: object, arg1: str) -> None: - """ - Send an event to other nodes, - by creating a PythonScriptEvent and propagating it to the rest of the tree. - Only the nodes and objects downstream will receive the message. - :param pyUserData: the user data that can be sent - :param eventName: the name of the event - :type pyUserData: py::object - :type eventName: string - - """ - @property - def children(self) -> sofapython3::NodeIterator: - """ - Field interface to acces the children of a node. - - :Example: - >>> n = Sofa.Core.Node("MyNode") - >>> for child in n.children: - >>> print(child.name) - - - :type: sofapython3::NodeIterator - """ - @property - def objects(self) -> sofapython3::NodeIterator: - """ - Field interface to acces the objects of a node. - - :Example: - >>> n = Sofa.Core.Node("MyNode") - >>> for object in n.objects: - >>> print(object.name) - - - :type: sofapython3::NodeIterator - """ - @property - def parents(self) -> sofapython3::NodeIterator: - """ - Field interface to acces the parents of a node. - :Example: - >>> n = Sofa.Core.Node("MyNode") - >>> for parent in n.parents: - >>> print(parent.name) - - - :type: sofapython3::NodeIterator - """ - pass -class Controller(Object, Base): - """ - An Interface for user interaction on SOFA Components. - - It can catch events to trigger actions, such as onAnimateBeginEvent, onAnimateEndEvent or onPythonScriptEvent. - A new custom controller class needs to be defined to use a controller in a script, - and that class needs to reimplement the __init__ method. - - :example of use: - - In the following example, we redefine the controller class, and reimplement the __init__ method. - We also implement the onAnimateBeginEvent, that will be activted everytime an animation step ends - and that will simply print a message in the command line. In the createScene function, we initialize - the controller and add it to the rootNode. - If you run this with runSofa, it will simply endlessly print `onAnimateBeginEvent` - when you click the Animate button. - - .. code-block:: python - - import Sofa.Core - - class MyController(Sofa.Core.Controller): - def __init__(self, *args, **kwargs): - ## These are needed (and the normal way to override from a python class) - Sofa.Core.Controller.__init__(self, *args, **kwargs) - print(" Python::__init__::"+str(self.name)) - - def onEvent(self, event): - """This function is the fallback one that is called if the XXXX event is - received but there is not overriden onXXXX() method. - """ - print("generic event handler catched ", event) - - def onAnimateBeginEvent(self, event): - print("onAnimateBeginEvent") - - def createScene(rootNode): - controller = MyController(name="MyC") - rootNode.addObject(controller) - return rootNode - - """ - def __init__(self, *args, **kwargs) -> None: ... - def init(self) -> None: ... - def reinit(self) -> None: ... - pass -class Data(): - """ - The purpose of a data is to store the attributs of your component. - - :Create a data field: - - To create a data field, you can use the function addData, as shown in the example below. Note that the help - parameter allows you to create a help message for the data field, accessible with the getHelp method. - - .. code-block:: python - - import Sofa.Core - - root = Sofa.Core.Node("root") - root.addData(name="aField", value=1.0 , help="help message",group="theDataGroup", - type="float") - - :Access the value of a data field in read-only: - - Accessing a data field is easy thanks to the generalized access API. You simply need the name of the data field, - as shown in the following : - - .. code-block:: python - - import Sofa.Core - - root = Sofa.Core.Node("root") - root.addData(name="aField", value=1.0 , help="help message",group="theDataGroup", - type="float") - valueOfaField = root.aField.value - print(valueOfaField) #will print '1.0' - - Please note that here valueOfaField is a copy of the real value of aField. You can change its value, but it won't change the value of aField. - - SOFA elements are often created with data fields, so you won't always need to create data fields. - For example, most SOFA elements are created with the data field `name` : - - .. code-block:: python - - import Sofa.Core - - root = Sofa.Core.Node("rootNode") - print(root.name.value) #will print 'rootNode' - - However, this API only allows you to access the value of a data field, but not to change it. - - :Change the value of a data field: - - To change the value of a data field, there are two possibilities. If the type of the data field is a scalar, you can do the following : - - .. code-block:: python - - import Sofa.Core - - root = Sofa.Core.Node("root") - root.addData(name="aField", value=1.0 , help="help message",group="theDataGroup", - type="float") - root.aField = 3.0 # will change the value of aField - print(root.aField.value) # will print '3.0' - - Or you can create a temporary pointer that will allow you to change the value of aField, instead of giving it a whole new one, - which is more cost effective when the type of the data field is something other than a scalar: - - .. code-block:: python - - import Sofa.Core - - root = Sofa.Core.Node("root") - root.addData(name="aField", value=[0.0, 1.0, 3.0] , help="help message",group="theDataGroup", - type="Vec3d") - with root.aField.writeable() as value: - value[0] = 3.0 - - print(root.aField.value) # will print '[3.0, 1.0, 3.0]' - - - """ - def __getattr__(self, arg0: str) -> object: ... - def __repr__(self) -> str: ... - def __setattr__(self, arg0: str, arg1: object) -> None: ... - def __str__(self) -> str: ... - def array(self) -> numpy.ndarray: - """ - Return a python read-only array of the data. - :rtype: read-only array - - """ - def getCounter(self) -> int: - """ - Return the number of changes since creation. - This can be used to efficiently detect changes. - :rtype: integer - - """ - def getHelp(self) -> str: - """ - Get the help message. - :rtype: string - - """ - def getLinkPath(self) -> str: - """ - Return the path of the link to the data. - :rtype: string - - """ - def getName(self) -> str: - """ - Get the name of the data. - :rtype: string - - """ - def getOwner(self) -> object: - """ - Return the Base component owning this data. - :rtype: Base - - """ - def getParent(self) -> Data: - """ - Return the parent data of this data. - :rtype: BaseData - - """ - def getPathName(self) -> str: - """ - Return the name of the path of the data. - :rtype: string - - """ - def getValueString(self) -> str: - """ - Print the value of the associated variable. - - """ - def getValueTypeString(self) -> str: - """ - Print the value of the associated variable. - - """ - def getValueVoidPtr(self) -> capsule: - """ - Get a constant void pointer to the value held in this data. - - """ - def hasChanged(self) -> bool: - """ - Update the data if it is dirty. - :return: true if it is updated, false otherwise. - ;rtype: boolean - - """ - def hasParent(self) -> bool: - """ - Check whether the data has a parent. - :return: true if the data has a parent. - :rtype: boolean - - """ - def isDirty(self) -> bool: - """ - Return true if the DDGNode needs to be updated. - - """ - def isPersistent(self) -> bool: - """ - Alias to match BaseData API. - Checks whether the link requires a path in order to be created. - :return: true if the link requires a path. - :rtype: boolean - - """ - def isReadOnly(self) -> bool: - """ - Return whether this data will be read-only in GUIs. - :return: True for read-only - - """ - def isRequired(self) -> bool: - """ - Check whether a data is flagged as required for the creation of an object. - :return: true if it is required. - - """ - def isSet(self) -> bool: - """ - Check if the value has been modified - If this data is linked, the value of this data will be considered as modified - (even if the parent's value has not been modified) - :return: True if the data has been modified - - """ - def read(self, arg0: str) -> bool: - """ - Read the command line, set the value of the data to the given content of the command line. - :param str: the content of the command line - :type str: string - - """ - def setName(self, arg0: str) -> None: - """ - Set a new name for the data. - :param name: the new name - :type name: string - - """ - def setParent(self, arg0: Data) -> None: - """ - Set a new parent and a new path for the data. - :param parent: the new parent of the data - :param path: the new path of the data - :type parent: BaseData - :type path: string - - """ - def setPersistent(self, arg0: bool) -> None: - """ - Alias to match BaseData API. - Changes the value of a flag, - that should be set to true if link requires a path string in order to be created. - :param bool: new value for the flag. - :type bool: boolean - - """ - def setReadOnly(self, arg0: bool) -> None: - """ - Set whether this data is read-only. (True for read-only) - :param bool: value of the read-only property - :type bool: boolean - - """ - def toList(self) -> list: - """ - Return a list containing the value of the vector of data. - - """ - def typeName(self) -> str: - """ - Return the name of the type of the data. - :rtype: string - - """ - def unset(self) -> None: - """ - Reset the isSet flag to false, to indicate that the current value is the default for this data. - - """ - def updateIfDirty(self) -> None: - """ - Utility method to call update if necessary. - This method should be called before reading or writing the value of this node. - - """ - @typing.overload - def writeableArray(self) -> object: - """ - Return a writable array of the data given an Object. - :param f: the object to convert into an array. - :type f: python object - :rtype: writeable array - - - - Return a new empty array. - :rtype: writeable array - - """ - @typing.overload - def writeableArray(self, arg0: object) -> object: ... - pass -class DataContainer(Data): - """ - Classic python container implemented for SOFA data fields. - - - """ - def __add__(self, arg0: object) -> object: ... - def __getitem__(self, arg0: object) -> object: ... - def __iadd__(self, arg0: object) -> DataContainer: ... - def __imul__(self, arg0: object) -> object: ... - def __isub__(self, arg0: object) -> DataContainer: ... - def __len__(self) -> int: - """ - Return the number of elements in the container's 1st - dimension. (equivalent to shape(0)) - - """ - def __mul__(self, arg0: object) -> object: ... - def __repr__(self) -> str: ... - @typing.overload - def __setitem__(self, arg0: int, arg1: object) -> None: ... - @typing.overload - def __setitem__(self, arg0: slice, arg1: object) -> object: ... - @typing.overload - def __setitem__(self, arg0: tuple, arg1: object) -> None: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: object) -> object: ... - def apply(self, arg0: function) -> None: ... - def array(self) -> numpy.ndarray: ... - def toList(self) -> object: ... - @typing.overload - def writeable(self) -> object: ... - @typing.overload - def writeable(self, arg0: object) -> object: ... - @property - def ndim(self) -> int: - """ - Return the number of dimensions in the container - - - :type: int - """ - @property - def shape(self) -> tuple: - """ - Return the shape of the container (a tuple of length ndim, - with each value being equal to the length of the given dimension) - - - :type: tuple - """ - @property - def size(self) -> int: - """ - Return the total number of elements in the container - ( equivalent to math.prod(self.shape()) ) - - - :type: int - """ - pass -class DataContainerContextManager(): - def __enter__(self) -> object: ... - def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... - pass -class DataDict(): - """ - DataDict exposes the data of a sofa object in a way similar to a normal python dictionnary. - - :Example: - .. code-block:: python - - for k,v in anObject.__data__.items(): - print("Data name :"+k+" value:" +str(v))) - - """ - @typing.overload - def __getitem__(self, arg0: int) -> object: ... - @typing.overload - def __getitem__(self, arg0: str) -> object: ... - @staticmethod - def __iter__(*args, **kwargs) -> typing.Any: ... - def __len__(self) -> int: ... - def __setitem__(self, arg0: str, arg1: object) -> float: ... - @staticmethod - def items(*args, **kwargs) -> typing.Any: - """ - Expose the data, both the key and the value of each item. - :Example: - .. code-block:: python - - for k,v in anObject.__data__.items(): - print("Data name :"+k+" value:" +str(v))) - - """ - @staticmethod - def keys(*args, **kwargs) -> typing.Any: - """ - Expose the data, but only the key (the name) of each items - - """ - @staticmethod - def values(*args, **kwargs) -> typing.Any: - """ - Expose the data, but only the value of each items - - """ - pass -class DataDictIterator(): - """ - Iterator reimplemented to fit dataDict. - - - """ - def __iter__(self) -> DataDictIterator: ... - def __next__(self) -> object: ... - pass -class DataEngine(Object, Base): - """ - DataEngine is a class that computes a set of Data outputs from a set of Data inputs. - - It is a trampoline class that enables python implementations - of the C++ sofa::core::DataEngine class - - """ - def __init__(self, *args, **kwargs) -> None: ... - def addInput(self, arg0: Data) -> None: - """ - Registers a data as an input for the DataEngine. - - :param data: The data to register as input. - :type data: Sofa.Core.Data. - :returns: None. - - """ - def addOutput(self, arg0: Data) -> None: - """ - Registers a data field as being an output for this engine. - If an Engine's output is accessed (getValue, beginEdit...) - AND one or more of its input is dirty, the engine's update() - method will be called - :param data: the data to register as an output - :rtype: None - - """ - pass -class DataLink(Data): - def __repr__(self) -> str: ... - def __str__(self) -> str: ... - pass -class DataString(Data): - def __eq__(self, arg0: Data) -> bool_: ... - def __getitem__(self, arg0: int) -> object: ... - def __len__(self) -> int: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... - __hash__ = None - pass -class DataVectorString(Data): - def __getitem__(self, arg0: int) -> object: ... - def __len__(self) -> int: ... - def __repr__(self) -> str: ... - def __str__(self) -> str: ... - pass -class ForceFieldRigid2d(Object, Base): - """ - An overridable class to create your own customized force field. - - """ - def __init__(self, *args, **kwargs) -> None: ... - pass -class ForceFieldRigid3d(Object, Base): - """ - An overridable class to create your own customized force field. - - """ - def __init__(self, *args, **kwargs) -> None: ... - pass -class ForceFieldVec1d(Object, Base): - """ - An overridable class to create your own customized force field. - - """ - def __init__(self, *args, **kwargs) -> None: ... - pass -class ForceFieldVec2d(Object, Base): - """ - An overridable class to create your own customized force field. - - """ - def __init__(self, *args, **kwargs) -> None: ... - pass -class ForceFieldVec3d(Object, Base): - """ - An overridable class to create your own customized force field. - - """ - def __init__(self, *args, **kwargs) -> None: ... - pass -class Link(): - """ - A Link allows you to access a sofa component from another one anywhere in the simulation graph. - In your scene creation file, it usually appear as : input=@../component. - - :Example of use: - - .. code-block:: python - - import Sofa.Core - import SofaRuntime - SofaRuntime.importPlugin("SofaComponentAll") - - root = Sofa.Core.Node("root") - root.addObject("MechanicalObject", name="t") - link = root.findLink("mechanicalState") # access the link - link.getValueString() # will print '@/t' - link.getHelp() # will print the help message for all mechanical states - - """ - def getHelp(self) -> str: - """ - Get the help message. - :rtype: string - - """ - def getLinkedBase(self, index: int = 0) -> object: - """ - Get the linked base. - :param index: index of the linked base. - :type index: int - - """ - def getLinkedPath(self, index: int = 0) -> str: - """ - Get the linked path. - :param index: index of the linked path. - :type index: int - - """ - def getName(self) -> str: - """ - Get the name of the link. - :rtype: string - - """ - def getOwnerBase(self) -> object: - """ - Get the base owner of the link. - :rtype: Base - - """ - def getPathName(self) -> str: - """ - Get the linked path. - :param index: index of the linked path. - :type index: int - - """ - def getSize(self) -> int: - """ - Get the size of the link. - :rtype: size_t - - """ - def getValueString(self) -> str: - """ - Print the value of the associated variable. - - """ - def getValueTypeString(self) -> str: - """ - Print the value of the associated variable. - - """ - def isMultiLink(self) -> bool: - """ - Checks whether the link is an array. - :return: true if link is an array. - :rtype: boolean - - """ - def isPersistent(self) -> bool: - """ - Alias to match BaseData API. - Checks whether the link requires a path in order to be created. - :return: true if the link requires a path. - :rtype: boolean - - """ - def isReadOnly(self) -> bool: - """ - Alias to match BaseData API. - Checks whether the link requires a path in order to be created. - :return: true if the link doesn't require a path. - :rtype: boolean - - """ - def read(self, arg0: str) -> bool: - """ - Read the command line. - :param str: the content of the command line - :type str: string - - """ - def setHelp(self, arg0: str) -> None: - """ - Set the help message. - :param message: the new help message - :type message: string - - """ - def setLinkedBase(self, arg0: Base) -> None: - """ - Get the linked base. - :param index: index of the linked base. - :type index: int - - """ - def setName(self, arg0: str) -> None: - """ - Set a new name for the link. - :param name: the name to be given to the link - :type name: string - - """ - def setPersistent(self, arg0: bool) -> None: - """ - Alias to match BaseData API. - Changes the value of a flag, - that should be set to true if link requires a path string in order to be created. - :param bool: new value for the flag. - :type bool: boolean - - """ - pass -class BasePrefab(Node, BaseNode, Context, BaseContext, Base): - pass -class NodeIterator(): - @typing.overload - def __getitem__(self, arg0: int) -> object: ... - @typing.overload - def __getitem__(self, arg0: str) -> object: ... - def __iter__(self) -> NodeIterator: ... - def __len__(self) -> object: ... - def __next__(self) -> object: ... - def at(self, arg0: int) -> object: ... - def remove_at(self, arg0: int) -> None: ... - pass -class Camera(Object, Base): - """ - Camera is an API dedicated to the control of the Camera in SOFA. - - :Example of use: - - .. code-block:: python - - import Sofa.Core - import SofaRuntime - SofaRuntime.importPlugin("SofaComponentAll") - - root = Sofa.Core.Node("root") - root.addObject("Camera", name="c") - root.c.position.value # Access the position of the camera - root.c.orientation.value # Access the orientation of the camera in quaternion - - :More complex example of use: - - The camera, added to a controller, can allow the user to create its own script to move and orientate the camera. - - In the example below, the mouse is used to orientate the camera, and the following commands are used to move it : ctrl+z to move forward, - ctrl+x to move backward, ctrl+d to translate on the right, ctrl+q to translate on the left. - The code for this example is available in the folder examples under the name BaseCamera.py of the SofaPython3 GitHub repository. - - .. image:: ../../../../../images/baseCamera.gif - :alt: Example of a controller for a BaseCamera - :align: center - :height: 250pt - - - """ - def Orthographic(self) -> None: ... - def Perspective(self) -> None: ... - @staticmethod - def getLookAtFromOrientation(*args, **kwargs) -> typing.Any: ... - def getModelViewMatrix(self) -> typing.List[float]: ... - def getOpenGLModelViewMatrix(self) -> typing.List[float]: ... - def getOpenGLProjectionMatrix(self) -> typing.List[float]: ... - @staticmethod - def getOrientationFromLookAt(*args, **kwargs) -> typing.Any: ... - @staticmethod - def getPositionFromOrientation(*args, **kwargs) -> typing.Any: ... - def getProjectionMatrix(self) -> typing.List[float]: ... - def rotate(self, arg0: list) -> None: ... - def rotateCameraAroundPoint(self, arg0: list, arg1: list) -> None: ... - def setCameraType(self, arg0: int) -> None: ... - pass -class ObjectFactory(): - """ - Main class used to register and dynamically create objects. - - It uses the Factory design pattern, where each class is registered in a map, - and dynamically retrieved given the type name. - - It also stores metainformation on each classes, such as description, - authors, license, and available template types. - - """ - @staticmethod - def getComponent(*args, **kwargs) -> typing.Any: - """ - Get an entry given a class name (or alias) - - """ - @staticmethod - def getComponentsFromTarget(*args, **kwargs) -> typing.Any: - """ - Return the registered classes from a given target - - """ - @staticmethod - def shortName(arg0: str) -> str: - """ - Return the shortname for this classname. Empty string if no creator exists for this classname. - - """ - components: list # value = [, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ] - targets = {'SofaBaseVisual', 'SofaBaseUtils', 'SofaBaseTopology', 'SofaBaseCollision', 'SofaSimulationCore'} - pass -class PrefabLink(): - @staticmethod - @typing.overload - def __init__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __init__(self, arg0: str) -> None: ... - def getTargetBase(self) -> object: ... - def getTargetPath(self) -> str: ... - pass -class RawPrefab(BasePrefab, Node, BaseNode, Context, BaseContext, Base): - """ - - """ - def __init__(self, *args, **kwargs) -> None: ... - def addPrefabParameter(self, name: str, help: str, type: str, default: object = None) -> None: ... - def init(self) -> None: ... - def reinit(self) -> None: ... - def setSourceTracking(self, arg0: str) -> None: ... - pass -class Topology(Base): - pass diff --git a/docs/sphinx-stubs/Sofa/Helper/System/__init__.pyi b/docs/sphinx-stubs/Sofa/Helper/System/__init__.pyi deleted file mode 100644 index 61f2d8a8..00000000 --- a/docs/sphinx-stubs/Sofa/Helper/System/__init__.pyi +++ /dev/null @@ -1,124 +0,0 @@ -import Sofa.Helper.System -import typing - -__all__ = [ - "FileRepository" -] - - -class FileRepository(): - """ - Helper class to find files in a list of directories. - - Each file is searched as follow: - - 1: Using the specified filename in current directory, or in the specified directory. - If the filename does not start with "/", "./", or "../" : - 2: In the directory path specified using addFirstPath method. - 3: In the directory path specified using an environment variable (default to SOFA_DATA_PATH). - 4: In the default directories relative to the main executable (default to ../share). - 5: In the directory path specified using addLastPath method. - - For file name starting with '/', './' or '../' only the first step is used. - A path is considered as a concatenation of directories separated by : on linux / mac and ; on windows - """ - def __init__(self, envVar: str = 'SOFA_DATA_PATH', relativePath: str = None, fileKeyMaps: typing.Dict[str, typing.List[str]] = {}) -> None: - """ - FileRepository(envVar = 'SOFA_DATA_PATH', relativePath = None, iniFilePath = None) - :param envVar: Every directory paths found in this environment variable will be automatically added to this file repository - :param relativePath: - :param iniFilePath: Every directory paths defined in this INI file will be added to this file repository - """ - def addFirstPath(self, path: str) -> None: - """ - Adds a path to the front of the set of paths. - """ - def addLastPath(self, path: str) -> None: - """ - Adds a path to the back of the set of paths. - """ - def clear(self) -> None: - """ - Remove all known paths. - """ - @staticmethod - def entrySeparator() -> str: - """ - OS-dependant character separing entries in list of paths. - """ - @typing.overload - def findFile(self, filename: str) -> bool: - """ - Find file using the stored set of paths. - :param basefile: override current directory by using the parent directory of the given file - :param filename: requested file as input, resolved file path as output - :return: true if the file was found in one of the directories, false otherwise - - - Find file using the stored set of paths. - :param basefile: override current directory by using the parent directory of the given file - :param filename: requested file as input, resolved file path as output - :return: true if the file was found in one of the directories, false otherwise - """ - @typing.overload - def findFile(self, filename: str, basedir: str) -> bool: ... - def findFileFromFile(self, filename: str, basefile: str) -> bool: - """ - Find file using the stored set of paths. - :param basefile: override current directory by using the parent directory of the given file - :param filename: requested file as input, resolved file path as output - :return: true if the file was found in one of the directories, false otherwise - """ - @typing.overload - def getFile(self, filename: str) -> str: - """ - Alias for findFile, but returning the resolved file as the result. Less informative for errors, but sometimes easier to use. - - - Alias for findFile, but returning the resolved file as the result. Less informative for errors, but sometimes easier to use. - """ - @typing.overload - def getFile(self, filename: str, basedir: str) -> str: ... - def getFirstPath(self) -> str: - """ - Get the first path into the set of paths. - """ - def getPaths(self) -> typing.List[str]: - """ - Get the list of directory paths included in this file repository. - """ - def getPathsJoined(self) -> str: - """ - Get the list of directory paths included in this file repository into a string separated by Sofa.Helper.System.FileRepository.entrySeparator(). - """ - def print(self) -> None: - """ - Print the list of path to std::cout. - """ - @staticmethod - def relativeToPath(path: str, refPath: str) -> str: - """ - Returns a string such as refPath + string = path if path contains refPath. - Otherwise returns path. - """ - def removePath(self, path: str) -> None: - """ - Remove a path of the set of paths. - """ - @property - def direct_access_protocol_prefix(self) -> str: - """ - A protocol like http: or file: which will bypass the file search if found in the filename of the findFile* functions that directly returns the path as if the function succeeded - Use case: add the prefix ram: as the direct protocol, this way the FileRepository will not try to look for the file on the hard disk and will directly return - then the inherited FileAccess singleton enhanced with the capacity to find ram file will deliver a correct stream to this in-ram virtual file - - :type: str - """ - @direct_access_protocol_prefix.setter - def direct_access_protocol_prefix(self, arg1: str) -> None: - """ - A protocol like http: or file: which will bypass the file search if found in the filename of the findFile* functions that directly returns the path as if the function succeeded - Use case: add the prefix ram: as the direct protocol, this way the FileRepository will not try to look for the file on the hard disk and will directly return - then the inherited FileAccess singleton enhanced with the capacity to find ram file will deliver a correct stream to this in-ram virtual file - """ - pass diff --git a/docs/sphinx-stubs/Sofa/Helper/__init__.pyi b/docs/sphinx-stubs/Sofa/Helper/__init__.pyi deleted file mode 100644 index 6f7fb83c..00000000 --- a/docs/sphinx-stubs/Sofa/Helper/__init__.pyi +++ /dev/null @@ -1,725 +0,0 @@ -""" - Utility functions - ----------------------- - The 'info' messages are emitted *only* when the object.printLog is - set to True. - - Examples: - - .. code-block:: python - - msg_info("something bad happens") - msg_info(sofaObject, "something bad happens") - msg_info(sofaNode, "something bad happens") - msg_info(emitting_file, emitting_loc, "something bad happens") - msg_info(sofaObject, "something bad happens", emitting_file, emitting_loc) - msg_info(sofaNode, "something bad happens", emitting_file, emitting_loc) - - Notes: - The way the message are printed depends on the application. - Messages can be routed the console, log files, GUI or ignored. - - .. autosummary:: - Sofa.Helper.msg_info - Sofa.Helper.msg_warning - Sofa.Helper.msg_error - Sofa.Helper.msg_deprecated - Sofa.Helper.msg_fatal - """ -import Sofa.Helper -import typing - -__all__ = [ - "MessageHandler", - "StdVectorBaseData", - "StdVectordouble", - "StdVectorfloat", - "StdVectorint", - "StdVectorlong", - "StdVectoruint", - "StdVectorulong", - "System", - "VectorBaseData", - "Vectordouble", - "Vectorfloat", - "Vectorint", - "Vectorlong", - "Vectoruint", - "Vectorulong", - "msg_deprecated", - "msg_error", - "msg_fatal", - "msg_info", - "msg_warning" -] - - -class MessageHandler(): - def __enter__(self) -> MessageHandler: ... - def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... - def __init__(self) -> None: ... - @staticmethod - def process(*args, **kwargs) -> typing.Any: ... - pass -class StdVectorBaseData(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - @staticmethod - def __contains__(*args, **kwargs) -> typing.Any: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectorBaseData) -> bool: ... - @staticmethod - @typing.overload - def __getitem__(*args, **kwargs) -> typing.Any: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectorBaseData: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectorBaseData) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectorBaseData) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @staticmethod - @typing.overload - def __setitem__(*args, **kwargs) -> typing.Any: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectorBaseData) -> None: ... - @staticmethod - def append(*args, **kwargs) -> typing.Any: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - @staticmethod - def count(*args, **kwargs) -> typing.Any: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectorBaseData) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - @staticmethod - def insert(*args, **kwargs) -> typing.Any: - """ - Insert an item at a given position. - """ - @staticmethod - def pop(*args, **kwargs) -> typing.Any: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @staticmethod - def remove(*args, **kwargs) -> typing.Any: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class StdVectordouble(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - def __contains__(self, x: float) -> bool: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectordouble) -> bool: ... - @typing.overload - def __getitem__(self, arg0: int) -> float: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectordouble: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectordouble) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectordouble) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @typing.overload - def __setitem__(self, arg0: int, arg1: float) -> None: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectordouble) -> None: ... - def append(self, x: float) -> None: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - def count(self, x: float) -> int: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectordouble) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - def insert(self, i: int, x: float) -> None: - """ - Insert an item at a given position. - """ - @typing.overload - def pop(self) -> float: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @typing.overload - def pop(self, i: int) -> float: ... - def remove(self, x: float) -> None: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class StdVectorfloat(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - def __contains__(self, x: float) -> bool: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectorfloat) -> bool: ... - @typing.overload - def __getitem__(self, arg0: int) -> float: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectorfloat: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectorfloat) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectorfloat) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @typing.overload - def __setitem__(self, arg0: int, arg1: float) -> None: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectorfloat) -> None: ... - def append(self, x: float) -> None: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - def count(self, x: float) -> int: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectorfloat) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - def insert(self, i: int, x: float) -> None: - """ - Insert an item at a given position. - """ - @typing.overload - def pop(self) -> float: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @typing.overload - def pop(self, i: int) -> float: ... - def remove(self, x: float) -> None: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class StdVectorint(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - def __contains__(self, x: int) -> bool: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectorint) -> bool: ... - @typing.overload - def __getitem__(self, arg0: int) -> int: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectorint: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectorint) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectorint) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @typing.overload - def __setitem__(self, arg0: int, arg1: int) -> None: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectorint) -> None: ... - def append(self, x: int) -> None: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - def count(self, x: int) -> int: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectorint) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - def insert(self, i: int, x: int) -> None: - """ - Insert an item at a given position. - """ - @typing.overload - def pop(self) -> int: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @typing.overload - def pop(self, i: int) -> int: ... - def remove(self, x: int) -> None: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class StdVectorlong(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - def __contains__(self, x: int) -> bool: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectorlong) -> bool: ... - @typing.overload - def __getitem__(self, arg0: int) -> int: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectorlong: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectorlong) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectorlong) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @typing.overload - def __setitem__(self, arg0: int, arg1: int) -> None: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectorlong) -> None: ... - def append(self, x: int) -> None: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - def count(self, x: int) -> int: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectorlong) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - def insert(self, i: int, x: int) -> None: - """ - Insert an item at a given position. - """ - @typing.overload - def pop(self) -> int: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @typing.overload - def pop(self, i: int) -> int: ... - def remove(self, x: int) -> None: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class StdVectoruint(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - def __contains__(self, x: int) -> bool: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectoruint) -> bool: ... - @typing.overload - def __getitem__(self, arg0: int) -> int: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectoruint: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectoruint) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectoruint) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @typing.overload - def __setitem__(self, arg0: int, arg1: int) -> None: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectoruint) -> None: ... - def append(self, x: int) -> None: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - def count(self, x: int) -> int: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectoruint) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - def insert(self, i: int, x: int) -> None: - """ - Insert an item at a given position. - """ - @typing.overload - def pop(self) -> int: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @typing.overload - def pop(self, i: int) -> int: ... - def remove(self, x: int) -> None: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class StdVectorulong(): - def __bool__(self) -> bool: - """ - Check whether the list is nonempty - """ - def __contains__(self, x: int) -> bool: - """ - Return true the container contains ``x`` - """ - @typing.overload - def __delitem__(self, arg0: int) -> None: - """ - Delete the list elements at index ``i`` - - Delete list elements using a slice object - """ - @typing.overload - def __delitem__(self, arg0: slice) -> None: ... - def __eq__(self, arg0: StdVectorulong) -> bool: ... - @typing.overload - def __getitem__(self, arg0: int) -> int: - """ - Retrieve list elements using a slice object - """ - @typing.overload - def __getitem__(self, s: slice) -> StdVectorulong: ... - @typing.overload - def __init__(self) -> None: - """ - Copy constructor - """ - @typing.overload - def __init__(self, arg0: StdVectorulong) -> None: ... - @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator: ... - def __len__(self) -> int: ... - def __ne__(self, arg0: StdVectorulong) -> bool: ... - def __repr__(self) -> str: - """ - Return the canonical string representation of this list. - """ - @typing.overload - def __setitem__(self, arg0: int, arg1: int) -> None: - """ - Assign list elements using a slice object - """ - @typing.overload - def __setitem__(self, arg0: slice, arg1: StdVectorulong) -> None: ... - def append(self, x: int) -> None: - """ - Add an item to the end of the list - """ - def clear(self) -> None: - """ - Clear the contents - """ - def count(self, x: int) -> int: - """ - Return the number of times ``x`` appears in the list - """ - @typing.overload - def extend(self, L: StdVectorulong) -> None: - """ - Extend the list by appending all the items in the given list - - Extend the list by appending all the items in the given list - """ - @typing.overload - def extend(self, L: typing.Iterable) -> None: ... - def insert(self, i: int, x: int) -> None: - """ - Insert an item at a given position. - """ - @typing.overload - def pop(self) -> int: - """ - Remove and return the last item - - Remove and return the item at index ``i`` - """ - @typing.overload - def pop(self, i: int) -> int: ... - def remove(self, x: int) -> None: - """ - Remove the first item from the list whose value is x. It is an error if there is no such item. - """ - __hash__ = None - pass -class VectorBaseData(StdVectorBaseData): - pass -class Vectordouble(StdVectordouble): - pass -class Vectorfloat(StdVectorfloat): - pass -class Vectorint(StdVectorint): - pass -class Vectorlong(StdVectorlong): - pass -class Vectoruint(StdVectoruint): - pass -class Vectorulong(StdVectorulong): - pass -def msg_deprecated(*args) -> None: - """ - Emit a deprecated message from python. - """ -def msg_error(*args) -> None: - """ - Emit an error message from python. - """ -def msg_fatal(*args) -> None: - """ - Emit a fatal error message from python. - """ -def msg_info(*args) -> None: - """ - Emit an info message from python. - """ -def msg_warning(*args) -> None: - """ - Emit a warning message from python. - """ diff --git a/docs/sphinx-stubs/Sofa/Simulation/__init__.pyi b/docs/sphinx-stubs/Sofa/Simulation/__init__.pyi deleted file mode 100644 index cba6aacd..00000000 --- a/docs/sphinx-stubs/Sofa/Simulation/__init__.pyi +++ /dev/null @@ -1,88 +0,0 @@ -""" - Controlling a simulation - ------------------------ - Main controller of the scene. - It defines how the scene is inited at the beginning, and updated at each time step. - It derives from Base in order to use smart pointers and model the parameters as Datas, - which makes their edition easy in the GUI. - - Example: - - .. code-block:: python - - import Sofa.Core - import SofaRuntime - SofaRuntime.importPlugin("SofaComponentAll") - - n = Sofa.Core.Node("MyNode") - Sofa.Simulation.init(n) - Sofa.Simulation.print(n) - - Functions: - - .. autosummary:: - Sofa.Simulation.animate - Sofa.Simulation.init - Sofa.Simulation.print - Sofa.Simulation.reset - Sofa.Simulation.load - Sofa.Simulation.unload - """ -import Sofa.Simulation -import typing -import Sofa.Core - -__all__ = [ - "animate", - "init", - "initTextures", - "initVisual", - "load", - "print", - "reset", - "unload", - "updateVisual" -] - - -def animate(arg0: Sofa.Core.Node, arg1: float) -> None: - """ - Execute one timestep. If dt is 0, the dt parameter in the graph will be used. - :param dt: the duration of the step. - - """ -def init(arg0: Sofa.Core.Node) -> None: - """ - Initialize the objects. - - """ -def initTextures(arg0: Sofa.Core.Node) -> None: - pass -def initVisual(arg0: Sofa.Core.Node) -> None: - pass -def load(arg0: str) -> object: - """ - Load a scene from a file. - :param filename: name of the file to be loaded - :param reload: default to false. It signals if the scene is being reloaded or loaded for - the first time. - :param sceneArgs: default to an empty vector. Contains the arguments of the scene. - - """ -def print(arg0: Sofa.Core.Node) -> None: - """ - Print all objects in the graph. - - """ -def reset(arg0: Sofa.Core.Node) -> None: - """ - Reset to initial state. - - """ -def unload(arg0: Sofa.Core.Node) -> None: - """ - Unload a scene from a Node. - - """ -def updateVisual(arg0: Sofa.Core.Node) -> None: - pass diff --git a/docs/sphinx-stubs/Sofa/Types/__init__.pyi b/docs/sphinx-stubs/Sofa/Types/__init__.pyi deleted file mode 100644 index 5c6e9e62..00000000 --- a/docs/sphinx-stubs/Sofa/Types/__init__.pyi +++ /dev/null @@ -1,40 +0,0 @@ -""" - Default data types - ------------------------------- - - .. autosummary:: - Sofa.Types.BoundingBox - ... - - """ -import Sofa.Types -import typing -import Sofa.Core - -__all__ = [ - "BoundingBox" -] - - -class BoundingBox(Sofa.Core.Data): - def getCenter(self) -> list: - """ - returns the center of the bbox - """ - def getMax(self) -> list: - """ - Returns a list (by copy) of the max bbox position - """ - def getMin(self) -> list: - """ - Returns a list (by copy) of the min bbox position - """ - def setMax(self, arg0: list) -> None: - """ - sets the max bbox position from a python list - """ - def setMin(self, arg0: list) -> None: - """ - sets the min bbox position from a python list - """ - pass diff --git a/docs/sphinx-stubs/Sofa/__init__.pyi b/docs/sphinx-stubs/Sofa/__init__.pyi deleted file mode 100644 index e4852a1d..00000000 --- a/docs/sphinx-stubs/Sofa/__init__.pyi +++ /dev/null @@ -1,52 +0,0 @@ -""" -Package containg the binding for the core of Sofa -------------------------------------------------- - -Example of use: - .. code-block:: python - - import Sofa.Core - import Sofa.Simulation - import SofaRuntime - SofaRuntime.importPlugin("SofaComponentAll") - - n = Sofa.Core.Node("MyNode") - n.addChild("Node2") - n.addObject("MechanicalObject", name="dofs") - - Sofa.Simulation.init(n) - Sofa.Simulation.print(n) - -Submodules: - .. autosummary:: - :toctree: _autosummary - - Sofa.Core - Sofa.Simulation - Sofa.Types - Sofa.Helper -""" -import Sofa -import typing -from Sofa.prefab import Prefab -import SofaTypes -import functools -import importlib -import inspect -import os -import sys -import traceback - -__all__ = [ - "Core", - "Helper", - "Simulation", - "SofaTypes", - "Types", - "prefab" -] - - -__SofaPythonEnvironment_importedModules__: dict # value = {'sys': , 'builtins': , '_frozen_importlib': , '_imp': , '_thread': , '_warnings': , '_weakref': , '_frozen_importlib_external': , 'posix': , '_io': , 'marshal': , 'time': , 'zipimport': , '_codecs': , 'codecs': , 'encodings.aliases': , 'encodings': , 'encodings.utf_8': , '_signal': , 'encodings.latin_1': , '_abc': , 'abc': , 'io': , '__main__': , '_stat': , 'stat': , '_collections_abc': , 'genericpath': , 'posixpath': , 'os.path': , 'os': , '_sitebuiltins': , '_locale': , '_bootlocale': , 'types': , 'importlib._bootstrap': , 'importlib._bootstrap_external': , 'warnings': , 'importlib': , 'importlib.machinery': , '_heapq': , 'heapq': , 'itertools': , 'keyword': , '_operator': , 'operator': , 'reprlib': , '_collections': , 'collections': , 'collections.abc': , '_functools': , 'functools': , 'contextlib': , 'enum': , '_sre': , 'sre_constants': , 'sre_parse': , 'sre_compile': , 'copyreg': , 're': , 'typing.io': , 'typing.re': , 'typing': , 'importlib.abc': , 'importlib.util': , 'mpl_toolkits': , 'sphinxcontrib': , 'zope': , 'paste': , 'abrt_exception_handler3': , 'site': , '_csv': , 'csv': , 'email': , 'fnmatch': , 'ntpath': , 'errno': , 'urllib': , 'urllib.parse': , 'pathlib': , 'binascii': , 'zlib': , '_compression': , '_weakrefset': , 'threading': , '_bz2': , 'bz2': , '_lzma': , 'lzma': , 'pwd': , 'grp': , 'shutil': , '_struct': , 'struct': , 'zipfile': , 'configparser': , 'importlib.metadata': , '_ast': , 'ast': , '_opcode': , 'opcode': , 'dis': , 'token': , 'tokenize': , 'linecache': , 'inspect': , 'traceback': , 'weakref': , '_string': , 'string': , 'atexit': , 'logging': , 'gettext': , 'argparse': , 'pybind11_stubgen': , 'pybind11_stubgen.__init__': , 'locale': , 'Sofa': , 'Sofa.Helper.System': , 'Sofa.Helper': , 'Sofa.Core': , 'Sofa.Simulation': , 'Sofa.Types': , 'SofaTypes.SofaTypes': , 'SofaTypes': , 'Sofa.prefab': } -__SofaPythonEnvironment_modulesExcludedFromReload = [] -__all__ = ['Helper', 'Core', 'Simulation', 'Types', 'SofaTypes', 'prefab'] diff --git a/docs/sphinx-stubs/Sofa/prefab/__init__.pyi b/docs/sphinx-stubs/Sofa/prefab/__init__.pyi deleted file mode 100644 index 0ea48a8b..00000000 --- a/docs/sphinx-stubs/Sofa/prefab/__init__.pyi +++ /dev/null @@ -1,44 +0,0 @@ -import Sofa.prefab -import typing -import Sofa -import Sofa.Core -import inspect - -__all__ = [ - "Prefab", - "Sofa", - "inspect" -] - - -class Prefab(Sofa.Core.RawPrefab, Sofa.Core.BasePrefab, Sofa.Core.Node, Sofa.Core.BaseNode, Sofa.Core.Context, Sofa.Core.BaseContext, Sofa.Core.Base): - """ - The Prefab object is a Base class to create custom Prefab components for SOFA, implemented in python. - A Prefab can have parameters defined in the "properties" list (datafields under the group "Prefab's Properties"), that trigger its doReInit() function when modified. Parameters must be in a list of dictionaries containing the 3 required fields ("name", "type", "help") and one optional field ("default"). - When initializing a Prefab, if a prefab property name matches a keyword argument fed to the Prefab's initializer, the property will be added to the prefab as a SOFA data of the given type. - - Prefabs have protected keyword arguments: - - name: the name of the prefab instance - - parent and parents: can't be used together, they set the context of the prefab, thus allowing paths resolution for Prefab parameters whose arguments are passed as link paths (strings). parents (with an '-s') sets multi-node contexts - - All other protected keyword arguments in SOFA components - - Example of use: - .. code-block:: python - import Sofa.Core - - class Foo(Sofa.Core.Prefab): - properties = [{ 'name': 'n', 'type': 'int', 'help': 'number of times this prefab prints 'message', 'default': '1'}, - {'name': 'message', 'type': 'string', 'help': 'message to display n times', 'default': 'Hello World!'}] - - def __init__(self, *a, *k): - Sofa.Core.Prefab.__init__(self, *a, **k) - - def doReInit(self): - for i in range(0, self.n.value): - print(self.message.value) - - n = Sofa.Core.Node() - n.addChild(Foo(name="aFooPrefab", n=42, message="hello universe!")) - - """ - pass diff --git a/docs/sphinx-stubs/SofaExporter/__init__.pyi b/docs/sphinx-stubs/SofaExporter/__init__.pyi deleted file mode 100644 index b31461c9..00000000 --- a/docs/sphinx-stubs/SofaExporter/__init__.pyi +++ /dev/null @@ -1,54 +0,0 @@ -""" - Binding for the SofaExporter plugin - ----------------------------------- - - Provides python bindings for the SofaExporter module - - Example of use: - - .. code-block:: python - - import SofaExporter - - .. autosummary:: - :toctree: _autosummary/_autosummary - - SofaExporter.STLExporter - - """ -import SofaExporter -import typing -import Sofa.Core - -__all__ = [ - "STLExporter" -] - - -class STLExporter(Sofa.Core.Object, Sofa.Core.Base): - def write(self) -> bool: - """ - Exports an STL file - --------------------------------------- - - Will export a binary or ascii file depending on the binary flag of STLExporter - Will auto-number the exported files - - Example of use: - .. code-block:: python - - import Sofa - import SofaExporter - - # Create a new node - n = Sofa.Core.Node("root"") - - # Add STLExporter - n.addObject("STLExporter", name="exporter", ...) - - # writes down the stl file - n.exporter.write() - - - """ - pass diff --git a/docs/sphinx-stubs/SofaRuntime/SofaRuntime/Timer/__init__.pyi b/docs/sphinx-stubs/SofaRuntime/SofaRuntime/Timer/__init__.pyi deleted file mode 100644 index 448cbb92..00000000 --- a/docs/sphinx-stubs/SofaRuntime/SofaRuntime/Timer/__init__.pyi +++ /dev/null @@ -1,62 +0,0 @@ -""" - Timer - ----------------------- - - Advanced timer, meant to gather precise statistics for results in published papers. - Not so advanced for now, but it will be... - """ -import SofaRuntime.SofaRuntime.Timer -import typing - -__all__ = [ - "begin", - "clear", - "end", - "getInterval", - "getRecords", - "isEnabled", - "setEnabled", - "setInterval", - "setOutputType", - "stepBegin", - "stepEnd" -] - - -def begin(id: str) -> None: - pass -def clear() -> None: - """ - Clears the AdvancedTimer. - """ -def end(id: str) -> None: - pass -def getInterval(id: str) -> None: - """ - Returns the Timer's interval. - """ -def getRecords(id: str) -> dict: - pass -def isEnabled(id: str) -> None: - """ - Returns True if the given id is enabled, False otherwise. - """ -def setEnabled(name: str, enabled: bool) -> None: - """ - Enables or disables the given timer. - """ -def setInterval(id: str, interval: int) -> None: - """ - Sets the interval for the given timer. - """ -def setOutputType(id: str, newOutputType: str) -> None: - """ - Set the outputType for the given AdvancedTimer. - - @param id string id of the timer - @param type string output type name (example : "json") - """ -def stepBegin(id: str) -> None: - pass -def stepEnd(id: str) -> None: - pass diff --git a/docs/sphinx-stubs/SofaRuntime/SofaRuntime/__init__.pyi b/docs/sphinx-stubs/SofaRuntime/SofaRuntime/__init__.pyi deleted file mode 100644 index 0c1300df..00000000 --- a/docs/sphinx-stubs/SofaRuntime/SofaRuntime/__init__.pyi +++ /dev/null @@ -1,38 +0,0 @@ -""" - Expose aspect specific to the application/runtime - ------------------------------------------------- - - .. autosummary:: - :toctree:_autosummary/_autosummary - - SofaRuntime.importPlugin - - - Example of use: - .. code-block:: python - - import SofaRuntime - SofaRuntime.importPlugin("SofaSparseSolver") - - """ -import SofaRuntime.SofaRuntime -import typing -import Sofa.Helper.System - -__all__ = [ - "DataRepository", - "PluginRepository", - "Timer", - "importPlugin", - "init" -] - - -def importPlugin(arg0: str) -> bool: - """ - import a sofa plugin into the current environment - """ -def init() -> None: - pass -DataRepository: Sofa.Helper.System.FileRepository -PluginRepository: Sofa.Helper.System.FileRepository diff --git a/docs/sphinx-stubs/SofaRuntime/__init__.pyi b/docs/sphinx-stubs/SofaRuntime/__init__.pyi deleted file mode 100644 index ba79d5c6..00000000 --- a/docs/sphinx-stubs/SofaRuntime/__init__.pyi +++ /dev/null @@ -1,51 +0,0 @@ -""" -SofaRuntime package ------------------------ - -""" -import SofaRuntime -import typing -import Sofa -import Sofa.Helper.System -import SofaRuntime.SofaRuntime.Timer -import importlib -import inspect -import os -import sys -import traceback - -__all__ = [ - "DataRepository", - "PluginRepository", - "Sofa", - "SofaRuntime", - "Timer", - "formatStackForSofa", - "getPythonCallingPoint", - "getPythonCallingPointAsString", - "getSofaFormattedStringFromException", - "getStackForSofa", - "importPlugin", - "importlib", - "init", - "inspect", - "os", - "sendMessageFromException", - "sofaExceptHandler", - "sofaFormatHandler", - "sys", - "traceback", - "unloadModules" -] - - -def importPlugin(arg0: str) -> bool: - """ - import a sofa plugin into the current environment - """ -def init() -> None: - pass -DataRepository: Sofa.Helper.System.FileRepository -PluginRepository: Sofa.Helper.System.FileRepository -__SofaPythonEnvironment_importedModules__: dict # value = {'sys': , 'builtins': , '_frozen_importlib': , '_imp': , '_thread': , '_warnings': , '_weakref': , '_frozen_importlib_external': , 'posix': , '_io': , 'marshal': , 'time': , 'zipimport': , '_codecs': , 'codecs': , 'encodings.aliases': , 'encodings': , 'encodings.utf_8': , '_signal': , 'encodings.latin_1': , '_abc': , 'abc': , 'io': , '__main__': , '_stat': , 'stat': , '_collections_abc': , 'genericpath': , 'posixpath': , 'os.path': , 'os': , '_sitebuiltins': , '_locale': , '_bootlocale': , 'types': , 'importlib._bootstrap': , 'importlib._bootstrap_external': , 'warnings': , 'importlib': , 'importlib.machinery': , '_heapq': , 'heapq': , 'itertools': , 'keyword': , '_operator': , 'operator': , 'reprlib': , '_collections': , 'collections': , 'collections.abc': , '_functools': , 'functools': , 'contextlib': , 'enum': , '_sre': , 'sre_constants': , 'sre_parse': , 'sre_compile': , 'copyreg': , 're': , 'typing.io': , 'typing.re': , 'typing': , 'importlib.abc': , 'importlib.util': , 'mpl_toolkits': , 'sphinxcontrib': , 'zope': , 'paste': , 'abrt_exception_handler3': , 'site': , '_csv': , 'csv': , 'email': , 'fnmatch': , 'ntpath': , 'errno': , 'urllib': , 'urllib.parse': , 'pathlib': , 'binascii': , 'zlib': , '_compression': , '_weakrefset': , 'threading': , '_bz2': , 'bz2': , '_lzma': , 'lzma': , 'pwd': , 'grp': , 'shutil': , '_struct': , 'struct': , 'zipfile': , 'configparser': , 'importlib.metadata': , '_ast': , 'ast': , '_opcode': , 'opcode': , 'dis': , 'token': , 'tokenize': , 'linecache': , 'inspect': , 'traceback': , 'weakref': , '_string': , 'string': , 'atexit': , 'logging': , 'gettext': , 'argparse': , 'pybind11_stubgen': , 'pybind11_stubgen.__init__': , 'locale': , 'SofaRuntime': , 'Sofa.Helper.System': , 'Sofa.Helper': , 'Sofa.Core': , 'Sofa.Simulation': , 'Sofa.Types': , 'SofaTypes.SofaTypes': , 'SofaTypes': , 'Sofa.prefab': , 'Sofa': , 'SofaRuntime.SofaRuntime.Timer': , 'SofaRuntime.SofaRuntime': } -__SofaPythonEnvironment_modulesExcludedFromReload = [] diff --git a/docs/sphinx-stubs/SofaTypes/SofaTypes/__init__.pyi b/docs/sphinx-stubs/SofaTypes/SofaTypes/__init__.pyi deleted file mode 100644 index 8027f6cf..00000000 --- a/docs/sphinx-stubs/SofaTypes/SofaTypes/__init__.pyi +++ /dev/null @@ -1,3010 +0,0 @@ -import SofaTypes.SofaTypes -import typing - -__all__ = [ - "Mat1x1", - "Mat2x2", - "Mat3x3", - "Mat3x4", - "Mat4x4", - "Quat", - "Vec10d", - "Vec10i", - "Vec11d", - "Vec11i", - "Vec12d", - "Vec12i", - "Vec1d", - "Vec1i", - "Vec2d", - "Vec2i", - "Vec3d", - "Vec3i", - "Vec4d", - "Vec4i", - "Vec5d", - "Vec5i", - "Vec6d", - "Vec6i", - "Vec7d", - "Vec7i", - "Vec8d", - "Vec8i", - "Vec9d", - "Vec9i" -] - - -class Mat1x1(): - @staticmethod - def Identity() -> Mat1x1: ... - def __add__(self, arg0: Mat1x1) -> Mat1x1: ... - def __eq__(self, arg0: Mat1x1) -> bool: ... - @staticmethod - @typing.overload - def __getitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __getitem__(self, arg0: int, arg1: int) -> float: ... - def __iadd__(self, arg0: Mat1x1) -> None: ... - def __imul__(self, arg0: float) -> None: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, arg0: Mat1x1) -> None: ... - @typing.overload - def __init__(self, arg0: list) -> None: ... - def __isub__(self, arg0: Mat1x1) -> None: ... - def __iter__(self) -> Mat1x1: ... - def __itruediv__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __mul__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __mul__(self, arg0: float) -> Mat1x1: ... - def __ne__(self, arg0: Mat1x1) -> bool: ... - def __neg__(self) -> Mat1x1: ... - @staticmethod - def __next__(*args, **kwargs) -> typing.Any: ... - def __repr__(self) -> str: ... - def __rmul__(self, arg0: float) -> Mat1x1: ... - @staticmethod - @typing.overload - def __setitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __setitem__(self, arg0: int, arg1: int, arg2: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Mat1x1) -> Mat1x1: ... - def __truediv__(self, arg0: float) -> Mat1x1: ... - def addTransposed(self, arg0: Mat1x1) -> None: ... - @staticmethod - def canSelfTranspose(arg0: Mat1x1, arg1: Mat1x1) -> bool: ... - def clear(self) -> None: ... - @staticmethod - def col(*args, **kwargs) -> typing.Any: ... - def fill(self, r: float) -> None: ... - def identity(self) -> None: ... - def invert(self, arg0: Mat1x1) -> bool: ... - def inverted(self) -> Mat1x1: ... - def isDiagonal(self) -> bool: ... - def isSymmetric(self) -> bool: ... - def isTransform(self) -> bool: ... - def minusTransposed(self, arg0: Mat1x1) -> Mat1x1: ... - @staticmethod - def multDiagonal(*args, **kwargs) -> typing.Any: ... - def plusTransposed(self, arg0: Mat1x1) -> Mat1x1: ... - @staticmethod - def row(*args, **kwargs) -> typing.Any: ... - def subTransposed(self, arg0: Mat1x1) -> None: ... - @typing.overload - def transpose(self) -> None: ... - @typing.overload - def transpose(self, m: Mat1x1) -> None: ... - def transposed(self) -> Mat1x1: ... - @property - def cols(self) -> int: - """ - :type: int - """ - @property - def rows(self) -> int: - """ - :type: int - """ - __hash__ = None - pass -class Mat2x2(): - @staticmethod - def Identity() -> Mat2x2: ... - def __add__(self, arg0: Mat2x2) -> Mat2x2: ... - def __eq__(self, arg0: Mat2x2) -> bool: ... - @staticmethod - @typing.overload - def __getitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __getitem__(self, arg0: int, arg1: int) -> float: ... - def __iadd__(self, arg0: Mat2x2) -> None: ... - def __imul__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __init__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, arg0: Mat2x2) -> None: ... - @typing.overload - def __init__(self, arg0: list) -> None: ... - def __isub__(self, arg0: Mat2x2) -> None: ... - def __iter__(self) -> Mat2x2: ... - def __itruediv__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __mul__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __mul__(self, arg0: float) -> Mat2x2: ... - def __ne__(self, arg0: Mat2x2) -> bool: ... - def __neg__(self) -> Mat2x2: ... - @staticmethod - def __next__(*args, **kwargs) -> typing.Any: ... - def __repr__(self) -> str: ... - def __rmul__(self, arg0: float) -> Mat2x2: ... - @staticmethod - @typing.overload - def __setitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __setitem__(self, arg0: int, arg1: int, arg2: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Mat2x2) -> Mat2x2: ... - def __truediv__(self, arg0: float) -> Mat2x2: ... - def addTransposed(self, arg0: Mat2x2) -> None: ... - @staticmethod - def canSelfTranspose(arg0: Mat2x2, arg1: Mat2x2) -> bool: ... - def clear(self) -> None: ... - @staticmethod - def col(*args, **kwargs) -> typing.Any: ... - def fill(self, r: float) -> None: ... - def identity(self) -> None: ... - def invert(self, arg0: Mat2x2) -> bool: ... - def inverted(self) -> Mat2x2: ... - def isDiagonal(self) -> bool: ... - def isSymmetric(self) -> bool: ... - def isTransform(self) -> bool: ... - def minusTransposed(self, arg0: Mat2x2) -> Mat2x2: ... - @staticmethod - def multDiagonal(*args, **kwargs) -> typing.Any: ... - def plusTransposed(self, arg0: Mat2x2) -> Mat2x2: ... - @staticmethod - def row(*args, **kwargs) -> typing.Any: ... - def subTransposed(self, arg0: Mat2x2) -> None: ... - @typing.overload - def transpose(self) -> None: ... - @typing.overload - def transpose(self, m: Mat2x2) -> None: ... - def transposed(self) -> Mat2x2: ... - @property - def cols(self) -> int: - """ - :type: int - """ - @property - def rows(self) -> int: - """ - :type: int - """ - __hash__ = None - pass -class Mat3x3(): - @staticmethod - def Identity() -> Mat3x3: ... - def __add__(self, arg0: Mat3x3) -> Mat3x3: ... - def __eq__(self, arg0: Mat3x3) -> bool: ... - @staticmethod - @typing.overload - def __getitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __getitem__(self, arg0: int, arg1: int) -> float: ... - def __iadd__(self, arg0: Mat3x3) -> None: ... - def __imul__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __init__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, arg0: Mat3x3) -> None: ... - @typing.overload - def __init__(self, arg0: list) -> None: ... - def __isub__(self, arg0: Mat3x3) -> None: ... - def __iter__(self) -> Mat3x3: ... - def __itruediv__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __mul__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __mul__(self, arg0: float) -> Mat3x3: ... - def __ne__(self, arg0: Mat3x3) -> bool: ... - def __neg__(self) -> Mat3x3: ... - @staticmethod - def __next__(*args, **kwargs) -> typing.Any: ... - def __repr__(self) -> str: ... - def __rmul__(self, arg0: float) -> Mat3x3: ... - @staticmethod - @typing.overload - def __setitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __setitem__(self, arg0: int, arg1: int, arg2: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Mat3x3) -> Mat3x3: ... - def __truediv__(self, arg0: float) -> Mat3x3: ... - def addTransposed(self, arg0: Mat3x3) -> None: ... - @staticmethod - def canSelfTranspose(arg0: Mat3x3, arg1: Mat3x3) -> bool: ... - def clear(self) -> None: ... - @staticmethod - def col(*args, **kwargs) -> typing.Any: ... - def fill(self, r: float) -> None: ... - def identity(self) -> None: ... - def invert(self, arg0: Mat3x3) -> bool: ... - def inverted(self) -> Mat3x3: ... - def isDiagonal(self) -> bool: ... - def isSymmetric(self) -> bool: ... - def isTransform(self) -> bool: ... - def minusTransposed(self, arg0: Mat3x3) -> Mat3x3: ... - @staticmethod - def multDiagonal(*args, **kwargs) -> typing.Any: ... - def plusTransposed(self, arg0: Mat3x3) -> Mat3x3: ... - @staticmethod - def row(*args, **kwargs) -> typing.Any: ... - def subTransposed(self, arg0: Mat3x3) -> None: ... - @typing.overload - def transpose(self) -> None: ... - @typing.overload - def transpose(self, m: Mat3x3) -> None: ... - def transposed(self) -> Mat3x3: ... - @property - def cols(self) -> int: - """ - :type: int - """ - @property - def rows(self) -> int: - """ - :type: int - """ - __hash__ = None - pass -class Mat3x4(): - def __add__(self, arg0: Mat3x4) -> Mat3x4: ... - def __eq__(self, arg0: Mat3x4) -> bool: ... - @staticmethod - @typing.overload - def __getitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __getitem__(self, arg0: int, arg1: int) -> float: ... - def __iadd__(self, arg0: Mat3x4) -> None: ... - def __imul__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __init__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, arg0: Mat3x4) -> None: ... - @typing.overload - def __init__(self, arg0: list) -> None: ... - def __isub__(self, arg0: Mat3x4) -> None: ... - def __iter__(self) -> Mat3x4: ... - def __itruediv__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __mul__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __mul__(self, arg0: float) -> Mat3x4: ... - def __ne__(self, arg0: Mat3x4) -> bool: ... - def __neg__(self) -> Mat3x4: ... - @staticmethod - def __next__(*args, **kwargs) -> typing.Any: ... - def __repr__(self) -> str: ... - def __rmul__(self, arg0: float) -> Mat3x4: ... - @staticmethod - @typing.overload - def __setitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __setitem__(self, arg0: int, arg1: int, arg2: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Mat3x4) -> Mat3x4: ... - def __truediv__(self, arg0: float) -> Mat3x4: ... - @staticmethod - def addTransposed(*args, **kwargs) -> typing.Any: ... - @staticmethod - def canSelfTranspose(*args, **kwargs) -> typing.Any: ... - def clear(self) -> None: ... - @staticmethod - def col(*args, **kwargs) -> typing.Any: ... - def fill(self, r: float) -> None: ... - def isDiagonal(self) -> bool: ... - def isSymmetric(self) -> bool: ... - def isTransform(self) -> bool: ... - @staticmethod - def minusTransposed(*args, **kwargs) -> typing.Any: ... - @staticmethod - def multDiagonal(*args, **kwargs) -> typing.Any: ... - @staticmethod - def plusTransposed(*args, **kwargs) -> typing.Any: ... - @staticmethod - def row(*args, **kwargs) -> typing.Any: ... - @staticmethod - def subTransposed(*args, **kwargs) -> typing.Any: ... - @staticmethod - def transpose(*args, **kwargs) -> typing.Any: ... - @staticmethod - def transposed(*args, **kwargs) -> typing.Any: ... - @property - def cols(self) -> int: - """ - :type: int - """ - @property - def rows(self) -> int: - """ - :type: int - """ - __hash__ = None - pass -class Mat4x4(): - @staticmethod - def Identity() -> Mat4x4: ... - def __add__(self, arg0: Mat4x4) -> Mat4x4: ... - def __eq__(self, arg0: Mat4x4) -> bool: ... - @staticmethod - @typing.overload - def __getitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __getitem__(self, arg0: int, arg1: int) -> float: ... - def __iadd__(self, arg0: Mat4x4) -> None: ... - def __imul__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __init__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, arg0: Mat4x4) -> None: ... - @typing.overload - def __init__(self, arg0: list) -> None: ... - def __isub__(self, arg0: Mat4x4) -> None: ... - def __iter__(self) -> Mat4x4: ... - def __itruediv__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __mul__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __mul__(self, arg0: float) -> Mat4x4: ... - def __ne__(self, arg0: Mat4x4) -> bool: ... - def __neg__(self) -> Mat4x4: ... - @staticmethod - def __next__(*args, **kwargs) -> typing.Any: ... - def __repr__(self) -> str: ... - def __rmul__(self, arg0: float) -> Mat4x4: ... - @staticmethod - @typing.overload - def __setitem__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __setitem__(self, arg0: int, arg1: int, arg2: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Mat4x4) -> Mat4x4: ... - def __truediv__(self, arg0: float) -> Mat4x4: ... - def addTransposed(self, arg0: Mat4x4) -> None: ... - @staticmethod - def canSelfTranspose(arg0: Mat4x4, arg1: Mat4x4) -> bool: ... - def clear(self) -> None: ... - @staticmethod - def col(*args, **kwargs) -> typing.Any: ... - def fill(self, r: float) -> None: ... - def identity(self) -> None: ... - def invert(self, arg0: Mat4x4) -> bool: ... - def inverted(self) -> Mat4x4: ... - def isDiagonal(self) -> bool: ... - def isSymmetric(self) -> bool: ... - def isTransform(self) -> bool: ... - def minusTransposed(self, arg0: Mat4x4) -> Mat4x4: ... - @staticmethod - def multDiagonal(*args, **kwargs) -> typing.Any: ... - def plusTransposed(self, arg0: Mat4x4) -> Mat4x4: ... - @staticmethod - def row(*args, **kwargs) -> typing.Any: ... - def subTransposed(self, arg0: Mat4x4) -> None: ... - @typing.overload - def transpose(self) -> None: ... - @typing.overload - def transpose(self, m: Mat4x4) -> None: ... - def transposed(self) -> Mat4x4: ... - @property - def cols(self) -> int: - """ - :type: int - """ - @property - def rows(self) -> int: - """ - :type: int - """ - __hash__ = None - pass -class Quat(): - def __add__(self, arg0: Quat) -> Quat: ... - def __eq__(self, arg0: Quat) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Quat) -> None: ... - @typing.overload - def __imul__(self, arg0: Quat) -> None: ... - @typing.overload - def __imul__(self, arg0: float) -> None: ... - @staticmethod - @typing.overload - def __init__(*args, **kwargs) -> typing.Any: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, arg0: Quat) -> None: ... - @typing.overload - def __init__(self, arg0: list) -> None: ... - @typing.overload - def __init__(self, x: float, y: float, z: float, w: float) -> None: ... - def __iter__(self) -> Quat: ... - def __itruediv__(self, arg0: float) -> None: ... - @typing.overload - def __mul__(self, arg0: Quat) -> Quat: ... - @typing.overload - def __mul__(self, arg0: float) -> Quat: ... - def __ne__(self, arg0: Quat) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __truediv__(self, arg0: float) -> Quat: ... - @staticmethod - def axisToQuat(*args, **kwargs) -> typing.Any: ... - def buildRotationMatrix(self, arg0: Mat4x4) -> None: ... - def clear(self) -> None: ... - @staticmethod - @typing.overload - def createFromEuler(*args, **kwargs) -> typing.Any: ... - @staticmethod - @typing.overload - def createFromEuler(arg0: float, arg1: float, arg2: float) -> None: ... - @staticmethod - def createFromFrame(*args, **kwargs) -> typing.Any: ... - @staticmethod - @typing.overload - def createFromRotationVector(*args, **kwargs) -> typing.Any: ... - @staticmethod - @typing.overload - def createFromRotationVector(arg0: float, arg1: float, arg2: float) -> None: ... - @staticmethod - def fromFrame(*args, **kwargs) -> typing.Any: ... - def fromMatrix(self, m: Mat3x3) -> None: ... - @staticmethod - def identity() -> Quat: ... - def inverse(self) -> Quat: ... - @staticmethod - def inverseRotate(*args, **kwargs) -> typing.Any: ... - def normalize(self) -> None: ... - @staticmethod - def quatToAxis(*args, **kwargs) -> typing.Any: ... - @staticmethod - def rotate(*args, **kwargs) -> typing.Any: ... - def set(self, x: float, y: float, z: float, w: float) -> None: ... - @staticmethod - def size() -> int: ... - @typing.overload - def slerp(self, a: Quat, b: Quat, t: float, allowdFlip: bool = True) -> None: ... - @typing.overload - def slerp(self, q1: Quat, t: float) -> Quat: ... - def slerp2(self, q1: Quat, t: float) -> Quat: ... - @staticmethod - def toEulerVector(*args, **kwargs) -> typing.Any: ... - def toMatrix(self, m: Mat3x3) -> None: ... - @staticmethod - def toRotationVector(*args, **kwargs) -> typing.Any: ... - __hash__ = None - pass -class Vec10d(): - def __add__(self, arg0: Vec10d) -> Vec10d: ... - def __eq__(self, arg0: Vec10d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec10d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec10d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec10d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec10d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec10d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec10d) -> None: ... - def __isub__(self, arg0: Vec10d) -> None: ... - def __iter__(self) -> Vec10d: ... - @typing.overload - def __mul__(self, arg0: Vec10d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec10d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec10d: ... - @typing.overload - def __mul__(self, arg0: Vec10d) -> Vec10d: ... - @typing.overload - def __mul__(self, arg0: Vec10d) -> Vec10d: ... - def __ne__(self, arg0: Vec10d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec10d) -> Vec10d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec10d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec10d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec10d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec10d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec10i(): - def __add__(self, arg0: Vec10i) -> Vec10i: ... - def __eq__(self, arg0: Vec10i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec10i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec10i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec10i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec10i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec10i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec10i) -> None: ... - def __isub__(self, arg0: Vec10i) -> None: ... - def __iter__(self) -> Vec10i: ... - @typing.overload - def __mul__(self, arg0: Vec10i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec10i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec10i: ... - @typing.overload - def __mul__(self, arg0: Vec10i) -> Vec10i: ... - @typing.overload - def __mul__(self, arg0: Vec10i) -> Vec10i: ... - def __ne__(self, arg0: Vec10i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec10i) -> Vec10i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec10i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec10i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec10i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec10i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec11d(): - def __add__(self, arg0: Vec11d) -> Vec11d: ... - def __eq__(self, arg0: Vec11d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec11d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec11d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec11d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec11d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec11d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec11d) -> None: ... - def __isub__(self, arg0: Vec11d) -> None: ... - def __iter__(self) -> Vec11d: ... - @typing.overload - def __mul__(self, arg0: Vec11d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec11d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec11d: ... - @typing.overload - def __mul__(self, arg0: Vec11d) -> Vec11d: ... - @typing.overload - def __mul__(self, arg0: Vec11d) -> Vec11d: ... - def __ne__(self, arg0: Vec11d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec11d) -> Vec11d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec11d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec11d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec11d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec11d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec11i(): - def __add__(self, arg0: Vec11i) -> Vec11i: ... - def __eq__(self, arg0: Vec11i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec11i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec11i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec11i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec11i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec11i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec11i) -> None: ... - def __isub__(self, arg0: Vec11i) -> None: ... - def __iter__(self) -> Vec11i: ... - @typing.overload - def __mul__(self, arg0: Vec11i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec11i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec11i: ... - @typing.overload - def __mul__(self, arg0: Vec11i) -> Vec11i: ... - @typing.overload - def __mul__(self, arg0: Vec11i) -> Vec11i: ... - def __ne__(self, arg0: Vec11i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec11i) -> Vec11i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec11i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec11i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec11i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec11i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec12d(): - def __add__(self, arg0: Vec12d) -> Vec12d: ... - def __eq__(self, arg0: Vec12d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec12d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec12d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec12d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec12d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec12d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec12d) -> None: ... - def __isub__(self, arg0: Vec12d) -> None: ... - def __iter__(self) -> Vec12d: ... - @typing.overload - def __mul__(self, arg0: Vec12d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec12d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec12d: ... - @typing.overload - def __mul__(self, arg0: Vec12d) -> Vec12d: ... - @typing.overload - def __mul__(self, arg0: Vec12d) -> Vec12d: ... - def __ne__(self, arg0: Vec12d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec12d) -> Vec12d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec12d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec12d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec12d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec12d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec12i(): - def __add__(self, arg0: Vec12i) -> Vec12i: ... - def __eq__(self, arg0: Vec12i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec12i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec12i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec12i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec12i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec12i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec12i) -> None: ... - def __isub__(self, arg0: Vec12i) -> None: ... - def __iter__(self) -> Vec12i: ... - @typing.overload - def __mul__(self, arg0: Vec12i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec12i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec12i: ... - @typing.overload - def __mul__(self, arg0: Vec12i) -> Vec12i: ... - @typing.overload - def __mul__(self, arg0: Vec12i) -> Vec12i: ... - def __ne__(self, arg0: Vec12i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec12i) -> Vec12i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec12i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec12i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec12i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec12i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec1d(): - def __add__(self, arg0: Vec1d) -> Vec1d: ... - def __eq__(self, arg0: Vec1d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec1d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec1d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec1d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec1d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec1d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec1d) -> None: ... - def __isub__(self, arg0: Vec1d) -> None: ... - def __iter__(self) -> Vec1d: ... - @typing.overload - def __mul__(self, arg0: Vec1d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec1d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec1d: ... - @typing.overload - def __mul__(self, arg0: Vec1d) -> Vec1d: ... - @typing.overload - def __mul__(self, arg0: Vec1d) -> Vec1d: ... - def __ne__(self, arg0: Vec1d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec1d) -> Vec1d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec1d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec1d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec1d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec1d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec1i(): - def __add__(self, arg0: Vec1i) -> Vec1i: ... - def __eq__(self, arg0: Vec1i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec1i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec1i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec1i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec1i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec1i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec1i) -> None: ... - def __isub__(self, arg0: Vec1i) -> None: ... - def __iter__(self) -> Vec1i: ... - @typing.overload - def __mul__(self, arg0: Vec1i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec1i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec1i: ... - @typing.overload - def __mul__(self, arg0: Vec1i) -> Vec1i: ... - @typing.overload - def __mul__(self, arg0: Vec1i) -> Vec1i: ... - def __ne__(self, arg0: Vec1i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec1i) -> Vec1i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec1i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec1i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec1i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec1i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec2d(): - def __add__(self, arg0: Vec2d) -> Vec2d: ... - def __eq__(self, arg0: Vec2d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec2d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec2d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec2d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec2d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec2d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec2d) -> None: ... - def __isub__(self, arg0: Vec2d) -> None: ... - def __iter__(self) -> Vec2d: ... - @typing.overload - def __mul__(self, arg0: Vec2d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec2d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec2d: ... - @typing.overload - def __mul__(self, arg0: Vec2d) -> Vec2d: ... - @typing.overload - def __mul__(self, arg0: Vec2d) -> Vec2d: ... - def __ne__(self, arg0: Vec2d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec2d) -> Vec2d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec2d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec2d: ... - def clear(self) -> None: ... - def cross(self, arg0: Vec2d) -> float: ... - def dot(self, arg0: Vec2d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec2d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec2i(): - def __add__(self, arg0: Vec2i) -> Vec2i: ... - def __eq__(self, arg0: Vec2i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec2i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec2i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec2i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec2i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec2i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec2i) -> None: ... - def __isub__(self, arg0: Vec2i) -> None: ... - def __iter__(self) -> Vec2i: ... - @typing.overload - def __mul__(self, arg0: Vec2i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec2i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec2i: ... - @typing.overload - def __mul__(self, arg0: Vec2i) -> Vec2i: ... - @typing.overload - def __mul__(self, arg0: Vec2i) -> Vec2i: ... - def __ne__(self, arg0: Vec2i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec2i) -> Vec2i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec2i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec2i: ... - def clear(self) -> None: ... - def cross(self, arg0: Vec2i) -> int: ... - def dot(self, arg0: Vec2i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec2i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec3d(): - def __add__(self, arg0: Vec3d) -> Vec3d: ... - def __eq__(self, arg0: Vec3d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec3d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec3d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec3d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec3d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec3d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec3d) -> None: ... - def __isub__(self, arg0: Vec3d) -> None: ... - def __iter__(self) -> Vec3d: ... - @typing.overload - def __mul__(self, arg0: Vec3d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec3d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec3d: ... - @typing.overload - def __mul__(self, arg0: Vec3d) -> Vec3d: ... - @typing.overload - def __mul__(self, arg0: Vec3d) -> Vec3d: ... - def __ne__(self, arg0: Vec3d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec3d) -> Vec3d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec3d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec3d: ... - def clear(self) -> None: ... - def cross(self, arg0: Vec3d) -> Vec3d: ... - def dot(self, arg0: Vec3d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec3d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec3i(): - def __add__(self, arg0: Vec3i) -> Vec3i: ... - def __eq__(self, arg0: Vec3i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec3i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec3i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec3i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec3i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec3i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec3i) -> None: ... - def __isub__(self, arg0: Vec3i) -> None: ... - def __iter__(self) -> Vec3i: ... - @typing.overload - def __mul__(self, arg0: Vec3i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec3i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec3i: ... - @typing.overload - def __mul__(self, arg0: Vec3i) -> Vec3i: ... - @typing.overload - def __mul__(self, arg0: Vec3i) -> Vec3i: ... - def __ne__(self, arg0: Vec3i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec3i) -> Vec3i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec3i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec3i: ... - def clear(self) -> None: ... - def cross(self, arg0: Vec3i) -> Vec3i: ... - def dot(self, arg0: Vec3i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec3i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec4d(): - def __add__(self, arg0: Vec4d) -> Vec4d: ... - def __eq__(self, arg0: Vec4d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec4d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec4d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec4d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec4d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec4d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec4d) -> None: ... - def __isub__(self, arg0: Vec4d) -> None: ... - def __iter__(self) -> Vec4d: ... - @typing.overload - def __mul__(self, arg0: Vec4d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec4d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec4d: ... - @typing.overload - def __mul__(self, arg0: Vec4d) -> Vec4d: ... - @typing.overload - def __mul__(self, arg0: Vec4d) -> Vec4d: ... - def __ne__(self, arg0: Vec4d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec4d) -> Vec4d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec4d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec4d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec4d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec4d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec4i(): - def __add__(self, arg0: Vec4i) -> Vec4i: ... - def __eq__(self, arg0: Vec4i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec4i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec4i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec4i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec4i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec4i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec4i) -> None: ... - def __isub__(self, arg0: Vec4i) -> None: ... - def __iter__(self) -> Vec4i: ... - @typing.overload - def __mul__(self, arg0: Vec4i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec4i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec4i: ... - @typing.overload - def __mul__(self, arg0: Vec4i) -> Vec4i: ... - @typing.overload - def __mul__(self, arg0: Vec4i) -> Vec4i: ... - def __ne__(self, arg0: Vec4i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec4i) -> Vec4i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec4i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec4i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec4i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec4i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec5d(): - def __add__(self, arg0: Vec5d) -> Vec5d: ... - def __eq__(self, arg0: Vec5d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec5d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec5d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec5d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec5d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec5d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec5d) -> None: ... - def __isub__(self, arg0: Vec5d) -> None: ... - def __iter__(self) -> Vec5d: ... - @typing.overload - def __mul__(self, arg0: Vec5d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec5d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec5d: ... - @typing.overload - def __mul__(self, arg0: Vec5d) -> Vec5d: ... - @typing.overload - def __mul__(self, arg0: Vec5d) -> Vec5d: ... - def __ne__(self, arg0: Vec5d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec5d) -> Vec5d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec5d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec5d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec5d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec5d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec5i(): - def __add__(self, arg0: Vec5i) -> Vec5i: ... - def __eq__(self, arg0: Vec5i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec5i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec5i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec5i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec5i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec5i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec5i) -> None: ... - def __isub__(self, arg0: Vec5i) -> None: ... - def __iter__(self) -> Vec5i: ... - @typing.overload - def __mul__(self, arg0: Vec5i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec5i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec5i: ... - @typing.overload - def __mul__(self, arg0: Vec5i) -> Vec5i: ... - @typing.overload - def __mul__(self, arg0: Vec5i) -> Vec5i: ... - def __ne__(self, arg0: Vec5i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec5i) -> Vec5i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec5i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec5i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec5i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec5i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec6d(): - def __add__(self, arg0: Vec6d) -> Vec6d: ... - def __eq__(self, arg0: Vec6d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec6d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec6d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec6d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec6d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec6d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec6d) -> None: ... - def __isub__(self, arg0: Vec6d) -> None: ... - def __iter__(self) -> Vec6d: ... - @typing.overload - def __mul__(self, arg0: Vec6d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec6d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec6d: ... - @typing.overload - def __mul__(self, arg0: Vec6d) -> Vec6d: ... - @typing.overload - def __mul__(self, arg0: Vec6d) -> Vec6d: ... - def __ne__(self, arg0: Vec6d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec6d) -> Vec6d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec6d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec6d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec6d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec6d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec6i(): - def __add__(self, arg0: Vec6i) -> Vec6i: ... - def __eq__(self, arg0: Vec6i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec6i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec6i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec6i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec6i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec6i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec6i) -> None: ... - def __isub__(self, arg0: Vec6i) -> None: ... - def __iter__(self) -> Vec6i: ... - @typing.overload - def __mul__(self, arg0: Vec6i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec6i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec6i: ... - @typing.overload - def __mul__(self, arg0: Vec6i) -> Vec6i: ... - @typing.overload - def __mul__(self, arg0: Vec6i) -> Vec6i: ... - def __ne__(self, arg0: Vec6i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec6i) -> Vec6i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec6i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec6i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec6i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec6i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec7d(): - def __add__(self, arg0: Vec7d) -> Vec7d: ... - def __eq__(self, arg0: Vec7d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec7d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec7d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec7d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec7d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec7d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec7d) -> None: ... - def __isub__(self, arg0: Vec7d) -> None: ... - def __iter__(self) -> Vec7d: ... - @typing.overload - def __mul__(self, arg0: Vec7d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec7d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec7d: ... - @typing.overload - def __mul__(self, arg0: Vec7d) -> Vec7d: ... - @typing.overload - def __mul__(self, arg0: Vec7d) -> Vec7d: ... - def __ne__(self, arg0: Vec7d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec7d) -> Vec7d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec7d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec7d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec7d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec7d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec7i(): - def __add__(self, arg0: Vec7i) -> Vec7i: ... - def __eq__(self, arg0: Vec7i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec7i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec7i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec7i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec7i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec7i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec7i) -> None: ... - def __isub__(self, arg0: Vec7i) -> None: ... - def __iter__(self) -> Vec7i: ... - @typing.overload - def __mul__(self, arg0: Vec7i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec7i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec7i: ... - @typing.overload - def __mul__(self, arg0: Vec7i) -> Vec7i: ... - @typing.overload - def __mul__(self, arg0: Vec7i) -> Vec7i: ... - def __ne__(self, arg0: Vec7i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec7i) -> Vec7i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec7i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec7i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec7i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec7i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec8d(): - def __add__(self, arg0: Vec8d) -> Vec8d: ... - def __eq__(self, arg0: Vec8d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec8d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec8d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec8d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec8d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec8d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec8d) -> None: ... - def __isub__(self, arg0: Vec8d) -> None: ... - def __iter__(self) -> Vec8d: ... - @typing.overload - def __mul__(self, arg0: Vec8d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec8d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec8d: ... - @typing.overload - def __mul__(self, arg0: Vec8d) -> Vec8d: ... - @typing.overload - def __mul__(self, arg0: Vec8d) -> Vec8d: ... - def __ne__(self, arg0: Vec8d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec8d) -> Vec8d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec8d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec8d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec8d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec8d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec8i(): - def __add__(self, arg0: Vec8i) -> Vec8i: ... - def __eq__(self, arg0: Vec8i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec8i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec8i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec8i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec8i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec8i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec8i) -> None: ... - def __isub__(self, arg0: Vec8i) -> None: ... - def __iter__(self) -> Vec8i: ... - @typing.overload - def __mul__(self, arg0: Vec8i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec8i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec8i: ... - @typing.overload - def __mul__(self, arg0: Vec8i) -> Vec8i: ... - @typing.overload - def __mul__(self, arg0: Vec8i) -> Vec8i: ... - def __ne__(self, arg0: Vec8i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec8i) -> Vec8i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec8i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec8i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec8i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec8i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec9d(): - def __add__(self, arg0: Vec9d) -> Vec9d: ... - def __eq__(self, arg0: Vec9d) -> bool: ... - def __getitem__(self, arg0: int) -> float: ... - def __iadd__(self, arg0: Vec9d) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec9d: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec9d: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec9d: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec9d: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec9d) -> None: ... - def __isub__(self, arg0: Vec9d) -> None: ... - def __iter__(self) -> Vec9d: ... - @typing.overload - def __mul__(self, arg0: Vec9d) -> float: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec9d: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec9d: ... - @typing.overload - def __mul__(self, arg0: Vec9d) -> Vec9d: ... - @typing.overload - def __mul__(self, arg0: Vec9d) -> Vec9d: ... - def __ne__(self, arg0: Vec9d) -> bool: ... - def __next__(self) -> float: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: float) -> float: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec9d) -> Vec9d: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec9d: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec9d: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec9d) -> float: ... - def fill(self, r: float) -> None: ... - def lNorm(self, l: int) -> float: ... - def norm(self) -> float: ... - def norm2(self) -> float: ... - def normalize(self, threshold: float = 2.220446049250313e-16) -> bool: ... - def normalized(self) -> Vec9d: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> float: ... - @property - def w(self) -> float: - """ - :type: float - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> float: - """ - :type: float - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> float: - """ - :type: float - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> float: - """ - :type: float - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass -class Vec9i(): - def __add__(self, arg0: Vec9i) -> Vec9i: ... - def __eq__(self, arg0: Vec9i) -> bool: ... - def __getitem__(self, arg0: int) -> int: ... - def __iadd__(self, arg0: Vec9i) -> None: ... - @typing.overload - def __idiv__(self, arg0: float) -> Vec9i: ... - @typing.overload - def __idiv__(self, arg0: int) -> Vec9i: ... - @typing.overload - def __imul__(self, arg0: float) -> Vec9i: ... - @typing.overload - def __imul__(self, arg0: int) -> Vec9i: ... - @typing.overload - def __init__(self) -> None: ... - @typing.overload - def __init__(self, *args) -> None: ... - @typing.overload - def __init__(self, arg0: Vec9i) -> None: ... - def __isub__(self, arg0: Vec9i) -> None: ... - def __iter__(self) -> Vec9i: ... - @typing.overload - def __mul__(self, arg0: Vec9i) -> int: ... - @typing.overload - def __mul__(self, arg0: float) -> Vec9i: ... - @typing.overload - def __mul__(self, arg0: int) -> Vec9i: ... - @typing.overload - def __mul__(self, arg0: Vec9i) -> Vec9i: ... - @typing.overload - def __mul__(self, arg0: Vec9i) -> Vec9i: ... - def __ne__(self, arg0: Vec9i) -> bool: ... - def __next__(self) -> int: ... - def __repr__(self) -> str: ... - def __setitem__(self, arg0: int, arg1: int) -> int: ... - def __str__(self) -> str: ... - def __sub__(self, arg0: Vec9i) -> Vec9i: ... - @typing.overload - def __truediv__(self, arg0: float) -> Vec9i: ... - @typing.overload - def __truediv__(self, arg0: int) -> Vec9i: ... - def clear(self) -> None: ... - def dot(self, arg0: Vec9i) -> int: ... - def fill(self, r: int) -> None: ... - def lNorm(self, l: int) -> int: ... - def norm(self) -> int: ... - def norm2(self) -> int: ... - def normalize(self, threshold: int = 0) -> bool: ... - def normalized(self) -> Vec9i: ... - @typing.overload - def set(self, *args) -> None: ... - @typing.overload - def set(self, arg0: list) -> None: ... - def sum(self) -> int: ... - @property - def w(self) -> int: - """ - :type: int - """ - @w.setter - def w(self, arg1: float) -> None: - pass - @property - def x(self) -> int: - """ - :type: int - """ - @x.setter - def x(self, arg1: float) -> None: - pass - @property - def xy(self) -> tuple: - """ - :type: tuple - """ - @xy.setter - def xy(self, arg1: list) -> None: - pass - @property - def xyz(self) -> tuple: - """ - :type: tuple - """ - @xyz.setter - def xyz(self, arg1: list) -> None: - pass - @property - def xyzw(self) -> tuple: - """ - :type: tuple - """ - @xyzw.setter - def xyzw(self, arg1: list) -> None: - pass - @property - def y(self) -> int: - """ - :type: int - """ - @y.setter - def y(self, arg1: float) -> None: - pass - @property - def z(self) -> int: - """ - :type: int - """ - @z.setter - def z(self, arg1: float) -> None: - pass - __hash__ = None - pass diff --git a/docs/sphinx-stubs/SofaTypes/__init__.pyi b/docs/sphinx-stubs/SofaTypes/__init__.pyi deleted file mode 100644 index 728fa42a..00000000 --- a/docs/sphinx-stubs/SofaTypes/__init__.pyi +++ /dev/null @@ -1,73 +0,0 @@ -""" -SofaType package ------------------------ - -""" -import SofaTypes -import typing -from SofaTypes.SofaTypes import Mat1x1 -from SofaTypes.SofaTypes import Mat2x2 -from SofaTypes.SofaTypes import Mat3x3 -from SofaTypes.SofaTypes import Mat3x4 -from SofaTypes.SofaTypes import Mat4x4 -from SofaTypes.SofaTypes import Quat -from SofaTypes.SofaTypes import Vec10d -from SofaTypes.SofaTypes import Vec10i -from SofaTypes.SofaTypes import Vec11d -from SofaTypes.SofaTypes import Vec11i -from SofaTypes.SofaTypes import Vec12d -from SofaTypes.SofaTypes import Vec12i -from SofaTypes.SofaTypes import Vec1d -from SofaTypes.SofaTypes import Vec1i -from SofaTypes.SofaTypes import Vec2d -from SofaTypes.SofaTypes import Vec2i -from SofaTypes.SofaTypes import Vec3d -from SofaTypes.SofaTypes import Vec3i -from SofaTypes.SofaTypes import Vec4d -from SofaTypes.SofaTypes import Vec4i -from SofaTypes.SofaTypes import Vec5d -from SofaTypes.SofaTypes import Vec5i -from SofaTypes.SofaTypes import Vec6d -from SofaTypes.SofaTypes import Vec6i -from SofaTypes.SofaTypes import Vec7d -from SofaTypes.SofaTypes import Vec7i -from SofaTypes.SofaTypes import Vec8d -from SofaTypes.SofaTypes import Vec8i -from SofaTypes.SofaTypes import Vec9d -from SofaTypes.SofaTypes import Vec9i - -__all__ = [ - "Mat1x1", - "Mat2x2", - "Mat3x3", - "Mat3x4", - "Mat4x4", - "Quat", - "SofaTypes", - "Vec10d", - "Vec10i", - "Vec11d", - "Vec11i", - "Vec12d", - "Vec12i", - "Vec1d", - "Vec1i", - "Vec2d", - "Vec2i", - "Vec3d", - "Vec3i", - "Vec4d", - "Vec4i", - "Vec5d", - "Vec5i", - "Vec6d", - "Vec6i", - "Vec7d", - "Vec7i", - "Vec8d", - "Vec8i", - "Vec9d", - "Vec9i" -] - - diff --git a/docs/sphinx-stubs/splib/__init__.pyi b/docs/sphinx-stubs/splib/__init__.pyi deleted file mode 100644 index 61d3e5b0..00000000 --- a/docs/sphinx-stubs/splib/__init__.pyi +++ /dev/null @@ -1,27 +0,0 @@ -""" -Splib library -------------- - - -.. autosummary:: - :toctree: _autosummary - - splib.animation - splib.caching - splib.meshing - -""" -import splib -import typing -import Sofa -import functools -import inspect - -__all__ = [ - "animation", - "caching", - "meshing" -] - - -__all__ = ['animation', 'caching', 'meshing'] diff --git a/docs/sphinx/content/modules/SofaRuntime/generated/SofaRuntime.sofaFormatHandler.rst b/docs/sphinx/content/modules/SofaRuntime/generated/SofaRuntime.sofaFormatHandler.rst new file mode 100644 index 00000000..b48d1ff1 --- /dev/null +++ b/docs/sphinx/content/modules/SofaRuntime/generated/SofaRuntime.sofaFormatHandler.rst @@ -0,0 +1,9 @@ +.. + base.rst + +SofaRuntime.sofaFormatHandler +============================= + +.. currentmodule:: SofaRuntime + +.. autofunction:: sofaFormatHandler \ No newline at end of file diff --git a/docs/sphinx/content/modules/SofaRuntime/generated/SofaRuntime.unloadModules.rst b/docs/sphinx/content/modules/SofaRuntime/generated/SofaRuntime.unloadModules.rst new file mode 100644 index 00000000..7308553d --- /dev/null +++ b/docs/sphinx/content/modules/SofaRuntime/generated/SofaRuntime.unloadModules.rst @@ -0,0 +1,9 @@ +.. + base.rst + +SofaRuntime.unloadModules +========================= + +.. currentmodule:: SofaRuntime + +.. autofunction:: unloadModules \ No newline at end of file diff --git a/docs/sphinx/source/_templates/autosummary/module.rst b/docs/sphinx/source/_templates/autosummary/module.rst deleted file mode 100644 index 19456fb1..00000000 --- a/docs/sphinx/source/_templates/autosummary/module.rst +++ /dev/null @@ -1,2 +0,0 @@ -.. automodule:: {{fullname}} - diff --git a/docs/sphinx/source/_templates/autosummary/summary.rst b/docs/sphinx/source/_templates/autosummary/summary.rst deleted file mode 100644 index dbe519ce..00000000 --- a/docs/sphinx/source/_templates/autosummary/summary.rst +++ /dev/null @@ -1,9 +0,0 @@ -{{ fullname }} -{{ underline }} - -SUMMARY TEMPLATE - -.. automodule:: {{ fullname }} - - - diff --git a/docs/sphinx/source/_templates/module.rst b/docs/sphinx/source/_templates/module.rst deleted file mode 100644 index 0e45f48e..00000000 --- a/docs/sphinx/source/_templates/module.rst +++ /dev/null @@ -1,8 +0,0 @@ -{{ fullname }} -{{ underline }} - -.. contents:: - :local: - -.. automodule:: {{fullname}} - diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py index 3b00b603..61c2f63c 100644 --- a/docs/sphinx/source/conf.py +++ b/docs/sphinx/source/conf.py @@ -36,28 +36,29 @@ 'sphinx.ext.autosummary', 'sphinxcontrib.contentui', 'sphinx.ext.viewcode', - 'sphinx.ext.githubpages', 'sphinx.ext.napoleon', + 'sphinx_search.extension', + 'sphinx_tabs.tabs', ] import sys +import os import re from pathlib import Path -stub_path = Path(__file__+"/../../../sphinx-stubs").resolve() -sys.path.insert(0, stub_path) -print(f"Adding {stub_path} to sys.path") - ## Include Python objects as they appear in source files ## Default: alphabetically ('alphabetical') -autodoc_member_order = 'bysource' -## Default flags used by autodoc directives +# autodoc_member_order = 'bysource' +# autodoc_class_signature = "separated" +autoclass_content = "both" autodoc_default_flags = [] + ## Generate autodoc stubs with summaries from code autosummary_generate = True +autosummary_ignore_module_all = False # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ['templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: @@ -70,35 +71,27 @@ # General information about the project. project = u'SofaPython3' -copyright = u'2021, SOFA Framework' +copyright = u'2023, SOFA Framework' author = u'consortium@sofa-framework.org' -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -_cmake_version_re = re.compile(r'project[^\S\n]*\(\w*[^\S\n]*VERSION[^\S\n]+(\w+).(\w+).(\w+)[^\S\n]*\)') - -version_major = 0 -version_minor = 0 -version_patch = 0 -for line in open('../../../CMakeLists.txt'): - version = _cmake_version_re.search(line) - if version: - version_major, version_minor, version_patch = version.group(1), version.group(2), version.group(3) - break - -version = f'{version_major}.{version_minor}' -# The full version, including alpha/beta/rc tags. -release = f'{version}.{version_patch}' +stream = os.popen("git rev-parse --abbrev-ref HEAD") +version = stream.read() + +# Définition d'un filtre Jinja2 personnalisé pour le soulignement +def custom_underline_filter(text, char): + return text + "\n" + char * len(text) + +html_context = { + 'current_version': version, + 'underline_filter': custom_underline_filter, +} # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -121,13 +114,24 @@ html_theme = "sphinx_rtd_theme" html_theme_path = ["_themes", ] - +html_title = 'SofaPython3 plugin documentation' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # -# html_theme_options = {} +html_theme_options = { + 'display_version': True, + 'prev_next_buttons_location': 'bottom', + 'style_external_links': False, + + # Toc options + 'collapse_navigation': False, + 'navigation_depth': 10, + 'titles_only': False +} + + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -144,6 +148,8 @@ 'about.html', 'navigation.html', 'searchbox.html', + 'relations.html', + 'donate.html', ] } @@ -179,7 +185,7 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'SofaPython3::Sofa.tex', u'SofaPython3::Sofa Documentation', - u'damien.marchal@univ-lille.fr', 'manual'), + author, 'manual'), ] @@ -213,7 +219,7 @@ class Mock(MagicMock): def __getattr__(cls, name): return MagicMock() -autodoc_mock_imports = ['numpy', 'Sofa', 'SofaRuntime', 'SofaExporter', 'SofaTypes', 'splib'] +autodoc_mock_imports = ['numpy','splib'] sys.modules.update((mod_name, Mock()) for mod_name in autodoc_mock_imports) diff --git a/docs/sphinx/source/menu/Compilation.rst b/docs/sphinx/source/content/Compilation.rst similarity index 77% rename from docs/sphinx/source/menu/Compilation.rst rename to docs/sphinx/source/content/Compilation.rst index 9467e0d0..4cb10472 100644 --- a/docs/sphinx/source/menu/Compilation.rst +++ b/docs/sphinx/source/content/Compilation.rst @@ -1,24 +1,26 @@ -Compilation -=========== +################## +Manual compilation +################## -The compilation of the SofaPython3 can be done automatically when `building SOFA `_, +The compilation of the SofaPython3 can be done when `building SOFA `_, or it can be done independently using an already compiled/installed SOFA: -* the former is called an *in-tree build*, which is, the compilation of SofaPython3 is included inside the build tree of SOFA -* the latter is called an *out-of-tree build*, hence the compilation of SofaPython3 is done in its own build tree, usually placed somewhere else than SOFA. +* the former is called an :ref:`intree`, which is, the compilation of SofaPython3 is included inside the build tree of SOFA +* the latter is called an :ref:`outtree`, hence the compilation of SofaPython3 is done in its own build tree, usually placed somewhere else than SOFA. +.. _compilation.prerequisites: +************* Prerequisites -------------- +************* The compilation of SofaPython3 requires the installation of some dependencies. The following table lists all of those prerequisites. -.. content-tabs:: +.. tabs:: - .. tab-container:: tab1 - :title: Ubuntu + .. tab:: Ubuntu .. list-table:: :widths: 15 10 30 45 @@ -43,8 +45,7 @@ prerequisites. - - .. tab-container:: tab2 - :title: MacOS + .. tab:: MacOS .. list-table:: :widths: 15 10 30 45 @@ -69,8 +70,7 @@ prerequisites. - - .. tab-container:: tab3 - :title: Windows + .. tab:: Windows .. list-table:: :widths: 15 10 30 45 @@ -105,9 +105,11 @@ prerequisites. +.. _intree: +************* In-tree build -------------- +************* We use here the term *in-tree build* to indicate that we wish to compile SofaPython3 in the same build tree as SOFA, which is, compiling SOFA will automatically compile SofaPython3 as an internal subproject. In this case, the compilation of the @@ -160,11 +162,16 @@ of python and pybind11 used for the compilation of the plugin: At this point, you are ready to start the compilation of SOFA and the SofaPython3 plugin. +.. _outtree: +***************** Out-of-tree build ------------------ +***************** + +Compilation +^^^^^^^^^^^ -As detailed above in the `Prerequisite `_ section, you must have an installed version of SOFA in order to compile the SofaPython3 plugin *out-of-tree*. Not only must the sources be compiled following the SOFA documentation, but you have to make sure to have an **install** directory, i.e. to execute the installation (e.g. by runnin the command ``cmake --install .`` from the SOFA build directory) +As detailed above in the :ref:`compilation.prerequisites` section, you must have an installed version of SOFA in order to compile the SofaPython3 plugin *out-of-tree*. Not only must the sources be compiled following the SOFA documentation, but you have to make sure to have an **install** directory, i.e. to execute the installation (e.g. by runnin the command ``cmake --install .`` from the SOFA build directory) Once done, export the installation path of SOFA inside the ``SOFA_ROOT`` environment variable. For example, @@ -204,5 +211,20 @@ Let's now pull the source code of the plugin, configure the build and start the $ cmake --build $SP3_BUILD $ cmake --install $SP3_BUILD -That's it, you are now ready to use SofaPython3. Keep the environment variable **SOFA_ROOT** and **SP3_ROOT** close by -for the upcoming sections. \ No newline at end of file +Keep the environment variable **SOFA_ROOT** and **SP3_ROOT** close by for the upcoming sections. + + +Setup using runSofa +^^^^^^^^^^^^^^^^^^^ + +Using SofaPython3 built out-of-tree (as explained just previously), you can load the SofaPython3 plugin in runSofa following one of this step: + + * use the "-l" of runSofa: ``runSofa -l /path/to/SofaPython3_build/lib/libSofaPython3.so `` + * or use the environment variable ``SOFA_PLUGIN_PATH=/path/to/SofaPython3_build/`` + * or add the component ```` in your scene + * or start runSofa, manually load the SofaPython3 library using *Edit->Plugin Manager->Add* , then restart runSofa: the plugin should load automatically + +Setup using python3 +^^^^^^^^^^^^^^^^^^^ + +See the `Setup your environment using python3 `_ section diff --git a/docs/sphinx/source/menu/Contributing.rst b/docs/sphinx/source/content/Contributing.rst similarity index 66% rename from docs/sphinx/source/menu/Contributing.rst rename to docs/sphinx/source/content/Contributing.rst index 4afdd9ae..69f8acba 100644 --- a/docs/sphinx/source/menu/Contributing.rst +++ b/docs/sphinx/source/content/Contributing.rst @@ -1,11 +1,13 @@ +############ Contributing -============ +############ We welcome any contribution. The SofaPython3 plugin, bindings and this documentation can be directly improved following a pull-request process in the GitHub repository. +************* Pull requests -------------- +************* If you are able to patch a bug, add the feature yourself, add new examples or simply fix a typo – fantastic, make a pull request with the code! Be sure you have read any documents on contributing and you understand `the SOFA license `_. Once you have submitted a pull request the maintainer(s) can compare your branch to the existing one and decide whether or not to incorporate (pull in) your changes. @@ -17,3 +19,16 @@ If you are able to patch a bug, add the feature yourself, add new examples or si * Make your changes. * Pull in changes from upstream often to `synchronize your fork `_ so that merge conflicts will be less likely in your pull request. * `Create a pull request `_ when you are ready to propose your changes into the main project. + + +*********************** +Share your achievements +*********************** + +Discovering what you achieve using SOFA and SofaPython3 is rewarding for the project. +We would be most grateful in case you: + +* `Cite SOFA `_ in your publications +* `Share your achievements `_ with the community +* Join the `SOFA annual conference `_ and present your work +* Share new `open-source plugins `_ diff --git a/docs/sphinx/source/menu/CustomModule.rst b/docs/sphinx/source/content/CustomModule.rst similarity index 92% rename from docs/sphinx/source/menu/CustomModule.rst rename to docs/sphinx/source/content/CustomModule.rst index b4ae8009..d92c4eb5 100644 --- a/docs/sphinx/source/menu/CustomModule.rst +++ b/docs/sphinx/source/content/CustomModule.rst @@ -1,5 +1,6 @@ +###################### Writing custom binding -====================== +###################### It is possible to write your custom binding for your own SOFA c++ components. For that you need to follow the example provided in bindings/BindingExample. In this example a custom c++ SOFA object diff --git a/docs/sphinx/source/content/FirstSteps.rst b/docs/sphinx/source/content/FirstSteps.rst new file mode 100644 index 00000000..7c5df332 --- /dev/null +++ b/docs/sphinx/source/content/FirstSteps.rst @@ -0,0 +1,515 @@ +########### +First steps +########### + +Executing a simulation +********************** + +With runSofa +^^^^^^^^^^^^ + +You can load a python based simulation directly in runSofa by using the command + +.. code-block:: shell + + runSofa examples/example1.py + +Let's now open ``examples/example1.py`` to have more insight. +The first important thin to notice is that the python script is importing modules called ``Sofa``, this module, and few other are containing +all SOFA specific component. Then the script is defining a ``createScene()`` function. This function is the entry point of your simulation and +is automatically called by the runSofa application when a python file is loaded. + +We will look with more details in this ``createScene()`` but first let's how we can execute the same file without using ``runSofa``. + + +With the python3 interpreter +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Before being able to execute a simulation from a python interpreter (including jupyter notebook) be sure you read the "`Setup your python3 environment `_" section +so your python environment is properly configured and has access to the SOFA specific python modules. + +When working a python3 interpreter, your simulation requires more than only the ``createScene()`` function. +Indeed, the python environment does not pre-generate a root node as the runSofa executable is. +One must therefore create it and then call the ``createScene()`` function: + +.. code-block:: python + + # Required import for SOFA within python + import Sofa + + + def main(): + # Call the SOFA function to create the root node + root = Sofa.Core.Node("root") + + # Call the createScene function, as runSofa does + createScene(root) + + # Once defined, initialization of the scene graph + Sofa.Simulation.init(root) + + # Run as many simulation steps (here 10 steps are computed) + for iteration in range(10): + Sofa.Simulation.animate(root, root.dt.value) + + + # Same createScene function as in the previous case + def createScene(rootNode): + #Doesn't do anything yet + return rootNode + + + # Function used only if this script is called from a python environment + if __name__ == '__main__': + main() + + +By structuring your scripts this way, you get the advantage to have a script loadable from both runSofa and a python3 interpreter. +Note that the ``main()`` function runs 10 time steps without any graphical user interface and the script ends. + +In case you want to manage the simulation from the runSofa GUI, you can simply change the ``main()`` function as follows: + +.. code-block:: python + + def main(): + # Call the SOFA function to create the root node + root = Sofa.Core.Node("root") + + # Call the createScene function, as runSofa does + createScene(root) + + # Once defined, initialization of the scene graph + Sofa.Simulation.init(root) + + # Launch the GUI (qt or qglviewer) + Sofa.Gui.GUIManager.Init("myscene", "qglviewer") + Sofa.Gui.GUIManager.createGUI(root, __file__) + Sofa.Gui.GUIManager.SetDimension(1080, 800) + + # Initialization of the scene will be done here + Sofa.Gui.GUIManager.MainLoop(root) + Sofa.Gui.GUIManager.closeGUI() + + +So far, you can load this python scene, but it doesn't do much. Let's enrich this scene! + +A scene in SOFA is an ordered tree of nodes representing objects (example of node: hand), with parent/child relationship (example of hand's child: finger). Each node has one or more components. Every node and component has a name and a few features. The main node at the top of the tree is usually called "rootNode" or "root". More about how to create a simulation scene can be found in the `SOFA online documentation `_ + + +Create a new simulation +*********************** + +If a python script is loaded within the runSofa executable, make sure the SofaPython3 plugin is well loaded. When opening the python script, runSofa will search for the `createScene(arg0: Sofa.Core.Node) -> Sofa.Core.Node` method and it uses it as the entry point of the SOFA simulation, and taking a single parameter: the root Node. Thus define this method: + +.. code-block:: python + + def createScene(rootNode): + #Doesn't do anything yet + return rootNode + + +Add your first object +^^^^^^^^^^^^^^^^^^^^^ + +We first propose to add a visual grid, in order to see things more clearly. To do that, we simply need to add an object to the rootNode with the right properties : + +.. code-block:: python + + def createScene(rootNode): + rootNode.addObject("VisualGrid", nbSubdiv=10, size=1000) + +Now, we create a new child node, in order to add the general configuration of the scene : required plugins (here SofaPython3) and other tools (like a system of axes). + +.. code-block:: python + + confignode = rootNode.addChild("Config") + confignode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight") + + +Finally, we add the sphere itself, which consists of two parts : the mechanical representation and the visual representation of the sphere: + +.. code-block:: python + + # Creating the falling sphere object + sphere = rootNode.addChild("sphere") + sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) + + #### Visualization subnode for the sphere + sphereVisu = sphere.addChild("VisualModel") + sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj") + sphereVisu.addObject('OglModel', name="model", src="@loader", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False) + sphereVisu.addObject('RigidMapping') + +.. image:: ../images/exampleScene_step1.png + :alt: This is what you should see in Sofa at this stage + :align: center + :height: 250pt + + +Now, if you execute your scene, you can see a sphere, but it won't move if you click on the Animate button in SOFA. Let's change that! + + +Define physical properties +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A default gravity force is implemented on SOFA. Here we reset it, for learning purposes. We also define the time step of the simulation. + +.. code-block:: python + + rootNode.gravity=[0.0,-9.81,0.0] + rootNode.dt=0.01 + +We add a mechanical model, so that all our futur elements will have the same total mass, volume and inertia matrix : + +.. code-block:: python + + totalMass = 1.0 + volume = 1.0 + inertiaMatrix=[1., 0., 0., 0., 1., 0., 0., 0., 1.] + +We add properties to the sphere. First, we add a mass, then an object called 'UncoupledConstraintCorrection', in charge of computing the constraint forces of the sphere, then we add two different solvers. One is a time integration scheme that defines the system to be solved at each time step of the simulation (here the implicit Euler Method), the other is a solving method (here the Conjugate Gradient method), that solves the equations governing the model at each time step, and updates the MechanicalObject. + +.. code-block:: python + + # Creating the falling sphere object + sphere = rootNode.addChild("sphere") + sphere.addObject('EulerImplicitSolver', name='odesolver') + sphere.addObject('CGLinearSolver', name='Solver', iterations=25, tolerance=1e-05, threshold=1e-05) + sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) + sphere.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + sphere.addObject('UncoupledConstraintCorrection') + +.. image:: ../images/exampleScene_step2.gif + :alt: This is what you should see in Sofa at this stage + :align: center + :height: 250pt + +Now, if you click on the Animate button in SOFA, the sphere will fall. + + +Add a second object +^^^^^^^^^^^^^^^^^^^ + +Let's add a second element, a floor, to see how they interact : + +.. code-block:: python + + # Creating the floor object + floor = rootNode.addChild("floor") + + floor.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0) + floor.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + + #### Collision subnode for the floor + floorCollis = floor.addChild('collision') + floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) + floorCollis.addObject('MeshTopology', src="@loader") + floorCollis.addObject('MechanicalObject') + floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) + floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) + floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) + floorCollis.addObject('RigidMapping') + + #### Visualization subnode for the floor + floorVisu = floor.addChild("VisualModel") + floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj") + floorVisu.addObject('OglModel', name="model", src="@loader", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False) + floorVisu.addObject('RigidMapping') + +.. image:: ../images/exampleScene_step3.gif + :alt: This is what you should see in Sofa at this stage + :align: center + :height: 250pt + +A floor has now been added to the scene. It is a stationnary object, it won't move during the simulation. When you click on the Animate button, you can see that the sphere goes through the floor, as if there were nothing there. That is because there is no collision modeling in the scene yet. + + +Add a collision pipeline +^^^^^^^^^^^^^^^^^^^^^^^^ + +We first add a collision model for the scene in general, that is stating how a contact between the objects is handled: here the objects must not be able to go through one another. Potential collisions are looked for within an alarmDistance radius from the objet. If a collision situation is detected, the collision model computes the behaviour of the objects, which are stopped at a ContactDistance from each other. + +.. code-block:: python + + # Collision pipeline + rootNode.addObject('DefaultPipeline') + rootNode.addObject('FreeMotionAnimationLoop') + rootNode.addObject('GenericConstraintSolver', tolerance="1e-6", maxIterations="1000") + rootNode.addObject('BruteForceBroadPhase') + rootNode.addObject('BVHNarrowPhase') + rootNode.addObject('RuleBasedContactManager', responseParams="mu="+str(0.0), name='Response', response='FrictionContactConstraint') + rootNode.addObject('LocalMinDistance', alarmDistance=10, contactDistance=5, angleCone=0.01) + + +We add a new child node to the sphere, that will be in charge of processing the collision. + +.. code-block:: python + + #### Collision subnode for the sphere + collision = sphere.addChild('collision') + collision.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj", triangulate="true", scale=45.0) + collision.addObject('MeshTopology', src="@loader") + collision.addObject('MechanicalObject') + collision.addObject('TriangleCollisionModel') + collision.addObject('LineCollisionModel') + collision.addObject('PointCollisionModel') + collision.addObject('RigidMapping') + + +We do the same for the floor, but we also specify that the floor is a stationnary object that shouldn't move. + +.. code-block:: python + + #### Collision subnode for the floor + floorCollis = floor.addChild('collision') + floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) + floorCollis.addObject('MeshTopology', src="@loader") + floorCollis.addObject('MechanicalObject') + floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) + floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) + floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) + floorCollis.addObject('RigidMapping') + + +.. image:: ../images/exampleScene_step4.gif + :alt: This is what you should see in Sofa at this stage + :align: center + :height: 250pt + +Now, the sphere is stopped by the floor, as it should be. +Congratulations! You made your first SOFA scene in Python3! + +For more information on how to use the SOFA modules bindings in python, visit this page: :doc:`Modules` + + +.. _fullscene: + +Full scene +^^^^^^^^^^ +Here is the entire code of the scene : + +.. code-block:: python + + import Sofa + import Sofa.Gui + + + def main(): + # Call the SOFA function to create the root node + root = Sofa.Core.Node("root") + + # Call the createScene function, as runSofa does + createScene(root) + + # Once defined, initialization of the scene graph + Sofa.Simulation.init(root) + + # Launch the GUI (qt or qglviewer) + Sofa.Gui.GUIManager.Init("myscene", "qglviewer") + Sofa.Gui.GUIManager.createGUI(root, __file__) + Sofa.Gui.GUIManager.SetDimension(1080, 800) + + # Initialization of the scene will be done here + Sofa.Gui.GUIManager.MainLoop(root) + Sofa.Gui.GUIManager.closeGUI() + + + def createScene(rootNode): + + rootNode.addObject("VisualGrid", nbSubdiv=10, size=1000) + + # Define the root node properties + rootNode.gravity=[0.0,-9.81,0.0] + rootNode.dt=0.01 + + # Loading all required SOFA modules + confignode = rootNode.addChild("Config") + confignode.addObject('RequiredPlugin', name="Sofa.Component.AnimationLoop", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Correction", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Solver", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Mapping.NonLinear", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Mass", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.StateContainer", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Visual", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D", printLog=False) + confignode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight") + + + # Collision pipeline + rootNode.addObject('DefaultPipeline') + rootNode.addObject('FreeMotionAnimationLoop') + rootNode.addObject('GenericConstraintSolver', tolerance="1e-6", maxIterations="1000") + rootNode.addObject('BruteForceBroadPhase') + rootNode.addObject('BVHNarrowPhase') + rootNode.addObject('RuleBasedContactManager', responseParams="mu="+str(0.0), name='Response', response='FrictionContactConstraint') + rootNode.addObject('LocalMinDistance', alarmDistance=10, contactDistance=5, angleCone=0.01) + + + totalMass = 1.0 + volume = 1.0 + inertiaMatrix=[1., 0., 0., 0., 1., 0., 0., 0., 1.] + + + sphere = rootNode.addChild("sphere") + sphere.addObject('EulerImplicitSolver', name='odesolver') + sphere.addObject('CGLinearSolver', name='Solver', iterations=25, tolerance=1e-05, threshold=1e-05) + sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) + sphere.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + sphere.addObject('UncoupledConstraintCorrection') + + #### Collision subnode for the sphere + collision = sphere.addChild('collision') + collision.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj", triangulate="true", scale=45.0) + collision.addObject('MeshTopology', src="@loader") + collision.addObject('MechanicalObject') + collision.addObject('TriangleCollisionModel') + collision.addObject('LineCollisionModel') + collision.addObject('PointCollisionModel') + collision.addObject('RigidMapping') + + #### Visualization subnode for the sphere + sphereVisu = sphere.addChild("VisualModel") + sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj") + sphereVisu.addObject('OglModel', name="model", src="@loader", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False) + sphereVisu.addObject('RigidMapping') + + + # Creating the floor object + floor = rootNode.addChild("floor") + + floor.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0) + floor.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + + #### Collision subnode for the floor + floorCollis = floor.addChild('collision') + floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) + floorCollis.addObject('MeshTopology', src="@loader") + floorCollis.addObject('MechanicalObject') + floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) + floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) + floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) + floorCollis.addObject('RigidMapping') + + #### Visualization subnode for the floor + floorVisu = floor.addChild("VisualModel") + floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj") + floorVisu.addObject('OglModel', name="model", src="@loader", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False) + floorVisu.addObject('RigidMapping') + + + return rootNode + + + # Function used only if this script is called from a python environment + if __name__ == '__main__': + main() + +Accessing data: read and write +****************************** + +One major advantage of coupling SOFA simulation and python is to access and process data before the simulation starts, while it is running and once the simulation ended. All components in SOFA have so-called data. A data is a public attribute of a Component (C++ class) visible to the user in the SOFA user interface and any data can also be accessed though python. + +Read access +^^^^^^^^^^^ + +Let's update the :ref:`fullscene` just introduced above in order to access data using the ``.value`` acessor once the GUI is closed: + + +.. code-block:: python + + import Sofa + import Sofa.Gui + + + def main(): + + ... + + # Initialization of the scene will be done here + Sofa.Gui.GUIManager.MainLoop(root) + Sofa.Gui.GUIManager.closeGUI() + + # Accessing and printing the final time of simulation + # "time" being the name of a Data available in all Nodes + finalTime = root.time.value + print(finalTime) + +Note that: +* accessing the Data "time" doing ``root.time`` would only return the python pointer and not the value of the Data +* Data which are vectors can be casted as numpy arrays + + + +Write access +^^^^^^^^^^^^ + +In the same way, Data can be modified (write access) using the ``.value`` accessor. Here is an example (without GUI) computing 10 time steps, then setting the world gravity to zero and recomputing 10 time steps: + + +.. code-block:: python + + + def main(): + + # Call the SOFA function to create the root node + root = Sofa.Core.Node("root") + + # Call the createScene function, as runSofa does + createScene(root) + + # Once defined, initialization of the scene graph + Sofa.Simulation.init(root) + + # Run the simulation for 10 steps + for iteration in range(10): + Sofa.Simulation.animate(root, root.dt.value) + + # Print the position of the falling sphere + print(root.sphere.mstate.position.value) + + # Increase the gravity + root.gravity.value = [0, 0, 0] + + # Run the simulation for 10 steps MORE + for iteration in range(10): + Sofa.Simulation.animate(root, root.dt.value) + + # Print the position of the falling sphere + print(root.sphere.mstate.position.value) + + +The ``.value`` accessor works for simple Data structures such as a string, an integer, a floating-point numbers or a vector of these. + +For more complex Data such as Data related to the degrees of freedom (e.g. Coord/Deriv, VecCoord/VecDeriv), the ``.writeableArray()`` write accessor must be used. Let's consider a scene graph that would have a *ConstantForceField* named "CFF" in the sphere node, and that we would like to modify the Data "totalForce" (a Deriv defined in `ConstantForceField.h `_), we should then write something like: + + +.. code-block:: python + + with root.sphere.CFF.totalForce.writeableArray() as wa: + wa[0] += 0.01 # modify the first entry of the Deriv Data "totalForce" + + + +More simulation examples +************************ + +Many `additional examples `_ are available within the SofaPython3 plugin in the *examples/* folder: + +* `basic.py `_ : basic scene with a rigid particle without a GUI +* `basic-addGUI.py `_ : same basic scene with a rigid particle with a GUI +* `emptyController.py `_ : example displaying all possible functions available in python controllers +* `access_matrix.py `_ : example on how to access the system matrix and vector +* `access_mass_matrix.py `_ : example on how to access the mass matrix +* `access_stiffness_matrix.py `_ : example on how to access the stiffness matrix +* `access_compliance_matrix.py `_ : example on how to access the compliance matrix used in constraint problems + +Do not hesitate to take a look and get inspiration! + diff --git a/docs/sphinx/source/content/Installation.rst b/docs/sphinx/source/content/Installation.rst new file mode 100644 index 00000000..70947aad --- /dev/null +++ b/docs/sphinx/source/content/Installation.rst @@ -0,0 +1,154 @@ +####### +Install +####### + +The SofaPython3 plugins allows you to embed a python3 interpreter into an existing SOFA application (eg: runSofa) and to create/launch SOFA simulations from a python environment. +Depending on your use case you may have different step to follow to get a fully working SofaPython3 environnement. + +.. _getsofapython3: + +*************** +Get SofaPython3 +*************** + +Latest version of the SofaPython3 plugins are now shipped within the binary SOFA release supported by the SOFA Constortium. +All you need is therefore to download these SOFA binaries from the `SOFA website `_. + + +******************** +Get python installed +******************** + +First, make sure you have the same version of python installed on your computer as the one that is used in the binary version. + +.. tabs:: + + .. tab:: Ubuntu + + Run in a terminal: + + .. code-block:: bash + + sudo add-apt-repository ppa:deadsnakes/ppa + sudo apt install libpython3.8 python3.8 python3-pip + python3.8 -m pip install numpy + + if you want to launch the runSofa: + + .. code-block:: bash + + sudo apt install libopengl0 + + + .. tab:: Ubuntu + + Run in a terminal: + + .. code-block:: bash + + brew install python@3.8 + export PATH="/usr/local/opt/python@3.8/bin/:$PATH" + + BigSur only: + + .. code-block:: bash + + pip3 install --upgrade pip + python3.8 -m pip install numpy + + Catalina only: + + .. code-block:: bash + + pip3 install numpy + + + .. tab:: Windows + + Download and install `Python 3.8 64bit `_ + + +********************** +Setup your environment +********************** + +using runSofa +************* + +Using SofaPython3 in runSofa requires loading the SofaPython3 plugin in your runSofa environment. If you downloaded and installed SOFA from the SOFA website (as explained above, see :ref:`getsofapython3`), you can load the SofaPython3 plugin using the PluginManager (in the GUI) or by auto-loading the plugin in runSofa: simply copy the file **plugin_list.conf.default** in */lib*, and rename it **plugin_list.conf**, then add the line: + + .. code-block:: text + + SofaPython3 NO_VERSION + + .. + Note that adding the line to the file **plugin_list.conf.default** in */lib* would work, but you would need to add the line everytime you compile the code. + +Having the SofaPython3 plugin active will allow you to open scene files using the ".py, .py3, .pyscn, .pyscn3" file extension in runSofa, with the command : + + .. code-block:: bash + + /bin/runSofa + + +using python3 +************* + +Before running your simulations, you must make sure to define the following environment variables: + + +.. tabs:: + + .. tab:: Ubuntu + + Run in a terminal: + + .. code-block:: bash + + export SOFA_ROOT=/path/to/SOFA_install + export PYTHONPATH=/path/to/SofaPython3/lib/python3/site-packages:$PYTHONPATH + + .. tab:: MacOS + + Run in a terminal: + + .. code-block:: bash + + export SOFA_ROOT=/path/to/SOFA_install + export PYTHONPATH=/path/to/SofaPython3/lib/python3/site-packages:$PYTHONPATH + export PATH="/usr/local/opt/python@3.8/bin/:$PATH" + + + .. tab:: Windows + + * Create a system variable **SOFA_ROOT** and set it to ```` + * Create a system variable **PYTHON_ROOT** and set it to ```` + * Create a system variable **PYTHONPATH** and set it to ``%SOFA_ROOT%\plugins\SofaPython3\lib\python3\site-packages`` + * Edit the system variable **Path** and add at the end ``;%PYTHON_ROOT%;%PYTHON_ROOT%\DLLs;%PYTHON_ROOT%\Lib;%SOFA_ROOT%\bin;`` + * Open a Console (cmd.exe) and run ``python -V && python -m pip install numpy scipy`` + + After that, all you need to do is open a Console (cmd.exe) and run: ``runSofa -lSofaPython3`` + + + +It is possible to use SOFA in any python3 interpreter. +The following code should cover most basic SOFA elements: + +.. code-block:: python + + # to be able to create SOFA objects you need to first load the plugins that implement them. + # For simplicity you can load the plugin "Sofa.Component" that will load all most + # common sofa objects. + import SofaRuntime + SofaRuntime.importPlugin("Sofa.Component") + + # to create elements like Node or objects + import Sofa.Core + + +Get support +*********** + +To freely get technical assistance from the community, please do not hesitate to join the `SofaPython3 GitHub forum `_ and post there any question related to SofaPython3. + +To quickly level up on SOFA, never hesitate to request `SOFA training sessions `_. diff --git a/docs/sphinx/source/content/Modules.rst b/docs/sphinx/source/content/Modules.rst new file mode 100644 index 00000000..602ae040 --- /dev/null +++ b/docs/sphinx/source/content/Modules.rst @@ -0,0 +1,23 @@ +####### +Modules +####### + +.. toctree:: + :titlesonly: + :hidden: + + modules/Sofa/index + modules/SofaRuntime/index + modules/SofaExporter/index + + +The SofaPython3 binding is highly modular allowing to select only the modules strictly relevant to your needs. +Most commonly used modules provided by the Sofa-consortium are: + +.. autosummary:: + + Sofa + SofaRuntime + SofaExporter + + \ No newline at end of file diff --git a/docs/sphinx/source/content/PythonLibraries.rst b/docs/sphinx/source/content/PythonLibraries.rst new file mode 100644 index 00000000..1079a994 --- /dev/null +++ b/docs/sphinx/source/content/PythonLibraries.rst @@ -0,0 +1,12 @@ +################### +Third party modules +################### + + +Additionnal libraries or plugins for SOFA including python3 bindings: + +- STLIB and SPLIB (both in `STLIB plugin `_) +- `Caribou `_ +- `Cosserat `_ + +More to be added. diff --git a/docs/sphinx/source/menu/SofaPlugin.rst b/docs/sphinx/source/content/UsingThePlugin.rst similarity index 65% rename from docs/sphinx/source/menu/SofaPlugin.rst rename to docs/sphinx/source/content/UsingThePlugin.rst index 11db59db..88b95707 100644 --- a/docs/sphinx/source/menu/SofaPlugin.rst +++ b/docs/sphinx/source/content/UsingThePlugin.rst @@ -1,18 +1,20 @@ +################ Using the plugin -================ +################ -The SofaPython3 plugins allows you to embed a python3 interpreter into an exising SOFA application (eg: runSofa) and to create/launch SOFA simulations from a python environment. +The SofaPython3 plugins allows you to embed a python3 interpreter into an existing SOFA application (eg: runSofa) and to create/launch SOFA simulations from a python environment. +************* Prerequisites -------------- +************* + If you downloaded and installed SOFA and its headers from the `SOFA website `_, make sure to have python3.10 installed on your computer. -.. content-tabs:: +.. tabs:: - .. tab-container:: tab1 - :title: Ubuntu + .. tab:: Ubuntu Run in a terminal: @@ -29,8 +31,7 @@ If you downloaded and installed SOFA and its headers from the `SOFA website `_ Run a python script -------------------- +******************* Within runSofa ^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ Within runSofa Using SofaPython3 in runSofa requires loading the SofaPython3 plugin in your runSofa environment. -* If you downloaded and installed SOFA and its headers from the `SOFA website `_, or if you `compiled SofaPython3 in-tree `_, you can load the SofaPython3 plugin using the PluginManager (in the GUI) or by auto-loading the plugin in runSofa: simply copy the file **plugin_list.conf.default** in */lib*, and rename it **plugin_list.conf**, then add the line: +* If you downloaded and installed SOFA and its headers from the `SOFA website `_, or if you `compiled SofaPython3 in-tree `_, you can load the SofaPython3 plugin using the PluginManager (in the GUI) or by auto-loading the plugin in runSofa: simply copy the file **plugin_list.conf.default** in */lib*, and rename it **plugin_list.conf**, then add the line: .. code-block:: bash @@ -83,7 +83,7 @@ Using SofaPython3 in runSofa requires loading the SofaPython3 plugin in your run /bin/runSofa -* If you `compiled SofaPython3 out-of-tree `_, you can load the SofaPython3 following one of this step: +* If you `compiled SofaPython3 out-of-tree `_, you can load the SofaPython3 following one of this step: * use the "-l" of runSofa: ``runSofa -l /path/to/SofaPython3_build/lib/libSofaPython3.so `` * or use the environment variable ``SOFA_PLUGIN_PATH=/path/to/SofaPython3_build/`` @@ -98,10 +98,9 @@ Within a python3 interpreter Before running your simulations, you must make sure to define the following environment variables: -.. content-tabs:: +.. tabs:: - .. tab-container:: tab1 - :title: Ubuntu + .. tab:: Ubuntu Run in a terminal: @@ -110,8 +109,7 @@ Before running your simulations, you must make sure to define the following envi export SOFA_ROOT=/path/to/SOFA_install export PYTHONPATH=/path/to/SofaPython3/lib/python3/site-packages:$PYTHONPATH - .. tab-container:: tab2 - :title: MacOS + .. tab:: MacOS Run in a terminal: @@ -122,8 +120,7 @@ Before running your simulations, you must make sure to define the following envi export PATH="/usr/local/opt/python@3.10/bin/:$PATH" - .. tab-container:: tab3 - :title: Windows + .. tab:: Windows * Create a system variable **SOFA_ROOT** and set it to ```` * Create a system variable **PYTHON_ROOT** and set it to ```` @@ -151,7 +148,7 @@ The following code should cover most basic SOFA elements: Create a simulation -------------------- +******************* A scene in SOFA is an ordered tree of nodes representing objects (example of node: hand), with parent/child relationship (example of hand's child: finger). Each node has one or more components. Every node and component has a name and a few features. The main node at the top of the tree is usually called "rootNode" or "root". More about how to create a simulation scene can be found in the `SOFA online documentation `_ @@ -164,15 +161,15 @@ If a python script is loaded within the runSofa executable, make sure the SofaPy .. code-block:: python def createScene(rootNode): - #Doesn't do anything yet - return rootNode + #Doesn't do anything yet + return rootNode Within a python3 interpreter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -With the SofaPython3 plugin, it is also possible to execute a python script. However, to run a SOFA simulation from a python3 interpreter, the python environment must be aware of the SOFA python modules and their location. To do so, make sure to read the "`Within a python3 interpreter `_" section. +With the SofaPython3 plugin, it is also possible to execute a python script. However, to run a SOFA simulation from a python3 interpreter, the python environment must be aware of the SOFA python modules and their location. To do so, make sure to read the "`Within a python3 interpreter `_" section. Within a python3 interpreter, your simulation requires more than only the ``createScene()`` function. Indeed, the python environment does not pre-generate a root node as the runSofa executable is. One must therefore create it and then call the ``createScene()`` function: @@ -184,24 +181,24 @@ Within a python3 interpreter, your simulation requires more than only the ``crea def main(): - # Call the SOFA function to create the root node - root = Sofa.Core.Node("root") + # Call the SOFA function to create the root node + root = Sofa.Core.Node("root") - # Call the createScene function, as runSofa does - createScene(root) + # Call the createScene function, as runSofa does + createScene(root) - # Once defined, initialization of the scene graph - Sofa.Simulation.init(root) + # Once defined, initialization of the scene graph + Sofa.Simulation.init(root) - # Run as many simulation steps (here 10 steps are computed) - for iteration in range(10): - Sofa.Simulation.animate(root, root.dt.value) + # Run as many simulation steps (here 10 steps are computed) + for iteration in range(10): + Sofa.Simulation.animate(root, root.dt.value) # Same createScene function as in the previous case def createScene(rootNode): - #Doesn't do anything yet - return rootNode + #Doesn't do anything yet + return rootNode # Function used only if this script is called from a python environment @@ -245,7 +242,7 @@ We first propose to add a visual grid, in order to see things more clearly. To d .. code-block:: python def createScene(rootNode): - rootNode.addObject("VisualGrid", nbSubdiv=10, size=1000) + rootNode.addObject("VisualGrid", nbSubdiv=10, size=1000) Now, we create a new child node, in order to add the general configuration of the scene : required plugins (here SofaPython3) and other tools (like a system of axes). @@ -260,14 +257,14 @@ Finally, we add the sphere itself, which consists of two parts : the mechanical .. code-block:: python # Creating the falling sphere object - sphere = rootNode.addChild("sphere") - sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) + sphere = rootNode.addChild("sphere") + sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) - #### Visualization subnode for the sphere - sphereVisu = sphere.addChild("VisualModel") - sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj") - sphereVisu.addObject('OglModel', name="model", src="@loader", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False) - sphereVisu.addObject('RigidMapping') + #### Visualization subnode for the sphere + sphereVisu = sphere.addChild("VisualModel") + sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj") + sphereVisu.addObject('OglModel', name="model", src="@loader", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False) + sphereVisu.addObject('RigidMapping') .. image:: ../images/exampleScene_step1.png :alt: This is what you should see in Sofa at this stage @@ -324,26 +321,26 @@ Let's add a second element, a floor, to see how they interact : .. code-block:: python # Creating the floor object - floor = rootNode.addChild("floor") - - floor.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0) - floor.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) - - #### Collision subnode for the floor - floorCollis = floor.addChild('collision') - floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) - floorCollis.addObject('MeshTopology', src="@loader") - floorCollis.addObject('MechanicalObject') - floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) - floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) - floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) - floorCollis.addObject('RigidMapping') - - #### Visualization subnode for the floor - floorVisu = floor.addChild("VisualModel") - floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj") - floorVisu.addObject('OglModel', name="model", src="@loader", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False) - floorVisu.addObject('RigidMapping') + floor = rootNode.addChild("floor") + + floor.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0) + floor.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + + #### Collision subnode for the floor + floorCollis = floor.addChild('collision') + floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) + floorCollis.addObject('MeshTopology', src="@loader") + floorCollis.addObject('MechanicalObject') + floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) + floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) + floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) + floorCollis.addObject('RigidMapping') + + #### Visualization subnode for the floor + floorVisu = floor.addChild("VisualModel") + floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj") + floorVisu.addObject('OglModel', name="model", src="@loader", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False) + floorVisu.addObject('RigidMapping') .. image:: ../images/exampleScene_step3.gif :alt: This is what you should see in Sofa at this stage @@ -408,12 +405,11 @@ We do the same for the floor, but we also specify that the floor is a stationnar Now, the sphere is stopped by the floor, as it should be. Congratulations! You made your first SOFA scene in Python3! -For more information on how to use the SOFA modules bindings in python, visit this page: :doc:`SofaModule` +For more information on how to use the SOFA modules bindings in python, visit this page: :doc:`Modules` - -Full scene -^^^^^^^^^^ +Full scene example +^^^^^^^^^^^^^^^^^^ Here is the entire code of the scene : .. code-block:: python @@ -444,96 +440,96 @@ Here is the entire code of the scene : def createScene(rootNode): - rootNode.addObject("VisualGrid", nbSubdiv=10, size=1000) - - # Define the root node properties - rootNode.gravity=[0.0,-9.81,0.0] - rootNode.dt=0.01 - - # Loading all required SOFA modules - confignode = rootNode.addChild("Config") - confignode.addObject('RequiredPlugin', name="Sofa.Component.AnimationLoop", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Correction", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Solver", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Mapping.NonLinear", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Mass", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.StateContainer", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.Component.Visual", printLog=False) - confignode.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D", printLog=False) - confignode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight") - - - # Collision pipeline - rootNode.addObject('DefaultPipeline') - rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', tolerance="1e-6", maxIterations="1000") - rootNode.addObject('BruteForceBroadPhase') - rootNode.addObject('BVHNarrowPhase') - rootNode.addObject('RuleBasedContactManager', responseParams="mu="+str(0.0), name='Response', response='FrictionContactConstraint') - rootNode.addObject('LocalMinDistance', alarmDistance=10, contactDistance=5, angleCone=0.01) - - - totalMass = 1.0 - volume = 1.0 - inertiaMatrix=[1., 0., 0., 0., 1., 0., 0., 0., 1.] - - # Creating the falling sphere object - sphere = rootNode.addChild("sphere") - sphere.addObject('EulerImplicitSolver', name='odesolver') - sphere.addObject('CGLinearSolver', name='Solver', iterations=25, tolerance=1e-05, threshold=1e-05) - sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) - sphere.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) - sphere.addObject('UncoupledConstraintCorrection') - - #### Collision subnode for the sphere - collision = sphere.addChild('collision') - collision.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj", triangulate="true", scale=45.0) - collision.addObject('MeshTopology', src="@loader") - collision.addObject('MechanicalObject') - collision.addObject('TriangleCollisionModel') - collision.addObject('LineCollisionModel') - collision.addObject('PointCollisionModel') - collision.addObject('RigidMapping') - - #### Visualization subnode for the sphere - sphereVisu = sphere.addChild("VisualModel") - sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj") - sphereVisu.addObject('OglModel', name="model", src="@loader", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False) - sphereVisu.addObject('RigidMapping') - - - # Creating the floor object - floor = rootNode.addChild("floor") - - floor.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0) - floor.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) - - #### Collision subnode for the floor - floorCollis = floor.addChild('collision') - floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) - floorCollis.addObject('MeshTopology', src="@loader") - floorCollis.addObject('MechanicalObject') - floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) - floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) - floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) - floorCollis.addObject('RigidMapping') - - #### Visualization subnode for the floor - floorVisu = floor.addChild("VisualModel") - floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj") - floorVisu.addObject('OglModel', name="model", src="@loader", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False) - floorVisu.addObject('RigidMapping') - - - return rootNode + rootNode.addObject("VisualGrid", nbSubdiv=10, size=1000) + + # Define the root node properties + rootNode.gravity=[0.0,-9.81,0.0] + rootNode.dt=0.01 + + # Loading all required SOFA modules + confignode = rootNode.addChild("Config") + confignode.addObject('RequiredPlugin', name="Sofa.Component.AnimationLoop", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Correction", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Solver", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Mapping.NonLinear", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Mass", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.StateContainer", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.Component.Visual", printLog=False) + confignode.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D", printLog=False) + confignode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight") + + + # Collision pipeline + rootNode.addObject('DefaultPipeline') + rootNode.addObject('FreeMotionAnimationLoop') + rootNode.addObject('GenericConstraintSolver', tolerance="1e-6", maxIterations="1000") + rootNode.addObject('BruteForceBroadPhase') + rootNode.addObject('BVHNarrowPhase') + rootNode.addObject('RuleBasedContactManager', responseParams="mu="+str(0.0), name='Response', response='FrictionContactConstraint') + rootNode.addObject('LocalMinDistance', alarmDistance=10, contactDistance=5, angleCone=0.01) + + + totalMass = 1.0 + volume = 1.0 + inertiaMatrix=[1., 0., 0., 0., 1., 0., 0., 0., 1.] + + + sphere = rootNode.addChild("sphere") + sphere.addObject('EulerImplicitSolver', name='odesolver') + sphere.addObject('CGLinearSolver', name='Solver', iterations=25, tolerance=1e-05, threshold=1e-05) + sphere.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50) + sphere.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + sphere.addObject('UncoupledConstraintCorrection') + + #### Collision subnode for the sphere + collision = sphere.addChild('collision') + collision.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj", triangulate="true", scale=45.0) + collision.addObject('MeshTopology', src="@loader") + collision.addObject('MechanicalObject') + collision.addObject('TriangleCollisionModel') + collision.addObject('LineCollisionModel') + collision.addObject('PointCollisionModel') + collision.addObject('RigidMapping') + + #### Visualization subnode for the sphere + sphereVisu = sphere.addChild("VisualModel") + sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/ball.obj") + sphereVisu.addObject('OglModel', name="model", src="@loader", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False) + sphereVisu.addObject('RigidMapping') + + + # Creating the floor object + floor = rootNode.addChild("floor") + + floor.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0) + floor.addObject('UniformMass', name="mass", vertexMass=[totalMass, volume, inertiaMatrix[:]]) + + #### Collision subnode for the floor + floorCollis = floor.addChild('collision') + floorCollis.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj", triangulate="true", scale=5.0) + floorCollis.addObject('MeshTopology', src="@loader") + floorCollis.addObject('MechanicalObject') + floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False) + floorCollis.addObject('LineCollisionModel', moving=False, simulated=False) + floorCollis.addObject('PointCollisionModel', moving=False, simulated=False) + floorCollis.addObject('RigidMapping') + + #### Visualization subnode for the floor + floorVisu = floor.addChild("VisualModel") + floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name="loader", filename="mesh/floor.obj") + floorVisu.addObject('OglModel', name="model", src="@loader", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False) + floorVisu.addObject('RigidMapping') + + + return rootNode # Function used only if this script is called from a python environment @@ -542,8 +538,8 @@ Here is the entire code of the scene : -Accessing data --------------- +Accessing data: read and write +****************************** One major advantage of coupling SOFA simulation and python is to access and process data before the simulation starts, while it is running and once the simulation ended. All components in SOFA have so-called data. A data is a public attribute of a Component (C++ class) visible to the user in the SOFA user interface and any data can also be accessed though python. @@ -551,7 +547,7 @@ One major advantage of coupling SOFA simulation and python is to access and proc Read access ^^^^^^^^^^^ -Let's consider the full scene introduced just `above in-tree `_ and try to access data using the ``.value`` acessor once the GUI is closed: +Let's update the :ref:`fullscene` just introduced above in order to access data using the ``.value`` acessor once the GUI is closed: .. code-block:: python @@ -630,7 +626,7 @@ For more complex Data such as Data related to the degrees of freedom (e.g. Coord More simulation examples ------------------------- +************************ Many `additional examples `_ are available within the SofaPython3 plugin in the *examples/* folder: @@ -645,9 +641,9 @@ Many `additional examples `_ and post there any question related to SofaPython3. +To freely get technical assistance from the community, please do not hesitate to join the `SofaPython3 GitHub forum `_ and post there any question related to SofaPython3. To quickly level up on SOFA, never hesitate to request `SOFA training sessions `_. diff --git a/docs/sphinx/source/content/modules/Sofa/additionalmodules.rst b/docs/sphinx/source/content/modules/Sofa/additionalmodules.rst new file mode 100644 index 00000000..8d9c5dfb --- /dev/null +++ b/docs/sphinx/source/content/modules/Sofa/additionalmodules.rst @@ -0,0 +1,12 @@ +Additional modules +================== + +.. autosummary:: + :toctree: generated + :template: autosummary/sub-modules.rst + :recursive: + + Sofa.SofaBaseTopology + Sofa.SofaConstraintSolver + Sofa.SofaDeformable + Sofa.SofaGL \ No newline at end of file diff --git a/docs/sphinx/source/content/modules/Sofa/index.rst b/docs/sphinx/source/content/modules/Sofa/index.rst new file mode 100644 index 00000000..69a69e54 --- /dev/null +++ b/docs/sphinx/source/content/modules/Sofa/index.rst @@ -0,0 +1,56 @@ +Sofa +**** + +.. currentmodule:: Sofa + +.. automodule:: Sofa + + +.. toctree:: + :hidden: + + submodules + +**Sub-modules** + +.. autosummary:: + :template: autosummary/sub-modules.rst + + Simulation + Core + Gui + Helper + Types + SofaTypes + prefab + constants + +.. toctree:: + :hidden: + + utilityfunctions + +**Utility Functions** + +.. autosummary:: + :template: autosummary/base.rst + + msg_error + msg_info + msg_warning + msg_deprecated + +.. toctree:: + :hidden: + + additionalmodules + +**Additional modules** + +.. autosummary:: + :template: autosummary/sub-modules.rst + + SofaBaseTopology + SofaConstraintSolver + SofaDeformable + SofaGL diff --git a/docs/sphinx/source/content/modules/Sofa/submodules.rst b/docs/sphinx/source/content/modules/Sofa/submodules.rst new file mode 100644 index 00000000..83e80527 --- /dev/null +++ b/docs/sphinx/source/content/modules/Sofa/submodules.rst @@ -0,0 +1,16 @@ +Sub-modules +=========== + +.. autosummary:: + :toctree: generated + :template: autosummary/sub-modules.rst + :recursive: + + Sofa.Simulation + Sofa.Core + Sofa.Gui + Sofa.Helper + Sofa.Types + Sofa.SofaTypes + Sofa.prefab + Sofa.constants \ No newline at end of file diff --git a/docs/sphinx/source/content/modules/Sofa/utilityfunctions.rst b/docs/sphinx/source/content/modules/Sofa/utilityfunctions.rst new file mode 100644 index 00000000..01e8dfb5 --- /dev/null +++ b/docs/sphinx/source/content/modules/Sofa/utilityfunctions.rst @@ -0,0 +1,12 @@ +Utility Functions +================= + +.. autosummary:: + :toctree: generated + :template: autosummary/base.rst + :recursive: + + Sofa.msg_error + Sofa.msg_info + Sofa.msg_warning + Sofa.msg_deprecated \ No newline at end of file diff --git a/docs/sphinx/source/content/modules/SofaExporter/index.rst b/docs/sphinx/source/content/modules/SofaExporter/index.rst new file mode 100644 index 00000000..1b689644 --- /dev/null +++ b/docs/sphinx/source/content/modules/SofaExporter/index.rst @@ -0,0 +1,17 @@ +SofaExporter +************ + +.. currentmodule:: SofaExporter + +.. automodule:: SofaExporter + +API Table of Content +-------------------- + +.. autosummary:: + :toctree: generated + :template: autosummary/base.rst + :recursive: + + STLExporter + VisualModelOBJExporter diff --git a/docs/sphinx/source/content/modules/SofaRuntime/index.rst b/docs/sphinx/source/content/modules/SofaRuntime/index.rst new file mode 100644 index 00000000..b347feb4 --- /dev/null +++ b/docs/sphinx/source/content/modules/SofaRuntime/index.rst @@ -0,0 +1,24 @@ +SofaRuntime +*********** + +.. currentmodule:: SofaRuntime + +.. automodule:: SofaRuntime + + +API Table of Content +-------------------- + +.. autosummary:: + :template: autosummary/base.rst + + importPlugin + unloadModules + formatStackForSofa + getStackForSofa + getPythonCallingPointAsString + getPythonCallingPoint + sendMessageFromException + sofaFormatHandler + sofaExceptHandler + getSofaFormattedStringFromException diff --git a/docs/sphinx/source/images/SofaPython3-logo.png b/docs/sphinx/source/images/SofaPython3-logo.png new file mode 100644 index 00000000..23eb3184 Binary files /dev/null and b/docs/sphinx/source/images/SofaPython3-logo.png differ diff --git a/docs/sphinx/source/index.rst b/docs/sphinx/source/index.rst index aaf200c8..3d004554 100644 --- a/docs/sphinx/source/index.rst +++ b/docs/sphinx/source/index.rst @@ -1,10 +1,10 @@ -General overview -================ +Welcome to SofaPython3 documentation ! +====================================== The SofaPython3 project brings python bindings for the `SOFA simulation framework `_. Thereby, it allows users to use most of the components and features found in SOFA directly into their python scripts. -This project is composed of two modules: 1. a *SOFA plugin* in the *SofaPython3/Plugin/* repository and 2. several *python modules* in the *SofaPython3/bindings/* repository. +This project is composed of two modules: a *SOFA plugin* in the *SofaPython3/Plugin/* repository & several *python modules* in the *SofaPython3/bindings/* repository. 1. The **SofaPython3 plugin** embeds a python interpreter and a SOFA scene loader. This plugin allows one to load a python script as the main simulation scene file. The scene loader will automatically detect the ".py", ".py3", ".py3scn" or @@ -18,23 +18,27 @@ that the python version is compatible. Hence, the python interpreter embedded in to load these binding modules. In addition, one could load the binding modules directly inside their own python interpreter without requiring the load of the plugin. -.. figure:: images/SP3_global_arch.png +.. figure:: images/SofaPython3-logo.png :alt: How SP3 fits in the SOFA usage pipeline :align: center - :width: 400 - -Content -------- + :width: 300 .. toctree:: - :glob: - :maxdepth: 1 - - menu/Compilation - menu/SofaPlugin - menu/SofaModule - menu/pythonLibraries - menu/CustomModule - menu/Contributing - - + :hidden: + :maxdepth: 5 + :caption: Content + :numbered: 3 + + content/Installation + content/FirstSteps + content/Modules + content/PythonLibraries + content/CustomModule + content/Compilation + content/Contributing + +Indices and tables +================== +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` \ No newline at end of file diff --git a/docs/sphinx/source/menu/SofaModule.rst b/docs/sphinx/source/menu/SofaModule.rst deleted file mode 100644 index 1a1aea95..00000000 --- a/docs/sphinx/source/menu/SofaModule.rst +++ /dev/null @@ -1,17 +0,0 @@ -The modules -================================ - -The binding is organize in several python modules. Each of them is exposing different aspect of the -Sofa API and components. - - - -.. autosummary:: - :toctree: _autosummary - - Sofa - SofaRuntime - SofaExporter - SofaTypes - - diff --git a/docs/sphinx/source/menu/pythonLibraries.rst b/docs/sphinx/source/menu/pythonLibraries.rst deleted file mode 100644 index 0c8e779c..00000000 --- a/docs/sphinx/source/menu/pythonLibraries.rst +++ /dev/null @@ -1,10 +0,0 @@ -Additionnal libraries -===================== - -Additionnal libraries for the SofaPython3 plugin. - -.. autosummary:: - :toctree: _autosummary - - splib - Sofa.constants diff --git a/docs/sphinx/source/requirements.txt b/docs/sphinx/source/requirements.txt index 8625ce05..64e3b225 100644 --- a/docs/sphinx/source/requirements.txt +++ b/docs/sphinx/source/requirements.txt @@ -1,3 +1,5 @@ mock sphinxcontrib-contentui - +sphinx-search +sphinx-autodoc-typehints +sphinx-rtd-theme diff --git a/docs/sphinx/source/templates/autosummary/base.rst b/docs/sphinx/source/templates/autosummary/base.rst new file mode 100644 index 00000000..f38003d3 --- /dev/null +++ b/docs/sphinx/source/templates/autosummary/base.rst @@ -0,0 +1,8 @@ +.. + base.rst + +{{ fullname | escape | underline | replace("=", '"') }} + +.. currentmodule:: {{ module }} + +.. auto{{ objtype }}:: {{ objname }} diff --git a/docs/sphinx/source/templates/autosummary/class.rst b/docs/sphinx/source/templates/autosummary/class.rst new file mode 100644 index 00000000..772805f8 --- /dev/null +++ b/docs/sphinx/source/templates/autosummary/class.rst @@ -0,0 +1,15 @@ +.. + class.rst + +{{ fullname | escape | underline | replace("=", '"') }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :inherited-members: + :show-inheritance: + + + + diff --git a/docs/sphinx/source/templates/autosummary/sub-modules.rst b/docs/sphinx/source/templates/autosummary/sub-modules.rst new file mode 100644 index 00000000..709f0478 --- /dev/null +++ b/docs/sphinx/source/templates/autosummary/sub-modules.rst @@ -0,0 +1,75 @@ +.. + sub-module.rst + +{{ fullname | escape | underline | replace("=", "-") }} + +General description +^^^^^^^^^^^^^^^^^^^ + +.. automodule:: {{ fullname }} + + +API Table of Content +^^^^^^^^^^^^^^^^^^^^ + +{% block modules %} + {% if modules %} + .. rubric:: Sub-modules + .. autosummary:: + :toctree: {{ fullname }}/submodules + {% for item in modules %} + {{ item }} + {%- endfor %} + {% endif %} +{% endblock %} +{% block attributes %} + {% if attributes %} + .. rubric:: Module Attributes + .. autosummary:: + :toctree: {{ fullname }}/attributes + {% for item in attributes %} + {{ item }} + {%- endfor %} + {% endif %} +{% endblock %} +{% block functions %} + {% if functions %} + .. rubric:: {{ _('Functions') }} + .. autosummary:: + :toctree: {{ fullname }}/functions + :nosignatures: + :template: autosummary/base.rst + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} +{% endblock %} +{% block classes %} + {% if classes %} + .. rubric:: {{ _('Classes') }} + .. autosummary:: + :toctree: {{ fullname }}/classes + :nosignatures: + :template: autosummary/class.rst + :recursive: + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} +{% endblock %} +{% block exceptions %} + {% if exceptions %} + .. rubric:: {{ _('Exceptions') }} + .. autosummary:: + :toctree: {{ fullname }}/exceptions + :nosignatures: + :template: base.rst + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} +{% endblock %} + + + + diff --git a/docs/sphinx/source/_templates/layout.html b/docs/sphinx/source/templates/layout.html similarity index 100% rename from docs/sphinx/source/_templates/layout.html rename to docs/sphinx/source/templates/layout.html