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
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:
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)
# Déclaration des entrées - sorties
@ -338,7 +338,7 @@ def jumeau_close():
# twins_serial.close() # Fermer proprement le port série
board.exit() # Fermer proprement la communication avec la carte
scene.objects['System']['twins'] = False
scene.objects['Twins-text']['Text'] = "Connection fermée"
scene.objects['Twins-text']['Text'] = "Connection fermée."
# Configuration du port
# 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)
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
scene.objects['Run-Hl'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False)
@ -130,7 +135,7 @@ def cmd_init():
# UI : Text, ...
scene.objects['Cmd-text']['Text']=""
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)
# Windows
@ -274,6 +279,11 @@ def manip_init():
# Configuration du moteur de rendu
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
scene.objects['About'].setVisible(False,True)
scene.objects['Doc'].setVisible(False,True)
@ -366,9 +376,9 @@ def manip(cont):
# Orbit
if obj['manip_mode']==0:
x0 = scene.objects['Orbit'].worldPosition.x
y0 =scene.objects['Orbit'].worldPosition.y
z0 =scene.objects['Orbit'].worldPosition.z
x0 = scene.objects['Orbit-Hud'].worldPosition.x
y0 =scene.objects['Orbit-Hud'].worldPosition.y
z0 =scene.objects['Orbit-Hud'].worldPosition.z
width = bge.render.getWindowWidth()
height = bge.render.getWindowHeight()
dist_orbit_y_base=200 # Pour 1280 x 720

View File

@ -1,4 +1,5 @@
import bge # Bibliothèque Blender Game Engine (UPBGE)
# import bpy # Blender
import webbrowser
import numpy as np
@ -36,6 +37,9 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
def open():
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_screen-up'].color= color_link
scene.objects['About_screen-down'].color= color_link
@ -69,6 +73,9 @@ def open():
def close(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
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)
##

View File

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

View File

@ -1,4 +1,5 @@
import bge # Bibliothèque Blender Game Engine (UPBGE)
# import bpy # Blender
import importlib
import webbrowser
@ -232,6 +233,9 @@ def open():
# Placer la tablette
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'].setVisible(True,True)
text_hide()
@ -277,6 +281,9 @@ def open():
def close(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
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")
for page in chap:
scene.objects["Doc_chap-"+page].setVisible(False,True)