Exemple #1
0
    def interactive_init(self):
        InteractiveWithMemory.interactive_init(self)
        self.victim = context.application.cache.node
        self.eye_rotation = context.application.camera.object_eye_rotation(self.victim)
        self.changed = False

        self.old_transformation = self.victim.transformation
Exemple #2
0
    def interactive_init(self):
        InteractiveWithMemory.interactive_init(self)
        self.victim = context.application.cache.node
        self.eye_rotation = context.application.camera.object_eye_rotation(
            self.victim)
        self.changed = False

        self.old_transformation = self.victim.transformation
Exemple #3
0
    def interactive_init(self):
        InteractiveWithMemory.interactive_init(self)
        cache = context.application.cache
        if len(cache.nodes) == 1:
            self.victim = cache.node
            helper = None
        else:
            self.victim = cache.next_to_last
            helper = cache.last
        self.rotation_axis = None
        self.changed = False
        rotation_center_object = None
        if helper is not None:
            # take the information out of the helper nodes
            if isinstance(helper, Vector):
                b = helper.children[0].translation_relative_to(
                    self.victim.parent)
                e = helper.children[1].translation_relative_to(
                    self.victim.parent)
                if not ((b is None) or (e is None)):
                    rotation_center_object = helper.children[0].target
                    self.rotation_axis = e - b
                    norm = numpy.dot(self.rotation_axis, self.rotation_axis)
                    if norm > 0.0:
                        self.rotation_axis /= norm
                    else:
                        self.rotation_axis = None
            else:
                rotation_center_object = helper
        else:
            rotation_center_object = self.victim

        self.rotation_center = Translation(
            rotation_center_object.get_frame_relative_to(self.victim.parent).t)
        drawing_area = context.application.main.drawing_area
        camera = context.application.camera
        self.screen_rotation_center = drawing_area.camera_to_screen(
            camera.object_to_camera(rotation_center_object))
        self.eye_rotation = camera.object_eye_rotation(self.victim)
        self.old_transformation = self.victim.transformation
Exemple #4
0
    def interactive_init(self):
        InteractiveWithMemory.interactive_init(self)
        cache = context.application.cache
        if len(cache.nodes) == 1:
            self.victim = cache.node
            helper = None
        else:
            self.victim = cache.next_to_last
            helper = cache.last
        self.rotation_axis = None
        self.changed = False
        rotation_center_object = None
        if helper is not None:
            # take the information out of the helper nodes
            if isinstance(helper, Vector):
                b = helper.children[0].translation_relative_to(self.victim.parent)
                e = helper.children[1].translation_relative_to(self.victim.parent)
                if not ((b is None) or (e is None)):
                    rotation_center_object = helper.children[0].target
                    self.rotation_axis = e - b
                    norm = numpy.dot(self.rotation_axis, self.rotation_axis)
                    if norm > 0.0:
                        self.rotation_axis /= norm
                    else:
                        self.rotation_axis = None
            else:
                rotation_center_object = helper
        else:
            rotation_center_object = self.victim

        self.rotation_center = Translation(rotation_center_object.get_frame_relative_to(self.victim.parent).t)
        drawing_area = context.application.main.drawing_area
        camera = context.application.camera
        self.screen_rotation_center = drawing_area.camera_to_screen(camera.object_to_camera(rotation_center_object))
        self.eye_rotation = camera.object_eye_rotation(self.victim)
        self.old_transformation = self.victim.transformation