Package gaiasky.script.v2.api
package gaiasky.script.v2.api
This package contains the APIv2 definition.
APIv2 is the preferred interface to access Gaia Sky scripting. It has been re-designed from the ground up, but it
contains the same functionality as the old APIv1
. Here are some of its properties:
- It is modular. All methods are organized into modules. This creates a nice distinction between similar calls affecting different systems.
The modules are:
BaseModule
— Functions to manipulate and query global attributes.CameraModule
— Functions to manipulate and query the camera. Contains an inner module.InteractiveCameraModule
— Functions to manipulate the camera in interactive mode.
TimeModule
— Functions to manipulate and query simulation time.SceneModule
— Functions to add and remove objects from the internal scene.DataModule
— Functions to load datasets.GraphicsModule
— Functions to manipulate and query the graphics system.CamcorderModule
— Functions to manipulate and query the camcorder system.UiModule
— Functions to manipulate and query the user interface.InputModule
— Functions to manipulate and query input events.OutputModule
— Functions to manipulate and query output systems like frame output or screenshots.RefsysModule
— Functions to convert between reference systems.GeomModule
— Functions to perform geometry operations.InstancesModule
— Functions to work with multiple connected instances in the primary-replica model.
- It is well organized.
- Uses consistent function naming.
- Uses consistent parameter naming.
From a script, you can access the new APIv2 like this:
from py4j.clientserver import ClientServer, JavaParameters
gateway = ClientServer(java_parameters=JavaParameters(auto_convert=True, auto_field=True))
apiv2 = gateway.entry_point.apiv2
# Base module
base = apiv2.base
# Time module
time = apiv2.time
# Camera module
camera = apiv2.camera
# Interactive camera module
icam = camera.interactive
# We can now use the modules
camera.go_to_object("Mars", 10.0, 5.0)
time.start_clock()
[...]
# Remember to shut down the connection before exiting
gateway.shutdown()
-
InterfacesClassDescriptionPublic API definition for the
BaseModule
, which contains methods and functions that perform essential or basic functionality.Public API definition for the camcorder module,CamcorderModule
.Public API definition for the camera module,CameraModule
.API definition for the data module,DataModule
.API definition for the geometry module,GeomModule
.Public API definition for the graphics module,GraphicsModule
.Public API definition for the UI module,UiModule
.API definition for the instances module,InstancesModule
.API definition for the interactive camera module,InteractiveCameraModule
.API definition for the output module,OutputModule
.API definition for the reference system module,RefsysModule
.API definition for the scene module,SceneModule
.API definition for the time module,TimeModule
.API definition for the UI module,UiModule
.