phobos package

Submodules

phobos.defs module

Contains different definitions for Phobos. Additional defintions are parsed from YAML files and added to this module at runtime.

phobos.defs.updateDefs(defsFolderPath)

Updates the definitions with all yml files in the given folder.

Parameters:defsFolderPath (str) – path to the folder with yaml files for definitions

Returns:

phobos.display module

class phobos.display.DisplayInformationOperator

Bases: bpy_types.Operator

Draw additional information about Phobos objects

bl_idname = 'phobos.display_information'
bl_label = 'Draw Model Information'
get_drawing_status()

TODO Missing documentation

invoke(context, event)
Parameters:
  • context
  • event

Returns:

modal(context, event)
Parameters:
  • context
  • event

Returns:

running = (<built-in function BoolProperty>, {'name': 'running', 'description': 'Whether the drawing thread is running or not.', 'get': <function DisplayInformationOperator.get_drawing_status>, 'set': <function DisplayInformationOperator.set_drawing_status>})
set_drawing_status(value)
Parameters:value

Returns:

phobos.display.draw_2dpolygon(points, linecolor=None, fillcolor=None, distance=0.2, linewidth=1)
Parameters:
  • points
  • linecolor – (Default value = None)
  • fillcolor – (Default value = None)
  • distance – (Default value = 0.2)
  • linewidth – (Default value = 1)

Returns:

phobos.display.draw_callback_2d(self, context)

Callback function for 2d drawing.

Parameters:context

Returns:

phobos.display.draw_callback_3d(self, context)

Callback function for 3d drawing.

Parameters:context

Returns:

phobos.display.draw_joint(joint, length)
Parameters:
  • joint
  • length

Returns:

phobos.display.draw_message(text, msgtype, slot, opacity=1.0, offset=0)
Parameters:
  • text
  • msgtype
  • slot
  • opacity – (Default value = 1.0)
  • offset – (Default value = 0)

Returns:

phobos.display.draw_path(path, color=(1.0, 1.0, 1.0, 1.0), dim3=False, width=4)
Parameters:
  • path
  • color – (Default value = colors[‘white’])
  • dim3 – (Default value = False)
  • width – (Default value = 4)

Returns:

phobos.display.draw_progressbar(value)
Parameters:value

Returns:

phobos.display.draw_text(text, position, color=(1.0, 1.0, 1.0, 1.0), size=14, dpi=150, font_id=0)
Parameters:
  • text
  • position
  • color – (Default value = (1.0)
  • 1.0
  • 1.0)
  • size – (Default value = 14)
  • dpi – (Default value = 150)
  • font_id – (Default value = 0)

Returns:

phobos.display.draw_textbox(text, origin, textsize=6, textcolor=(1.0, 1.0, 1.0, 1.0), backgroundcolor=(0.1, 0.1, 0.1, 0.8), offset=Vector((0.0, 0.0)), linewidth=2, hborder=3, vborder=4, rightalign=False, indicator_line=True)
Parameters:
  • text
  • origin
  • textsize – (Default value = 6)
  • textcolor – (Default value = colors[‘white’])
  • backgroundcolor – (Default value = colors[‘background’])
  • offset – (Default value = Vector((0.0)
  • 0.0))
  • linewidth – (Default value = 2)
  • hborder – (Default value = 3)
  • vborder – (Default value = 4)
  • rightalign – (Default value = False)
  • indicator_line – (Default value = True)

Returns:

phobos.display.getRegionData()

TODO Missing documentation

phobos.display.push_message(text, msgtype='none')
Parameters:
  • text
  • msgtype – (Default value = ‘none’)

Returns:

phobos.display.register()

TODO Missing documentation

phobos.display.setProgress(value, info=None)
Parameters:
  • value
  • info – (Default value = None)

Returns:

phobos.display.to2d(coords)
Parameters:coords

Returns:

phobos.display.to3d(coords, distance=1.0)
Parameters:
  • coords
  • distance – (Default value = 1.0)

Returns:

phobos.display.unregister()

TODO Missing documentation

phobos.phobosgui module

class phobos.phobosgui.MatrixPropGroup

Bases: bpy_types.PropertyGroup

TODO Missing documentation

FloatProperty()
FloatProperty(name="", description="", default=0.0, min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, tags={}, subtype='NONE', unit='NONE', update=None, get=None, set=None)

