Skip to content
Snippets Groups Projects
Commit 2712413e authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Update doc rendering

parent 571a15af
Branches
Tags
No related merge requests found
......@@ -4,8 +4,8 @@ Run several blender instances if blender is installed
import pkg_resources
import glob
import os
import shutil
import sys
import shutil
import inspect
import tempfile
......@@ -18,8 +18,8 @@ def activate_virtualenv(venv_path):
exec(f.read(), dict(__file__=filepath))
venv = sys.base_prefix
print(venv)
venv_path = sys.base_prefix
blendercomand = shutil.which('blender')
worldfile = pkg_resources.resource_filename(
'navipy', 'resources/forest_world.blend')
......@@ -29,7 +29,7 @@ for demofile in glob.iglob('**/blenddemo*.py', recursive=True):
tfile.write('import os \n'.encode(encoding))
for line in inspect.getsourcelines(activate_virtualenv)[0]:
tfile.write(line.encode(encoding))
line = 'activate_virtualenv(\"{}\")\n'.format(venv)
line = 'activate_virtualenv(\"{}\")\n'.format(venv_path)
tfile.write(line.encode(encoding))
with open(demofile) as infile:
for line in infile:
......
......@@ -15,13 +15,16 @@ Blender comes with its own python installation. Thus, we need to \
tell blender to use our virtualenv where the navigation toolbox \
is installed. To do we need to import the os module
.. literalinclude:: example/rendering/blenddemo_beesampling.py
:lines: 5 - 6
.. literalinclude:: blender_run.py
:lines: 6 - 7
then activate the environment:
then activate the environment by using the following function:
.. literalinclude:: example/rendering/blenddemo_beesampling.py
:lines: 12 - 26
.. literalinclude:: blender_run.py
:lines: 13 - 18
here venv_path is the path to the virtual environment within which \
navipy has been installed.
Now, blender can import all modules used by the navigation toolbox.
......@@ -39,13 +42,9 @@ Custom sampling
Rendering classes
-----------------
BeeSampling
~~~~~~~~~~~
.. autoclass:: navipy.rendering.bee_sampling.BeeSampling
:members:
Cyberbee
~~~~~~~~
.. autoclass:: navipy.rendering.cyber_bee.Cyberbee
:members:
"""
......@@ -6,10 +6,10 @@ With the toolbox at disposition we just need to configure the \
BeeSampling to render images on a regular 3D grid.
.. literalinclude:: example/rendering/blenddemo_beesampling.py
:lines: 34
:lines: 9
.. literalinclude:: example/rendering/blenddemo_beesampling.py
:lines: 37-44
:lines: 12-19
If we want to use the distance to objects, we need to tell the \
BeeSampling what is the maximum distance to objects in the environment.\
......@@ -18,13 +18,12 @@ compressed in the database, all distance to object will be equal to \
zero:
.. literalinclude:: example/rendering/blenddemo_beesampling.py
:lines: 48-49
:lines: 23-24
Finally we can generate the database.
.. literalinclude:: example/rendering/blenddemo_beesampling.py
:lines: 53-54
:lines: 28-29
"""
import warnings
try:
......@@ -42,13 +41,7 @@ from navipy.database import DataBaseSave
class BeeSampling(Cyberbee):
"""
BeeSampling is a class deriving from Cyberbee.
The BeeSampling can be used to generate a database of
images taken on a rectangular regular grid. For the database,
the BeeSampling rely on DataBase
It worth noting that the generated database can take a large
harddrive space, as each image is composed of 4 channels of 180x360 pixels.
BeeSampling allows to create a DataBase using Cyberbee as the renderer.
"""
def __init__(self):
......
"""
BLA
.. literalinclude:: example/rendering/blenddemo_cyberbee.py
:lines: 1-2
With the toolbox at disposition we just need to configure the \
Cyberbee to render images at desired positions.
.. literalinclude:: example/rendering/blenddemo_cyberbee.py
:lines: 7-8
To render a scene at a given positions we just have to do:
.. literalinclude:: example/rendering/blenddemo_cyberbee.py
:lines: 9-10
"""
import warnings
......@@ -93,25 +105,11 @@ class Cyberbee():
return bpy.data.scenes["Scene"].camera.rotation_mode
@camera_rotation_mode.setter
def camera_rotation_mode(self, mode='XYZ'):
def camera_rotation_mode(self, mode):
"""change the camera rotation mode
:param mode: the mode of rotation for the camera see blender doc
(default: 'XYZ').
:param mode: the mode of rotation for the camera see blender do
:type mode: a string
.. seealso: blender bpy.data.scenes["Scene"].camera.rotation_mode
..todo: Use @property.setter
def camera_rotation_mode(self, mode='XYZ')
"""
if not isinstance(mode, str):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment