mirror of
https://forge.apps.education.fr/blender-edutech/jumeaux-numeriques.git
synced 2024-01-27 06:56:18 +01:00
Désactivation de l'AA en option + comportement de l'émetteur/récepteur IR de la barrière coulissante
This commit is contained in:
parent
b13431720a
commit
1961879269
@ -166,19 +166,67 @@ def fdc_f (cont):
|
|||||||
def ir_emet (cont):
|
def ir_emet (cont):
|
||||||
if scene.objects['System']['run'] :
|
if scene.objects['System']['run'] :
|
||||||
obj = cont.owner
|
obj = cont.owner
|
||||||
obj_recepteur=scene.objects['Recepteur IR']
|
|
||||||
if obj['active'] and scene.objects['Emetteur IR Led-on'].visible == False:
|
# Passif
|
||||||
|
if obj['active'] == False and obj.color !=color_passive:
|
||||||
|
obj.color =color_passive
|
||||||
|
scene.objects['Emetteur IR Led'].setVisible(True,False)
|
||||||
|
scene.objects['Emetteur IR Led-on'].setVisible(False,False)
|
||||||
|
scene.objects['Recepteur IR']['active'] = False
|
||||||
|
|
||||||
|
# Active
|
||||||
|
if obj['active']:
|
||||||
|
|
||||||
|
# Allumage
|
||||||
|
if scene.objects['Emetteur IR Led-on'].visible == False:
|
||||||
scene.objects['Emetteur IR Led-on'].setVisible(True,False)
|
scene.objects['Emetteur IR Led-on'].setVisible(True,False)
|
||||||
scene.objects['Emetteur IR Led'].setVisible(False,False)
|
scene.objects['Emetteur IR Led'].setVisible(False,False)
|
||||||
obj.color = color_active
|
obj.color = color_active
|
||||||
obj_recepteur.color = color_active
|
scene.objects['Recepteur IR']['active'] = True
|
||||||
obj_recepteur['active'] = True
|
|
||||||
if obj['active']==False and scene.objects['Emetteur IR Led-on'].visible == True:
|
# Forçage (click)
|
||||||
scene.objects['Emetteur IR Led'].setVisible(True,False)
|
if obj['click'] == True:
|
||||||
scene.objects['Emetteur IR Led-on'].setVisible(False,False)
|
obj['activated'] = True
|
||||||
|
scene.objects['Recepteur IR']['activated'] = True
|
||||||
|
|
||||||
|
# Couleurs
|
||||||
|
if obj['activated'] == True and obj.color !=color_activated:
|
||||||
|
obj.color =color_activated
|
||||||
|
if obj['activated'] == False :
|
||||||
|
if obj['mo'] == True and obj.color !=color_hl:
|
||||||
|
obj.color =color_hl
|
||||||
|
if obj['mo'] == False and obj.color !=color_active:
|
||||||
|
obj.color =color_active
|
||||||
|
|
||||||
|
##
|
||||||
|
# Récepteur IR
|
||||||
|
##
|
||||||
|
|
||||||
|
def ir_recep (cont):
|
||||||
|
if scene.objects['System']['run'] :
|
||||||
|
obj = cont.owner
|
||||||
|
|
||||||
|
# Passif
|
||||||
|
if obj['active'] == False and obj.color !=color_passive:
|
||||||
obj.color =color_passive
|
obj.color =color_passive
|
||||||
obj_recepteur.color = color_passive
|
|
||||||
obj_recepteur['active'] = False
|
# Active
|
||||||
|
if obj['active']:
|
||||||
|
|
||||||
|
# Forçage (click)
|
||||||
|
if obj['click'] == True:
|
||||||
|
obj['activated'] = True
|
||||||
|
scene.objects['Emetteur IR']['activated'] = True
|
||||||
|
|
||||||
|
# Couleurs
|
||||||
|
if obj['activated'] == True and obj.color !=color_activated:
|
||||||
|
obj.color =color_activated
|
||||||
|
if obj['activated'] == False :
|
||||||
|
if obj['mo'] == True and obj.color !=color_hl:
|
||||||
|
obj.color =color_hl
|
||||||
|
if obj['mo'] == False and obj.color !=color_active:
|
||||||
|
obj.color =color_active
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Boutons
|
# Boutons
|
||||||
|
@ -44,6 +44,32 @@ brochage={
|
|||||||
# Fonctions
|
# Fonctions
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# Fermer le portail
|
||||||
|
def fermer():
|
||||||
|
print ("Fermeture")
|
||||||
|
ir_emet(True)
|
||||||
|
while fdc_f() ==False:
|
||||||
|
gyr(True)
|
||||||
|
mot_o(False)
|
||||||
|
mot_f(True)
|
||||||
|
# if ir_recep()==False or bp_int() or bp_ext() : # Ouverture en cas présence d'obstacle ou boutons
|
||||||
|
# ouvrir()
|
||||||
|
# print ("Temporisation")
|
||||||
|
# tempo(2) # Temporisation 2s
|
||||||
|
gyr(False)
|
||||||
|
mot_f(False)
|
||||||
|
ir_emet(False)
|
||||||
|
|
||||||
|
# Ouvrir le portail
|
||||||
|
def ouvrir():
|
||||||
|
print ("Ouverture")
|
||||||
|
while fdc_o() ==False:
|
||||||
|
gyr(True)
|
||||||
|
mot_f(False)
|
||||||
|
mot_o(True)
|
||||||
|
gyr(False)
|
||||||
|
mot_o(False)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Commandes
|
# Commandes
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -57,38 +83,31 @@ def commandes():
|
|||||||
# gyr(False)
|
# gyr(False)
|
||||||
# tempo(1)
|
# tempo(1)
|
||||||
|
|
||||||
# Mise en place : Fermeture
|
|
||||||
print ("go go ")
|
|
||||||
while fdc_f() ==False :
|
|
||||||
gyr(True)
|
|
||||||
mot_f(True)
|
|
||||||
mot_f(False)
|
|
||||||
gyr(False)
|
|
||||||
|
|
||||||
# Fonctionnement normal
|
|
||||||
while True :
|
while True :
|
||||||
|
ir_emet(True)
|
||||||
|
tempo(10) # Temporisation 2s
|
||||||
|
ir_emet(False)
|
||||||
|
tempo(10) # Temporisation 2s
|
||||||
|
|
||||||
# Ouverture
|
|
||||||
if bp_int() or bp_ext() :
|
|
||||||
while fdc_o() ==False:
|
|
||||||
gyr(True)
|
|
||||||
mot_o(True)
|
|
||||||
gyr(False)
|
|
||||||
mot_o(False)
|
|
||||||
|
|
||||||
tempo(2) # Temporisation
|
# # Mise en place : Fermeture
|
||||||
|
# print ("Mise en place : Fermeture")
|
||||||
|
# fermer()
|
||||||
|
|
||||||
# Fermeture
|
# # Fonctionnement normal
|
||||||
while fdc_f() ==False:
|
# print ("Attente")
|
||||||
gyr(True)
|
|
||||||
mot_f(True)
|
|
||||||
gyr(False)
|
|
||||||
mot_f(False)
|
|
||||||
|
|
||||||
# # Ecrire votre code ici ...
|
|
||||||
# gyr(True) # Activer le gyrophare
|
|
||||||
# while True :
|
# while True :
|
||||||
# pass
|
|
||||||
|
# # Ouverture
|
||||||
|
# if bp_int() or bp_ext() :
|
||||||
|
# ouvrir()
|
||||||
|
|
||||||
|
# print ("Temporisation")
|
||||||
|
# tempo(2) # Temporisation 2s
|
||||||
|
|
||||||
|
# # Fermeture
|
||||||
|
# fermer()
|
||||||
|
# print ("Attente")
|
||||||
|
|
||||||
fin() # A garder
|
fin() # A garder
|
||||||
|
|
||||||
|
Binary file not shown.
22
twin.py
22
twin.py
@ -26,14 +26,12 @@ import twin_about # About
|
|||||||
|
|
||||||
# UPBGE scene
|
# UPBGE scene
|
||||||
scene = bge.logic.getCurrentScene()
|
scene = bge.logic.getCurrentScene()
|
||||||
|
eevee = bpy.context.scene.eevee
|
||||||
system=importlib.import_module(scene.objects['System']['script'][:-4]) # Système
|
system=importlib.import_module(scene.objects['System']['script'][:-4]) # Système
|
||||||
|
|
||||||
# Memory
|
# Memory
|
||||||
sys.setrecursionlimit(10**5) # Limite sur la récursivité (valeur par défaut : 1000) -> segfault de Blender
|
sys.setrecursionlimit(10**5) # Limite sur la récursivité (valeur par défaut : 1000) -> segfault de Blender
|
||||||
|
|
||||||
# EEVEE
|
|
||||||
eevee = bpy.context.scene.eevee
|
|
||||||
|
|
||||||
# Config file
|
# Config file
|
||||||
twin_config = ET.parse('twin_config.xml')
|
twin_config = ET.parse('twin_config.xml')
|
||||||
twin_config_tree = twin_config.getroot()
|
twin_config_tree = twin_config.getroot()
|
||||||
@ -123,9 +121,14 @@ def cmd_init():
|
|||||||
|
|
||||||
# Fichier de config (screen size : data/config/screen/width-> [0][0].text, height-> [0][1].text)
|
# Fichier de config (screen size : data/config/screen/width-> [0][0].text, height-> [0][1].text)
|
||||||
bge.render.setWindowSize(int(twin_config_tree[0][0].text),int(twin_config_tree[0][1].text))
|
bge.render.setWindowSize(int(twin_config_tree[0][0].text),int(twin_config_tree[0][1].text))
|
||||||
quality_eevee=('LOW', 'MEDIUM','HIGH','ULTRA')
|
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
|
||||||
scene.objects['About']['quality'] = int(twin_config_tree[0][2].text)
|
scene.objects['About']['quality'] = int(twin_config_tree[0][2].text)
|
||||||
bpy.context.scene.eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
|
||||||
|
eevee.smaa_quality= 'LOW'
|
||||||
|
eevee.use_eevee_smaa = False
|
||||||
|
else:
|
||||||
|
eevee.use_eevee_smaa = True
|
||||||
|
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
||||||
|
|
||||||
# Ajout du Hud
|
# Ajout du Hud
|
||||||
# scene.active_camera = scene.objects["Camera"]
|
# scene.active_camera = scene.objects["Camera"]
|
||||||
@ -283,9 +286,6 @@ def circle (center, radius, color):
|
|||||||
# def manip_init(cont):
|
# def manip_init(cont):
|
||||||
def manip_init():
|
def manip_init():
|
||||||
|
|
||||||
# Configuration du moteur de rendu
|
|
||||||
eevee.use_eevee_smaa = True
|
|
||||||
|
|
||||||
# Ajout du Hud
|
# Ajout du Hud
|
||||||
scene.active_camera = scene.objects["Camera"]
|
scene.active_camera = scene.objects["Camera"]
|
||||||
scene.objects['Sun'].setVisible(True,True)
|
scene.objects['Sun'].setVisible(True,True)
|
||||||
@ -548,7 +548,8 @@ def cycle_hl(cont):
|
|||||||
|
|
||||||
# Passif
|
# Passif
|
||||||
if "active" in obj.getPropertyNames():
|
if "active" in obj.getPropertyNames():
|
||||||
if obj['mo'] == False:
|
if obj['active'] == False:
|
||||||
|
obj.color = color_passive
|
||||||
return
|
return
|
||||||
|
|
||||||
# Activation
|
# Activation
|
||||||
@ -576,7 +577,8 @@ def cycle_click(cont):
|
|||||||
|
|
||||||
# Passif
|
# Passif
|
||||||
if "active" in obj.getPropertyNames():
|
if "active" in obj.getPropertyNames():
|
||||||
if obj['mo'] == False:
|
if obj['active'] == False:
|
||||||
|
obj.color = color_passive
|
||||||
return
|
return
|
||||||
|
|
||||||
# Activation
|
# Activation
|
||||||
|
@ -52,8 +52,8 @@ def open():
|
|||||||
scene.objects['About_screen']['Text']= "Taille écran : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
scene.objects['About_screen']['Text']= "Taille écran : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
||||||
scene.objects['About_quality-up'].color= color_link
|
scene.objects['About_quality-up'].color= color_link
|
||||||
scene.objects['About_quality-down'].color= color_link
|
scene.objects['About_quality-down'].color= color_link
|
||||||
quality_txt=("Basse", "Moyenne", "Haute", "Ultra")
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
||||||
scene.objects['About_quality']['Text']= "Qualité rendu : "+quality_txt[scene.objects['About']['quality']]
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
||||||
|
|
||||||
# Liens
|
# Liens
|
||||||
scene.objects['About_link-git'].color= color_link
|
scene.objects['About_link-git'].color= color_link
|
||||||
@ -77,7 +77,7 @@ def open():
|
|||||||
scene.objects['About_screen-up-colbox'].restorePhysics()
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
||||||
|
|
||||||
# Qualité du rendu : Boutons < et >
|
# Qualité du rendu : Boutons < et >
|
||||||
if scene.objects['About']['quality']==3:
|
if scene.objects['About']['quality']==4:
|
||||||
scene.objects['About_quality-up'].setVisible(False,True)
|
scene.objects['About_quality-up'].setVisible(False,True)
|
||||||
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
||||||
else:
|
else:
|
||||||
@ -205,14 +205,19 @@ def screen_down(cont):
|
|||||||
|
|
||||||
def quality_up(cont):
|
def quality_up(cont):
|
||||||
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
quality_txt=("Basse", "Moyenne", "Haute", "Ultra")
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
||||||
quality_eevee=('LOW', 'MEDIUM','HIGH','ULTRA')
|
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
|
||||||
scene.objects['About']['quality'] +=1
|
scene.objects['About']['quality'] +=1
|
||||||
scene.objects['About_quality']['Text']= "Qualité rendu : "+quality_txt[scene.objects['About']['quality']]
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
||||||
bpy.context.scene.eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
|
||||||
|
eevee.smaa_quality= 'LOW'
|
||||||
|
eevee.use_eevee_smaa = False
|
||||||
|
else:
|
||||||
|
eevee.use_eevee_smaa = True
|
||||||
|
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
||||||
|
|
||||||
# Boutons < et >
|
# Boutons < et >
|
||||||
if scene.objects['About']['quality']==3:
|
if scene.objects['About']['quality']==4:
|
||||||
scene.objects['About_quality-up'].setVisible(False,True)
|
scene.objects['About_quality-up'].setVisible(False,True)
|
||||||
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
||||||
if scene.objects['About']['quality']==1:
|
if scene.objects['About']['quality']==1:
|
||||||
@ -221,16 +226,21 @@ def quality_up(cont):
|
|||||||
|
|
||||||
def quality_down(cont):
|
def quality_down(cont):
|
||||||
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
||||||
quality_txt=("Basse", "Moyenne", "Haute", "Ultra")
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
||||||
quality_eevee=('LOW', 'MEDIUM','HIGH','ULTRA')
|
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
|
||||||
scene.objects['About']['quality'] -=1
|
scene.objects['About']['quality'] -=1
|
||||||
scene.objects['About_quality']['Text']= "Qualité rendu : "+quality_txt[scene.objects['About']['quality']]
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
||||||
bpy.context.scene.eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
|
||||||
|
eevee.smaa_quality= 'LOW'
|
||||||
|
eevee.use_eevee_smaa = False
|
||||||
|
else:
|
||||||
|
eevee.use_eevee_smaa = True
|
||||||
|
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
|
||||||
|
|
||||||
# Boutons < et >
|
# Boutons < et >
|
||||||
if scene.objects['About']['quality']==0:
|
if scene.objects['About']['quality']==0:
|
||||||
scene.objects['About_quality-down'].setVisible(False,True)
|
scene.objects['About_quality-down'].setVisible(False,True)
|
||||||
scene.objects['About_quality-down-colbox'].suspendPhysics (True)
|
scene.objects['About_quality-down-colbox'].suspendPhysics (True)
|
||||||
if scene.objects['About']['quality']==2:
|
if scene.objects['About']['quality']==3:
|
||||||
scene.objects['About_quality-up'].setVisible(True,True)
|
scene.objects['About_quality-up'].setVisible(True,True)
|
||||||
scene.objects['About_quality-up-colbox'].restorePhysics()
|
scene.objects['About_quality-up-colbox'].restorePhysics()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<data>
|
<data>
|
||||||
<screen>
|
<screen>
|
||||||
<width>1242</width>
|
<width>1318</width>
|
||||||
<height>699</height>
|
<height>741</height>
|
||||||
<quality>1</quality>
|
<quality>1</quality>
|
||||||
</screen>
|
</screen>
|
||||||
</data>
|
</data>
|
@ -301,10 +301,13 @@ def close(cont):
|
|||||||
scene.objects["Doc_chap-"+page].worldPosition.y = scene.objects["Doc_chap-"+page]['init_ly']
|
scene.objects["Doc_chap-"+page].worldPosition.y = scene.objects["Doc_chap-"+page]['init_ly']
|
||||||
scene.objects["Doc_chap-"+page].worldPosition.z = scene.objects["Doc_chap-"+page]['init_lz']
|
scene.objects["Doc_chap-"+page].worldPosition.z = scene.objects["Doc_chap-"+page]['init_lz']
|
||||||
scene.objects['Doc'].setVisible(False,True)
|
scene.objects['Doc'].setVisible(False,True)
|
||||||
|
if scene.objects['Doc']['static'] :
|
||||||
for card in card_description:
|
for card in card_description:
|
||||||
scene.objects["Doc_page-"+card].setVisible(False,True)
|
scene.objects["Doc_page-"+card].setVisible(False,True)
|
||||||
scene.objects["Doc_title-"+card].setVisible(False,True)
|
scene.objects["Doc_title-"+card].setVisible(False,True)
|
||||||
scene.objects["Doc_text-"+card].setVisible(False,True)
|
scene.objects["Doc_text-"+card].setVisible(False,True)
|
||||||
|
else:
|
||||||
|
text_dynamic_hide()
|
||||||
|
|
||||||
##
|
##
|
||||||
# Highlight
|
# Highlight
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user