Ajout de l'Overlay du Hud

This commit is contained in:
Philippe Roy 2022-12-21 05:43:56 +01:00
parent f14e6310bd
commit 2cabb7deeb
7 changed files with 33 additions and 9 deletions

Binary file not shown.

View File

@ -302,9 +302,9 @@ def jumeau(pins):
# UI : étape 2 # UI : étape 2
if board =="": if board =="":
scene.objects['Twins-text']['Text'] = "Connection ouverte : "+device+" - "+str(speed)+" baud" scene.objects['Twins-text']['Text'] = "Connection ouverte : "+device+" - "+str(speed)+" baud."
else: else:
scene.objects['Twins-text']['Text'] = "Connection ouverte : "+board_name+" sur "+device+" à "+str(speed)+" baud" scene.objects['Twins-text']['Text'] = "Connection ouverte : "+board_name+" sur "+device+" à "+str(speed)+" baud."
tempo (0.1) tempo (0.1)
# Déclaration des entrées - sorties # Déclaration des entrées - sorties
@ -338,7 +338,7 @@ def jumeau_close():
# twins_serial.close() # Fermer proprement le port série # twins_serial.close() # Fermer proprement le port série
board.exit() # Fermer proprement la communication avec la carte board.exit() # Fermer proprement la communication avec la carte
scene.objects['System']['twins'] = False scene.objects['System']['twins'] = False
scene.objects['Twins-text']['Text'] = "Connection fermée" scene.objects['Twins-text']['Text'] = "Connection fermée."
# Configuration du port # Configuration du port
# FIXME # FIXME

18
twin.py
View File

@ -119,6 +119,11 @@ 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))
# Ajout du Hud
# scene.active_camera = scene.objects["Camera"]
# scene.objects['Sun'].setVisible(True,True)
# scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
# UI : Commands # UI : Commands
scene.objects['Run-Hl'].setVisible(False,False) scene.objects['Run-Hl'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False) scene.objects['Pause-Hl'].setVisible(False,False)
@ -130,7 +135,7 @@ def cmd_init():
# UI : Text, ... # UI : Text, ...
scene.objects['Cmd-text']['Text']="" scene.objects['Cmd-text']['Text']=""
scene.objects['Cmd-text'].setVisible(True,False) scene.objects['Cmd-text'].setVisible(True,False)
scene.objects['Twins-text']['Text']="" scene.objects['Twins-text']['Text']="Connection fermée."
scene.objects['Twins-text'].setVisible(False,False) scene.objects['Twins-text'].setVisible(False,False)
# Windows # Windows
@ -274,6 +279,11 @@ def manip_init():
# Configuration du moteur de rendu # Configuration du moteur de rendu
eevee.use_eevee_smaa = True eevee.use_eevee_smaa = True
# Ajout du Hud
scene.active_camera = scene.objects["Camera"]
scene.objects['Sun'].setVisible(True,True)
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
# Fenêtres # Fenêtres
scene.objects['About'].setVisible(False,True) scene.objects['About'].setVisible(False,True)
scene.objects['Doc'].setVisible(False,True) scene.objects['Doc'].setVisible(False,True)
@ -366,9 +376,9 @@ def manip(cont):
# Orbit # Orbit
if obj['manip_mode']==0: if obj['manip_mode']==0:
x0 = scene.objects['Orbit'].worldPosition.x x0 = scene.objects['Orbit-Hud'].worldPosition.x
y0 =scene.objects['Orbit'].worldPosition.y y0 =scene.objects['Orbit-Hud'].worldPosition.y
z0 =scene.objects['Orbit'].worldPosition.z z0 =scene.objects['Orbit-Hud'].worldPosition.z
width = bge.render.getWindowWidth() width = bge.render.getWindowWidth()
height = bge.render.getWindowHeight() height = bge.render.getWindowHeight()
dist_orbit_y_base=200 # Pour 1280 x 720 dist_orbit_y_base=200 # Pour 1280 x 720

View File

@ -1,4 +1,5 @@
import bge # Bibliothèque Blender Game Engine (UPBGE) import bge # Bibliothèque Blender Game Engine (UPBGE)
# import bpy # Blender
import webbrowser import webbrowser
import numpy as np import numpy as np
@ -36,6 +37,9 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
def open(): def open():
scene.active_camera = scene.objects["Camera-About"] scene.active_camera = scene.objects["Camera-About"]
# scene.removeOverlayCollection(bpy.data.collections['Hud']) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-icon'].setVisible(False,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-text'].setVisible(False,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['About_close'].color= color_link scene.objects['About_close'].color= color_link
scene.objects['About_screen-up'].color= color_link scene.objects['About_screen-up'].color= color_link
scene.objects['About_screen-down'].color= color_link scene.objects['About_screen-down'].color= color_link
@ -69,6 +73,9 @@ def open():
def close(cont): def close(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 :
scene.active_camera = scene.objects["Camera"] scene.active_camera = scene.objects["Camera"]
# scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud']) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-icon'].setVisible(True,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-text'].setVisible(True,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['About'].setVisible(False,True) scene.objects['About'].setVisible(False,True)
## ##

View File

@ -1,6 +1,6 @@
<data> <data>
<screen> <screen>
<width>775</width> <width>1339</width>
<height>435</height> <height>753</height>
</screen> </screen>
</data> </data>

View File

@ -1,4 +1,5 @@
import bge # Bibliothèque Blender Game Engine (UPBGE) import bge # Bibliothèque Blender Game Engine (UPBGE)
# import bpy # Blender
import importlib import importlib
import webbrowser import webbrowser
@ -232,6 +233,9 @@ def open():
# Placer la tablette # Placer la tablette
scene.active_camera = scene.objects["Camera-Doc"] scene.active_camera = scene.objects["Camera-Doc"]
# scene.removeOverlayCollection(bpy.data.collections['Hud']) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-icon'].setVisible(False,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-text'].setVisible(False,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Doc_close'].color= color_doc_fct scene.objects['Doc_close'].color= color_doc_fct
scene.objects['Doc'].setVisible(True,True) scene.objects['Doc'].setVisible(True,True)
text_hide() text_hide()
@ -277,6 +281,9 @@ def open():
def close(cont): def close(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 :
scene.active_camera = scene.objects["Camera"] scene.active_camera = scene.objects["Camera"]
# scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud']) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-icon'].setVisible(True,True) # Crash de UPBGE sur la supression de l'Overlay
scene.objects['Twins-text'].setVisible(True,True) # Crash de UPBGE sur la supression de l'Overlay
chap=("general", "system", "python") chap=("general", "system", "python")
for page in chap: for page in chap:
scene.objects["Doc_chap-"+page].setVisible(False,True) scene.objects["Doc_chap-"+page].setVisible(False,True)