Ejemplo n.º 1
0
 def __init__ (self, overlaid_object):
     
     AbstractObject.__init__(self)
     
     # Fill in the data sent as parameters
     self.overlaid_object = overlaid_object
     
     if not self.overlaid_object:
         logger.critical("[INTERNAL ERROR] An overlay can not be initialized before " + \
         "the component it overlays!")
Ejemplo n.º 2
0
    def __init__(self, overlaid_object):

        AbstractObject.__init__(self)

        # Fill in the data sent as parameters
        self.overlaid_object = overlaid_object

        if not self.overlaid_object:
            logger.critical("[INTERNAL ERROR] An overlay can not be initialized before " + \
            "the component it overlays!")
Ejemplo n.º 3
0
    def __init__(self, obj, parent=None):

        AbstractObject.__init__(self)

        # Fill in the data sent as parameters
        self.bge_object = obj
        self.robot_parent = parent

        self.level = self.bge_object.get("abstraction_level", "default")

        # Variable to indicate the activation status of the component
        self._active = True

        self.check_level()

        # Define the position of sensors with respect
        #  to their robot parent
        # TODO: implement this using morse.helpers.transformation
        if parent:
            self.relative_position = obj.getVectTo(parent.bge_object)

        # Create an instance of the 3d transformation class
        self.position_3d = morse.helpers.transformation.Transformation3d(obj)

        self.initialize_local_data()
        self.update_properties()

        # The actual frequency at which the action is called
        # The frequency of the game sensor specifies how many times
        # the action is skipped when the logic brick is executed.
        # e.g. game sensor frequency = 0 -> sensor runs at full logic rate
        sensors = blenderapi.getalwayssensors(obj)
        self._frequency = blenderapi.getfrequency()
        # New MORSE_LOGIC sensor, see AbstractComponent.morseable()
        morselogic = [s for s in sensors if s.name.startswith('MORSE_LOGIC')]
        if len(morselogic) == 1:
            if blenderapi.version() >= (2, 74, 5):
                self._frequency /= morselogic[0].skippedTicks + 1
            else:
                self._frequency /= morselogic[0].frequency + 1
        # Backward compatible (some actuators got special logic)
        elif len(sensors) == 1:
            if blenderapi.version() >= (2, 74, 5):
                self._frequency /= sensors[0].skippedTicks + 1
            else:
                self._frequency /= sensors[0].frequency + 1
        elif len(sensors) == 0:
            logger.warning("Can't get frequency for " + self.name() + \
                           " as the Game Logic sensor calling the action can't be found.")
        else:
            logger.warning(self.name() + " has too many Game Logic sensors to get " + \
                    "an unambiguous frequency for the action.")
Ejemplo n.º 4
0
    def __init__ (self, obj, parent=None):

        AbstractObject.__init__(self)

        # Fill in the data sent as parameters
        self.bge_object = obj
        self.robot_parent = parent

        self.level = self.bge_object.get("abstraction_level", "default")

        # Variable to indicate the activation status of the component
        self._active = True

        self.check_level()

        # Define the position of sensors with respect
        #  to their robot parent
        # TODO: implement this using morse.helpers.transformation
        if parent:
            self.relative_position = obj.getVectTo(parent.bge_object)

        # Create an instance of the 3d transformation class
        self.position_3d = morse.helpers.transformation.Transformation3d(obj)

        self.initialize_local_data()
        self.update_properties()

        # The actual frequency at which the action is called
        # The frequency of the game sensor specifies how many times
        # the action is skipped when the logic brick is executed.
        # e.g. game sensor frequency = 0 -> sensor runs at full logic rate
        sensors = blenderapi.getalwayssensors(obj)
        self._frequency = blenderapi.getfrequency()
        # New MORSE_LOGIC sensor, see AbstractComponent.morseable()
        morselogic = [s for s in sensors if s.name.startswith('MORSE_LOGIC')]
        if len(morselogic) == 1:
            if blenderapi.version() >= (2, 74, 5):
                self._frequency /= morselogic[0].skippedTicks + 1
            else:
                self._frequency /= morselogic[0].frequency + 1
        # Backward compatible (some actuators got special logic)
        elif len(sensors) == 1:
            if blenderapi.version() >= (2, 74, 5):
                self._frequency /= sensors[0].skippedTicks + 1
            else:
                self._frequency /= sensors[0].frequency + 1
        elif len(sensors) == 0:
            logger.warning("Can't get frequency for " + self.name() + \
                           " as the Game Logic sensor calling the action can't be found.")
        else:
            logger.warning(self.name() + " has too many Game Logic sensors to get " + \
                    "an unambiguous frequency for the action.")
Ejemplo n.º 5
0
    def __init__ (self, obj, parent=None):

        AbstractObject.__init__(self)

        # Fill in the data sent as parameters
        self.bge_object = obj
        self.robot_parent = parent

        self.level = self.bge_object.get("abstraction_level", "default")

        # Variable to indicate the activation status of the component
        self._active = True

        self.check_level()

        # Define the position of sensors with respect
        #  to their robot parent
        # TODO: implement this using morse.helpers.transformation
        if parent:
            self.relative_position = obj.getVectTo(parent.bge_object)

        # Create an instance of the 3d transformation class
        self.position_3d = morse.helpers.transformation.Transformation3d(obj)

        self.initialize_local_data()
        self.update_properties()

        # The actual frequency at which the action is called
        # The frequency of the game sensor specifies how many times
        # the action is skipped when the logic brick is executed.
        # e.g. game sensor frequency = 0 -> sensor runs at full logic rate
        sensors = blenderapi.getalwayssensors(obj)
        self._frequency = blenderapi.getfrequency()

        if 'frequency' in self.bge_object:
            self._frequency = self.bge_object['frequency']
            self._last_call = None
            self._component_period = 1.0 / self._frequency
            self.__time = blenderapi.persistantstorage().time
Ejemplo n.º 6
0
 def __init__(self):
     AbstractObject.__init__(self)
Ejemplo n.º 7
0
 def __init__(self):
     AbstractObject.__init__(self)
     self.time = blenderapi.persistantstorage().time
     self.ref_fps = blenderapi.getfrequency()
     self._alarm_time = None
Ejemplo n.º 8
0
 def __init__(self):
     AbstractObject.__init__(self)
Ejemplo n.º 9
0
 def interrupt(self):
     if self.overlaid_object.on_completion:
         self.overlaid_object.interrupt()
     else:
         AbstractObject.interrupt(self)
Ejemplo n.º 10
0
 def __init__(self):
     AbstractObject.__init__(self)
     self.time = blenderapi.persistantstorage().time
     self.ref_fps = blenderapi.getfrequency()
     self._alarm_time = None
Ejemplo n.º 11
0
 def interrupt(self):
     if self.overlaid_object.on_completion:
         self.overlaid_object.interrupt()
     else:
         AbstractObject.interrupt(self)
Ejemplo n.º 12
0
 def __init__(self):
     AbstractObject.__init__(self)
     self.time = blenderapi.persistantstorage().time
     self._alarm_time = None
Ejemplo n.º 13
0
 def __init__(self):
     AbstractObject.__init__(self)
     self.time = blenderapi.persistantstorage().time
     self._alarm_time = None