Returns a new float property definition.

Parameters:
  • name (string) – Name used in the user interface.
  • description (string) – Text used for the tooltip and api documentation.
  • min (float) – Hard minimum, trying to assign a value below will silently assign this minimum instead.
  • max (float) – Hard maximum, trying to assign a value above will silently assign this maximum instead.
  • soft_min (float) – Soft minimum (>= min), user won’t be able to drag the widget below this value in the UI.
  • soft_max (float) – Soft maximum (<= max), user won’t be able to drag the widget above this value in the UI.
  • step (int) – Step of increment/decrement in UI, in [1, 100], defaults to 3 (WARNING: actual value is /100).
  • precision (int) – Maximum number of decimal digits to display, in [0, 6].
  • options (set) – Enumerator in [‘HIDDEN’, ‘SKIP_SAVE’, ‘ANIMATABLE’, ‘LIBRARY_EDITABLE’, ‘PROPORTIONAL’,’TEXTEDIT_UPDATE’].
  • tags (set) – Enumerator of tags that are defined by parent class.
  • subtype (string) – Enumerator in [‘PIXEL’, ‘UNSIGNED’, ‘PERCENTAGE’, ‘FACTOR’, ‘ANGLE’, ‘TIME’, ‘DISTANCE’, ‘NONE’].
  • unit (string) – Enumerator in [‘NONE’, ‘LENGTH’, ‘AREA’, ‘VOLUME’, ‘ROTATION’, ‘TIME’, ‘VELOCITY’, ‘ACCELERATION’, ‘MASS’, ‘CAMERA’].
  • update (function) – Function to be called when this value is modified, This function must take 2 values (self, context) and return None. Warning there are no safety checks to avoid infinite recursion.
  • get (function) – Function to be called when this value is ‘read’, This function must take 1 value (self) and return the value of the property.
  • set (function) – Function to be called when this value is ‘written’, This function must take 2 values (self, value) and return None.
loc_x_local = (<built-in function FloatProperty>, {'name': 'location x', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'LENGTH', 'subtype': 'DISTANCE', 'description': 'X coordinate in the local space'})
loc_x_world = (<built-in function FloatProperty>, {'name': 'location x', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'LENGTH', 'subtype': 'DISTANCE', 'description': 'X coordinate in the world space'})
loc_y_local = (<built-in function FloatProperty>, {'name': 'location y', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'LENGTH', 'subtype': 'DISTANCE', 'description': 'Y coordinate in the local space'})
loc_y_world = (<built-in function FloatProperty>, {'name': 'location y', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'LENGTH', 'subtype': 'DISTANCE', 'description': 'Y coordinate in the world space'})
loc_z_local = (<built-in function FloatProperty>, {'name': 'location z', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'LENGTH', 'subtype': 'DISTANCE', 'description': 'Z coordinate in the local space'})
loc_z_world = (<built-in function FloatProperty>, {'name': 'location z', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'LENGTH', 'subtype': 'DISTANCE', 'description': 'Z coordinate in the world space'})
rot_x_local = (<built-in function FloatProperty>, {'name': 'rotation x', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'ROTATION', 'subtype': 'ANGLE', 'description': 'Rotation around local x axis'})
rot_x_world = (<built-in function FloatProperty>, {'name': 'rotation x', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'ROTATION', 'subtype': 'ANGLE', 'description': 'Rotation around world x axis'})
rot_y_local = (<built-in function FloatProperty>, {'name': 'rotation y', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'ROTATION', 'subtype': 'ANGLE', 'description': 'Rotation around local y axis'})
rot_y_world = (<built-in function FloatProperty>, {'name': 'rotation y', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'ROTATION', 'subtype': 'ANGLE', 'description': 'Rotation around world y axis'})
rot_z_local = (<built-in function FloatProperty>, {'name': 'rotation z', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'ROTATION', 'subtype': 'ANGLE', 'description': 'Rotation around local z axis'})
rot_z_world = (<built-in function FloatProperty>, {'name': 'rotation z', 'get': <function MatrixPropGroup.<lambda>>, 'unit': 'ROTATION', 'subtype': 'ANGLE', 'description': 'Rotation around world z axis'})
class phobos.phobosgui.Mesh_Export_UIList

Bases: bpy_types.UIList

TODO Missing documentation

