import bge # Bibliothèque Blender Game Engine (UPBGE) ############################################################################### # twin_doc.py # @title: Documentation de l'environnement 3D des jumeaux numériques # @project: Blender-EduTech # @lang: fr # @authors: Philippe Roy # @copyright: Copyright (C) 2020-2022 Philippe Roy # @license: GNU GPL ############################################################################### # UPBGE scene scene = bge.logic.getCurrentScene() # Colors color_link = [0.051, 0.270, 0.279,1] # Turquoise # color_link = [0.024, 0.006, 0.8, 1] # Bleu color_link_hl = [0.8, 0.005, 0.315, 1] # Magenta # UPBGE constants JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED JUST_RELEASED = bge.logic.KX_INPUT_JUST_RELEASED ACTIVATE = bge.logic.KX_INPUT_ACTIVE # JUST_DEACTIVATED = bge.logic.KX_SENSOR_JUST_DEACTIVATED ## # Ouverture ## def open(): scene.active_camera = scene.objects["Camera-Doc"] scene.objects['Doc_close'].color= color_link scene.objects['Doc'].setVisible(True,True) def close(cont): if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive : scene.active_camera = scene.objects["Camera"] scene.objects['Doc'].setVisible(False,True) ## # Highlight ## def hl(cont): if cont.sensors['MO'].status == JUST_ACTIVATED: obj = cont.owner name=obj.name[:-7] scene.objects[name].color = color_link_hl if cont.sensors['MO'].status == JUST_RELEASED: obj = cont.owner name=obj.name[:-7] scene.objects[name].color = color_link