MCPcopy Create free account
hub / github.com/BerkeleyAutomation/meshrender / __init__

Method __init__

meshrender/viewer.py:81–196  ·  view source on GitHub ↗

Initialize a scene viewer and open the viewer window. Parameters ---------- scene : Scene A scene to view. The scene's camera is not used. size : (int, int) The width and height of the target window in pixels. raymond_lighting : bool

(self, scene, size=(640,480), raymond_lighting=True,
                 animate=False, animate_az=0.05, animate_rate=30.0, animate_axis=None,
                 two_sided_lighting=False, line_width = 1.0,
                 registered_keys={}, starting_camera_pose=None, max_frames=0,
                 save_directory=None, save_filename=None,
                 title='Scene Viewer', target_object=None, **kwargs)

Source from the content-addressed store, hash-verified

79
80
81 def __init__(self, scene, size=(640,480), raymond_lighting=True,
82 animate=False, animate_az=0.05, animate_rate=30.0, animate_axis=None,
83 two_sided_lighting=False, line_width = 1.0,
84 registered_keys={}, starting_camera_pose=None, max_frames=0,
85 save_directory=None, save_filename=None,
86 title='Scene Viewer', target_object=None, **kwargs):
87 """Initialize a scene viewer and open the viewer window.
88
89 Parameters
90 ----------
91 scene : Scene
92 A scene to view. The scene's camera is not used.
93 size : (int, int)
94 The width and height of the target window in pixels.
95 raymond_lighting : bool
96 If True, the scene's point and directional lights are discarded in favor
97 of a set of three directional lights that move with the camera.
98 animate : bool
99 If True, the camera will rotate by default about the scene.
100 animate_az : float
101 The number of radians to rotate per timestep.
102 animate_rate : float
103 The framerate for animation in fps.
104 animate_axis : (3,) float or None
105 If present, the animation will rotate about the given axis in world coordinates.
106 Otherwise, the animation will rotate in azimuth.
107 two_sided_lighting : bool
108 If True, the shader will treat all normals as facing the camera.
109 line_width : float
110 Sets the line width for wireframe meshes (default is 1).
111 registered_keys : dict
112 Map from alphabetic key to a tuple containing
113 (1) a callback function taking the viewer itself as its first argument and
114 (2) an additional list of arguments for the callback.
115 starting_camera_pose : autolab_core.RigidTransform
116 An initial pose for the camera, if specified.
117 max_frames : int
118 If greater than zero, the viewer will display for the given
119 number of frames, save those frames, and then close.
120 save_directory : str
121 A directory to open the TK save file dialog in to begin with.
122 If None, uses the current directory.
123 save_filename : str
124 A default filename to open the save box with. Shouldn't have an extension --
125 extension will be .png or .gif depending on save type.
126 title : str
127 A title for the scene viewer.
128 target_object : str
129 The name of the object in the scene to center rotations around.
130 kwargs : other kwargs
131 Other optional keyword arguments.
132 """
133 if _USE_EGL_OFFSCREEN:
134 raise ValueError('Cannot initialize SceneViewer when MESHRENDER_EGL_OFFSCREEN is set.')
135 self._gl_initialized = False
136
137 # Save basic information
138 self.scene = scene

Callers

nothing calls this directly

Calls 5

_reset_viewMethod · 0.95
_init_glMethod · 0.95
_update_flagsMethod · 0.95
_get_raymond_lightsMethod · 0.80
close_rendererMethod · 0.80

Tested by

no test coverage detected