draw_item(context, layout, data, item, icon, active_data, active_propname, index)
Parameters:
  • context
  • layout
  • data
  • item
  • icon
  • active_data
  • active_propname
  • index

Returns:

class phobos.phobosgui.ModelPoseProp

Bases: bpy_types.PropertyGroup

TODO Missing documentation

hide = (<built-in function BoolProperty>, {'default': True})
icon = (<built-in function StringProperty>, {})
label = (<built-in function StringProperty>, {})
model_file = (<built-in function StringProperty>, {})
parent = (<built-in function StringProperty>, {})
path = (<built-in function StringProperty>, {})
preview = (<built-in function StringProperty>, {})
robot_name = (<built-in function StringProperty>, {})
type = (<built-in function StringProperty>, {})
class phobos.phobosgui.Models_Poses_UIList

Bases: bpy_types.UIList

TODO Missing documentation

draw_item(context, layout, data, item, icon, active_data, active_propname, index)
Parameters:
  • context
  • layout
  • data
  • item
  • icon
  • active_data
  • active_propname
  • index

Returns:

filter_items(context, data, propname)
Parameters:
  • context
  • data
  • propname

Returns:

class phobos.phobosgui.PhobosDisplayPanel

Bases: bpy_types.Panel

TODO Missing documentation

bl_category = 'Phobos'
bl_idname = 'TOOLS_DISPLAY_PT_PHOBOS'
bl_label = 'Display'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosExportPanel

Bases: bpy_types.Panel

Contains the export settings for models/meshes etc. in the Phobos viewport toolbar

bl_category = 'Phobos'
bl_idname = 'TOOLS_EXPORT_PT_PHOBOS'
bl_label = 'Export'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
check(context)
Parameters:context

Returns:

draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosExportSettings

Bases: bpy_types.PropertyGroup

TODO Missing documentation

axis_forward_items = <generator object PhobosExportSettings.<genexpr>>
axis_up_items = <generator object PhobosExportSettings.<genexpr>>
decimalPlaces = (<built-in function IntProperty>, {'name': 'decimals', 'description': 'Number of decimal places to export', 'default': 5, 'min': 3})
exportTextures = (<built-in function BoolProperty>, {'name': 'Export textures', 'default': True})
export_sdf_mesh_type = (<built-in function EnumProperty>, {'items': <function PhobosExportSettings.getMeshTypeListForEnumProp>, 'name': 'SDF mesh type', 'description': 'Mesh type to use in exported SDF files.'})
export_sdf_model_config = (<built-in function BoolProperty>, {'default': False, 'name': 'Export Gazebo model.config', 'description': 'Export model.config file along with the SDF file.'})
export_sdf_to_gazebo_models = (<built-in function BoolProperty>, {'default': False, 'name': 'Export to Gazebo models folder', 'description': 'Export model to the Gazebo models folder.'})
getMeshTypeListForEnumProp(context)
Parameters:context

Returns:

