2022-10-09 15:34:06 +02:00
|
|
|
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
2023-02-05 20:56:46 +01:00
|
|
|
import bpy # Blender
|
|
|
|
import sys
|
2022-10-09 15:34:06 +02:00
|
|
|
import webbrowser
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# rp_about.py
|
|
|
|
# @title: A propos pour Ropy
|
|
|
|
# @project: Ropy (Blender-EduTech)
|
|
|
|
# @lang: fr
|
|
|
|
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
2023-12-27 14:36:42 +01:00
|
|
|
# @copyright: Copyright (C) 2022-2024 Philippe Roy
|
2022-10-09 15:34:06 +02:00
|
|
|
# @license: GNU GPL
|
|
|
|
###############################################################################
|
|
|
|
|
2023-02-05 20:56:46 +01:00
|
|
|
# UPBGE scene
|
2022-10-09 15:34:06 +02:00
|
|
|
scene = bge.logic.getCurrentScene()
|
2023-02-05 20:56:46 +01:00
|
|
|
eevee = bpy.context.scene.eevee
|
2022-10-09 15:34:06 +02:00
|
|
|
|
|
|
|
# Colors
|
|
|
|
color_link = (0, 1, 0.857,1) # Turquoise
|
|
|
|
color_link_hl = (0.799, 0.617, 0.021, 1) # Jaune
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2023-02-05 18:17:16 +01:00
|
|
|
###############################################################################
|
|
|
|
# Crédits
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
credits_description = {
|
|
|
|
'Blender' : ["Blender","Plateforme de modélisation et d'animation 3D","https://blender.org", "GNU GPL"],
|
|
|
|
'UPBGE' : ["UPBGE","Moteur de jeu 3D","https://upbge.org", "GNU GPL"],
|
|
|
|
'Python' : ["Python","Langage de programmation","https://python.org", "PSFL"],
|
|
|
|
'Pylint' : ["Pylint","Bibliothèque de vérification d'un code Python","https://pylint.pycqa.org", "GNU GPL"],
|
|
|
|
'pySerial' : ["pySerial","Bibliothèque de communication série","https://pyserial.readthedocs.io", "BSD-3-Clause"],
|
|
|
|
'wxWidgets' : ["wxWidgets","Bibliothèque GUI","https://www.wxwidgets.org", "wxWindows Library Licence"],
|
|
|
|
'wxPython' : ["wxPython","API Python de wxWidgets","https://www.wxpython.org", "GNU GPL"],
|
|
|
|
'Qt5' : ["Qt5","Bibliothèque GUI","https://www.qt.io", "GNU LGPL-3"],
|
|
|
|
'PyQt' : ["PyQt","API Python de Qt5","https://www.riverbankcomputing.com/software/pyqt","GNU GPL"],
|
|
|
|
'Polygonrunway' : ["Roman Klčo","Modèles 3D","https://www.patreon.com/polygonrunway/",""],
|
|
|
|
'KayKit' : ["Kay Lousberg","Modèles 3D","www.kaylousberg.com","CC0 1.0"],
|
|
|
|
'Kenney' : ["Kenney","Modèles 3D, icônes et sons","https://www.kenney.nl","CC0 1.0"],
|
|
|
|
'Game-icons.net' : ["Game-icons.net","Icônes","https://game-icons.net","CC BY 3.0"],
|
|
|
|
'Mainframe' : ["Mainframe","Police de caractères","https://www.dafont.com/fr/mainframe.font", "CC BY 4.0"]}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Page About
|
|
|
|
###############################################################################
|
|
|
|
|
2022-10-09 15:34:06 +02:00
|
|
|
##
|
|
|
|
# Ouverture
|
|
|
|
##
|
|
|
|
|
|
|
|
def open():
|
|
|
|
scene.objects['About_close'].color= color_link
|
2023-02-05 18:17:16 +01:00
|
|
|
scene.objects['About_credits'].color= color_link
|
|
|
|
|
|
|
|
# Configuration
|
2022-10-22 01:04:48 +02:00
|
|
|
scene.objects['About_screen-up'].color= color_link
|
|
|
|
scene.objects['About_screen-down'].color= color_link
|
2023-02-05 20:56:46 +01:00
|
|
|
scene.objects['About_screen']['Text']= "Taille écran : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
2023-02-05 18:17:16 +01:00
|
|
|
scene.objects['About_quality-up'].color= color_link
|
|
|
|
scene.objects['About_quality-down'].color= color_link
|
2023-02-05 20:56:46 +01:00
|
|
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
|
|
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']]
|
|
|
|
|
|
|
|
# # Configuration
|
|
|
|
# scene.objects['About_screen-up'].color= color_link
|
|
|
|
# scene.objects['About_screen-down'].color= color_link
|
2023-02-05 18:17:16 +01:00
|
|
|
# scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
2023-02-05 20:56:46 +01:00
|
|
|
# scene.objects['About_quality-up'].color= color_link
|
|
|
|
# scene.objects['About_quality-down'].color= color_link
|
|
|
|
# # scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(bge.render.getWindowWidth()) +" x "+str(bge.render.getWindowHeight())
|
2022-10-09 15:34:06 +02:00
|
|
|
|
2023-02-05 18:17:16 +01:00
|
|
|
# Liens
|
2022-10-09 15:34:06 +02:00
|
|
|
scene.objects['About_link-git'].color= color_link
|
2023-12-02 16:44:40 +01:00
|
|
|
scene.objects['About_text-git'].color= color_link
|
|
|
|
scene.objects['About_text2-git'].color= color_link
|
2022-10-09 15:34:06 +02:00
|
|
|
scene.objects['About_link-gpl'].color= color_link
|
|
|
|
scene.objects['About_link-upbge'].color= color_link
|
2023-12-02 16:44:40 +01:00
|
|
|
scene.objects['About_text-upbge'].color= color_link
|
2023-02-05 18:17:16 +01:00
|
|
|
|
|
|
|
# Animation
|
2022-10-09 15:34:06 +02:00
|
|
|
scene.objects['About'].setVisible(True,True)
|
|
|
|
scene.objects['About'].worldPosition = [0, 1.53623, -1.8] # old [0, 1.53623, -0.892838]
|
|
|
|
scene.objects['About']['timer'] = 0
|
|
|
|
scene.objects['About']['anim'] = True
|
|
|
|
|
2023-02-06 15:11:34 +01:00
|
|
|
# Taille de l'écran : Boutons < et > ("640x360", "960x540", "1280x720", "1920x1080")
|
2022-11-26 01:29:27 +01:00
|
|
|
if bge.render.getWindowWidth() <=640:
|
|
|
|
scene.objects['About_screen-down'].setVisible(False,True)
|
|
|
|
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_screen-down'].setVisible(True,True)
|
|
|
|
scene.objects['About_screen-down-colbox'].restorePhysics()
|
|
|
|
if bge.render.getWindowWidth() >= 1920:
|
|
|
|
scene.objects['About_screen-up'].setVisible(False,True)
|
|
|
|
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_screen-up'].setVisible(True,True)
|
|
|
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
|
|
|
|
2023-02-05 20:56:46 +01:00
|
|
|
# Qualité du rendu : Boutons < et >
|
|
|
|
if scene.objects['About']['quality']==4:
|
|
|
|
scene.objects['About_quality-up'].setVisible(False,True)
|
|
|
|
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_quality-up'].setVisible(True,True)
|
|
|
|
scene.objects['About_quality-up-colbox'].restorePhysics()
|
|
|
|
if scene.objects['About']['quality']==0:
|
|
|
|
scene.objects['About_quality-down'].setVisible(False,True)
|
|
|
|
scene.objects['About_quality-down-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_quality-down'].setVisible(True,True)
|
|
|
|
scene.objects['About_quality-down-colbox'].restorePhysics()
|
|
|
|
|
2022-10-09 15:34:06 +02:00
|
|
|
##
|
|
|
|
# Animation de l'ouverture
|
|
|
|
##
|
|
|
|
|
|
|
|
def open_anim():
|
|
|
|
resol=0.5
|
|
|
|
scene.objects['About'].localPosition.y -= 1.09*resol
|
|
|
|
scene.objects['About'].localPosition.z += 0.85*resol
|
|
|
|
scene.objects['About']['timer']+=1
|
|
|
|
if scene.objects['About']['timer']== 40:
|
|
|
|
scene.objects['About']['anim'] = False
|
|
|
|
|
|
|
|
##
|
|
|
|
# Highlight
|
|
|
|
##
|
|
|
|
|
|
|
|
def hl(cont):
|
2023-12-02 16:44:40 +01:00
|
|
|
|
2023-12-11 04:25:00 +01:00
|
|
|
# Focus souris
|
2023-12-02 16:44:40 +01:00
|
|
|
if cont.sensors['MO'].status == JUST_ACTIVATED :
|
2022-10-09 15:34:06 +02:00
|
|
|
obj = cont.owner
|
|
|
|
name=obj.name[:-7]
|
|
|
|
scene.objects[name].color = color_link_hl
|
|
|
|
|
2023-12-02 16:44:40 +01:00
|
|
|
# Liens composés de texte
|
|
|
|
if name == "About_link-git":
|
|
|
|
scene.objects["About_text-git"].color = color_link_hl
|
|
|
|
scene.objects["About_text2-git"].color = color_link_hl
|
|
|
|
if name == "About_link-upbge":
|
|
|
|
scene.objects["About_text-upbge"].color = color_link_hl
|
|
|
|
|
2023-12-11 04:25:00 +01:00
|
|
|
# Perte du focus souris
|
2023-12-02 16:44:40 +01:00
|
|
|
if cont.sensors['MO'].status == JUST_RELEASED :
|
2022-10-09 15:34:06 +02:00
|
|
|
obj = cont.owner
|
|
|
|
name=obj.name[:-7]
|
|
|
|
scene.objects[name].color = color_link
|
|
|
|
|
2023-12-02 16:44:40 +01:00
|
|
|
# Liens composés de texte
|
|
|
|
if name == "About_link-git":
|
|
|
|
scene.objects["About_text-git"].color = color_link
|
|
|
|
scene.objects["About_text2-git"].color = color_link
|
|
|
|
if name == "About_link-upbge":
|
|
|
|
scene.objects["About_text-upbge"].color = color_link
|
|
|
|
|
2022-10-09 15:34:06 +02:00
|
|
|
##
|
|
|
|
# Liens
|
|
|
|
##
|
|
|
|
|
|
|
|
def link(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
obj = cont.owner
|
|
|
|
name=obj.name[:-7]
|
|
|
|
link={
|
2023-02-16 02:20:58 +01:00
|
|
|
'About_link-git' : 'https://forge.aeif.fr/blender-edutech/ropy',
|
2022-10-09 15:34:06 +02:00
|
|
|
'About_link-gpl' : 'https://www.gnu.org/licenses/gpl-3.0.html',
|
2023-02-05 18:17:16 +01:00
|
|
|
'About_link-upbge' : 'https://www.upbge.org'}
|
2022-10-09 15:34:06 +02:00
|
|
|
webbrowser.open(link [name])
|
|
|
|
|
2023-02-05 18:17:16 +01:00
|
|
|
###############################################################################
|
|
|
|
# Page Crédits
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
def credits(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
|
|
|
|
# Mémorisation de la position des pages avant changement
|
|
|
|
scene.objects["About"]['init_lx']=scene.objects["About"].worldPosition.x
|
|
|
|
scene.objects["About"]['init_ly']=scene.objects["About"].worldPosition.y
|
|
|
|
scene.objects["About"]['init_lz']=scene.objects["About"].worldPosition.z
|
|
|
|
scene.objects["Credits"]['init_lx']=scene.objects["Credits"].worldPosition.x
|
|
|
|
scene.objects["Credits"]['init_ly']=scene.objects["Credits"].worldPosition.y
|
|
|
|
scene.objects["Credits"]['init_lz']=scene.objects["Credits"].worldPosition.z
|
|
|
|
|
2023-02-06 15:11:34 +01:00
|
|
|
# Overlay
|
2024-01-01 22:04:43 +01:00
|
|
|
scene.active_camera = scene.objects["Camera-Simple"]
|
2023-02-06 15:11:34 +01:00
|
|
|
scene.objects['Camera'].setVisible(False,True)
|
|
|
|
scene.objects['Doc-cmd-colbox'].suspendPhysics (True)
|
|
|
|
|
2023-07-11 22:25:15 +02:00
|
|
|
# Afficher la page Crédits
|
2023-02-05 18:17:16 +01:00
|
|
|
scene.objects["Credits"].worldPosition.x = scene.objects["About"]['init_lx']
|
|
|
|
scene.objects["Credits"].worldPosition.y = scene.objects["About"]['init_ly']
|
|
|
|
scene.objects["Credits"].worldPosition.z = scene.objects["About"]['init_lz']
|
|
|
|
scene.objects["About"].worldPosition.x = scene.objects["Credits"]['init_lx']
|
|
|
|
scene.objects["About"].worldPosition.y = scene.objects["Credits"]['init_ly']
|
|
|
|
scene.objects["About"].worldPosition.z = scene.objects["Credits"]['init_lz']
|
|
|
|
scene.objects['Credits_close'].color= color_link
|
|
|
|
scene.objects['About'].setVisible(False,True)
|
|
|
|
scene.objects['Credits'].setVisible(True,True)
|
|
|
|
|
|
|
|
# Afficher les descriptions
|
|
|
|
credits_description_list=list (credits_description)
|
|
|
|
for i in range(len(credits_description_list)):
|
|
|
|
scene.objects["Credits_url-"+str(i+1)]['Text']= credits_description[credits_description_list[i]][0]
|
|
|
|
scene.objects["Credits_url-"+str(i+1)].color= color_link
|
|
|
|
scene.objects["Credits_text-"+str(i+1)]['Text']= credits_description[credits_description_list[i]][1]
|
|
|
|
scene.objects["Credits_license-"+str(i+1)]['Text']= credits_description[credits_description_list[i]][3]
|
|
|
|
|
|
|
|
def credits_close(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
|
|
|
|
# Revenir à la page About
|
|
|
|
scene.objects["Credits"].worldPosition.x = scene.objects["Credits"]['init_lx']
|
|
|
|
scene.objects["Credits"].worldPosition.y = scene.objects["Credits"]['init_ly']
|
|
|
|
scene.objects["Credits"].worldPosition.z = scene.objects["Credits"]['init_lz']
|
|
|
|
scene.objects["About"].worldPosition.x = scene.objects["About"]['init_lx']
|
|
|
|
scene.objects["About"].worldPosition.y = scene.objects["About"]['init_ly']
|
|
|
|
scene.objects["About"].worldPosition.z = scene.objects["About"]['init_lz']
|
|
|
|
scene.objects['Credits'].setVisible(False,True)
|
|
|
|
scene.objects['About'].setVisible(True,True)
|
|
|
|
|
2023-02-06 15:11:34 +01:00
|
|
|
# Overlay
|
2024-01-01 22:04:43 +01:00
|
|
|
scene.objects['Camera'].setVisible(True,True)
|
2023-02-06 15:11:34 +01:00
|
|
|
if scene.objects['Commands']['twins']:
|
|
|
|
scene.objects['Points-Twins'].setVisible(True,True)
|
|
|
|
scene.objects['Points-Twins-text'].setVisible(True,False)
|
|
|
|
else:
|
|
|
|
scene.objects['Points-Twins'].setVisible(False,True)
|
|
|
|
scene.objects['Points-Twins-text'].setVisible(False,False)
|
|
|
|
scene.active_camera = scene.objects["Camera"]
|
|
|
|
|
|
|
|
# UI : Commands
|
|
|
|
scene.objects['Run-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Pause'].setVisible(False,False)
|
|
|
|
scene.objects['Pause'].suspendPhysics()
|
|
|
|
scene.objects['Pause-Hl'].setVisible(False,False)
|
|
|
|
# scene.objects['Stop'].setVisible(False,False)
|
|
|
|
# scene.objects['Stop'].suspendPhysics()
|
|
|
|
scene.objects['Stop-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Aim-cmd-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Doc-cmd-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Doc-cmd-colbox'].restorePhysics()
|
|
|
|
scene.objects['ResetView-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['About-cmd-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Speed_up-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Speed_down-Hl'].setVisible(False,False)
|
|
|
|
scene.objects['Cmd-text'].setVisible(False,False)
|
|
|
|
|
|
|
|
# Task panel
|
|
|
|
if scene.objects['Commands']['task']:
|
|
|
|
scene.objects['Task-cmd'].setVisible(False,True)
|
|
|
|
scene.objects['Task-cmd'].suspendPhysics()
|
|
|
|
scene.objects['Task-cmd-Hl'].setVisible(False,True)
|
|
|
|
scene.objects['Task_close-cmd'].setVisible(True,True)
|
|
|
|
scene.objects['Task_close-cmd'].restorePhysics()
|
|
|
|
scene.objects['Task_close-cmd-Hl'].setVisible(False,True)
|
|
|
|
else:
|
|
|
|
scene.objects['Task_close-cmd'].setVisible(False,True)
|
|
|
|
scene.objects['Task_close-cmd'].suspendPhysics()
|
|
|
|
scene.objects['Task_close-cmd-Hl'].setVisible(False,True)
|
|
|
|
scene.objects['Task-cmd'].setVisible(True,True)
|
|
|
|
scene.objects['Task-cmd'].restorePhysics()
|
|
|
|
scene.objects['Task-cmd-Hl'].setVisible(False,True)
|
|
|
|
|
|
|
|
# Vitesse
|
|
|
|
if scene.objects['Points']['upgrade_speed'] ==False:
|
|
|
|
scene.objects['Text_speed'].setVisible(False,True)
|
|
|
|
scene.objects['Text_speed_label-fr'].setVisible(False,True)
|
|
|
|
scene.objects['Speed_down'].setVisible(False,True)
|
|
|
|
scene.objects['Speed_up'].setVisible(False,True)
|
|
|
|
|
2023-12-27 14:36:42 +01:00
|
|
|
# # Camera
|
|
|
|
# scene.objects['Camera'].worldPosition.x = scene.objects['Camera']['current_lx']
|
|
|
|
# scene.objects['Camera'].worldPosition.y = scene.objects['Camera']['current_ly']
|
|
|
|
# scene.objects['Camera'].worldPosition.z = scene.objects['Camera']['current_lz']
|
2023-02-06 15:11:34 +01:00
|
|
|
|
2023-02-05 18:17:16 +01:00
|
|
|
def credits_link(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
obj = cont.owner
|
|
|
|
idx=int(obj.name[12:-7])
|
|
|
|
webbrowser.open(credits_description[list(credits_description)[idx-1]][2])
|
2023-02-05 20:56:46 +01:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Configuration
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
##
|
|
|
|
# Taille de l'écran
|
|
|
|
##
|
|
|
|
|
|
|
|
def get_near_pos(value_list,value):
|
|
|
|
delta=[]
|
|
|
|
for i in range (len(value_list)):
|
|
|
|
delta.append(abs(value-value_list[i]))
|
|
|
|
return delta.index(min(delta))
|
|
|
|
|
|
|
|
# Taille de l'écran +
|
|
|
|
def screen_up(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
screen_width_mode=[640, 960, 1280, 1920]
|
|
|
|
screen_height_mode=[360, 540, 720,1080]
|
|
|
|
screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
|
|
|
|
i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
|
|
|
|
if i>=0 and i<3 :
|
|
|
|
if bge.render.getWindowWidth()<screen_width_mode[i]:
|
|
|
|
screen_width=screen_width_mode[i]
|
|
|
|
screen_height=screen_height_mode[i]
|
|
|
|
else:
|
|
|
|
screen_width=screen_width_mode[i+1]
|
|
|
|
screen_height=screen_height_mode[i+1]
|
|
|
|
scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height)
|
|
|
|
bge.render.setWindowSize(screen_width,screen_height)
|
|
|
|
|
|
|
|
# Boutons < et >
|
|
|
|
if screen_width <=640:
|
|
|
|
scene.objects['About_screen-down'].setVisible(False,True)
|
|
|
|
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_screen-down'].setVisible(True,True)
|
|
|
|
scene.objects['About_screen-down-colbox'].restorePhysics()
|
|
|
|
if screen_width >= 1920:
|
|
|
|
scene.objects['About_screen-up'].setVisible(False,True)
|
|
|
|
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_screen-up'].setVisible(True,True)
|
|
|
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
|
|
|
|
|
|
|
# Taille de l'écran -
|
|
|
|
def screen_down(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
screen_width_mode=[640, 960, 1280, 1920]
|
|
|
|
screen_height_mode=[360, 540, 720,1080]
|
|
|
|
screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
|
|
|
|
i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
|
|
|
|
if i>0 and i<=3 :
|
|
|
|
if bge.render.getWindowWidth()>screen_width_mode[i]:
|
|
|
|
screen_width=screen_width_mode[i]
|
|
|
|
screen_height=screen_height_mode[i]
|
|
|
|
else:
|
|
|
|
screen_width=screen_width_mode[i-1]
|
|
|
|
screen_height=screen_height_mode[i-1]
|
|
|
|
scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height)
|
|
|
|
bge.render.setWindowSize(screen_width,screen_height)
|
|
|
|
|
|
|
|
# Boutons < et >
|
|
|
|
if screen_width <=640:
|
|
|
|
scene.objects['About_screen-down'].setVisible(False,True)
|
|
|
|
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_screen-down'].setVisible(True,True)
|
|
|
|
scene.objects['About_screen-down-colbox'].restorePhysics()
|
|
|
|
if screen_width >= 1920:
|
|
|
|
scene.objects['About_screen-up'].setVisible(False,True)
|
|
|
|
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
|
|
|
|
else:
|
|
|
|
scene.objects['About_screen-up'].setVisible(True,True)
|
|
|
|
scene.objects['About_screen-up-colbox'].restorePhysics()
|
|
|
|
|
|
|
|
##
|
|
|
|
# Qualité du rendu
|
|
|
|
##
|
|
|
|
|
|
|
|
def quality_up(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
scene.objects['About']['quality'] +=1
|
2023-02-06 17:34:39 +01:00
|
|
|
quality_apply(scene.objects['About']['quality'])
|
2023-02-05 20:56:46 +01:00
|
|
|
|
|
|
|
# Boutons < et >
|
|
|
|
if scene.objects['About']['quality']==4:
|
|
|
|
scene.objects['About_quality-up'].setVisible(False,True)
|
|
|
|
scene.objects['About_quality-up-colbox'].suspendPhysics (True)
|
|
|
|
if scene.objects['About']['quality']==1:
|
|
|
|
scene.objects['About_quality-down'].setVisible(True,True)
|
|
|
|
scene.objects['About_quality-down-colbox'].restorePhysics()
|
|
|
|
|
|
|
|
def quality_down(cont):
|
|
|
|
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
|
|
|
|
scene.objects['About']['quality'] -=1
|
2023-02-06 17:34:39 +01:00
|
|
|
quality_apply(scene.objects['About']['quality'])
|
2023-02-05 20:56:46 +01:00
|
|
|
|
|
|
|
# Boutons < et >
|
|
|
|
if scene.objects['About']['quality']==0:
|
|
|
|
scene.objects['About_quality-down'].setVisible(False,True)
|
|
|
|
scene.objects['About_quality-down-colbox'].suspendPhysics (True)
|
|
|
|
if scene.objects['About']['quality']==3:
|
|
|
|
scene.objects['About_quality-up'].setVisible(True,True)
|
|
|
|
scene.objects['About_quality-up-colbox'].restorePhysics()
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# Qualité du rendu EEVEE de 0 à 4
|
|
|
|
##
|
|
|
|
|
2023-02-07 06:39:45 +01:00
|
|
|
def quality_apply(quality, start_flag=False):
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
# Texte du About
|
|
|
|
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
|
|
|
|
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[quality]
|
2023-02-07 06:39:45 +01:00
|
|
|
if start_flag== False and sys.platform!="linux": # Plantage sur Windows -> redémarrage après changement
|
|
|
|
return
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
# Inconvenant
|
|
|
|
if quality== 0:
|
2023-08-23 01:11:49 +02:00
|
|
|
eevee.use_taa_reprojection = False
|
2023-02-06 17:34:39 +01:00
|
|
|
eevee.use_ssr = False # Screen space reflection
|
|
|
|
eevee.use_gtao = False # Ambient occlusion
|
|
|
|
eevee.taa_render_samples = 1
|
|
|
|
eevee.taa_samples = 1
|
|
|
|
eevee.use_volumetric_lights = False
|
|
|
|
eevee.use_volumetric_shadows = False
|
|
|
|
eevee.shadow_cascade_size='64'
|
|
|
|
eevee.shadow_cube_size='64'
|
2023-12-28 17:00:24 +01:00
|
|
|
bpy.data.particles["Feuillage"].count = 100
|
2023-12-27 14:36:42 +01:00
|
|
|
# scene.objects['terrain-scatter.001'].setVisible(False,True)
|
|
|
|
# scene.objects['terrain-scatter.002'].setVisible(False,True)
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
# Basse
|
|
|
|
if quality== 1:
|
2023-07-11 00:45:33 +02:00
|
|
|
eevee.use_taa_reprojection = True
|
2023-02-06 17:34:39 +01:00
|
|
|
eevee.use_ssr = True # Screen space reflection
|
|
|
|
eevee.use_ssr_refraction = False # Screen space refractions
|
|
|
|
eevee.use_ssr_halfres = True
|
|
|
|
eevee.use_gtao = False
|
|
|
|
eevee.taa_render_samples = 32
|
|
|
|
eevee.taa_samples = 8
|
|
|
|
eevee.use_volumetric_lights = True
|
|
|
|
eevee.use_volumetric_shadows = False
|
|
|
|
eevee.shadow_cascade_size='1024'
|
|
|
|
eevee.shadow_cube_size='512'
|
2023-12-28 17:00:24 +01:00
|
|
|
bpy.data.particles["Feuillage"].count = 100
|
2023-12-27 14:36:42 +01:00
|
|
|
# scene.objects['terrain-scatter.001'].setVisible(False,True)
|
|
|
|
# scene.objects['terrain-scatter.002'].setVisible(False,True)
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
# Moyenne
|
|
|
|
if quality== 2:
|
2023-07-11 00:45:33 +02:00
|
|
|
eevee.use_taa_reprojection = True
|
2023-02-06 17:34:39 +01:00
|
|
|
eevee.use_ssr = True # Screen space reflection
|
|
|
|
eevee.use_ssr_refraction = True # Screen space refractions
|
|
|
|
eevee.use_ssr_halfres = True
|
|
|
|
eevee.use_gtao = False
|
|
|
|
eevee.taa_render_samples = 64
|
|
|
|
eevee.taa_samples = 16
|
|
|
|
eevee.use_volumetric_lights = True
|
|
|
|
eevee.use_volumetric_shadows = False
|
|
|
|
eevee.shadow_cascade_size='1024'
|
|
|
|
eevee.shadow_cube_size='512'
|
2023-12-28 17:00:24 +01:00
|
|
|
bpy.data.particles["Feuillage"].count = 100
|
2023-12-27 14:36:42 +01:00
|
|
|
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
|
|
|
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
# Haute
|
|
|
|
if quality== 3:
|
2023-07-11 00:45:33 +02:00
|
|
|
eevee.use_taa_reprojection = True
|
2023-02-06 17:34:39 +01:00
|
|
|
eevee.use_ssr = True
|
|
|
|
eevee.use_ssr_refraction = True
|
|
|
|
eevee.use_ssr_halfres = False
|
|
|
|
eevee.use_gtao = False
|
|
|
|
eevee.taa_render_samples = 64
|
|
|
|
eevee.taa_samples = 16
|
|
|
|
eevee.use_volumetric_lights = True
|
|
|
|
eevee.use_volumetric_shadows = False
|
|
|
|
eevee.shadow_cascade_size='1024'
|
|
|
|
eevee.shadow_cube_size='512'
|
2023-12-28 17:00:24 +01:00
|
|
|
bpy.data.particles["Feuillage"].count = 500
|
2023-12-27 14:36:42 +01:00
|
|
|
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
|
|
|
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
2023-02-06 17:34:39 +01:00
|
|
|
|
|
|
|
# Épique
|
|
|
|
if quality== 4:
|
2023-07-11 00:45:33 +02:00
|
|
|
eevee.use_taa_reprojection = True
|
2023-02-06 17:34:39 +01:00
|
|
|
eevee.use_ssr = True
|
|
|
|
eevee.use_ssr_refraction = True
|
|
|
|
eevee.use_ssr_halfres = False
|
|
|
|
eevee.use_gtao = True
|
|
|
|
eevee.taa_render_samples = 64
|
|
|
|
eevee.taa_samples = 16
|
|
|
|
eevee.use_volumetric_lights = True
|
|
|
|
eevee.use_volumetric_shadows = True
|
|
|
|
eevee.shadow_cascade_size='4096'
|
|
|
|
eevee.shadow_cube_size='4096'
|
2023-12-28 17:00:24 +01:00
|
|
|
bpy.data.particles["Feuillage"].count = 1000
|
2023-12-27 14:36:42 +01:00
|
|
|
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
|
|
|
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|