def __init__(self, obj, parent=None): """ Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent. """ logger.info("%s initialization" % obj.name) # Call the constructor of the parent class morse.core.sensor.Sensor.__init__(self, obj, parent) # Set the background color of the scene self.bg_color = [143, 143, 143, 255] self._texture_ok = False self._camera_running = False self.scene_name = 'S.%dx%d' % (self.image_width, self.image_height) persistantstorage = morse.core.blenderapi.persistantstorage() parent_name = self.robot_parent.name() is_parent_external = False for robot in persistantstorage.externalRobotDict.keys(): if robot.name == parent_name: is_parent_external = True break if not is_parent_external: logger.info("Adding scene %s" % self.scene_name) blenderapi.add_scene(self.scene_name, overlay=0) logger.info('Component initialized, runs at %.2f Hz', self.frequency)
def __init__(self, obj, parent=None): """ Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent. """ logger.info("%s initialization" % obj.name) # Call the constructor of the parent class morse.core.sensor.Sensor.__init__(self, obj, parent) # Set the background color of the scene self.bg_color = [143, 143, 143, 255] self._camera_image = None """ Check if the bge.render.offScreenCreate method exists. If it exists, Morse will use it (to use FBO). Otherwise, Morse will se the old and classic viewport rendering. It requieres creation of additional scenes for each camera resolution, and synchronisation of these scenes before rendering (which makes the process potentially slower and may introduce some glitches if some objects are not properly synchronised). Unfortunabely, it seems that the current FBO handling do not work properly for Z-Buffer. Turn off temporarly until we find a solution (on Morse side), or the issue has been fixed (if needed) on Blender side. """ #self._offscreen_create = getattr(blenderapi.render(), 'offScreenCreate', None) self._offscreen_create = False if not self._offscreen_create: self.scene_name = 'S.%dx%d' % (self.image_width, self.image_height) persistantstorage = morse.core.blenderapi.persistantstorage() parent_name = self.robot_parent.name() is_parent_external = False for robot in persistantstorage.externalRobotDict.keys(): if robot.name == parent_name: is_parent_external = True break if not is_parent_external: logger.info("Adding scene %s" % self.scene_name) blenderapi.add_scene(self.scene_name, overlay=0) logger.info('Component initialized, runs at %.2f Hz', self.frequency)
def __init__(self, obj, parent=None): """ Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent. """ logger.info("%s initialization" % obj.name) # Call the constructor of the parent class super(Camera, self).__init__(obj, parent) # Set the background color of the scene self.bg_color = [143, 143, 143, 255] self._texture_ok = False self._camera_running = False self.scene_name = 'S.%dx%d' % (self.image_width, self.image_height) blenderapi.add_scene(self.scene_name, overlay=0) logger.info('Component initialized, runs at %.2f Hz', self.frequency)
def __init__(self, obj, parent=None): """ Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent. """ logger.info("%s initialization" % obj.name) # Call the constructor of the parent class super(Camera, self).__init__(obj, parent) # Set the background color of the scene self.bg_color = [143, 143, 143, 255] self._texture_ok = False self._camera_running = False import camera_scene # file like 'component_config.py' in the .blend if self.bge_object.name in camera_scene.camera_scene: self.scene_name = camera_scene.camera_scene[self.bge_object.name] blenderapi.add_scene(self.scene_name, overlay=0) logger.info('Component initialized, runs at %.2f Hz', self.frequency) else: logger.info('External camera')