obj_axis_forward = (<built-in function EnumProperty>, {'items': <generator object PhobosExportSettings.<genexpr>>, 'name': 'Forward', 'description': 'Forward axis of the obj export.', 'default': '-Z'})
obj_axis_up = (<built-in function EnumProperty>, {'items': <generator object PhobosExportSettings.<genexpr>>, 'name': 'Up', 'description': 'Up axis of the obj export.', 'default': 'Y'})
outputMeshtype = (<built-in function EnumProperty>, {'items': <function PhobosExportSettings.getMeshTypeListForEnumProp>, 'name': 'link', 'description': 'Mesh type to use in exported entity/scene files.'})
path = (<built-in function StringProperty>, {'name': 'path', 'subtype': 'DIR_PATH', 'default': '../', 'update': <function PhobosExportSettings.updateExportPath>})
selectedOnly = (<built-in function BoolProperty>, {'name': 'Selected only', 'default': True, 'description': 'Export only selected objects'})
updateExportPath(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosImportPanel

Bases: bpy_types.Panel

Contains the import settings in the Phobos viewport toolbar

bl_category = 'Phobos'
bl_idname = 'TOOLS_IMPORT_PT_PHOBOS'
bl_label = 'Import'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosMatrixPanel

Bases: bpy_types.Panel

Contains summary information and editing possibilities in the Buttons Window

Args:

Returns:

bl_context = 'object'
bl_idname = 'INFOBAR_PT_PHOBOS_TOOLS'
bl_label = 'Phobos Matrix Information'
bl_region_type = 'WINDOW'
bl_space_type = 'PROPERTIES'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosModelLibraryPanel

Bases: bpy_types.Panel

TODO Missing documentation

bl_category = 'Phobos Models'
bl_idname = 'TOOLS_PT_PHOBOS_LOCALMODELS'
bl_label = 'Local Model Library'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosModelPanel

Bases: bpy_types.Panel

Contains all model editing tools in the Phobos viewport toolbar

bl_category = 'Phobos'
bl_idname = 'TOOLS_PT_PHOBOS_MODEL'
bl_label = 'Model Editing'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosModelWarningsPanel

Bases: bpy_types.Panel

TODO Missing documentation

bl_context = 'object'
bl_idname = 'MODELWARNINGS_PT_PHOBOS_TOOLS'
bl_label = 'Phobos Model Warnings'
bl_region_type = 'WINDOW'
bl_space_type = 'PROPERTIES'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosObjectInformationPanel

Bases: bpy_types.Panel

Contains information like parent, immediate children etc. in the Buttons Window.

bl_context = 'object'
bl_idname = 'OBJINFO_PT_PHOBOS_TOOLS'
bl_label = 'Phobos Object Information'
bl_region_type = 'WINDOW'
bl_space_type = 'PROPERTIES'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosPrefs

Bases: bpy_types.AddonPreferences

The general Phobos addon settings are stored in this class. They can be edited in the User Preferences of Blender under the Addon tab.

Args:

Returns:

bl_idname = 'phobos'
configfolder = (<built-in function StringProperty>, {'name': 'configfolder', 'subtype': 'DIR_PATH', 'description': 'Path to the system-dependent config folder of Phobos.', 'default': ''})
draw(context)
Parameters:context

Returns:

exportpluginsfolder = (<built-in function StringProperty>, {'name': 'exportpluginsfolder', 'subtype': 'DIR_PATH', 'default': '.'})
gazebomodelfolder = (<built-in function StringProperty>, {'name': 'Gazebo Model Folder', 'subtype': 'DIR_PATH', 'description': 'Path to the Gazebo model folder.', 'default': ''})
logactive = (<built-in function BoolProperty>, {'default': False, 'name': 'logactive', 'description': 'Activate logging'})
logfile = (<built-in function StringProperty>, {'name': 'logfile', 'subtype': 'FILE_PATH', 'default': '.'})
loglevel = (<built-in function EnumProperty>, {'name': 'loglevel', 'items': (('NONE', 'NONE', 'NONE'), ('ERROR', 'ERROR', 'ERROR'), ('WARNING', 'WARNING', 'WARNING'), ('INFO', 'INFO', 'INFO'), ('DEBUG', 'DEBUG', 'DEBUG')), 'default': 'ERROR'})
logtofile = (<built-in function BoolProperty>, {'name': 'logtofile', 'default': False})
logtoterminal = (<built-in function BoolProperty>, {'name': 'logtoterminal', 'default': True})
models_poses = (<built-in function CollectionProperty>, {'type': <class 'phobos.phobosgui.ModelPoseProp'>})
modelsfolder = (<built-in function StringProperty>, {'name': 'modelsfolder', 'subtype': 'DIR_PATH', 'default': ''})
useremail = (<built-in function StringProperty>, {'name': 'useremail', 'default': 'None', 'description': 'E-mail adress of the user/company (used for export information etc.)'})
username = (<built-in function StringProperty>, {'name': 'username', 'default': 'Anonymous', 'description': 'Name of the user/company (used for export information etc.)'})
class phobos.phobosgui.PhobosPropertyInformationPanel

Bases: bpy_types.Panel

Contains all properties sorted in different categories

Add an object link, which is a clickable goto button in the GUI.

Parameters:
  • prop
  • value
  • column
  • guiparams (dict) – parameters for the GUI of Blender
Returns:

None

Return type:

None

addProp(props, values, layout, guiparams)

Add a property/list of properties to the specified layout category.

Parameters:
  • props (list/str) – property or list of property names to add
  • values (list) – list of or single float, str etc which corresponds to the property name
  • layout (list) – sublayout description as defined in :func:draw
  • guiparams
Returns:

None

Return type:

None

bl_context = 'object'
bl_idname = 'PROPINFO_PT_PHOBOS_TOOLS'
bl_label = 'Phobos Property Information'
bl_region_type = 'WINDOW'
bl_space_type = 'PROPERTIES'
checkParams(item)

Looks for a property name in the .. data:supportedProps.

If the property is not defined in .. data:supportedProps, the returned dictionary contains empty information required for drawing.

Parameters:item (str) – property name to look for
Returns:entry in .. data:supportedProps
Return type:dict
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosSubmodelsPanel

Bases: bpy_types.Panel

TODO Missing documentation

bl_category = 'Phobos Models'
bl_idname = 'TOOLS_SUBMODELS_PT_PHOBOS'
bl_label = 'Submodels'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

class phobos.phobosgui.PhobosToolsPanel

Bases: bpy_types.Panel

Contains all general phobos tools in the Phobos viewport toolbar

bl_category = 'Phobos'
bl_idname = 'TOOLS_PT_PHOBOS_TOOLS'
bl_label = 'General Tools'
bl_region_type = 'TOOLS'
bl_space_type = 'VIEW_3D'
draw(context)
Parameters:context

Returns:

draw_header(context)
Parameters:context

Returns:

phobos.phobosgui.getMatrixData(coord, space)
Parameters:
  • coord
  • space

Returns:

phobos.phobosgui.get_operator_manuals()

Returns a tuple with the Phobos wiki Operator page and pairs of operator names and wiki page anchor names to allow for linking from Blender to wiki. :return: tuple

Args:

Returns:

phobos.phobosgui.register()

TODO Missing documentation

phobos.phobosgui.showPreview(self, value)
Parameters:value

Returns:

phobos.phobosgui.unregister()

TODO Missing documentation

phobos.phoboslog module

class phobos.phoboslog.Col

Bases: enum.Enum

Provides the color ids for different terminal messages.

BOLD = '\x1b[1m'
DEBUG = '\x1b[35m'
DIM = '\x1b[2m'
ENDC = '\x1b[0m'
FAIL = '\x1b[91m'
HEADER = '\x1b[95m'
OKBLUE = '\x1b[94m'
OKGREEN = '\x1b[92m'
UNDERLINE = '\x1b[4m'
WARNING = '\x1b[93m'
phobos.phoboslog.FUNCTION_BLACKLIST = 'register'

Calling functions that will never be logged to the GUI of Blender.

phobos.phoboslog.LOGLEVELS = ('NONE', 'ERROR', 'WARNING', 'INFO', 'DEBUG')

Levels of detail for the logging information.

phobos.phoboslog.decorate(level)

Simple wrapper to color the log level according to the colors from Col.

If there is no decorator for this level, an undecorated string will be returned.

Parameters:level (str) – the loging level as described by LOGLEVELS.
Returns:decorated string of the specific level
Return type:str
phobos.phoboslog.find_calling_operator(frame)

Finds the calling operator of a log call from the specified frame.

If one intermediary function name is in the FUNCTION_BLACKLIST, the search is interrupted.

If nothing is found or the search is interrupted, None will be returned.

Parameters:
  • frame(frame – frame): call frame to begin search from
  • frame
Returns:

execute function of the calling operator or None

Return type:

function

phobos.phoboslog.log(message, level='INFO', prefix='', guionly=False, end='\n')

Logs a given message to the blender console/logging file and if log level is low enough.

The origin can be defined as string or an object. The message is logged by the operator depending on the loglevel settings.

Parameters:
  • message (str) – message to log
  • level (str, optional) – valid log level for the message as defined by LOGLEVELS (Default value = “INFO”)
  • prefix (str, optional) – any string that should be printed before the message (Default value = “”)
  • guionly (bool, optional) – if True, only prints to GUI (Default value = False)
  • end (str, optional) – string to be used at the end of the resulting print statement (Default value = ‘n’)

Returns:

phobos.phobossystem module

phobos.phobossystem.getBlenderConfigPath()

Returns the configuration path for user-specific blender data.

Args:

Returns:str – scripts path
phobos.phobossystem.getConfigPath()

Returns the path for configuration data for all major platforms

Returns(str): config path

Args:

Returns:

phobos.phobossystem.getScriptsPath()

Returns the path for user-specific blender scripts for all major platforms

Returns(str): scripts path

Args:

Returns:

Module contents