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

Class SceneObject

meshrender/scene_object.py:8–78  ·  view source on GitHub ↗

A complete description of an object in a Scene. This includes its geometry (represented as a Trimesh), its pose in the world, and its material properties.

Source from the content-addressed store, hash-verified

6from .material import MaterialProperties
7
8class SceneObject(object):
9 """A complete description of an object in a Scene.
10
11 This includes its geometry (represented as a Trimesh), its pose in the world,
12 and its material properties.
13 """
14
15 def __init__(self, mesh,
16 T_obj_world=None,
17 material=None,
18 enabled=True):
19 """Initialize a scene object with the given mesh, pose, and material.
20
21 Parameters
22 ----------
23 mesh : trimesh.Trimesh
24 A mesh representing the object's geometry.
25 T_obj_world : autolab_core.RigidTransform
26 A rigid transformation from the object's frame to the world frame.
27 material : MaterialProperties
28 A set of material properties for the object.
29 enabled : bool
30 If False, the object will not be rendered.
31 """
32 if not isinstance(mesh, Trimesh):
33 raise ValueError('mesh must be an object of type Trimesh')
34 if T_obj_world is None:
35 T_obj_world = RigidTransform(from_frame='obj', to_frame='world')
36 if material is None:
37 material = MaterialProperties()
38 if material.smooth:
39 mesh = mesh.smoothed()
40
41 self._mesh = mesh
42 self._material = material
43 self.T_obj_world = T_obj_world
44 self._enabled = True
45
46 @property
47 def enabled(self):
48 """bool: If False, the object will not be rendered.
49 """
50 return self._enabled
51
52 @enabled.setter
53 def enabled(self, enabled):
54 self._enabled = enabled
55
56 @property
57 def mesh(self):
58 """trimesh.Trimesh: A mesh representing the object's geometry.
59 """
60 return self._mesh
61
62 @property
63 def material(self):
64 """MaterialProperties: A set of material properties for the object.
65 """

Callers 1

test_viewer.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected