Class BaseModule
- All Implemented Interfaces:
BaseAPI
-
Field Summary
Fields inherited from class APIModule
api, em, logger, me, nameModifier and TypeFieldDescriptionprotected final APIv2Reference to API object.protected final EventManagerReference to event manager.protected final Logger.Logprotected final APIModuleReference to self.protected final StringModule name. -
Constructor Summary
ConstructorsConstructorDescriptionBaseModule(EventManager em, APIv2 api, String name) Create a new module with the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidLog an error using the internal logging system.Gets the location of the asset directory.Return the build string.Get the absolute path of the default directory where the camcorder files are saved.Get the absolute path to the location of the configuration directory.Get the absolute path of the local data directory, configured in yourconfig.yamlfile.Get the absolute path to the default datasets directory.Get the absolute path of the default output directory for the frame output system.Get the absolute path of the default directory where the screenshots are saved.Get the absolute path to the location of the inputListener mappings.Return a string with the version number, the build string, the system, the builder, and the build time.Return the version number string.doubleinternal_to_km(double iu) Converts the value in internal units to Kilometers.double[]internal_to_km(double[] iu) Converts the array in internal units to Kilometers.double[]internal_to_km(List<?> internalUnits) doubleReturns the internal unit to meter conversion factor.doubleinternal_to_m(double iu) Converts the value in internal units to metres.doubleinternal_to_pc(double iu) Converts the value in internal units to parsecs.double[]internal_to_pc(double[] iu) Converts the array in internal units to parsecs.doublekilometersToInternalUnits(double kilometres) doublekm_to_internal(double km) Converts the kilometres to internal units.voidPrint text using the internal logging system.doubleReturns the meter to internal unit conversion factor.doublem_to_internal(double m) Converts the metres to internal units.voidpark_camera_runnable(String id, Runnable r) Park a camera updateRunnableto the main loop thread, and keeps it running every frame until it finishes, or it is removed byBaseAPI.remove_runnable(String).voidpark_runnable(String id, Runnable runnable) Alias topark_scene_runnable(String, Runnable).voidpark_scene_runnable(String id, Runnable r) Park an updateRunnableto the main loop thread, and keeps it running every frame until it finishes, or it is removed byBaseAPI.remove_runnable(String).doublepc_to_internal(double pc) Converts the parsecs to internal units.voidPost aRunnableto the main loop thread.voidPrint text using the internal logging system.voidquit()Initiate the quit action to terminate the program.voidRemove the runnable with the given id, if any.voidCreate a backup of the current settings state that can be restored later on.voidClear the stack of settings objects.booleanTake the settings object at the top of the settings stack and makes it effective.voidsleep(float value) Sleep for the given number of seconds in the application time (FPS), so if we are capturing frames and the frame rate is set to 30 FPS, the command sleep(1) will put the script to sleep for 30 frames.voidsleep(int seconds) Alias tosleep(float), but using an int parameter type instead of a float.voidsleep_frames(long frames) Sleep for a number of frames.
-
Constructor Details
-
BaseModule
Create a new module with the given attributes.- Parameters:
em- Reference to the event manager.api- Reference to the API class.name- Name of the module.
-
-
Method Details
-
get_version
Description copied from interface:BaseAPIReturn a string with the version number, the build string, the system, the builder, and the build time.- Specified by:
get_versionin interfaceBaseAPI- Returns:
- A string with the full version information.
-
get_version_number
Description copied from interface:BaseAPIReturn the version number string.- Specified by:
get_version_numberin interfaceBaseAPI- Returns:
- The version number string.
-
get_build_string
Description copied from interface:BaseAPIReturn the build string.- Specified by:
get_build_stringin interfaceBaseAPI- Returns:
- The build string.
-
get_assets_dir
Description copied from interface:BaseAPIGets the location of the asset directory. The asset directory contains some internal files essential for Gaia Sky to function properly, like the default versions of the configuration file, or the UI theme files.This location depends on the operating system and launch method.
- Specified by:
get_assets_dirin interfaceBaseAPI
-
get_default_frame_output_dir
Description copied from interface:BaseAPIGet the absolute path of the default output directory for the frame output system. This may be different from where the actual frames are saved, as this is specified in a setting in the configuration file.In order to get the actual current output location for the frame output system, use
OutputModule.get_current_frame_output_dir().- Specified by:
get_default_frame_output_dirin interfaceBaseAPI- Returns:
- Absolute path of directory where still frames are saved.
-
get_default_screenshots_dir
Description copied from interface:BaseAPIGet the absolute path of the default directory where the screenshots are saved. This may be different from where the actual screenshots are saved, as this is specified in a setting in the configuration file.In order to get the actual current output location for screenshots, use
OutputModule.get_current_screenshots_dir().- Specified by:
get_default_screenshots_dirin interfaceBaseAPI- Returns:
- Absolute path of directory where screenshots are saved.
-
get_camcorder_dir
Description copied from interface:BaseAPIGet the absolute path of the default directory where the camcorder files are saved.- Specified by:
get_camcorder_dirin interfaceBaseAPI- Returns:
- Absolute path of directory where camcorder files are saved.
-
get_mappings_dir
Description copied from interface:BaseAPIGet the absolute path to the location of the inputListener mappings.- Specified by:
get_mappings_dirin interfaceBaseAPI- Returns:
- Absolute path to the location of the inputListener mappings.
-
get_data_dir
Description copied from interface:BaseAPIGet the absolute path of the local data directory, configured in yourconfig.yamlfile.- Specified by:
get_data_dirin interfaceBaseAPI- Returns:
- Absolute path to the location of the data files.
-
get_config_dir
Description copied from interface:BaseAPIGet the absolute path to the location of the configuration directory.- Specified by:
get_config_dirin interfaceBaseAPI- Returns:
- Absolute path of config directory.
-
get_default_datasets_dir
Description copied from interface:BaseAPIGet the absolute path to the default datasets directory. This is~/.gaiasky/in Windows and macOS, and~/.local/share/gaiaskyin Linux.Note that the actual datasets directory may be different, as it is stored in a setting in the configuration file. This only returns the default location. You can get the actual location where datasets are stored with
DataModule.get_datasets_directory().- Specified by:
get_default_datasets_dirin interfaceBaseAPI- Returns:
- Absolute path to the default data directory.
-
sleep
public void sleep(float value) Description copied from interface:BaseAPISleep for the given number of seconds in the application time (FPS), so if we are capturing frames and the frame rate is set to 30 FPS, the command sleep(1) will put the script to sleep for 30 frames. -
sleep
public void sleep(int seconds) Alias tosleep(float), but using an int parameter type instead of a float. -
sleep_frames
public void sleep_frames(long frames) Description copied from interface:BaseAPISleep for a number of frames. The frame monitor is notified at the beginning of each frame, before the update-render cycle. When frames is 1, this method returns just before the processing of the next frame starts.- Specified by:
sleep_framesin interfaceBaseAPI- Parameters:
frames- The number of frames to wait.
-
post_runnable
-
park_scene_runnable
Description copied from interface:BaseAPIPark an update
Runnableto the main loop thread, and keeps it running every frame until it finishes, or it is removed byBaseAPI.remove_runnable(String). This object runs after the update-scene stage and before the render stage, so it is intended for updating scene objects.Be careful with this function, as it probably needs a cleanup before the script is finished. Otherwise, all parked runnables will keep running until Gaia Sky is restarted, so make sure to remove them with
BaseAPI.remove_runnable(String)if needed.- Specified by:
park_scene_runnablein interfaceBaseAPI- Parameters:
id- The string id to identify the runnable.r- The scene update runnable to park.
-
park_runnable
Alias topark_scene_runnable(String, Runnable). -
park_camera_runnable
Description copied from interface:BaseAPIPark a camera update
Runnableto the main loop thread, and keeps it running every frame until it finishes, or it is removed byBaseAPI.remove_runnable(String). This object runs after the update-camera stage and before the update-scene, so it is intended for updating the camera only.Be careful with this function, as it probably needs a cleanup before the script is finished. Otherwise, all parked runnables will keep running until Gaia Sky is restarted, so make sure to remove them with
BaseAPI.remove_runnable(String)if needed.- Specified by:
park_camera_runnablein interfaceBaseAPI- Parameters:
id- The string id to identify the runnable.r- The camera update runnable to park.
-
remove_runnable
Description copied from interface:BaseAPIRemove the runnable with the given id, if any. Use this method to remove previously parked scene and camera runnables.- Specified by:
remove_runnablein interfaceBaseAPI- Parameters:
id- The id of the runnable to remove.
-
settings_backup
public void settings_backup()Description copied from interface:BaseAPICreate a backup of the current settings state that can be restored later on. The settings are backed up in a stack, so multiple calls to this method put different copies of the settings on the stack in a LIFO fashion.
This method, together with
BaseAPI.settings_restore(), are useful to back up and restore the settings at the beginning and end of your scripts, respectively, and ensure that the user settings are left unmodified after your script ends.- Specified by:
settings_backupin interfaceBaseAPI
-
settings_restore
public boolean settings_restore()Description copied from interface:BaseAPITake the settings object at the top of the settings stack and makes it effective.
This method, together with
BaseAPI.settings_backup(), are useful to back up and restore the settings at the beginning and end of your scripts, respectively, and ensure that the user settings are left unmodified after your script ends.WARN: This function applies all settings immediately, and the user interface may be re-initialized. Be aware that the UI may be set to its default state after this call.
- Specified by:
settings_restorein interfaceBaseAPI- Returns:
- True if the stack was not empty and the settings were restored successfully. False otherwise.
-
settings_clear_stack
public void settings_clear_stack()Description copied from interface:BaseAPIClear the stack of settings objects. This will invalidate all previous calls toBaseAPI.settings_backup(), effectively making the settings stack empty. CallingBaseAPI.settings_restore()after this method will return false.- Specified by:
settings_clear_stackin interfaceBaseAPI
-
m_to_internal
public double m_to_internal()Description copied from interface:BaseAPIReturns the meter to internal unit conversion factor. Use this factor to multiply your coordinates in meters to get them in internal units.- Specified by:
m_to_internalin interfaceBaseAPI- Returns:
- The factor
Constants.M_TO_U.
-
internal_to_m
public double internal_to_m()Description copied from interface:BaseAPIReturns the internal unit to meter conversion factor. Use this factor to multiply your coordinates in internal units to get them in meters.- Specified by:
internal_to_min interfaceBaseAPI- Returns:
- The factor
Constants.U_TO_M.
-
internal_to_m
public double internal_to_m(double iu) Description copied from interface:BaseAPIConverts the value in internal units to metres.- Specified by:
internal_to_min interfaceBaseAPI- Parameters:
iu- The value in internal units.- Returns:
- The value in metres.
-
internal_to_km
public double internal_to_km(double iu) Description copied from interface:BaseAPIConverts the value in internal units to Kilometers.- Specified by:
internal_to_kmin interfaceBaseAPI- Parameters:
iu- The value in internal units.- Returns:
- The value in Kilometers.
-
internal_to_km
public double[] internal_to_km(double[] iu) Description copied from interface:BaseAPIConverts the array in internal units to Kilometers.- Specified by:
internal_to_kmin interfaceBaseAPI- Parameters:
iu- The array in internal units.- Returns:
- The array in Kilometers.
-
internal_to_pc
public double internal_to_pc(double iu) Description copied from interface:BaseAPIConverts the value in internal units to parsecs.- Specified by:
internal_to_pcin interfaceBaseAPI- Parameters:
iu- The value in internal units.- Returns:
- The value in parsecs.
-
internal_to_pc
public double[] internal_to_pc(double[] iu) Description copied from interface:BaseAPIConverts the array in internal units to parsecs.- Specified by:
internal_to_pcin interfaceBaseAPI- Parameters:
iu- The array in internal units.- Returns:
- The array in parsecs.
-
internal_to_km
-
m_to_internal
public double m_to_internal(double m) Description copied from interface:BaseAPIConverts the metres to internal units.- Specified by:
m_to_internalin interfaceBaseAPI- Parameters:
m- The value in metres.- Returns:
- The value in internal units.
-
km_to_internal
public double km_to_internal(double km) Description copied from interface:BaseAPIConverts the kilometres to internal units.- Specified by:
km_to_internalin interfaceBaseAPI- Parameters:
km- The value in kilometers.- Returns:
- The value in internal units.
-
pc_to_internal
public double pc_to_internal(double pc) Description copied from interface:BaseAPIConverts the parsecs to internal units.- Specified by:
pc_to_internalin interfaceBaseAPI- Parameters:
pc- The value in parsecs.- Returns:
- The value in internal units.
-
kilometersToInternalUnits
public double kilometersToInternalUnits(double kilometres) -
print
-
log
-
error
-
quit
-