예제 #1
0
 def __init__(self,
              joint_name,
              radius,
              animation_src,
              scene_object,
              visualize=True,
              density=PRIMITIVE_BODY_DENSITY):
     ComponentBase.__init__(self, scene_object)
     visualize = True
     if visualize:
         material = materials.red
         self.mesh = Mesh.build_sphere(20, 20, radius * 2, material)
     else:
         self.mesh = None
     self.joint_name = joint_name
     kinematic = True
     self.src_controller = self.scene_object._components[animation_src]
     self.skeleton = self.src_controller.skeleton
     print("create collision boundy")
     name = str(scene_object.node_id) + "_body"
     orientation = [1, 0, 0, 0]
     position = scene_object.getPosition()
     self.transformation = np.eye(4)
     self.scene = self.scene_object.scene
     self.sim = self.scene_object.scene.sim
     self.body = self.sim.create_sphere_body(name, position, orientation,
                                             radius, kinematic, density)
     self.body_id = self.body.get_id()
     self.active = True
예제 #2
0
 def __init__(self,
              radius,
              length,
              animation_src,
              scene_object,
              visualize=True,
              density=PRIMITIVE_BODY_DENSITY):
     ComponentBase.__init__(self, scene_object)
     direction = "y"
     if visualize:
         material = materials.red
         self.mesh = Mesh.build_capsule(20, 20, radius * 2, length,
                                        direction, material)
     else:
         self.mesh = None
     kinematic = True
     self.src_controller = self.scene_object._components[animation_src]
     name = str(scene_object.node_id) + "_body"
     capsule_dir = ODE_DIRECTION_MAP[direction]
     orientation = [1, 0, 0, 0]
     position = scene_object.getPosition()
     self.transformation = np.eye(4)
     self.y_offset = length / 2
     self.sim = self.scene_object.scene.sim
     self.body = self.sim.create_cylinder_body(name, position, orientation,
                                               length, radius, capsule_dir,
                                               True, kinematic, density)
     self.body_id = self.body.get_id()
     self.active = True
 def __init__(self, scene_object, color=(0, 0, 1)):
     ComponentBase.__init__(self, scene_object)
     AnimationController.__init__(self)
     self.loadedCorrectly = False
     self.hasVisualization = False
     self.name = ""
     self._visualization = SkeletonVisualization(self.scene_object, color)
     self.track = AnimationBlendNode()
     self.n_neighbors = 5
     self.current_parameter = None
     self.markers = dict()
예제 #4
0
 def __init__(self, scene_object, anim_controller, joint_name):
     ComponentBase.__init__(self, scene_object)
     self.anim_controller = anim_controller
     self.joint_name = joint_name
     self.skeleton = self.anim_controller.get_skeleton()
     self.edit_mode = False
     if self.joint_name in self.skeleton.animated_joints and np.linalg.norm(
             self.skeleton.nodes[self.joint_name].offset) > 0:
         self.cs = CoordinateSystemRenderer(3.0)
     else:
         self.cs = None
     self.global_matrix = np.eye(4)
예제 #5
0
 def __init__(self, port, scene_object, src_component):
     print("create animation server", port)
     ComponentBase.__init__(self, scene_object)
     TCPServer.__init__(self, port)
     self.src_component_key = src_component
     self.animation_src = scene_object._components[src_component]
     self.animation_src.animation_server = self
     self.activate_emit = True
     self.frame_buffer = None
     self.skeleton = self.animation_src.get_skeleton()
     self.animated_joints = [key for key in self.skeleton.nodes.keys() if len(self.skeleton.nodes[key].children) >0]#self.skeleton.animated_joints# self.animation_src.get_animated_joints()
     self.scale = 1.0
     self.search_message_header = False
     self.activate_simulation = constants.activate_simulation
 def __init__(self, scene_object, color=(0, 0, 1), mg=None):
     ComponentBase.__init__(self, scene_object)
     AnimationController.__init__(self)
     self._motion_graph = mg
     self._visualization = SkeletonVisualization(self.scene_object, color)
     self.name = ""
     strong_components = self._motion_graph.strong_components
     self.current_node_id = min(strong_components)
     self.current_direction = []
     self.current_root_pos = []
     self.current_root_quat = []
     self.angleX = 0
     self.frameTime = 0
     self.animationSpeed = 1
예제 #7
0
 def __init__(self, port, scene_object, src_component):
     print("create animation server", port)
     ComponentBase.__init__(self, scene_object)
     web_app = WebSocketApplication(self,
                                    [(r"/ws", AnimationWebSocketHandler)])
     self.server_thread = ServerThread(web_app, port)
     self.broadcast_thread = BroadcastThread(web_app)
     self.src_component_key = src_component
     self.animation_src = scene_object._components[src_component]
     self.animation_src.animation_server = self
     self.activate_emit = True
     self.frame_buffer = None
     self.skeleton = self.animation_src.get_skeleton()
     self.animated_joints = [
         key for key in self.skeleton.nodes.keys()
         if len(self.skeleton.nodes[key].children) > 0
     ]  #self.skeleton.animated_joints# self.animation_src.get_animated_joints()
     self.scale = 1.0
예제 #8
0
 def __init__(self, scene_object, folder_path, filetype, color):
     ComponentBase.__init__(self, scene_object)
     self.mainContext = 0
     self.name = folder_path
     AnimationController.__init__(self)
     self.skeleton_vis = SkeletonVisualization(scene_object, color)
     self.skeleton_vis.draw_mode = 2
     self.skeleton_vis.visible = False
     scene_object.add_component("skeleton_vis", self.skeleton_vis)
     self.folder_path = Path(folder_path)
     self._animation_files = []
     self.current_controller = None
     self.motion_cache = dict()
     self.state = None
     for filename in self.folder_path.iterdir():
         print(filename, filetype, filename.suffix)
         if filename.is_file() and filename.suffix == "." + filetype:
             self._animation_files.append(filename.name)
     self.select_file(self._animation_files[0])
예제 #9
0
 def __init__(self, scene_object):
     ComponentBase.__init__(self, scene_object)
     self.controller = scene_object._components[
         "morphablegraph_state_machine"]
     self.walk_targets = []
     self.tolerance = 20
 def __init__(self, scene_object):
     ComponentBase.__init__(self, scene_object)
     self.play = True
     return
예제 #11
0
 def __init__(self, scene_object):
     ComponentBase.__init__(self, scene_object)